summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/glib/gio/gaction.h98
-rw-r--r--include/glib/gio/gactiongroup.h161
-rw-r--r--include/glib/gio/gactiongroupexporter.h45
-rw-r--r--include/glib/gio/gactionmap.h95
-rw-r--r--include/glib/gio/gappinfo.h347
-rw-r--r--include/glib/gio/gapplication.h252
-rw-r--r--include/glib/gio/gapplicationcommandline.h122
-rw-r--r--include/glib/gio/gasyncinitable.h130
-rw-r--r--include/glib/gio/gasyncresult.h85
-rw-r--r--include/glib/gio/gbufferedinputstream.h133
-rw-r--r--include/glib/gio/gbufferedoutputstream.h86
-rw-r--r--include/glib/gio/gbytesicon.h52
-rw-r--r--include/glib/gio/gcancellable.h118
-rw-r--r--include/glib/gio/gcharsetconverter.h63
-rw-r--r--include/glib/gio/gcontenttype.h82
-rw-r--r--include/glib/gio/gconverter.h96
-rw-r--r--include/glib/gio/gconverterinputstream.h80
-rw-r--r--include/glib/gio/gconverteroutputstream.h80
-rw-r--r--include/glib/gio/gcredentials.h85
-rw-r--r--include/glib/gio/gdatagrambased.h144
-rw-r--r--include/glib/gio/gdatainputstream.h180
-rw-r--r--include/glib/gio/gdataoutputstream.h125
-rw-r--r--include/glib/gio/gdbusactiongroup.h54
-rw-r--r--include/glib/gio/gdbusaddress.h65
-rw-r--r--include/glib/gio/gdbusauthobserver.h51
-rw-r--r--include/glib/gio/gdbusconnection.h683
-rw-r--r--include/glib/gio/gdbuserror.h109
-rw-r--r--include/glib/gio/gdbusinterface.h81
-rw-r--r--include/glib/gio/gdbusinterfaceskeleton.h127
-rw-r--r--include/glib/gio/gdbusintrospection.h325
-rw-r--r--include/glib/gio/gdbusmenumodel.h45
-rw-r--r--include/glib/gio/gdbusmessage.h197
-rw-r--r--include/glib/gio/gdbusmethodinvocation.h97
-rw-r--r--include/glib/gio/gdbusnameowning.h115
-rw-r--r--include/glib/gio/gdbusnamewatching.h102
-rw-r--r--include/glib/gio/gdbusobject.h78
-rw-r--r--include/glib/gio/gdbusobjectmanager.h94
-rw-r--r--include/glib/gio/gdbusobjectmanagerclient.h146
-rw-r--r--include/glib/gio/gdbusobjectmanagerserver.h93
-rw-r--r--include/glib/gio/gdbusobjectproxy.h79
-rw-r--r--include/glib/gio/gdbusobjectskeleton.h96
-rw-r--r--include/glib/gio/gdbusproxy.h214
-rw-r--r--include/glib/gio/gdbusserver.h60
-rw-r--r--include/glib/gio/gdbusutils.h55
-rw-r--r--include/glib/gio/gdrive.h272
-rw-r--r--include/glib/gio/gdtlsclientconnection.h75
-rw-r--r--include/glib/gio/gdtlsconnection.h206
-rw-r--r--include/glib/gio/gdtlsserverconnection.h69
-rw-r--r--include/glib/gio/gemblem.h61
-rw-r--r--include/glib/gio/gemblemedicon.h81
-rw-r--r--include/glib/gio/gfile.h1285
-rw-r--r--include/glib/gio/gfileattribute.h84
-rw-r--r--include/glib/gio/gfileenumerator.h152
-rw-r--r--include/glib/gio/gfileicon.h57
-rw-r--r--include/glib/gio/gfileinfo.h1144
-rw-r--r--include/glib/gio/gfileinputstream.h114
-rw-r--r--include/glib/gio/gfileiostream.h121
-rw-r--r--include/glib/gio/gfilemonitor.h98
-rw-r--r--include/glib/gio/gfilenamecompleter.h79
-rw-r--r--include/glib/gio/gfileoutputstream.h122
-rw-r--r--include/glib/gio/gfilterinputstream.h78
-rw-r--r--include/glib/gio/gfilteroutputstream.h78
-rw-r--r--include/glib/gio/gicon.h102
-rw-r--r--include/glib/gio/ginetaddress.h124
-rw-r--r--include/glib/gio/ginetaddressmask.h85
-rw-r--r--include/glib/gio/ginetsocketaddress.h78
-rw-r--r--include/glib/gio/ginitable.h105
-rw-r--r--include/glib/gio/ginputstream.h216
-rw-r--r--include/glib/gio/gio-autocleanups.h153
-rw-r--r--include/glib/gio/gio.h177
-rw-r--r--include/glib/gio/gioenums.h1969
-rw-r--r--include/glib/gio/gioenumtypes.h177
-rw-r--r--include/glib/gio/gioerror.h53
-rw-r--r--include/glib/gio/giomodule.h193
-rw-r--r--include/glib/gio/gioscheduler.h54
-rw-r--r--include/glib/gio/giostream.h135
-rw-r--r--include/glib/gio/giotypes.h654
-rw-r--r--include/glib/gio/glistmodel.h72
-rw-r--r--include/glib/gio/gliststore.h77
-rw-r--r--include/glib/gio/gloadableicon.h99
-rw-r--r--include/glib/gio/gmemoryinputstream.h90
-rw-r--r--include/glib/gio/gmemoryoutputstream.h107
-rw-r--r--include/glib/gio/gmenu.h182
-rw-r--r--include/glib/gio/gmenuexporter.h40
-rw-r--r--include/glib/gio/gmenumodel.h305
-rw-r--r--include/glib/gio/gmount.h276
-rw-r--r--include/glib/gio/gmountoperation.h177
-rw-r--r--include/glib/gio/gnativesocketaddress.h65
-rw-r--r--include/glib/gio/gnativevolumemonitor.h61
-rw-r--r--include/glib/gio/gnetworkaddress.h80
-rw-r--r--include/glib/gio/gnetworking.h82
-rw-r--r--include/glib/gio/gnetworkmonitor.h99
-rw-r--r--include/glib/gio/gnetworkservice.h76
-rw-r--r--include/glib/gio/gnotification.h97
-rw-r--r--include/glib/gio/goutputstream.h332
-rw-r--r--include/glib/gio/gpermission.h127
-rw-r--r--include/glib/gio/gpollableinputstream.h105
-rw-r--r--include/glib/gio/gpollableoutputstream.h126
-rw-r--r--include/glib/gio/gpollableutils.h64
-rw-r--r--include/glib/gio/gpropertyaction.h47
-rw-r--r--include/glib/gio/gproxy.h128
-rw-r--r--include/glib/gio/gproxyaddress.h86
-rw-r--r--include/glib/gio/gproxyaddressenumerator.h81
-rw-r--r--include/glib/gio/gproxyresolver.h95
-rw-r--r--include/glib/gio/gremoteactiongroup.h75
-rw-r--r--include/glib/gio/gresolver.h292
-rw-r--r--include/glib/gio/gresource.h130
-rw-r--r--include/glib/gio/gseekable.h103
-rw-r--r--include/glib/gio/gsettings.h345
-rw-r--r--include/glib/gio/gsettingsbackend.h174
-rw-r--r--include/glib/gio/gsettingsschema.h112
-rw-r--r--include/glib/gio/gsimpleaction.h63
-rw-r--r--include/glib/gio/gsimpleactiongroup.h97
-rw-r--r--include/glib/gio/gsimpleasyncresult.h162
-rw-r--r--include/glib/gio/gsimpleiostream.h45
-rw-r--r--include/glib/gio/gsimplepermission.h45
-rw-r--r--include/glib/gio/gsimpleproxyresolver.h89
-rw-r--r--include/glib/gio/gsocket.h328
-rw-r--r--include/glib/gio/gsocketaddress.h82
-rw-r--r--include/glib/gio/gsocketaddressenumerator.h101
-rw-r--r--include/glib/gio/gsocketclient.h197
-rw-r--r--include/glib/gio/gsocketconnectable.h81
-rw-r--r--include/glib/gio/gsocketconnection.h115
-rw-r--r--include/glib/gio/gsocketcontrolmessage.h111
-rw-r--r--include/glib/gio/gsocketlistener.h155
-rw-r--r--include/glib/gio/gsocketservice.h93
-rw-r--r--include/glib/gio/gsrvtarget.h59
-rw-r--r--include/glib/gio/gsubprocess.h167
-rw-r--r--include/glib/gio/gsubprocesslauncher.h116
-rw-r--r--include/glib/gio/gtask.h165
-rw-r--r--include/glib/gio/gtcpconnection.h69
-rw-r--r--include/glib/gio/gtcpwrapperconnection.h69
-rw-r--r--include/glib/gio/gtestdbus.h72
-rw-r--r--include/glib/gio/gthemedicon.h68
-rw-r--r--include/glib/gio/gthreadedsocketservice.h81
-rw-r--r--include/glib/gio/gtlsbackend.h113
-rw-r--r--include/glib/gio/gtlscertificate.h92
-rw-r--r--include/glib/gio/gtlsclientconnection.h86
-rw-r--r--include/glib/gio/gtlsconnection.h163
-rw-r--r--include/glib/gio/gtlsdatabase.h247
-rw-r--r--include/glib/gio/gtlsfiledatabase.h58
-rw-r--r--include/glib/gio/gtlsinteraction.h148
-rw-r--r--include/glib/gio/gtlspassword.h119
-rw-r--r--include/glib/gio/gtlsserverconnection.h69
-rw-r--r--include/glib/gio/gvfs.h168
-rw-r--r--include/glib/gio/gvolume.h253
-rw-r--r--include/glib/gio/gvolumemonitor.h154
-rw-r--r--include/glib/gio/gzlibcompressor.h62
-rw-r--r--include/glib/gio/gzlibdecompressor.h58
-rw-r--r--include/glib/glib-object.h43
-rw-r--r--include/glib/glib-unix.h119
-rw-r--r--include/glib/glib.h116
-rw-r--r--include/glib/glib/deprecated/gallocator.h88
-rw-r--r--include/glib/glib/deprecated/gcache.h75
-rw-r--r--include/glib/glib/deprecated/gcompletion.h83
-rw-r--r--include/glib/glib/deprecated/gmain.h135
-rw-r--r--include/glib/glib/deprecated/grel.h105
-rw-r--r--include/glib/glib/deprecated/gthread.h289
-rw-r--r--include/glib/glib/galloca.h103
-rw-r--r--include/glib/glib/garray.h272
-rw-r--r--include/glib/glib/gasyncqueue.h124
-rw-r--r--include/glib/glib/gatomic.h291
-rw-r--r--include/glib/glib/gbacktrace.h72
-rw-r--r--include/glib/glib/gbase64.h61
-rw-r--r--include/glib/glib/gbitlock.h76
-rw-r--r--include/glib/glib/gbookmarkfile.h254
-rw-r--r--include/glib/glib/gbytes.h90
-rw-r--r--include/glib/glib/gcharset.h47
-rw-r--r--include/glib/glib/gchecksum.h103
-rw-r--r--include/glib/glib/gconvert.h177
-rw-r--r--include/glib/glib/gdataset.h150
-rw-r--r--include/glib/glib/gdate.h307
-rw-r--r--include/glib/glib/gdatetime.h274
-rw-r--r--include/glib/glib/gdir.h52
-rw-r--r--include/glib/glib/genviron.h63
-rw-r--r--include/glib/glib/gerror.h117
-rw-r--r--include/glib/glib/gfileutils.h179
-rw-r--r--include/glib/glib/ggettext.h63
-rw-r--r--include/glib/glib/ghash.h188
-rw-r--r--include/glib/glib/ghmac.h83
-rw-r--r--include/glib/glib/ghook.h202
-rw-r--r--include/glib/glib/ghostutils.h43
-rw-r--r--include/glib/glib/gi18n-lib.h36
-rw-r--r--include/glib/glib/gi18n.h32
-rw-r--r--include/glib/glib/giochannel.h404
-rw-r--r--include/glib/glib/gkeyfile.h330
-rw-r--r--include/glib/glib/glib-autocleanups.h93
-rw-r--r--include/glib/glib/glist.h156
-rw-r--r--include/glib/glib/gmacros.h1099
-rw-r--r--include/glib/glib/gmain.h689
-rw-r--r--include/glib/glib/gmappedfile.h58
-rw-r--r--include/glib/glib/gmarkup.h261
-rw-r--r--include/glib/glib/gmem.h392
-rw-r--r--include/glib/glib/gmessages.h636
-rw-r--r--include/glib/glib/gnode.h307
-rw-r--r--include/glib/glib/goption.h388
-rw-r--r--include/glib/glib/gpattern.h53
-rw-r--r--include/glib/glib/gpoll.h120
-rw-r--r--include/glib/glib/gprimes.h50
-rw-r--r--include/glib/glib/gprintf.h57
-rw-r--r--include/glib/glib/gqsort.h45
-rw-r--r--include/glib/glib/gquark.h68
-rw-r--r--include/glib/glib/gqueue.h203
-rw-r--r--include/glib/glib/grand.h99
-rw-r--r--include/glib/glib/grcbox.h88
-rw-r--r--include/glib/glib/grefcount.h123
-rw-r--r--include/glib/glib/grefstring.h57
-rw-r--r--include/glib/glib/gregex.h609
-rw-r--r--include/glib/glib/gscanner.h299
-rw-r--r--include/glib/glib/gsequence.h173
-rw-r--r--include/glib/glib/gshell.h57
-rw-r--r--include/glib/glib/gslice.h99
-rw-r--r--include/glib/glib/gslist.h143
-rw-r--r--include/glib/glib/gspawn.h265
-rw-r--r--include/glib/glib/gstdio.h177
-rw-r--r--include/glib/glib/gstrfuncs.h362
-rw-r--r--include/glib/glib/gstring.h187
-rw-r--r--include/glib/glib/gstringchunk.h57
-rw-r--r--include/glib/glib/gtestutils.h605
-rw-r--r--include/glib/glib/gthread.h556
-rw-r--r--include/glib/glib/gthreadpool.h96
-rw-r--r--include/glib/glib/gtimer.h78
-rw-r--r--include/glib/glib/gtimezone.h93
-rw-r--r--include/glib/glib/gtrashstack.h58
-rw-r--r--include/glib/glib/gtree.h104
-rw-r--r--include/glib/glib/gtypes.h585
-rw-r--r--include/glib/glib/gunicode.h929
-rw-r--r--include/glib/glib/gurifuncs.h83
-rw-r--r--include/glib/glib/gutils.h364
-rw-r--r--include/glib/glib/guuid.h42
-rw-r--r--include/glib/glib/gvariant.h521
-rw-r--r--include/glib/glib/gvarianttype.h382
-rw-r--r--include/glib/glib/gversion.h55
-rw-r--r--include/glib/glib/gversionmacros.h923
-rw-r--r--include/glib/glib/gwin32.h140
-rw-r--r--include/glib/glibconfig.h216
-rw-r--r--include/glib/gmodule.h117
-rw-r--r--include/glib/gobject/gbinding.h149
-rw-r--r--include/glib/gobject/gboxed.h122
-rw-r--r--include/glib/gobject/gclosure.h317
-rw-r--r--include/glib/gobject/genums.h279
-rw-r--r--include/glib/gobject/glib-enumtypes.h25
-rw-r--r--include/glib/gobject/glib-types.h362
-rw-r--r--include/glib/gobject/gmarshal.h434
-rw-r--r--include/glib/gobject/gobject-autocleanups.h31
-rw-r--r--include/glib/gobject/gobject.h899
-rw-r--r--include/glib/gobject/gobjectnotifyqueue.c197
-rw-r--r--include/glib/gobject/gparam.h452
-rw-r--r--include/glib/gobject/gparamspecs.h1170
-rw-r--r--include/glib/gobject/gsignal.h623
-rw-r--r--include/glib/gobject/gsourceclosure.h38
-rw-r--r--include/glib/gobject/gtype.h2356
-rw-r--r--include/glib/gobject/gtypemodule.h295
-rw-r--r--include/glib/gobject/gtypeplugin.h134
-rw-r--r--include/glib/gobject/gvalue.h196
-rw-r--r--include/glib/gobject/gvaluearray.h104
-rw-r--r--include/glib/gobject/gvaluecollector.h261
-rw-r--r--include/glib/gobject/gvaluetypes.h300
-rw-r--r--include/glib/msvc_recommended_pragmas.h34
-rw-r--r--include/gst/allocators/allocators-prelude.h33
-rw-r--r--include/gst/allocators/allocators.h32
-rw-r--r--include/gst/allocators/gstdmabuf.h120
-rw-r--r--include/gst/allocators/gstfdmemory.h100
-rw-r--r--include/gst/allocators/gstphysmemory.h62
-rw-r--r--include/gst/app/app-enumtypes.h24
-rw-r--r--include/gst/app/app-prelude.h33
-rw-r--r--include/gst/app/app.h28
-rw-r--r--include/gst/app/gstappsink.h194
-rw-r--r--include/gst/app/gstappsrc.h232
-rw-r--r--include/gst/audio/audio-bad-prelude.h35
-rw-r--r--include/gst/audio/audio-buffer.h98
-rw-r--r--include/gst/audio/audio-channel-mixer.h84
-rw-r--r--include/gst/audio/audio-channels.h180
-rw-r--r--include/gst/audio/audio-converter.h180
-rw-r--r--include/gst/audio/audio-enumtypes.h120
-rw-r--r--include/gst/audio/audio-format.h412
-rw-r--r--include/gst/audio/audio-info.h143
-rw-r--r--include/gst/audio/audio-prelude.h33
-rw-r--r--include/gst/audio/audio-quantize.h103
-rw-r--r--include/gst/audio/audio-resampler.h259
-rw-r--r--include/gst/audio/audio.h120
-rw-r--r--include/gst/audio/gstaudioaggregator.h232
-rw-r--r--include/gst/audio/gstaudiobasesink.h277
-rw-r--r--include/gst/audio/gstaudiobasesrc.h160
-rw-r--r--include/gst/audio/gstaudiocdsrc.h145
-rw-r--r--include/gst/audio/gstaudioclock.h115
-rw-r--r--include/gst/audio/gstaudiodecoder.h449
-rw-r--r--include/gst/audio/gstaudioencoder.h378
-rw-r--r--include/gst/audio/gstaudiofilter.h107
-rw-r--r--include/gst/audio/gstaudioiec61937.h36
-rw-r--r--include/gst/audio/gstaudiometa.h252
-rw-r--r--include/gst/audio/gstaudioringbuffer.h414
-rw-r--r--include/gst/audio/gstaudiosink.h136
-rw-r--r--include/gst/audio/gstaudiosrc.h106
-rw-r--r--include/gst/audio/gstaudiostreamalign.h92
-rw-r--r--include/gst/audio/gstnonstreamaudiodecoder.h412
-rw-r--r--include/gst/audio/gstplanaraudioadapter.h116
-rw-r--r--include/gst/audio/streamvolume.h80
-rw-r--r--include/gst/base/base-prelude.h35
-rw-r--r--include/gst/base/base.h44
-rw-r--r--include/gst/base/gstadapter.h149
-rw-r--r--include/gst/base/gstaggregator.h462
-rw-r--r--include/gst/base/gstbaseparse.h385
-rw-r--r--include/gst/base/gstbasesink.h345
-rw-r--r--include/gst/base/gstbasesrc.h346
-rw-r--r--include/gst/base/gstbasetransform.h372
-rw-r--r--include/gst/base/gstbitreader.h328
-rw-r--r--include/gst/base/gstbitwriter.h384
-rw-r--r--include/gst/base/gstbytereader.h684
-rw-r--r--include/gst/base/gstbytewriter.h468
-rw-r--r--include/gst/base/gstcollectpads.h456
-rw-r--r--include/gst/base/gstdataqueue.h184
-rw-r--r--include/gst/base/gstflowcombiner.h82
-rw-r--r--include/gst/base/gstpushsrc.h102
-rw-r--r--include/gst/base/gstqueuearray.h109
-rw-r--r--include/gst/base/gsttypefindhelper.h105
-rw-r--r--include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h35
-rw-r--r--include/gst/basecamerabinsrc/gstbasecamerasrc.h159
-rw-r--r--include/gst/basecamerabinsrc/gstcamerabin-enum.h68
-rw-r--r--include/gst/basecamerabinsrc/gstcamerabinpreview.h69
-rw-r--r--include/gst/check/check-prelude.h43
-rw-r--r--include/gst/check/check.h33
-rw-r--r--include/gst/check/gstbufferstraw.h40
-rw-r--r--include/gst/check/gstcheck.h756
-rw-r--r--include/gst/check/gstconsistencychecker.h52
-rw-r--r--include/gst/check/gstharness.h474
-rw-r--r--include/gst/check/gsttestclock.h148
-rw-r--r--include/gst/check/internal-check.h1328
-rw-r--r--include/gst/codecparsers/codecparsers-prelude.h35
-rw-r--r--include/gst/codecparsers/gstav1parser.h1846
-rw-r--r--include/gst/codecparsers/gsth264parser.h1336
-rw-r--r--include/gst/codecparsers/gsth265parser.h1815
-rw-r--r--include/gst/codecparsers/gstjpeg2000sampling.h115
-rw-r--r--include/gst/codecparsers/gstjpegparser.h412
-rw-r--r--include/gst/codecparsers/gstmpeg4parser.h592
-rw-r--r--include/gst/codecparsers/gstmpegvideometa.h92
-rw-r--r--include/gst/codecparsers/gstmpegvideoparser.h570
-rw-r--r--include/gst/codecparsers/gstvc1parser.h656
-rw-r--r--include/gst/codecparsers/gstvp8parser.h346
-rw-r--r--include/gst/codecparsers/gstvp8rangedecoder.h80
-rw-r--r--include/gst/codecparsers/gstvp9parser.h521
-rw-r--r--include/gst/controller/controller-enumtypes.h26
-rw-r--r--include/gst/controller/controller-prelude.h35
-rw-r--r--include/gst/controller/controller.h35
-rw-r--r--include/gst/controller/gstargbcontrolbinding.h103
-rw-r--r--include/gst/controller/gstdirectcontrolbinding.h129
-rw-r--r--include/gst/controller/gstinterpolationcontrolsource.h104
-rw-r--r--include/gst/controller/gstlfocontrolsource.h102
-rw-r--r--include/gst/controller/gstproxycontrolbinding.h85
-rw-r--r--include/gst/controller/gsttimedvaluecontrolsource.h160
-rw-r--r--include/gst/controller/gsttriggercontrolsource.h87
-rw-r--r--include/gst/fft/fft-prelude.h33
-rw-r--r--include/gst/fft/fft.h31
-rw-r--r--include/gst/fft/gstfft.h57
-rw-r--r--include/gst/fft/gstfftf32.h71
-rw-r--r--include/gst/fft/gstfftf64.h71
-rw-r--r--include/gst/fft/gstffts16.h71
-rw-r--r--include/gst/fft/gstffts32.h71
-rw-r--r--include/gst/gl/gl-enumtypes.h87
-rw-r--r--include/gst/gl/gl-prelude.h33
-rw-r--r--include/gst/gl/gl.h56
-rw-r--r--include/gst/gl/glprototypes/all_functions.h34
-rw-r--r--include/gst/gl/glprototypes/base.h328
-rw-r--r--include/gst/gl/glprototypes/blending.h99
-rw-r--r--include/gst/gl/glprototypes/buffer_storage.h42
-rw-r--r--include/gst/gl/glprototypes/buffers.h48
-rw-r--r--include/gst/gl/glprototypes/debug.h117
-rw-r--r--include/gst/gl/glprototypes/eglimage.h53
-rw-r--r--include/gst/gl/glprototypes/fbo.h157
-rw-r--r--include/gst/gl/glprototypes/fixedfunction.h144
-rw-r--r--include/gst/gl/glprototypes/gles.h102
-rw-r--r--include/gst/gl/glprototypes/gstgl_compat.h67
-rw-r--r--include/gst/gl/glprototypes/gstgl_gles2compat.h60
-rw-r--r--include/gst/gl/glprototypes/opengl.h72
-rw-r--r--include/gst/gl/glprototypes/query.h63
-rw-r--r--include/gst/gl/glprototypes/shaders.h374
-rw-r--r--include/gst/gl/glprototypes/sync.h49
-rw-r--r--include/gst/gl/glprototypes/vao.h37
-rw-r--r--include/gst/gl/gstgl_enums.h49
-rw-r--r--include/gst/gl/gstgl_fwd.h147
-rw-r--r--include/gst/gl/gstglapi.h114
-rw-r--r--include/gst/gl/gstglbasefilter.h100
-rw-r--r--include/gst/gl/gstglbasememory.h421
-rw-r--r--include/gst/gl/gstglbasesrc.h100
-rw-r--r--include/gst/gl/gstglbuffer.h150
-rw-r--r--include/gst/gl/gstglbufferpool.h83
-rw-r--r--include/gst/gl/gstglcolorconvert.h156
-rw-r--r--include/gst/gl/gstglcontext.h252
-rw-r--r--include/gst/gl/gstglcontextconfig.h160
-rw-r--r--include/gst/gl/gstgldebug.h182
-rw-r--r--include/gst/gl/gstgldisplay.h190
-rw-r--r--include/gst/gl/gstglfeature.h62
-rw-r--r--include/gst/gl/gstglfilter.h149
-rw-r--r--include/gst/gl/gstglformat.h171
-rw-r--r--include/gst/gl/gstglframebuffer.h119
-rw-r--r--include/gst/gl/gstglfuncs.h111
-rw-r--r--include/gst/gl/gstglmemory.h327
-rw-r--r--include/gst/gl/gstglmemorypbo.h119
-rw-r--r--include/gst/gl/gstgloverlaycompositor.h92
-rw-r--r--include/gst/gl/gstglquery.h162
-rw-r--r--include/gst/gl/gstglrenderbuffer.h176
-rw-r--r--include/gst/gl/gstglshader.h156
-rw-r--r--include/gst/gl/gstglshaderstrings.h63
-rw-r--r--include/gst/gl/gstglsl.h169
-rw-r--r--include/gst/gl/gstglslstage.h108
-rw-r--r--include/gst/gl/gstglsyncmeta.h95
-rw-r--r--include/gst/gl/gstglupload.h124
-rw-r--r--include/gst/gl/gstglutils.h73
-rw-r--r--include/gst/gl/gstglviewconvert.h139
-rw-r--r--include/gst/gl/gstglwindow.h282
-rw-r--r--include/gst/glib-compat.h39
-rw-r--r--include/gst/gst.h141
-rw-r--r--include/gst/gstallocator.h201
-rw-r--r--include/gst/gstatomicqueue.h72
-rw-r--r--include/gst/gstbin.h333
-rw-r--r--include/gst/gstbuffer.h793
-rw-r--r--include/gst/gstbufferlist.h187
-rw-r--r--include/gst/gstbufferpool.h350
-rw-r--r--include/gst/gstbus.h253
-rw-r--r--include/gst/gstcaps.h543
-rw-r--r--include/gst/gstcapsfeatures.h127
-rw-r--r--include/gst/gstchildproxy.h162
-rw-r--r--include/gst/gstclock.h712
-rw-r--r--include/gst/gstcompat.h103
-rw-r--r--include/gst/gstconfig.h204
-rw-r--r--include/gst/gstcontext.h134
-rw-r--r--include/gst/gstcontrolbinding.h191
-rw-r--r--include/gst/gstcontrolsource.h147
-rw-r--r--include/gst/gstdatetime.h167
-rw-r--r--include/gst/gstdebugutils.h125
-rw-r--r--include/gst/gstdevice.h120
-rw-r--r--include/gst/gstdevicemonitor.h118
-rw-r--r--include/gst/gstdeviceprovider.h266
-rw-r--r--include/gst/gstdeviceproviderfactory.h102
-rw-r--r--include/gst/gstdynamictypefactory.h109
-rw-r--r--include/gst/gstelement.h1209
-rw-r--r--include/gst/gstelementfactory.h272
-rw-r--r--include/gst/gstelementmetadata.h79
-rw-r--r--include/gst/gstenumtypes.h430
-rw-r--r--include/gst/gsterror.h273
-rw-r--r--include/gst/gstevent.h738
-rw-r--r--include/gst/gstformat.h126
-rw-r--r--include/gst/gstghostpad.h151
-rw-r--r--include/gst/gstinfo.h1812
-rw-r--r--include/gst/gstiterator.h290
-rw-r--r--include/gst/gstmacros.h59
-rw-r--r--include/gst/gstmemory.h390
-rw-r--r--include/gst/gstmessage.h842
-rw-r--r--include/gst/gstmeta.h301
-rw-r--r--include/gst/gstminiobject.h315
-rw-r--r--include/gst/gstobject.h332
-rw-r--r--include/gst/gstpad.h1576
-rw-r--r--include/gst/gstpadtemplate.h246
-rw-r--r--include/gst/gstparamspecs.h190
-rw-r--r--include/gst/gstparse.h138
-rw-r--r--include/gst/gstpipeline.h138
-rw-r--r--include/gst/gstplugin.h402
-rw-r--r--include/gst/gstpluginfeature.h164
-rw-r--r--include/gst/gstpoll.h132
-rw-r--r--include/gst/gstpreset.h118
-rw-r--r--include/gst/gstpromise.h120
-rw-r--r--include/gst/gstprotection.h100
-rw-r--r--include/gst/gstquery.h661
-rw-r--r--include/gst/gstregistry.h132
-rw-r--r--include/gst/gstsample.h194
-rw-r--r--include/gst/gstsegment.h351
-rw-r--r--include/gst/gststreamcollection.h119
-rw-r--r--include/gst/gststreams.h159
-rw-r--r--include/gst/gststructure.h399
-rw-r--r--include/gst/gstsystemclock.h97
-rw-r--r--include/gst/gsttaglist.h1122
-rw-r--r--include/gst/gsttagsetter.h106
-rw-r--r--include/gst/gsttask.h220
-rw-r--r--include/gst/gsttaskpool.h177
-rw-r--r--include/gst/gsttoc.h249
-rw-r--r--include/gst/gsttocsetter.h72
-rw-r--r--include/gst/gsttracer.h83
-rw-r--r--include/gst/gsttracerfactory.h64
-rw-r--r--include/gst/gsttracerrecord.h106
-rw-r--r--include/gst/gsttypefind.h221
-rw-r--r--include/gst/gsttypefindfactory.h72
-rw-r--r--include/gst/gsturi.h396
-rw-r--r--include/gst/gstutils.h1230
-rw-r--r--include/gst/gstvalue.h821
-rw-r--r--include/gst/gstversion.h91
-rw-r--r--include/gst/insertbin/gstinsertbin.h127
-rw-r--r--include/gst/interfaces/photography-enumtypes.h60
-rw-r--r--include/gst/interfaces/photography-prelude.h35
-rw-r--r--include/gst/interfaces/photography.h685
-rw-r--r--include/gst/isoff/gstisoff.h299
-rw-r--r--include/gst/math-compat.h116
-rw-r--r--include/gst/mpegts/gst-atsc-descriptor.h87
-rw-r--r--include/gst/mpegts/gst-atsc-section.h543
-rw-r--r--include/gst/mpegts/gst-dvb-descriptor.h1139
-rw-r--r--include/gst/mpegts/gst-dvb-section.h500
-rw-r--r--include/gst/mpegts/gst-hdmv-section.h66
-rw-r--r--include/gst/mpegts/gst-isdb-descriptor.h89
-rw-r--r--include/gst/mpegts/gst-scte-section.h287
-rw-r--r--include/gst/mpegts/gstmpegts-enumtypes.h180
-rw-r--r--include/gst/mpegts/gstmpegtsdescriptor.h393
-rw-r--r--include/gst/mpegts/gstmpegtssection.h508
-rw-r--r--include/gst/mpegts/mpegts-prelude.h35
-rw-r--r--include/gst/mpegts/mpegts.h51
-rw-r--r--include/gst/net/gstnet.h31
-rw-r--r--include/gst/net/gstnetaddressmeta.h63
-rw-r--r--include/gst/net/gstnetclientclock.h106
-rw-r--r--include/gst/net/gstnetcontrolmessagemeta.h69
-rw-r--r--include/gst/net/gstnettimepacket.h81
-rw-r--r--include/gst/net/gstnettimeprovider.h79
-rw-r--r--include/gst/net/gstnetutils.h37
-rw-r--r--include/gst/net/gstptpclock.h161
-rw-r--r--include/gst/net/net-prelude.h35
-rw-r--r--include/gst/net/net.h36
-rw-r--r--include/gst/pbutils/codec-utils.h162
-rw-r--r--include/gst/pbutils/descriptions.h101
-rw-r--r--include/gst/pbutils/encoding-profile.h286
-rw-r--r--include/gst/pbutils/encoding-target.h181
-rw-r--r--include/gst/pbutils/gstaudiovisualizer.h112
-rw-r--r--include/gst/pbutils/gstdiscoverer.h435
-rw-r--r--include/gst/pbutils/gstpluginsbaseversion.h79
-rw-r--r--include/gst/pbutils/install-plugins.h164
-rw-r--r--include/gst/pbutils/missing-plugins.h90
-rw-r--r--include/gst/pbutils/pbutils-enumtypes.h42
-rw-r--r--include/gst/pbutils/pbutils-prelude.h41
-rw-r--r--include/gst/pbutils/pbutils.h44
-rw-r--r--include/gst/play/gstplay-media-info.h280
-rw-r--r--include/gst/play/gstplay-signal-adapter.h59
-rw-r--r--include/gst/play/gstplay-types.h47
-rw-r--r--include/gst/play/gstplay-video-overlay-video-renderer.h77
-rw-r--r--include/gst/play/gstplay-video-renderer.h57
-rw-r--r--include/gst/play/gstplay-visualization.h61
-rw-r--r--include/gst/play/gstplay.h442
-rw-r--r--include/gst/play/play-prelude.h43
-rw-r--r--include/gst/play/play.h31
-rw-r--r--include/gst/player/gstplayer-g-main-context-signal-dispatcher.h50
-rw-r--r--include/gst/player/gstplayer-media-info.h255
-rw-r--r--include/gst/player/gstplayer-signal-dispatcher.h54
-rw-r--r--include/gst/player/gstplayer-types.h36
-rw-r--r--include/gst/player/gstplayer-video-overlay-video-renderer.h68
-rw-r--r--include/gst/player/gstplayer-video-renderer.h48
-rw-r--r--include/gst/player/gstplayer-visualization.h60
-rw-r--r--include/gst/player/gstplayer.h306
-rw-r--r--include/gst/player/player-prelude.h43
-rw-r--r--include/gst/player/player.h31
-rw-r--r--include/gst/riff/riff-ids.h536
-rw-r--r--include/gst/riff/riff-media.h74
-rw-r--r--include/gst/riff/riff-prelude.h33
-rw-r--r--include/gst/riff/riff-read.h98
-rw-r--r--include/gst/riff/riff.h30
-rw-r--r--include/gst/rtp/gstrtcpbuffer.h671
-rw-r--r--include/gst/rtp/gstrtp-enumtypes.h64
-rw-r--r--include/gst/rtp/gstrtpbaseaudiopayload.h124
-rw-r--r--include/gst/rtp/gstrtpbasedepayload.h135
-rw-r--r--include/gst/rtp/gstrtpbasepayload.h199
-rw-r--r--include/gst/rtp/gstrtpbuffer.h286
-rw-r--r--include/gst/rtp/gstrtpdefs.h58
-rw-r--r--include/gst/rtp/gstrtphdrext.h294
-rw-r--r--include/gst/rtp/gstrtpmeta.h79
-rw-r--r--include/gst/rtp/gstrtppayloads.h199
-rw-r--r--include/gst/rtp/rtp-prelude.h33
-rw-r--r--include/gst/rtp/rtp.h36
-rw-r--r--include/gst/rtsp-server/rtsp-address-pool.h205
-rw-r--r--include/gst/rtsp-server/rtsp-auth.h230
-rw-r--r--include/gst/rtsp-server/rtsp-client.h294
-rw-r--r--include/gst/rtsp-server/rtsp-context.h97
-rw-r--r--include/gst/rtsp-server/rtsp-media-factory-uri.h91
-rw-r--r--include/gst/rtsp-server/rtsp-media-factory.h284
-rw-r--r--include/gst/rtsp-server/rtsp-media.h449
-rw-r--r--include/gst/rtsp-server/rtsp-mount-points.h105
-rw-r--r--include/gst/rtsp-server/rtsp-onvif-client.h65
-rw-r--r--include/gst/rtsp-server/rtsp-onvif-media-factory.h95
-rw-r--r--include/gst/rtsp-server/rtsp-onvif-media.h71
-rw-r--r--include/gst/rtsp-server/rtsp-onvif-server.h71
-rw-r--r--include/gst/rtsp-server/rtsp-params.h41
-rw-r--r--include/gst/rtsp-server/rtsp-permissions.h122
-rw-r--r--include/gst/rtsp-server/rtsp-sdp.h49
-rw-r--r--include/gst/rtsp-server/rtsp-server-object.h211
-rw-r--r--include/gst/rtsp-server/rtsp-server-prelude.h44
-rw-r--r--include/gst/rtsp-server/rtsp-server.h56
-rw-r--r--include/gst/rtsp-server/rtsp-session-media.h123
-rw-r--r--include/gst/rtsp-server/rtsp-session-pool.h169
-rw-r--r--include/gst/rtsp-server/rtsp-session.h186
-rw-r--r--include/gst/rtsp-server/rtsp-stream-transport.h229
-rw-r--r--include/gst/rtsp-server/rtsp-stream.h406
-rw-r--r--include/gst/rtsp-server/rtsp-thread-pool.h191
-rw-r--r--include/gst/rtsp-server/rtsp-token.h113
-rw-r--r--include/gst/rtsp/gstrtsp-enumtypes.h82
-rw-r--r--include/gst/rtsp/gstrtsp.h33
-rw-r--r--include/gst/rtsp/gstrtspconnection.h395
-rw-r--r--include/gst/rtsp/gstrtspdefs.h453
-rw-r--r--include/gst/rtsp/gstrtspextension.h122
-rw-r--r--include/gst/rtsp/gstrtspmessage.h347
-rw-r--r--include/gst/rtsp/gstrtsprange.h164
-rw-r--r--include/gst/rtsp/gstrtsptransport.h201
-rw-r--r--include/gst/rtsp/gstrtspurl.h121
-rw-r--r--include/gst/rtsp/rtsp-prelude.h41
-rw-r--r--include/gst/rtsp/rtsp.h37
-rw-r--r--include/gst/sctp/sctp-prelude.h35
-rw-r--r--include/gst/sctp/sctpreceivemeta.h57
-rw-r--r--include/gst/sctp/sctpsendmeta.h69
-rw-r--r--include/gst/sdp/gstmikey.h749
-rw-r--r--include/gst/sdp/gstsdp.h58
-rw-r--r--include/gst/sdp/gstsdpmessage.h762
-rw-r--r--include/gst/sdp/sdp-prelude.h33
-rw-r--r--include/gst/sdp/sdp.h31
-rw-r--r--include/gst/tag/gsttagdemux.h139
-rw-r--r--include/gst/tag/gsttagmux.h89
-rw-r--r--include/gst/tag/tag-enumtypes.h30
-rw-r--r--include/gst/tag/tag-prelude.h33
-rw-r--r--include/gst/tag/tag.h708
-rw-r--r--include/gst/tag/xmpwriter.h72
-rw-r--r--include/gst/transcoder/gsttranscoder-signal-adapter.h55
-rw-r--r--include/gst/transcoder/gsttranscoder.h178
-rw-r--r--include/gst/transcoder/transcoder-enumtypes.h28
-rw-r--r--include/gst/transcoder/transcoder-prelude.h38
-rw-r--r--include/gst/validate/gst-validate-bin-monitor.h91
-rw-r--r--include/gst/validate/gst-validate-element-monitor.h93
-rw-r--r--include/gst/validate/gst-validate-enum-types.h47
-rw-r--r--include/gst/validate/gst-validate-enums.h116
-rw-r--r--include/gst/validate/gst-validate-media-info.h89
-rw-r--r--include/gst/validate/gst-validate-monitor-factory.h39
-rw-r--r--include/gst/validate/gst-validate-monitor.h142
-rw-r--r--include/gst/validate/gst-validate-override-registry.h66
-rw-r--r--include/gst/validate/gst-validate-override.h141
-rw-r--r--include/gst/validate/gst-validate-pad-monitor.h156
-rw-r--r--include/gst/validate/gst-validate-pipeline-monitor.h98
-rw-r--r--include/gst/validate/gst-validate-report.h336
-rw-r--r--include/gst/validate/gst-validate-reporter.h158
-rw-r--r--include/gst/validate/gst-validate-runner.h104
-rw-r--r--include/gst/validate/gst-validate-scenario.h425
-rw-r--r--include/gst/validate/gst-validate-types.h30
-rw-r--r--include/gst/validate/gst-validate-utils.h93
-rw-r--r--include/gst/validate/media-descriptor-parser.h83
-rw-r--r--include/gst/validate/media-descriptor-writer.h113
-rw-r--r--include/gst/validate/media-descriptor.h194
-rw-r--r--include/gst/validate/validate-prelude.h31
-rw-r--r--include/gst/validate/validate.h38
-rw-r--r--include/gst/video/colorbalance.h124
-rw-r--r--include/gst/video/colorbalancechannel.h89
-rw-r--r--include/gst/video/gstvideoaffinetransformationmeta.h81
-rw-r--r--include/gst/video/gstvideoaggregator.h332
-rw-r--r--include/gst/video/gstvideocodecalphameta.h88
-rw-r--r--include/gst/video/gstvideodecoder.h558
-rw-r--r--include/gst/video/gstvideoencoder.h395
-rw-r--r--include/gst/video/gstvideofilter.h89
-rw-r--r--include/gst/video/gstvideometa.h418
-rw-r--r--include/gst/video/gstvideopool.h88
-rw-r--r--include/gst/video/gstvideosink.h153
-rw-r--r--include/gst/video/gstvideotimecode.h257
-rw-r--r--include/gst/video/gstvideoutils.h341
-rw-r--r--include/gst/video/navigation.h338
-rw-r--r--include/gst/video/video-anc.h504
-rw-r--r--include/gst/video/video-blend.h41
-rw-r--r--include/gst/video/video-chroma.h118
-rw-r--r--include/gst/video/video-color.h304
-rw-r--r--include/gst/video/video-converter.h318
-rw-r--r--include/gst/video/video-dither.h81
-rw-r--r--include/gst/video/video-enumtypes.h248
-rw-r--r--include/gst/video/video-event.h69
-rw-r--r--include/gst/video/video-format.h809
-rw-r--r--include/gst/video/video-frame.h254
-rw-r--r--include/gst/video/video-hdr.h143
-rw-r--r--include/gst/video/video-info.h484
-rw-r--r--include/gst/video/video-multiview.h108
-rw-r--r--include/gst/video/video-overlay-composition.h310
-rw-r--r--include/gst/video/video-prelude.h41
-rw-r--r--include/gst/video/video-resampler.h178
-rw-r--r--include/gst/video/video-scaler.h101
-rw-r--r--include/gst/video/video-tile.h140
-rw-r--r--include/gst/video/video.h200
-rw-r--r--include/gst/video/videodirection.h64
-rw-r--r--include/gst/video/videoorientation.h111
-rw-r--r--include/gst/video/videooverlay.h119
-rw-r--r--include/gst/webrtc/datachannel.h52
-rw-r--r--include/gst/webrtc/dtlstransport.h42
-rw-r--r--include/gst/webrtc/icetransport.h41
-rw-r--r--include/gst/webrtc/rtcsessiondescription.h61
-rw-r--r--include/gst/webrtc/rtpreceiver.h42
-rw-r--r--include/gst/webrtc/rtpsender.h46
-rw-r--r--include/gst/webrtc/rtptransceiver.h41
-rw-r--r--include/gst/webrtc/sctptransport.h42
-rw-r--r--include/gst/webrtc/webrtc-enumtypes.h92
-rw-r--r--include/gst/webrtc/webrtc.h34
-rw-r--r--include/gst/webrtc/webrtc_fwd.h467
-rw-r--r--libs/win32/glib-2.0.libbin0 -> 405828 bytes
-rw-r--r--libs/win32/gobject-2.0.libbin0 -> 111404 bytes
-rw-r--r--libs/win32/gstreamer-1.0.libbin0 -> 472494 bytes
-rw-r--r--libs/win32/gstrtp-1.0.libbin0 -> 64200 bytes
-rw-r--r--libs/win32/gstsdp-1.0.libbin0 -> 48828 bytes
-rw-r--r--libs/win32/gstwebrtc-1.0.libbin0 -> 17242 bytes
-rw-r--r--libs/win64/glib-2.0.libbin0 -> 395734 bytes
-rw-r--r--libs/win64/gobject-2.0.libbin0 -> 109228 bytes
-rw-r--r--libs/win64/gstreamer-1.0.libbin0 -> 463556 bytes
-rw-r--r--libs/win64/gstrtp-1.0.libbin0 -> 63138 bytes
-rw-r--r--libs/win64/gstsdp-1.0.libbin0 -> 47978 bytes
-rw-r--r--libs/win64/gstwebrtc-1.0.libbin0 -> 16998 bytes
-rw-r--r--protocols/JabberG/jabber.vcxproj9
-rw-r--r--protocols/JabberG/jabber.vcxproj.filters3
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp8
-rw-r--r--protocols/JabberG/src/jabber_caps.h9
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp17
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp3
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp1
-rw-r--r--protocols/JabberG/src/jabber_proto.h16
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp97
-rw-r--r--protocols/JabberG/src/jabber_voip.cpp519
706 files changed, 139192 insertions, 33 deletions
diff --git a/include/glib/gio/gaction.h b/include/glib/gio/gaction.h
new file mode 100644
index 0000000000..f9f4b38e7d
--- /dev/null
+++ b/include/glib/gio/gaction.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_ACTION_H__
+#define __G_ACTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ACTION (g_action_get_type ())
+#define G_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_ACTION, GAction))
+#define G_IS_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_ACTION))
+#define G_ACTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+ G_TYPE_ACTION, GActionInterface))
+
+typedef struct _GActionInterface GActionInterface;
+
+struct _GActionInterface
+{
+ GTypeInterface g_iface;
+
+ /* virtual functions */
+ const gchar * (* get_name) (GAction *action);
+ const GVariantType * (* get_parameter_type) (GAction *action);
+ const GVariantType * (* get_state_type) (GAction *action);
+ GVariant * (* get_state_hint) (GAction *action);
+
+ gboolean (* get_enabled) (GAction *action);
+ GVariant * (* get_state) (GAction *action);
+
+ void (* change_state) (GAction *action,
+ GVariant *value);
+ void (* activate) (GAction *action,
+ GVariant *parameter);
+};
+
+GLIB_AVAILABLE_IN_2_30
+GType g_action_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_action_get_name (GAction *action);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_action_get_parameter_type (GAction *action);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_action_get_state_type (GAction *action);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_action_get_state_hint (GAction *action);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_action_get_enabled (GAction *action);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_action_get_state (GAction *action);
+
+GLIB_AVAILABLE_IN_ALL
+void g_action_change_state (GAction *action,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+void g_action_activate (GAction *action,
+ GVariant *parameter);
+
+GLIB_AVAILABLE_IN_2_28
+gboolean g_action_name_is_valid (const gchar *action_name);
+
+GLIB_AVAILABLE_IN_2_38
+gboolean g_action_parse_detailed_name (const gchar *detailed_name,
+ gchar **action_name,
+ GVariant **target_value,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_38
+gchar * g_action_print_detailed_name (const gchar *action_name,
+ GVariant *target_value);
+
+G_END_DECLS
+
+#endif /* __G_ACTION_H__ */
diff --git a/include/glib/gio/gactiongroup.h b/include/glib/gio/gactiongroup.h
new file mode 100644
index 0000000000..bba8a236b7
--- /dev/null
+++ b/include/glib/gio/gactiongroup.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_ACTION_GROUP_H__
+#define __G_ACTION_GROUP_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+
+#define G_TYPE_ACTION_GROUP (g_action_group_get_type ())
+#define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_ACTION_GROUP, GActionGroup))
+#define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_ACTION_GROUP))
+#define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+ G_TYPE_ACTION_GROUP, GActionGroupInterface))
+
+typedef struct _GActionGroupInterface GActionGroupInterface;
+
+struct _GActionGroupInterface
+{
+ GTypeInterface g_iface;
+
+ /* virtual functions */
+ gboolean (* has_action) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ gchar ** (* list_actions) (GActionGroup *action_group);
+
+ gboolean (* get_action_enabled) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ GVariant * (* get_action_state_hint) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ GVariant * (* get_action_state) (GActionGroup *action_group,
+ const gchar *action_name);
+
+ void (* change_action_state) (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *value);
+
+ void (* activate_action) (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *parameter);
+
+ /* signals */
+ void (* action_added) (GActionGroup *action_group,
+ const gchar *action_name);
+ void (* action_removed) (GActionGroup *action_group,
+ const gchar *action_name);
+ void (* action_enabled_changed) (GActionGroup *action_group,
+ const gchar *action_name,
+ gboolean enabled);
+ void (* action_state_changed) (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *state);
+
+ /* more virtual functions */
+ gboolean (* query_action) (GActionGroup *action_group,
+ const gchar *action_name,
+ gboolean *enabled,
+ const GVariantType **parameter_type,
+ const GVariantType **state_type,
+ GVariant **state_hint,
+ GVariant **state);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_action_group_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_action_group_has_action (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_action_group_list_actions (GActionGroup *action_group);
+
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
+ const gchar *action_name);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
+ const gchar *action_name);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_action_group_get_action_state (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_change_action_state (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *value);
+
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_activate_action (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *parameter);
+
+/* signals */
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_action_added (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_action_removed (GActionGroup *action_group,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_action_enabled_changed (GActionGroup *action_group,
+ const gchar *action_name,
+ gboolean enabled);
+
+GLIB_AVAILABLE_IN_ALL
+void g_action_group_action_state_changed (GActionGroup *action_group,
+ const gchar *action_name,
+ GVariant *state);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_action_group_query_action (GActionGroup *action_group,
+ const gchar *action_name,
+ gboolean *enabled,
+ const GVariantType **parameter_type,
+ const GVariantType **state_type,
+ GVariant **state_hint,
+ GVariant **state);
+
+G_END_DECLS
+
+#endif /* __G_ACTION_GROUP_H__ */
diff --git a/include/glib/gio/gactiongroupexporter.h b/include/glib/gio/gactiongroupexporter.h
new file mode 100644
index 0000000000..ba28c8954b
--- /dev/null
+++ b/include/glib/gio/gactiongroupexporter.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ * Copyright © 2011 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+
+#ifndef __G_ACTION_GROUP_EXPORTER_H__
+#define __G_ACTION_GROUP_EXPORTER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_32
+guint g_dbus_connection_export_action_group (GDBusConnection *connection,
+ const gchar *object_path,
+ GActionGroup *action_group,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+void g_dbus_connection_unexport_action_group (GDBusConnection *connection,
+ guint export_id);
+
+G_END_DECLS
+
+#endif /* __G_ACTION_GROUP_EXPORTER_H__ */
diff --git a/include/glib/gio/gactionmap.h b/include/glib/gio/gactionmap.h
new file mode 100644
index 0000000000..2a22a27712
--- /dev/null
+++ b/include/glib/gio/gactionmap.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_ACTION_MAP_H__
+#define __G_ACTION_MAP_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+
+#define G_TYPE_ACTION_MAP (g_action_map_get_type ())
+#define G_ACTION_MAP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_ACTION_MAP, GActionMap))
+#define G_IS_ACTION_MAP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_ACTION_MAP))
+#define G_ACTION_MAP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+ G_TYPE_ACTION_MAP, GActionMapInterface))
+
+typedef struct _GActionMapInterface GActionMapInterface;
+typedef struct _GActionEntry GActionEntry;
+
+struct _GActionMapInterface
+{
+ GTypeInterface g_iface;
+
+ GAction * (* lookup_action) (GActionMap *action_map,
+ const gchar *action_name);
+ void (* add_action) (GActionMap *action_map,
+ GAction *action);
+ void (* remove_action) (GActionMap *action_map,
+ const gchar *action_name);
+};
+
+struct _GActionEntry
+{
+ const gchar *name;
+
+ void (* activate) (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+
+ const gchar *parameter_type;
+
+ const gchar *state;
+
+ void (* change_state) (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data);
+
+ /*< private >*/
+ gsize padding[3];
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_action_map_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+GAction * g_action_map_lookup_action (GActionMap *action_map,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_2_32
+void g_action_map_add_action (GActionMap *action_map,
+ GAction *action);
+GLIB_AVAILABLE_IN_2_32
+void g_action_map_remove_action (GActionMap *action_map,
+ const gchar *action_name);
+GLIB_AVAILABLE_IN_2_32
+void g_action_map_add_action_entries (GActionMap *action_map,
+ const GActionEntry *entries,
+ gint n_entries,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_ACTION_MAP_H__ */
diff --git a/include/glib/gio/gappinfo.h b/include/glib/gio/gappinfo.h
new file mode 100644
index 0000000000..d26d048a5f
--- /dev/null
+++ b/include/glib/gio/gappinfo.h
@@ -0,0 +1,347 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_APP_INFO_H__
+#define __G_APP_INFO_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_APP_INFO (g_app_info_get_type ())
+#define G_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APP_INFO, GAppInfo))
+#define G_IS_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APP_INFO))
+#define G_APP_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_APP_INFO, GAppInfoIface))
+
+#define G_TYPE_APP_LAUNCH_CONTEXT (g_app_launch_context_get_type ())
+#define G_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContext))
+#define G_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
+#define G_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_APP_LAUNCH_CONTEXT))
+#define G_IS_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_APP_LAUNCH_CONTEXT))
+#define G_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
+
+typedef struct _GAppLaunchContextClass GAppLaunchContextClass;
+typedef struct _GAppLaunchContextPrivate GAppLaunchContextPrivate;
+
+/**
+ * GAppInfo:
+ *
+ * Information about an installed application and methods to launch
+ * it (with file arguments).
+ */
+
+/**
+ * GAppInfoIface:
+ * @g_iface: The parent interface.
+ * @dup: Copies a #GAppInfo.
+ * @equal: Checks two #GAppInfos for equality.
+ * @get_id: Gets a string identifier for a #GAppInfo.
+ * @get_name: Gets the name of the application for a #GAppInfo.
+ * @get_description: Gets a short description for the application described by the #GAppInfo.
+ * @get_executable: Gets the executable name for the #GAppInfo.
+ * @get_icon: Gets the #GIcon for the #GAppInfo.
+ * @launch: Launches an application specified by the #GAppInfo.
+ * @supports_uris: Indicates whether the application specified supports launching URIs.
+ * @supports_files: Indicates whether the application specified accepts filename arguments.
+ * @launch_uris: Launches an application with a list of URIs.
+ * @should_show: Returns whether an application should be shown (e.g. when getting a list of installed applications).
+ * [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
+ * @set_as_default_for_type: Sets an application as default for a given content type.
+ * @set_as_default_for_extension: Sets an application as default for a given file extension.
+ * @add_supports_type: Adds to the #GAppInfo information about supported file types.
+ * @can_remove_supports_type: Checks for support for removing supported file types from a #GAppInfo.
+ * @remove_supports_type: Removes a supported application type from a #GAppInfo.
+ * @can_delete: Checks if a #GAppInfo can be deleted. Since 2.20
+ * @do_delete: Deletes a #GAppInfo. Since 2.20
+ * @get_commandline: Gets the commandline for the #GAppInfo. Since 2.20
+ * @get_display_name: Gets the display name for the #GAppInfo. Since 2.24
+ * @set_as_last_used_for_type: Sets the application as the last used. See g_app_info_set_as_last_used_for_type().
+ * @get_supported_types: Retrieves the list of content types that @app_info claims to support.
+ * @launch_uris_async: Asynchronously launches an application with a list of URIs. (Since: 2.60)
+ * @launch_uris_finish: Finishes an operation started with @launch_uris_async. (Since: 2.60)
+
+ * Application Information interface, for operating system portability.
+ */
+typedef struct _GAppInfoIface GAppInfoIface;
+
+struct _GAppInfoIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GAppInfo * (* dup) (GAppInfo *appinfo);
+ gboolean (* equal) (GAppInfo *appinfo1,
+ GAppInfo *appinfo2);
+ const char * (* get_id) (GAppInfo *appinfo);
+ const char * (* get_name) (GAppInfo *appinfo);
+ const char * (* get_description) (GAppInfo *appinfo);
+ const char * (* get_executable) (GAppInfo *appinfo);
+ GIcon * (* get_icon) (GAppInfo *appinfo);
+ gboolean (* launch) (GAppInfo *appinfo,
+ GList *files,
+ GAppLaunchContext *context,
+ GError **error);
+ gboolean (* supports_uris) (GAppInfo *appinfo);
+ gboolean (* supports_files) (GAppInfo *appinfo);
+ gboolean (* launch_uris) (GAppInfo *appinfo,
+ GList *uris,
+ GAppLaunchContext *context,
+ GError **error);
+ gboolean (* should_show) (GAppInfo *appinfo);
+
+ /* For changing associations */
+ gboolean (* set_as_default_for_type) (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+ gboolean (* set_as_default_for_extension) (GAppInfo *appinfo,
+ const char *extension,
+ GError **error);
+ gboolean (* add_supports_type) (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+ gboolean (* can_remove_supports_type) (GAppInfo *appinfo);
+ gboolean (* remove_supports_type) (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+ gboolean (* can_delete) (GAppInfo *appinfo);
+ gboolean (* do_delete) (GAppInfo *appinfo);
+ const char * (* get_commandline) (GAppInfo *appinfo);
+ const char * (* get_display_name) (GAppInfo *appinfo);
+ gboolean (* set_as_last_used_for_type) (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+ const char ** (* get_supported_types) (GAppInfo *appinfo);
+ void (* launch_uris_async) (GAppInfo *appinfo,
+ GList *uris,
+ GAppLaunchContext *context,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* launch_uris_finish) (GAppInfo *appinfo,
+ GAsyncResult *result,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_app_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GAppInfo * g_app_info_create_from_commandline (const char *commandline,
+ const char *application_name,
+ GAppInfoCreateFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GAppInfo * g_app_info_dup (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_equal (GAppInfo *appinfo1,
+ GAppInfo *appinfo2);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_id (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_name (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_display_name (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_description (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_executable (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+const char *g_app_info_get_commandline (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_app_info_get_icon (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_launch (GAppInfo *appinfo,
+ GList *files,
+ GAppLaunchContext *context,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_supports_uris (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_supports_files (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_launch_uris (GAppInfo *appinfo,
+ GList *uris,
+ GAppLaunchContext *context,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+void g_app_info_launch_uris_async (GAppInfo *appinfo,
+ GList *uris,
+ GAppLaunchContext *context,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_60
+gboolean g_app_info_launch_uris_finish (GAppInfo *appinfo,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_should_show (GAppInfo *appinfo);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_set_as_default_for_type (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_set_as_default_for_extension (GAppInfo *appinfo,
+ const char *extension,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_add_supports_type (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_can_remove_supports_type (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_remove_supports_type (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+const char **g_app_info_get_supported_types (GAppInfo *appinfo);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_can_delete (GAppInfo *appinfo);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_delete (GAppInfo *appinfo);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
+ const char *content_type,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GList * g_app_info_get_all (void);
+GLIB_AVAILABLE_IN_ALL
+GList * g_app_info_get_all_for_type (const char *content_type);
+GLIB_AVAILABLE_IN_ALL
+GList * g_app_info_get_recommended_for_type (const gchar *content_type);
+GLIB_AVAILABLE_IN_ALL
+GList * g_app_info_get_fallback_for_type (const gchar *content_type);
+
+GLIB_AVAILABLE_IN_ALL
+void g_app_info_reset_type_associations (const char *content_type);
+GLIB_AVAILABLE_IN_ALL
+GAppInfo *g_app_info_get_default_for_type (const char *content_type,
+ gboolean must_support_uris);
+GLIB_AVAILABLE_IN_ALL
+GAppInfo *g_app_info_get_default_for_uri_scheme (const char *uri_scheme);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_app_info_launch_default_for_uri (const char *uri,
+ GAppLaunchContext *context,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_50
+void g_app_info_launch_default_for_uri_async (const char *uri,
+ GAppLaunchContext *context,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_app_info_launch_default_for_uri_finish (GAsyncResult *result,
+ GError **error);
+
+
+/**
+ * GAppLaunchContext:
+ *
+ * Integrating the launch with the launching application. This is used to
+ * handle for instance startup notification and launching the new application
+ * on the same screen as the launching window.
+ */
+struct _GAppLaunchContext
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GAppLaunchContextPrivate *priv;
+};
+
+struct _GAppLaunchContextClass
+{
+ GObjectClass parent_class;
+
+ char * (* get_display) (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files);
+ char * (* get_startup_notify_id) (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files);
+ void (* launch_failed) (GAppLaunchContext *context,
+ const char *startup_notify_id);
+ void (* launched) (GAppLaunchContext *context,
+ GAppInfo *info,
+ GVariant *platform_data);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_app_launch_context_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GAppLaunchContext *g_app_launch_context_new (void);
+
+GLIB_AVAILABLE_IN_2_32
+void g_app_launch_context_setenv (GAppLaunchContext *context,
+ const char *variable,
+ const char *value);
+GLIB_AVAILABLE_IN_2_32
+void g_app_launch_context_unsetenv (GAppLaunchContext *context,
+ const char *variable);
+GLIB_AVAILABLE_IN_2_32
+char ** g_app_launch_context_get_environment (GAppLaunchContext *context);
+
+GLIB_AVAILABLE_IN_ALL
+char * g_app_launch_context_get_display (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files);
+GLIB_AVAILABLE_IN_ALL
+char * g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files);
+GLIB_AVAILABLE_IN_ALL
+void g_app_launch_context_launch_failed (GAppLaunchContext *context,
+ const char * startup_notify_id);
+
+#define G_TYPE_APP_INFO_MONITOR (g_app_info_monitor_get_type ())
+#define G_APP_INFO_MONITOR(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_APP_INFO_MONITOR, GAppInfoMonitor))
+#define G_IS_APP_INFO_MONITOR(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_APP_INFO_MONITOR))
+
+typedef struct _GAppInfoMonitor GAppInfoMonitor;
+
+GLIB_AVAILABLE_IN_2_40
+GType g_app_info_monitor_get_type (void);
+
+GLIB_AVAILABLE_IN_2_40
+GAppInfoMonitor * g_app_info_monitor_get (void);
+
+G_END_DECLS
+
+#endif /* __G_APP_INFO_H__ */
diff --git a/include/glib/gio/gapplication.h b/include/glib/gio/gapplication.h
new file mode 100644
index 0000000000..adc32ed44c
--- /dev/null
+++ b/include/glib/gio/gapplication.h
@@ -0,0 +1,252 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_APPLICATION_H__
+#define __G_APPLICATION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_APPLICATION (g_application_get_type ())
+#define G_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_APPLICATION, GApplication))
+#define G_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_APPLICATION, GApplicationClass))
+#define G_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_APPLICATION))
+#define G_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_APPLICATION))
+#define G_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_APPLICATION, GApplicationClass))
+
+typedef struct _GApplicationPrivate GApplicationPrivate;
+typedef struct _GApplicationClass GApplicationClass;
+
+struct _GApplication
+{
+ /*< private >*/
+ GObject parent_instance;
+
+ GApplicationPrivate *priv;
+};
+
+struct _GApplicationClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* signals */
+ void (* startup) (GApplication *application);
+
+ void (* activate) (GApplication *application);
+
+ void (* open) (GApplication *application,
+ GFile **files,
+ gint n_files,
+ const gchar *hint);
+
+ int (* command_line) (GApplication *application,
+ GApplicationCommandLine *command_line);
+
+ /* vfuncs */
+
+ /**
+ * GApplicationClass::local_command_line:
+ * @application: a #GApplication
+ * @arguments: (inout) (array zero-terminated=1): array of command line arguments
+ * @exit_status: (out): exit status to fill after processing the command line.
+ *
+ * This virtual function is always invoked in the local instance. It
+ * gets passed a pointer to a %NULL-terminated copy of @argv and is
+ * expected to remove arguments that it handled (shifting up remaining
+ * arguments).
+ *
+ * The last argument to local_command_line() is a pointer to the @status
+ * variable which can used to set the exit status that is returned from
+ * g_application_run().
+ *
+ * See g_application_run() for more details on #GApplication startup.
+ *
+ * Returns: %TRUE if the commandline has been completely handled
+ */
+ gboolean (* local_command_line) (GApplication *application,
+ gchar ***arguments,
+ int *exit_status);
+
+ void (* before_emit) (GApplication *application,
+ GVariant *platform_data);
+ void (* after_emit) (GApplication *application,
+ GVariant *platform_data);
+ void (* add_platform_data) (GApplication *application,
+ GVariantBuilder *builder);
+ void (* quit_mainloop) (GApplication *application);
+ void (* run_mainloop) (GApplication *application);
+ void (* shutdown) (GApplication *application);
+
+ gboolean (* dbus_register) (GApplication *application,
+ GDBusConnection *connection,
+ const gchar *object_path,
+ GError **error);
+ void (* dbus_unregister) (GApplication *application,
+ GDBusConnection *connection,
+ const gchar *object_path);
+ gint (* handle_local_options)(GApplication *application,
+ GVariantDict *options);
+ gboolean (* name_lost) (GApplication *application);
+
+ /*< private >*/
+ gpointer padding[7];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_application_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_application_id_is_valid (const gchar *application_id);
+
+GLIB_AVAILABLE_IN_ALL
+GApplication * g_application_new (const gchar *application_id,
+ GApplicationFlags flags);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_application_get_application_id (GApplication *application);
+GLIB_AVAILABLE_IN_ALL
+void g_application_set_application_id (GApplication *application,
+ const gchar *application_id);
+
+GLIB_AVAILABLE_IN_2_34
+GDBusConnection * g_application_get_dbus_connection (GApplication *application);
+GLIB_AVAILABLE_IN_2_34
+const gchar * g_application_get_dbus_object_path (GApplication *application);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_application_get_inactivity_timeout (GApplication *application);
+GLIB_AVAILABLE_IN_ALL
+void g_application_set_inactivity_timeout (GApplication *application,
+ guint inactivity_timeout);
+
+GLIB_AVAILABLE_IN_ALL
+GApplicationFlags g_application_get_flags (GApplication *application);
+GLIB_AVAILABLE_IN_ALL
+void g_application_set_flags (GApplication *application,
+ GApplicationFlags flags);
+
+GLIB_AVAILABLE_IN_2_42
+const gchar * g_application_get_resource_base_path (GApplication *application);
+GLIB_AVAILABLE_IN_2_42
+void g_application_set_resource_base_path (GApplication *application,
+ const gchar *resource_path);
+
+GLIB_DEPRECATED
+void g_application_set_action_group (GApplication *application,
+ GActionGroup *action_group);
+
+GLIB_AVAILABLE_IN_2_40
+void g_application_add_main_option_entries (GApplication *application,
+ const GOptionEntry *entries);
+
+GLIB_AVAILABLE_IN_2_42
+void g_application_add_main_option (GApplication *application,
+ const char *long_name,
+ char short_name,
+ GOptionFlags flags,
+ GOptionArg arg,
+ const char *description,
+ const char *arg_description);
+GLIB_AVAILABLE_IN_2_40
+void g_application_add_option_group (GApplication *application,
+ GOptionGroup *group);
+GLIB_AVAILABLE_IN_2_56
+void g_application_set_option_context_parameter_string (GApplication *application,
+ const gchar *parameter_string);
+GLIB_AVAILABLE_IN_2_56
+void g_application_set_option_context_summary (GApplication *application,
+ const gchar *summary);
+GLIB_AVAILABLE_IN_2_56
+void g_application_set_option_context_description (GApplication *application,
+ const gchar *description);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_application_get_is_registered (GApplication *application);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_application_get_is_remote (GApplication *application);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_application_register (GApplication *application,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_application_hold (GApplication *application);
+GLIB_AVAILABLE_IN_ALL
+void g_application_release (GApplication *application);
+
+GLIB_AVAILABLE_IN_ALL
+void g_application_activate (GApplication *application);
+
+GLIB_AVAILABLE_IN_ALL
+void g_application_open (GApplication *application,
+ GFile **files,
+ gint n_files,
+ const gchar *hint);
+
+GLIB_AVAILABLE_IN_ALL
+int g_application_run (GApplication *application,
+ int argc,
+ char **argv);
+
+GLIB_AVAILABLE_IN_2_32
+void g_application_quit (GApplication *application);
+
+GLIB_AVAILABLE_IN_2_32
+GApplication * g_application_get_default (void);
+GLIB_AVAILABLE_IN_2_32
+void g_application_set_default (GApplication *application);
+
+GLIB_AVAILABLE_IN_2_38
+void g_application_mark_busy (GApplication *application);
+GLIB_AVAILABLE_IN_2_38
+void g_application_unmark_busy (GApplication *application);
+GLIB_AVAILABLE_IN_2_44
+gboolean g_application_get_is_busy (GApplication *application);
+
+GLIB_AVAILABLE_IN_2_40
+void g_application_send_notification (GApplication *application,
+ const gchar *id,
+ GNotification *notification);
+GLIB_AVAILABLE_IN_2_40
+void g_application_withdraw_notification (GApplication *application,
+ const gchar *id);
+
+GLIB_AVAILABLE_IN_2_44
+void g_application_bind_busy_property (GApplication *application,
+ gpointer object,
+ const gchar *property);
+
+GLIB_AVAILABLE_IN_2_44
+void g_application_unbind_busy_property (GApplication *application,
+ gpointer object,
+ const gchar *property);
+
+G_END_DECLS
+
+#endif /* __G_APPLICATION_H__ */
diff --git a/include/glib/gio/gapplicationcommandline.h b/include/glib/gio/gapplicationcommandline.h
new file mode 100644
index 0000000000..6610e86bd2
--- /dev/null
+++ b/include/glib/gio/gapplicationcommandline.h
@@ -0,0 +1,122 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_APPLICATION_COMMAND_LINE_H__
+#define __G_APPLICATION_COMMAND_LINE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_APPLICATION_COMMAND_LINE (g_application_command_line_get_type ())
+#define G_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_APPLICATION_COMMAND_LINE, \
+ GApplicationCommandLine))
+#define G_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_APPLICATION_COMMAND_LINE, \
+ GApplicationCommandLineClass))
+#define G_IS_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_APPLICATION_COMMAND_LINE))
+#define G_IS_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_APPLICATION_COMMAND_LINE))
+#define G_APPLICATION_COMMAND_LINE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_APPLICATION_COMMAND_LINE, \
+ GApplicationCommandLineClass))
+
+typedef struct _GApplicationCommandLinePrivate GApplicationCommandLinePrivate;
+typedef struct _GApplicationCommandLineClass GApplicationCommandLineClass;
+
+struct _GApplicationCommandLine
+{
+ /*< private >*/
+ GObject parent_instance;
+
+ GApplicationCommandLinePrivate *priv;
+};
+
+struct _GApplicationCommandLineClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ void (* print_literal) (GApplicationCommandLine *cmdline,
+ const gchar *message);
+ void (* printerr_literal) (GApplicationCommandLine *cmdline,
+ const gchar *message);
+ GInputStream * (* get_stdin) (GApplicationCommandLine *cmdline);
+
+ gpointer padding[11];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_application_command_line_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_application_command_line_get_arguments (GApplicationCommandLine *cmdline,
+ int *argc);
+
+GLIB_AVAILABLE_IN_2_40
+GVariantDict * g_application_command_line_get_options_dict (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_2_36
+GInputStream * g_application_command_line_get_stdin (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * const * g_application_command_line_get_environ (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_application_command_line_getenv (GApplicationCommandLine *cmdline,
+ const gchar *name);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_application_command_line_get_cwd (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_application_command_line_get_is_remote (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_ALL
+void g_application_command_line_print (GApplicationCommandLine *cmdline,
+ const gchar *format,
+ ...) G_GNUC_PRINTF(2, 3);
+GLIB_AVAILABLE_IN_ALL
+void g_application_command_line_printerr (GApplicationCommandLine *cmdline,
+ const gchar *format,
+ ...) G_GNUC_PRINTF(2, 3);
+
+GLIB_AVAILABLE_IN_ALL
+int g_application_command_line_get_exit_status (GApplicationCommandLine *cmdline);
+GLIB_AVAILABLE_IN_ALL
+void g_application_command_line_set_exit_status (GApplicationCommandLine *cmdline,
+ int exit_status);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_application_command_line_get_platform_data (GApplicationCommandLine *cmdline);
+
+GLIB_AVAILABLE_IN_2_36
+GFile * g_application_command_line_create_file_for_arg (GApplicationCommandLine *cmdline,
+ const gchar *arg);
+
+G_END_DECLS
+
+#endif /* __G_APPLICATION_COMMAND_LINE_H__ */
diff --git a/include/glib/gio/gasyncinitable.h b/include/glib/gio/gasyncinitable.h
new file mode 100644
index 0000000000..f30d2cec76
--- /dev/null
+++ b/include/glib/gio/gasyncinitable.h
@@ -0,0 +1,130 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_ASYNC_INITABLE_H__
+#define __G_ASYNC_INITABLE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+#include <gio/ginitable.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ASYNC_INITABLE (g_async_initable_get_type ())
+#define G_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitable))
+#define G_IS_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_INITABLE))
+#define G_ASYNC_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitableIface))
+#define G_TYPE_IS_ASYNC_INITABLE(type) (g_type_is_a ((type), G_TYPE_ASYNC_INITABLE))
+
+/**
+ * GAsyncInitable:
+ *
+ * Interface for asynchronously initializable objects.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GAsyncInitableIface GAsyncInitableIface;
+
+/**
+ * GAsyncInitableIface:
+ * @g_iface: The parent interface.
+ * @init_async: Starts initialization of the object.
+ * @init_finish: Finishes initialization of the object.
+ *
+ * Provides an interface for asynchronous initializing object such that
+ * initialization may fail.
+ *
+ * Since: 2.22
+ **/
+struct _GAsyncInitableIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ void (* init_async) (GAsyncInitable *initable,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* init_finish) (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_async_initable_get_type (void) G_GNUC_CONST;
+
+
+GLIB_AVAILABLE_IN_ALL
+void g_async_initable_init_async (GAsyncInitable *initable,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_async_initable_init_finish (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_async_initable_new_async (GType object_type,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ const gchar *first_property_name,
+ ...);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async)
+void g_async_initable_newv_async (GType object_type,
+ guint n_parameters,
+ GParameter *parameters,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+void g_async_initable_new_valist_async (GType object_type,
+ const gchar *first_property_name,
+ va_list var_args,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GObject *g_async_initable_new_finish (GAsyncInitable *initable,
+ GAsyncResult *res,
+ GError **error);
+
+
+
+G_END_DECLS
+
+
+#endif /* __G_ASYNC_INITABLE_H__ */
diff --git a/include/glib/gio/gasyncresult.h b/include/glib/gio/gasyncresult.h
new file mode 100644
index 0000000000..956cbc4738
--- /dev/null
+++ b/include/glib/gio/gasyncresult.h
@@ -0,0 +1,85 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_ASYNC_RESULT_H__
+#define __G_ASYNC_RESULT_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ASYNC_RESULT (g_async_result_get_type ())
+#define G_ASYNC_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_RESULT, GAsyncResult))
+#define G_IS_ASYNC_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_RESULT))
+#define G_ASYNC_RESULT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_RESULT, GAsyncResultIface))
+
+/**
+ * GAsyncResult:
+ *
+ * Holds results information for an asynchronous operation,
+ * usually passed directly to an asynchronous _finish() operation.
+ **/
+typedef struct _GAsyncResultIface GAsyncResultIface;
+
+
+/**
+ * GAsyncResultIface:
+ * @g_iface: The parent interface.
+ * @get_user_data: Gets the user data passed to the callback.
+ * @get_source_object: Gets the source object that issued the asynchronous operation.
+ * @is_tagged: Checks if a result is tagged with a particular source.
+ *
+ * Interface definition for #GAsyncResult.
+ **/
+struct _GAsyncResultIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ gpointer (* get_user_data) (GAsyncResult *res);
+ GObject * (* get_source_object) (GAsyncResult *res);
+
+ gboolean (* is_tagged) (GAsyncResult *res,
+ gpointer source_tag);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_async_result_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_result_get_user_data (GAsyncResult *res);
+GLIB_AVAILABLE_IN_ALL
+GObject *g_async_result_get_source_object (GAsyncResult *res);
+
+GLIB_AVAILABLE_IN_2_34
+gboolean g_async_result_legacy_propagate_error (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_async_result_is_tagged (GAsyncResult *res,
+ gpointer source_tag);
+
+G_END_DECLS
+
+#endif /* __G_ASYNC_RESULT_H__ */
diff --git a/include/glib/gio/gbufferedinputstream.h b/include/glib/gio/gbufferedinputstream.h
new file mode 100644
index 0000000000..19c42147c0
--- /dev/null
+++ b/include/glib/gio/gbufferedinputstream.h
@@ -0,0 +1,133 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_BUFFERED_INPUT_STREAM_H__
+#define __G_BUFFERED_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gfilterinputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_BUFFERED_INPUT_STREAM (g_buffered_input_stream_get_type ())
+#define G_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStream))
+#define G_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass))
+#define G_IS_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_BUFFERED_INPUT_STREAM))
+#define G_IS_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_BUFFERED_INPUT_STREAM))
+#define G_BUFFERED_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass))
+
+/**
+ * GBufferedInputStream:
+ *
+ * Implements #GFilterInputStream with a sized input buffer.
+ **/
+typedef struct _GBufferedInputStreamClass GBufferedInputStreamClass;
+typedef struct _GBufferedInputStreamPrivate GBufferedInputStreamPrivate;
+
+struct _GBufferedInputStream
+{
+ GFilterInputStream parent_instance;
+
+ /*< private >*/
+ GBufferedInputStreamPrivate *priv;
+};
+
+struct _GBufferedInputStreamClass
+{
+ GFilterInputStreamClass parent_class;
+
+ gssize (* fill) (GBufferedInputStream *stream,
+ gssize count,
+ GCancellable *cancellable,
+ GError **error);
+
+ /* Async ops: (optional in derived classes) */
+ void (* fill_async) (GBufferedInputStream *stream,
+ gssize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gssize (* fill_finish) (GBufferedInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_buffered_input_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GInputStream* g_buffered_input_stream_new (GInputStream *base_stream);
+GLIB_AVAILABLE_IN_ALL
+GInputStream* g_buffered_input_stream_new_sized (GInputStream *base_stream,
+ gsize size);
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_buffered_input_stream_get_buffer_size (GBufferedInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_buffered_input_stream_set_buffer_size (GBufferedInputStream *stream,
+ gsize size);
+GLIB_AVAILABLE_IN_ALL
+gsize g_buffered_input_stream_get_available (GBufferedInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gsize g_buffered_input_stream_peek (GBufferedInputStream *stream,
+ void *buffer,
+ gsize offset,
+ gsize count);
+GLIB_AVAILABLE_IN_ALL
+const void* g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream,
+ gsize *count);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_buffered_input_stream_fill (GBufferedInputStream *stream,
+ gssize count,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
+ gssize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gssize g_buffered_input_stream_fill_finish (GBufferedInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+int g_buffered_input_stream_read_byte (GBufferedInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_BUFFERED_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gbufferedoutputstream.h b/include/glib/gio/gbufferedoutputstream.h
new file mode 100644
index 0000000000..f88f27952a
--- /dev/null
+++ b/include/glib/gio/gbufferedoutputstream.h
@@ -0,0 +1,86 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_BUFFERED_OUTPUT_STREAM_H__
+#define __G_BUFFERED_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gfilteroutputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_BUFFERED_OUTPUT_STREAM (g_buffered_output_stream_get_type ())
+#define G_BUFFERED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStream))
+#define G_BUFFERED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStreamClass))
+#define G_IS_BUFFERED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_BUFFERED_OUTPUT_STREAM))
+#define G_IS_BUFFERED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_BUFFERED_OUTPUT_STREAM))
+#define G_BUFFERED_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStreamClass))
+
+/**
+ * GBufferedOutputStream:
+ *
+ * An implementation of #GFilterOutputStream with a sized buffer.
+ **/
+typedef struct _GBufferedOutputStreamClass GBufferedOutputStreamClass;
+typedef struct _GBufferedOutputStreamPrivate GBufferedOutputStreamPrivate;
+
+struct _GBufferedOutputStream
+{
+ GFilterOutputStream parent_instance;
+
+ /*< protected >*/
+ GBufferedOutputStreamPrivate *priv;
+};
+
+struct _GBufferedOutputStreamClass
+{
+ GFilterOutputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_buffered_output_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GOutputStream* g_buffered_output_stream_new (GOutputStream *base_stream);
+GLIB_AVAILABLE_IN_ALL
+GOutputStream* g_buffered_output_stream_new_sized (GOutputStream *base_stream,
+ gsize size);
+GLIB_AVAILABLE_IN_ALL
+gsize g_buffered_output_stream_get_buffer_size (GBufferedOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream,
+ gsize size);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_buffered_output_stream_get_auto_grow (GBufferedOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_buffered_output_stream_set_auto_grow (GBufferedOutputStream *stream,
+ gboolean auto_grow);
+
+G_END_DECLS
+
+#endif /* __G_BUFFERED_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gbytesicon.h b/include/glib/gio/gbytesicon.h
new file mode 100644
index 0000000000..5661044b72
--- /dev/null
+++ b/include/glib/gio/gbytesicon.h
@@ -0,0 +1,52 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_BYTES_ICON_H__
+#define __G_BYTES_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_BYTES_ICON (g_bytes_icon_get_type ())
+#define G_BYTES_ICON(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_BYTES_ICON, GBytesIcon))
+#define G_IS_BYTES_ICON(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_BYTES_ICON))
+
+/**
+ * GBytesIcon:
+ *
+ * Gets an icon for a #GBytes. Implements #GLoadableIcon.
+ **/
+GLIB_AVAILABLE_IN_2_38
+GType g_bytes_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_38
+GIcon * g_bytes_icon_new (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_2_38
+GBytes * g_bytes_icon_get_bytes (GBytesIcon *icon);
+
+G_END_DECLS
+
+#endif /* __G_BYTES_ICON_H__ */
diff --git a/include/glib/gio/gcancellable.h b/include/glib/gio/gcancellable.h
new file mode 100644
index 0000000000..45b9a5a19e
--- /dev/null
+++ b/include/glib/gio/gcancellable.h
@@ -0,0 +1,118 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CANCELLABLE_H__
+#define __G_CANCELLABLE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CANCELLABLE (g_cancellable_get_type ())
+#define G_CANCELLABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CANCELLABLE, GCancellable))
+#define G_CANCELLABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CANCELLABLE, GCancellableClass))
+#define G_IS_CANCELLABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CANCELLABLE))
+#define G_IS_CANCELLABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CANCELLABLE))
+#define G_CANCELLABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CANCELLABLE, GCancellableClass))
+
+/**
+ * GCancellable:
+ *
+ * Allows actions to be cancelled.
+ */
+typedef struct _GCancellableClass GCancellableClass;
+typedef struct _GCancellablePrivate GCancellablePrivate;
+
+struct _GCancellable
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GCancellablePrivate *priv;
+};
+
+struct _GCancellableClass
+{
+ GObjectClass parent_class;
+
+ void (* cancelled) (GCancellable *cancellable);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_cancellable_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GCancellable *g_cancellable_new (void);
+
+/* These are only safe to call inside a cancellable op */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_cancellable_is_cancelled (GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_cancellable_set_error_if_cancelled (GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+int g_cancellable_get_fd (GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_cancellable_make_pollfd (GCancellable *cancellable,
+ GPollFD *pollfd);
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_release_fd (GCancellable *cancellable);
+
+GLIB_AVAILABLE_IN_ALL
+GSource * g_cancellable_source_new (GCancellable *cancellable);
+
+GLIB_AVAILABLE_IN_ALL
+GCancellable *g_cancellable_get_current (void);
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_push_current (GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_pop_current (GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_reset (GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+gulong g_cancellable_connect (GCancellable *cancellable,
+ GCallback callback,
+ gpointer data,
+ GDestroyNotify data_destroy_func);
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_disconnect (GCancellable *cancellable,
+ gulong handler_id);
+
+
+/* This is safe to call from another thread */
+GLIB_AVAILABLE_IN_ALL
+void g_cancellable_cancel (GCancellable *cancellable);
+
+G_END_DECLS
+
+#endif /* __G_CANCELLABLE_H__ */
diff --git a/include/glib/gio/gcharsetconverter.h b/include/glib/gio/gcharsetconverter.h
new file mode 100644
index 0000000000..610f774d85
--- /dev/null
+++ b/include/glib/gio/gcharsetconverter.h
@@ -0,0 +1,63 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CHARSET_CONVERTER_H__
+#define __G_CHARSET_CONVERTER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gconverter.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CHARSET_CONVERTER (g_charset_converter_get_type ())
+#define G_CHARSET_CONVERTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CHARSET_CONVERTER, GCharsetConverter))
+#define G_CHARSET_CONVERTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CHARSET_CONVERTER, GCharsetConverterClass))
+#define G_IS_CHARSET_CONVERTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CHARSET_CONVERTER))
+#define G_IS_CHARSET_CONVERTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CHARSET_CONVERTER))
+#define G_CHARSET_CONVERTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CHARSET_CONVERTER, GCharsetConverterClass))
+
+typedef struct _GCharsetConverterClass GCharsetConverterClass;
+
+struct _GCharsetConverterClass
+{
+ GObjectClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_charset_converter_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GCharsetConverter *g_charset_converter_new (const gchar *to_charset,
+ const gchar *from_charset,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_charset_converter_set_use_fallback (GCharsetConverter *converter,
+ gboolean use_fallback);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_charset_converter_get_use_fallback (GCharsetConverter *converter);
+GLIB_AVAILABLE_IN_ALL
+guint g_charset_converter_get_num_fallbacks (GCharsetConverter *converter);
+
+G_END_DECLS
+
+#endif /* __G_CHARSET_CONVERTER_H__ */
diff --git a/include/glib/gio/gcontenttype.h b/include/glib/gio/gcontenttype.h
new file mode 100644
index 0000000000..db2c974f3b
--- /dev/null
+++ b/include/glib/gio/gcontenttype.h
@@ -0,0 +1,82 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CONTENT_TYPE_H__
+#define __G_CONTENT_TYPE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_content_type_equals (const gchar *type1,
+ const gchar *type2);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_content_type_is_a (const gchar *type,
+ const gchar *supertype);
+GLIB_AVAILABLE_IN_2_52
+gboolean g_content_type_is_mime_type (const gchar *type,
+ const gchar *mime_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_content_type_is_unknown (const gchar *type);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_content_type_get_description (const gchar *type);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_content_type_get_mime_type (const gchar *type);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_content_type_get_icon (const gchar *type);
+GLIB_AVAILABLE_IN_2_34
+GIcon * g_content_type_get_symbolic_icon (const gchar *type);
+GLIB_AVAILABLE_IN_2_34
+gchar * g_content_type_get_generic_icon_name (const gchar *type);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_content_type_can_be_executable (const gchar *type);
+
+GLIB_AVAILABLE_IN_ALL
+gchar * g_content_type_from_mime_type (const gchar *mime_type);
+
+GLIB_AVAILABLE_IN_ALL
+gchar * g_content_type_guess (const gchar *filename,
+ const guchar *data,
+ gsize data_size,
+ gboolean *result_uncertain);
+
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_content_type_guess_for_tree (GFile *root);
+
+GLIB_AVAILABLE_IN_ALL
+GList * g_content_types_get_registered (void);
+
+/*< private >*/
+#ifndef __GTK_DOC_IGNORE__
+GLIB_AVAILABLE_IN_2_60
+const gchar * const *g_content_type_get_mime_dirs (void);
+GLIB_AVAILABLE_IN_2_60
+void g_content_type_set_mime_dirs (const gchar * const *dirs);
+#endif /* __GTK_DOC_IGNORE__ */
+
+G_END_DECLS
+
+#endif /* __G_CONTENT_TYPE_H__ */
diff --git a/include/glib/gio/gconverter.h b/include/glib/gio/gconverter.h
new file mode 100644
index 0000000000..87164534ba
--- /dev/null
+++ b/include/glib/gio/gconverter.h
@@ -0,0 +1,96 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CONVERTER_H__
+#define __G_CONVERTER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CONVERTER (g_converter_get_type ())
+#define G_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_CONVERTER, GConverter))
+#define G_IS_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_CONVERTER))
+#define G_CONVERTER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_CONVERTER, GConverterIface))
+
+/**
+ * GConverter:
+ *
+ * Seek object for streaming operations.
+ *
+ * Since: 2.24
+ **/
+typedef struct _GConverterIface GConverterIface;
+
+/**
+ * GConverterIface:
+ * @g_iface: The parent interface.
+ * @convert: Converts data.
+ * @reset: Reverts the internal state of the converter to its initial state.
+ *
+ * Provides an interface for converting data from one type
+ * to another type. The conversion can be stateful
+ * and may fail at any place.
+ *
+ * Since: 2.24
+ **/
+struct _GConverterIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GConverterResult (* convert) (GConverter *converter,
+ const void *inbuf,
+ gsize inbuf_size,
+ void *outbuf,
+ gsize outbuf_size,
+ GConverterFlags flags,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error);
+ void (* reset) (GConverter *converter);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_converter_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GConverterResult g_converter_convert (GConverter *converter,
+ const void *inbuf,
+ gsize inbuf_size,
+ void *outbuf,
+ gsize outbuf_size,
+ GConverterFlags flags,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_converter_reset (GConverter *converter);
+
+
+G_END_DECLS
+
+
+#endif /* __G_CONVERTER_H__ */
diff --git a/include/glib/gio/gconverterinputstream.h b/include/glib/gio/gconverterinputstream.h
new file mode 100644
index 0000000000..48cc102212
--- /dev/null
+++ b/include/glib/gio/gconverterinputstream.h
@@ -0,0 +1,80 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CONVERTER_INPUT_STREAM_H__
+#define __G_CONVERTER_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gfilterinputstream.h>
+#include <gio/gconverter.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CONVERTER_INPUT_STREAM (g_converter_input_stream_get_type ())
+#define G_CONVERTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStream))
+#define G_CONVERTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStreamClass))
+#define G_IS_CONVERTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CONVERTER_INPUT_STREAM))
+#define G_IS_CONVERTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CONVERTER_INPUT_STREAM))
+#define G_CONVERTER_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStreamClass))
+
+/**
+ * GConverterInputStream:
+ *
+ * An implementation of #GFilterInputStream that allows data
+ * conversion.
+ **/
+typedef struct _GConverterInputStreamClass GConverterInputStreamClass;
+typedef struct _GConverterInputStreamPrivate GConverterInputStreamPrivate;
+
+struct _GConverterInputStream
+{
+ GFilterInputStream parent_instance;
+
+ /*< private >*/
+ GConverterInputStreamPrivate *priv;
+};
+
+struct _GConverterInputStreamClass
+{
+ GFilterInputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_converter_input_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GInputStream *g_converter_input_stream_new (GInputStream *base_stream,
+ GConverter *converter);
+GLIB_AVAILABLE_IN_ALL
+GConverter *g_converter_input_stream_get_converter (GConverterInputStream *converter_stream);
+
+G_END_DECLS
+
+#endif /* __G_CONVERTER_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gconverteroutputstream.h b/include/glib/gio/gconverteroutputstream.h
new file mode 100644
index 0000000000..b9a1e5d407
--- /dev/null
+++ b/include/glib/gio/gconverteroutputstream.h
@@ -0,0 +1,80 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_CONVERTER_OUTPUT_STREAM_H__
+#define __G_CONVERTER_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gfilteroutputstream.h>
+#include <gio/gconverter.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CONVERTER_OUTPUT_STREAM (g_converter_output_stream_get_type ())
+#define G_CONVERTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStream))
+#define G_CONVERTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStreamClass))
+#define G_IS_CONVERTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CONVERTER_OUTPUT_STREAM))
+#define G_IS_CONVERTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CONVERTER_OUTPUT_STREAM))
+#define G_CONVERTER_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStreamClass))
+
+/**
+ * GConverterOutputStream:
+ *
+ * An implementation of #GFilterOutputStream that allows data
+ * conversion.
+ **/
+typedef struct _GConverterOutputStreamClass GConverterOutputStreamClass;
+typedef struct _GConverterOutputStreamPrivate GConverterOutputStreamPrivate;
+
+struct _GConverterOutputStream
+{
+ GFilterOutputStream parent_instance;
+
+ /*< private >*/
+ GConverterOutputStreamPrivate *priv;
+};
+
+struct _GConverterOutputStreamClass
+{
+ GFilterOutputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_converter_output_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GOutputStream *g_converter_output_stream_new (GOutputStream *base_stream,
+ GConverter *converter);
+GLIB_AVAILABLE_IN_ALL
+GConverter *g_converter_output_stream_get_converter (GConverterOutputStream *converter_stream);
+
+G_END_DECLS
+
+#endif /* __G_CONVERTER_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gcredentials.h b/include/glib/gio/gcredentials.h
new file mode 100644
index 0000000000..25cebf2b42
--- /dev/null
+++ b/include/glib/gio/gcredentials.h
@@ -0,0 +1,85 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_CREDENTIALS_H__
+#define __G_CREDENTIALS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+#ifdef G_OS_UNIX
+/* To get the uid_t type */
+#include <unistd.h>
+#include <sys/types.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define G_TYPE_CREDENTIALS (g_credentials_get_type ())
+#define G_CREDENTIALS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CREDENTIALS, GCredentials))
+#define G_CREDENTIALS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CREDENTIALS, GCredentialsClass))
+#define G_CREDENTIALS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CREDENTIALS, GCredentialsClass))
+#define G_IS_CREDENTIALS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CREDENTIALS))
+#define G_IS_CREDENTIALS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CREDENTIALS))
+
+typedef struct _GCredentialsClass GCredentialsClass;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_credentials_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GCredentials *g_credentials_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_credentials_to_string (GCredentials *credentials);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_credentials_get_native (GCredentials *credentials,
+ GCredentialsType native_type);
+
+GLIB_AVAILABLE_IN_ALL
+void g_credentials_set_native (GCredentials *credentials,
+ GCredentialsType native_type,
+ gpointer native);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_credentials_is_same_user (GCredentials *credentials,
+ GCredentials *other_credentials,
+ GError **error);
+
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_36
+pid_t g_credentials_get_unix_pid (GCredentials *credentials,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+uid_t g_credentials_get_unix_user (GCredentials *credentials,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_credentials_set_unix_user (GCredentials *credentials,
+ uid_t uid,
+ GError **error);
+#endif
+
+G_END_DECLS
+
+#endif /* __G_DBUS_PROXY_H__ */
diff --git a/include/glib/gio/gdatagrambased.h b/include/glib/gio/gdatagrambased.h
new file mode 100644
index 0000000000..838b485df9
--- /dev/null
+++ b/include/glib/gio/gdatagrambased.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2015 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Philip Withnall <philip.withnall@collabora.co.uk>
+ */
+
+#ifndef __G_DATAGRAM_BASED_H__
+#define __G_DATAGRAM_BASED_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DATAGRAM_BASED (g_datagram_based_get_type ())
+#define G_DATAGRAM_BASED(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_DATAGRAM_BASED, GDatagramBased))
+#define G_IS_DATAGRAM_BASED(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_DATAGRAM_BASED))
+#define G_DATAGRAM_BASED_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+ G_TYPE_DATAGRAM_BASED, \
+ GDatagramBasedInterface))
+#define G_TYPE_IS_DATAGRAM_BASED(type) (g_type_is_a ((type), \
+ G_TYPE_DATAGRAM_BASED))
+
+/**
+ * GDatagramBased:
+ *
+ * Interface for socket-like objects with datagram semantics.
+ *
+ * Since: 2.48
+ */
+typedef struct _GDatagramBasedInterface GDatagramBasedInterface;
+
+/**
+ * GDatagramBasedInterface:
+ * @g_iface: The parent interface.
+ * @receive_messages: Virtual method for g_datagram_based_receive_messages().
+ * @send_messages: Virtual method for g_datagram_based_send_messages().
+ * @create_source: Virtual method for g_datagram_based_create_source().
+ * @condition_check: Virtual method for g_datagram_based_condition_check().
+ * @condition_wait: Virtual method for
+ * g_datagram_based_condition_wait().
+ *
+ * Provides an interface for socket-like objects which have datagram semantics,
+ * following the Berkeley sockets API. The interface methods are thin wrappers
+ * around the corresponding virtual methods, and no pre-processing of inputs is
+ * implemented — so implementations of this API must handle all functionality
+ * documented in the interface methods.
+ *
+ * Since: 2.48
+ */
+struct _GDatagramBasedInterface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual table */
+ gint (*receive_messages) (GDatagramBased *datagram_based,
+ GInputMessage *messages,
+ guint num_messages,
+ gint flags,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+ gint (*send_messages) (GDatagramBased *datagram_based,
+ GOutputMessage *messages,
+ guint num_messages,
+ gint flags,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+
+ GSource *(*create_source) (GDatagramBased *datagram_based,
+ GIOCondition condition,
+ GCancellable *cancellable);
+ GIOCondition (*condition_check) (GDatagramBased *datagram_based,
+ GIOCondition condition);
+ gboolean (*condition_wait) (GDatagramBased *datagram_based,
+ GIOCondition condition,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_2_48
+GType
+g_datagram_based_get_type (void);
+
+GLIB_AVAILABLE_IN_2_48
+gint
+g_datagram_based_receive_messages (GDatagramBased *datagram_based,
+ GInputMessage *messages,
+ guint num_messages,
+ gint flags,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+gint
+g_datagram_based_send_messages (GDatagramBased *datagram_based,
+ GOutputMessage *messages,
+ guint num_messages,
+ gint flags,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+GSource *
+g_datagram_based_create_source (GDatagramBased *datagram_based,
+ GIOCondition condition,
+ GCancellable *cancellable);
+GLIB_AVAILABLE_IN_2_48
+GIOCondition
+g_datagram_based_condition_check (GDatagramBased *datagram_based,
+ GIOCondition condition);
+GLIB_AVAILABLE_IN_2_48
+gboolean
+g_datagram_based_condition_wait (GDatagramBased *datagram_based,
+ GIOCondition condition,
+ gint64 timeout,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DATAGRAM_BASED_H__ */
diff --git a/include/glib/gio/gdatainputstream.h b/include/glib/gio/gdatainputstream.h
new file mode 100644
index 0000000000..3ad3b825f7
--- /dev/null
+++ b/include/glib/gio/gdatainputstream.h
@@ -0,0 +1,180 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_DATA_INPUT_STREAM_H__
+#define __G_DATA_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gbufferedinputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ())
+#define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream))
+#define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
+#define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM))
+#define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM))
+#define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
+
+/**
+ * GDataInputStream:
+ *
+ * An implementation of #GBufferedInputStream that allows for high-level
+ * data manipulation of arbitrary data (including binary operations).
+ **/
+typedef struct _GDataInputStreamClass GDataInputStreamClass;
+typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate;
+
+struct _GDataInputStream
+{
+ GBufferedInputStream parent_instance;
+
+ /*< private >*/
+ GDataInputStreamPrivate *priv;
+};
+
+struct _GDataInputStreamClass
+{
+ GBufferedInputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_data_input_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDataInputStream * g_data_input_stream_new (GInputStream *base_stream);
+
+GLIB_AVAILABLE_IN_ALL
+void g_data_input_stream_set_byte_order (GDataInputStream *stream,
+ GDataStreamByteOrder order);
+GLIB_AVAILABLE_IN_ALL
+GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_data_input_stream_set_newline_type (GDataInputStream *stream,
+ GDataStreamNewlineType type);
+GLIB_AVAILABLE_IN_ALL
+GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+guchar g_data_input_stream_read_byte (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+char * g_data_input_stream_read_line (GDataInputStream *stream,
+ gsize *length,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_30
+char * g_data_input_stream_read_line_utf8 (GDataInputStream *stream,
+ gsize *length,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_data_input_stream_read_line_async (GDataInputStream *stream,
+ gint io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+char * g_data_input_stream_read_line_finish (GDataInputStream *stream,
+ GAsyncResult *result,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_2_30
+char * g_data_input_stream_read_line_finish_utf8(GDataInputStream *stream,
+ GAsyncResult *result,
+ gsize *length,
+ GError **error);
+GLIB_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto)
+char * g_data_input_stream_read_until (GDataInputStream *stream,
+ const gchar *stop_chars,
+ gsize *length,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_async)
+void g_data_input_stream_read_until_async (GDataInputStream *stream,
+ const gchar *stop_chars,
+ gint io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_finish)
+char * g_data_input_stream_read_until_finish (GDataInputStream *stream,
+ GAsyncResult *result,
+ gsize *length,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+char * g_data_input_stream_read_upto (GDataInputStream *stream,
+ const gchar *stop_chars,
+ gssize stop_chars_len,
+ gsize *length,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_data_input_stream_read_upto_async (GDataInputStream *stream,
+ const gchar *stop_chars,
+ gssize stop_chars_len,
+ gint io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+char * g_data_input_stream_read_upto_finish (GDataInputStream *stream,
+ GAsyncResult *result,
+ gsize *length,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DATA_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gdataoutputstream.h b/include/glib/gio/gdataoutputstream.h
new file mode 100644
index 0000000000..62cf7b5e3c
--- /dev/null
+++ b/include/glib/gio/gdataoutputstream.h
@@ -0,0 +1,125 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_DATA_OUTPUT_STREAM_H__
+#define __G_DATA_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gfilteroutputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DATA_OUTPUT_STREAM (g_data_output_stream_get_type ())
+#define G_DATA_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStream))
+#define G_DATA_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStreamClass))
+#define G_IS_DATA_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_OUTPUT_STREAM))
+#define G_IS_DATA_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_OUTPUT_STREAM))
+#define G_DATA_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStreamClass))
+
+/**
+ * GDataOutputStream:
+ *
+ * An implementation of #GBufferedOutputStream that allows for high-level
+ * data manipulation of arbitrary data (including binary operations).
+ **/
+typedef struct _GDataOutputStream GDataOutputStream;
+typedef struct _GDataOutputStreamClass GDataOutputStreamClass;
+typedef struct _GDataOutputStreamPrivate GDataOutputStreamPrivate;
+
+struct _GDataOutputStream
+{
+ GFilterOutputStream parent_instance;
+
+ /*< private >*/
+ GDataOutputStreamPrivate *priv;
+};
+
+struct _GDataOutputStreamClass
+{
+ GFilterOutputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_data_output_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDataOutputStream * g_data_output_stream_new (GOutputStream *base_stream);
+
+GLIB_AVAILABLE_IN_ALL
+void g_data_output_stream_set_byte_order (GDataOutputStream *stream,
+ GDataStreamByteOrder order);
+GLIB_AVAILABLE_IN_ALL
+GDataStreamByteOrder g_data_output_stream_get_byte_order (GDataOutputStream *stream);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_byte (GDataOutputStream *stream,
+ guchar data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_int16 (GDataOutputStream *stream,
+ gint16 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_uint16 (GDataOutputStream *stream,
+ guint16 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_int32 (GDataOutputStream *stream,
+ gint32 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_uint32 (GDataOutputStream *stream,
+ guint32 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_int64 (GDataOutputStream *stream,
+ gint64 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_uint64 (GDataOutputStream *stream,
+ guint64 data,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_data_output_stream_put_string (GDataOutputStream *stream,
+ const char *str,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DATA_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gdbusactiongroup.h b/include/glib/gio/gdbusactiongroup.h
new file mode 100644
index 0000000000..93e6a2cfe4
--- /dev/null
+++ b/include/glib/gio/gdbusactiongroup.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ * Copyright © 2011 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_DBUS_ACTION_GROUP_H__
+#define __G_DBUS_ACTION_GROUP_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include "giotypes.h"
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_ACTION_GROUP (g_dbus_action_group_get_type ())
+#define G_DBUS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroup))
+#define G_DBUS_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroupClass))
+#define G_IS_DBUS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_DBUS_ACTION_GROUP))
+#define G_IS_DBUS_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_DBUS_ACTION_GROUP))
+#define G_DBUS_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroupClass))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_action_group_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+GDBusActionGroup * g_dbus_action_group_get (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_ACTION_GROUP_H__ */
diff --git a/include/glib/gio/gdbusaddress.h b/include/glib/gio/gdbusaddress.h
new file mode 100644
index 0000000000..43915bb8d5
--- /dev/null
+++ b/include/glib/gio/gdbusaddress.h
@@ -0,0 +1,65 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_ADDRESS_H__
+#define __G_DBUS_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_36
+gchar *g_dbus_address_escape_value (const gchar *string);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_address (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_supported_address (const gchar *string,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_address_get_stream (const gchar *address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_dbus_address_get_stream_finish (GAsyncResult *res,
+ gchar **out_guid,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_dbus_address_get_stream_sync (const gchar *address,
+ gchar **out_guid,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_address_get_for_bus_sync (GBusType bus_type,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_ADDRESS_H__ */
diff --git a/include/glib/gio/gdbusauthobserver.h b/include/glib/gio/gdbusauthobserver.h
new file mode 100644
index 0000000000..8fe7b32928
--- /dev/null
+++ b/include/glib/gio/gdbusauthobserver.h
@@ -0,0 +1,51 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_AUTH_OBSERVER_H__
+#define __G_DBUS_AUTH_OBSERVER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_AUTH_OBSERVER (g_dbus_auth_observer_get_type ())
+#define G_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_AUTH_OBSERVER, GDBusAuthObserver))
+#define G_IS_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_AUTH_OBSERVER))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_auth_observer_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusAuthObserver *g_dbus_auth_observer_new (void);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_auth_observer_authorize_authenticated_peer (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials);
+
+GLIB_AVAILABLE_IN_2_34
+gboolean g_dbus_auth_observer_allow_mechanism (GDBusAuthObserver *observer,
+ const gchar *mechanism);
+
+G_END_DECLS
+
+#endif /* _G_DBUS_AUTH_OBSERVER_H__ */
diff --git a/include/glib/gio/gdbusconnection.h b/include/glib/gio/gdbusconnection.h
new file mode 100644
index 0000000000..c37363c0d1
--- /dev/null
+++ b/include/glib/gio/gdbusconnection.h
@@ -0,0 +1,683 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_CONNECTION_H__
+#define __G_DBUS_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_CONNECTION (g_dbus_connection_get_type ())
+#define G_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_CONNECTION, GDBusConnection))
+#define G_IS_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_CONNECTION))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_connection_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+void g_bus_get (GBusType bus_type,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_bus_get_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_bus_get_sync (GBusType bus_type,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_new (GIOStream *stream,
+ const gchar *guid,
+ GDBusConnectionFlags flags,
+ GDBusAuthObserver *observer,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_connection_new_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_connection_new_sync (GIOStream *stream,
+ const gchar *guid,
+ GDBusConnectionFlags flags,
+ GDBusAuthObserver *observer,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_new_for_address (const gchar *address,
+ GDBusConnectionFlags flags,
+ GDBusAuthObserver *observer,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_connection_new_for_address_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_connection_new_for_address_sync (const gchar *address,
+ GDBusConnectionFlags flags,
+ GDBusAuthObserver *observer,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_start_message_processing (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_is_closed (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_dbus_connection_get_stream (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_connection_get_guid (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_connection_get_unique_name (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+GCredentials *g_dbus_connection_get_peer_credentials (GDBusConnection *connection);
+
+GLIB_AVAILABLE_IN_2_34
+guint32 g_dbus_connection_get_last_serial (GDBusConnection *connection);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_get_exit_on_close (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_set_exit_on_close (GDBusConnection *connection,
+ gboolean exit_on_close);
+GLIB_AVAILABLE_IN_ALL
+GDBusCapabilityFlags g_dbus_connection_get_capabilities (GDBusConnection *connection);
+GLIB_AVAILABLE_IN_2_60
+GDBusConnectionFlags g_dbus_connection_get_flags (GDBusConnection *connection);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_close (GDBusConnection *connection,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_close_finish (GDBusConnection *connection,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_close_sync (GDBusConnection *connection,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_flush (GDBusConnection *connection,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_flush_finish (GDBusConnection *connection,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_flush_sync (GDBusConnection *connection,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_send_message (GDBusConnection *connection,
+ GDBusMessage *message,
+ GDBusSendMessageFlags flags,
+ volatile guint32 *out_serial,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_send_message_with_reply (GDBusConnection *connection,
+ GDBusMessage *message,
+ GDBusSendMessageFlags flags,
+ gint timeout_msec,
+ volatile guint32 *out_serial,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection,
+ GDBusMessage *message,
+ GDBusSendMessageFlags flags,
+ gint timeout_msec,
+ volatile guint32 *out_serial,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_emit_signal (GDBusConnection *connection,
+ const gchar *destination_bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_call (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ const GVariantType *reply_type,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_connection_call_finish (GDBusConnection *connection,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_connection_call_sync (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ const GVariantType *reply_type,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_30
+void g_dbus_connection_call_with_unix_fd_list (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ const GVariantType *reply_type,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GUnixFDList *fd_list,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_30
+GVariant *g_dbus_connection_call_with_unix_fd_list_finish (GDBusConnection *connection,
+ GUnixFDList **out_fd_list,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_2_30
+GVariant *g_dbus_connection_call_with_unix_fd_list_sync (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ const GVariantType *reply_type,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GUnixFDList *fd_list,
+ GUnixFDList **out_fd_list,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+
+/**
+ * GDBusInterfaceMethodCallFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that the method was invoked on.
+ * @interface_name: The D-Bus interface name the method was invoked on.
+ * @method_name: The name of the method that was invoked.
+ * @parameters: A #GVariant tuple with parameters.
+ * @invocation: (transfer full): A #GDBusMethodInvocation object that must be used to return a value or error.
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
+ *
+ * The type of the @method_call function in #GDBusInterfaceVTable.
+ *
+ * Since: 2.26
+ */
+typedef void (*GDBusInterfaceMethodCallFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data);
+
+/**
+ * GDBusInterfaceGetPropertyFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that the method was invoked on.
+ * @interface_name: The D-Bus interface name for the property.
+ * @property_name: The name of the property to get the value of.
+ * @error: Return location for error.
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
+ *
+ * The type of the @get_property function in #GDBusInterfaceVTable.
+ *
+ * Returns: A #GVariant with the value for @property_name or %NULL if
+ * @error is set. If the returned #GVariant is floating, it is
+ * consumed - otherwise its reference count is decreased by one.
+ *
+ * Since: 2.26
+ */
+typedef GVariant *(*GDBusInterfaceGetPropertyFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GError **error,
+ gpointer user_data);
+
+/**
+ * GDBusInterfaceSetPropertyFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that the method was invoked on.
+ * @interface_name: The D-Bus interface name for the property.
+ * @property_name: The name of the property to get the value of.
+ * @value: The value to set the property to.
+ * @error: Return location for error.
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
+ *
+ * The type of the @set_property function in #GDBusInterfaceVTable.
+ *
+ * Returns: %TRUE if the property was set to @value, %FALSE if @error is set.
+ *
+ * Since: 2.26
+ */
+typedef gboolean (*GDBusInterfaceSetPropertyFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *property_name,
+ GVariant *value,
+ GError **error,
+ gpointer user_data);
+
+/**
+ * GDBusInterfaceVTable:
+ * @method_call: Function for handling incoming method calls.
+ * @get_property: Function for getting a property.
+ * @set_property: Function for setting a property.
+ *
+ * Virtual table for handling properties and method calls for a D-Bus
+ * interface.
+ *
+ * Since 2.38, if you want to handle getting/setting D-Bus properties
+ * asynchronously, give %NULL as your get_property() or set_property()
+ * function. The D-Bus call will be directed to your @method_call function,
+ * with the provided @interface_name set to "org.freedesktop.DBus.Properties".
+ *
+ * Ownership of the #GDBusMethodInvocation object passed to the
+ * method_call() function is transferred to your handler; you must
+ * call one of the methods of #GDBusMethodInvocation to return a reply
+ * (possibly empty), or an error. These functions also take ownership
+ * of the passed-in invocation object, so unless the invocation
+ * object has otherwise been referenced, it will be then be freed.
+ * Calling one of these functions may be done within your
+ * method_call() implementation but it also can be done at a later
+ * point to handle the method asynchronously.
+ *
+ * The usual checks on the validity of the calls is performed. For
+ * `Get` calls, an error is automatically returned if the property does
+ * not exist or the permissions do not allow access. The same checks are
+ * performed for `Set` calls, and the provided value is also checked for
+ * being the correct type.
+ *
+ * For both `Get` and `Set` calls, the #GDBusMethodInvocation
+ * passed to the @method_call handler can be queried with
+ * g_dbus_method_invocation_get_property_info() to get a pointer
+ * to the #GDBusPropertyInfo of the property.
+ *
+ * If you have readable properties specified in your interface info,
+ * you must ensure that you either provide a non-%NULL @get_property()
+ * function or provide implementations of both the `Get` and `GetAll`
+ * methods on org.freedesktop.DBus.Properties interface in your @method_call
+ * function. Note that the required return type of the `Get` call is
+ * `(v)`, not the type of the property. `GetAll` expects a return value
+ * of type `a{sv}`.
+ *
+ * If you have writable properties specified in your interface info,
+ * you must ensure that you either provide a non-%NULL @set_property()
+ * function or provide an implementation of the `Set` call. If implementing
+ * the call, you must return the value of type %G_VARIANT_TYPE_UNIT.
+ *
+ * Since: 2.26
+ */
+struct _GDBusInterfaceVTable
+{
+ GDBusInterfaceMethodCallFunc method_call;
+ GDBusInterfaceGetPropertyFunc get_property;
+ GDBusInterfaceSetPropertyFunc set_property;
+
+ /*< private >*/
+ /* Padding for future expansion - also remember to update
+ * gdbusconnection.c:_g_dbus_interface_vtable_copy() when
+ * changing this.
+ */
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+guint g_dbus_connection_register_object (GDBusConnection *connection,
+ const gchar *object_path,
+ GDBusInterfaceInfo *interface_info,
+ const GDBusInterfaceVTable *vtable,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func,
+ GError **error);
+GLIB_AVAILABLE_IN_2_46
+guint g_dbus_connection_register_object_with_closures (GDBusConnection *connection,
+ const gchar *object_path,
+ GDBusInterfaceInfo *interface_info,
+ GClosure *method_call_closure,
+ GClosure *get_property_closure,
+ GClosure *set_property_closure,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_unregister_object (GDBusConnection *connection,
+ guint registration_id);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+/**
+ * GDBusSubtreeEnumerateFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that was registered with g_dbus_connection_register_subtree().
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
+ *
+ * The type of the @enumerate function in #GDBusSubtreeVTable.
+ *
+ * This function is called when generating introspection data and also
+ * when preparing to dispatch incoming messages in the event that the
+ * %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not
+ * specified (ie: to verify that the object path is valid).
+ *
+ * Hierarchies are not supported; the items that you return should not
+ * contain the '/' character.
+ *
+ * The return value will be freed with g_strfreev().
+ *
+ * Returns: A newly allocated array of strings for node names that are children of @object_path.
+ *
+ * Since: 2.26
+ */
+typedef gchar** (*GDBusSubtreeEnumerateFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ gpointer user_data);
+
+/**
+ * GDBusSubtreeIntrospectFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that was registered with g_dbus_connection_register_subtree().
+ * @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
+ *
+ * The type of the @introspect function in #GDBusSubtreeVTable.
+ *
+ * Subtrees are flat. @node, if non-%NULL, is always exactly one
+ * segment of the object path (ie: it never contains a slash).
+ *
+ * This function should return %NULL to indicate that there is no object
+ * at this node.
+ *
+ * If this function returns non-%NULL, the return value is expected to
+ * be a %NULL-terminated array of pointers to #GDBusInterfaceInfo
+ * structures describing the interfaces implemented by @node. This
+ * array will have g_dbus_interface_info_unref() called on each item
+ * before being freed with g_free().
+ *
+ * The difference between returning %NULL and an array containing zero
+ * items is that the standard DBus interfaces will returned to the
+ * remote introspector in the empty array case, but not in the %NULL
+ * case.
+ *
+ * Returns: A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL.
+ *
+ * Since: 2.26
+ */
+typedef GDBusInterfaceInfo ** (*GDBusSubtreeIntrospectFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *node,
+ gpointer user_data);
+
+/**
+ * GDBusSubtreeDispatchFunc:
+ * @connection: A #GDBusConnection.
+ * @sender: The unique bus name of the remote caller.
+ * @object_path: The object path that was registered with g_dbus_connection_register_subtree().
+ * @interface_name: The D-Bus interface name that the method call or property access is for.
+ * @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
+ * @out_user_data: (nullable) (not optional): Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL).
+ * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
+ *
+ * The type of the @dispatch function in #GDBusSubtreeVTable.
+ *
+ * Subtrees are flat. @node, if non-%NULL, is always exactly one
+ * segment of the object path (ie: it never contains a slash).
+ *
+ * Returns: A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods.
+ *
+ * Since: 2.26
+ */
+typedef const GDBusInterfaceVTable * (*GDBusSubtreeDispatchFunc) (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *node,
+ gpointer *out_user_data,
+ gpointer user_data);
+
+/**
+ * GDBusSubtreeVTable:
+ * @enumerate: Function for enumerating child nodes.
+ * @introspect: Function for introspecting a child node.
+ * @dispatch: Function for dispatching a remote call on a child node.
+ *
+ * Virtual table for handling subtrees registered with g_dbus_connection_register_subtree().
+ *
+ * Since: 2.26
+ */
+struct _GDBusSubtreeVTable
+{
+ GDBusSubtreeEnumerateFunc enumerate;
+ GDBusSubtreeIntrospectFunc introspect;
+ GDBusSubtreeDispatchFunc dispatch;
+
+ /*< private >*/
+ /* Padding for future expansion - also remember to update
+ * gdbusconnection.c:_g_dbus_subtree_vtable_copy() when
+ * changing this.
+ */
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+guint g_dbus_connection_register_subtree (GDBusConnection *connection,
+ const gchar *object_path,
+ const GDBusSubtreeVTable *vtable,
+ GDBusSubtreeFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_connection_unregister_subtree (GDBusConnection *connection,
+ guint registration_id);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+/**
+ * GDBusSignalCallback:
+ * @connection: A #GDBusConnection.
+ * @sender_name: The unique bus name of the sender of the signal.
+ * @object_path: The object path that the signal was emitted on.
+ * @interface_name: The name of the interface.
+ * @signal_name: The name of the signal.
+ * @parameters: A #GVariant tuple with parameters for the signal.
+ * @user_data: User data passed when subscribing to the signal.
+ *
+ * Signature for callback function used in g_dbus_connection_signal_subscribe().
+ *
+ * Since: 2.26
+ */
+typedef void (*GDBusSignalCallback) (GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_dbus_connection_signal_subscribe (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *interface_name,
+ const gchar *member,
+ const gchar *object_path,
+ const gchar *arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_signal_unsubscribe (GDBusConnection *connection,
+ guint subscription_id);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+/**
+ * GDBusMessageFilterFunction:
+ * @connection: (transfer none): A #GDBusConnection.
+ * @message: (transfer full): A locked #GDBusMessage that the filter function takes ownership of.
+ * @incoming: %TRUE if it is a message received from the other peer, %FALSE if it is
+ * a message to be sent to the other peer.
+ * @user_data: User data passed when adding the filter.
+ *
+ * Signature for function used in g_dbus_connection_add_filter().
+ *
+ * A filter function is passed a #GDBusMessage and expected to return
+ * a #GDBusMessage too. Passive filter functions that don't modify the
+ * message can simply return the @message object:
+ * |[
+ * static GDBusMessage *
+ * passive_filter (GDBusConnection *connection
+ * GDBusMessage *message,
+ * gboolean incoming,
+ * gpointer user_data)
+ * {
+ * // inspect @message
+ * return message;
+ * }
+ * ]|
+ * Filter functions that wants to drop a message can simply return %NULL:
+ * |[
+ * static GDBusMessage *
+ * drop_filter (GDBusConnection *connection
+ * GDBusMessage *message,
+ * gboolean incoming,
+ * gpointer user_data)
+ * {
+ * if (should_drop_message)
+ * {
+ * g_object_unref (message);
+ * message = NULL;
+ * }
+ * return message;
+ * }
+ * ]|
+ * Finally, a filter function may modify a message by copying it:
+ * |[
+ * static GDBusMessage *
+ * modifying_filter (GDBusConnection *connection
+ * GDBusMessage *message,
+ * gboolean incoming,
+ * gpointer user_data)
+ * {
+ * GDBusMessage *copy;
+ * GError *error;
+ *
+ * error = NULL;
+ * copy = g_dbus_message_copy (message, &error);
+ * // handle @error being set
+ * g_object_unref (message);
+ *
+ * // modify @copy
+ *
+ * return copy;
+ * }
+ * ]|
+ * If the returned #GDBusMessage is different from @message and cannot
+ * be sent on @connection (it could use features, such as file
+ * descriptors, not compatible with @connection), then a warning is
+ * logged to standard error. Applications can
+ * check this ahead of time using g_dbus_message_to_blob() passing a
+ * #GDBusCapabilityFlags value obtained from @connection.
+ *
+ * Returns: (transfer full) (nullable): A #GDBusMessage that will be freed with
+ * g_object_unref() or %NULL to drop the message. Passive filter
+ * functions can simply return the passed @message object.
+ *
+ * Since: 2.26
+ */
+typedef GDBusMessage *(*GDBusMessageFilterFunction) (GDBusConnection *connection,
+ GDBusMessage *message,
+ gboolean incoming,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_dbus_connection_add_filter (GDBusConnection *connection,
+ GDBusMessageFilterFunction filter_function,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_connection_remove_filter (GDBusConnection *connection,
+ guint filter_id);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+
+G_END_DECLS
+
+#endif /* __G_DBUS_CONNECTION_H__ */
diff --git a/include/glib/gio/gdbuserror.h b/include/glib/gio/gdbuserror.h
new file mode 100644
index 0000000000..35a156cb26
--- /dev/null
+++ b/include/glib/gio/gdbuserror.h
@@ -0,0 +1,109 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_ERROR_H__
+#define __G_DBUS_ERROR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_DBUS_ERROR:
+ *
+ * Error domain for errors generated by a remote message bus. Errors
+ * in this domain will be from the #GDBusError enumeration. See
+ * #GError for more information on error domains.
+ *
+ * Note that this error domain is intended only for
+ * returning errors from a remote message bus process. Errors
+ * generated locally in-process by e.g. #GDBusConnection should use the
+ * %G_IO_ERROR domain.
+ *
+ * Since: 2.26
+ */
+#define G_DBUS_ERROR g_dbus_error_quark()
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_dbus_error_quark (void);
+
+/* Used by applications to check, get and strip the D-Bus error name */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_error_is_remote_error (const GError *error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_error_get_remote_error (const GError *error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_error_strip_remote_error (GError *error);
+
+/**
+ * GDBusErrorEntry:
+ * @error_code: An error code.
+ * @dbus_error_name: The D-Bus error name to associate with @error_code.
+ *
+ * Struct used in g_dbus_error_register_error_domain().
+ *
+ * Since: 2.26
+ */
+struct _GDBusErrorEntry
+{
+ gint error_code;
+ const gchar *dbus_error_name;
+};
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_error_register_error (GQuark error_domain,
+ gint error_code,
+ const gchar *dbus_error_name);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_error_unregister_error (GQuark error_domain,
+ gint error_code,
+ const gchar *dbus_error_name);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_error_register_error_domain (const gchar *error_domain_quark_name,
+ volatile gsize *quark_volatile,
+ const GDBusErrorEntry *entries,
+ guint num_entries);
+
+/* Only used by object mappings to map back and forth to GError */
+GLIB_AVAILABLE_IN_ALL
+GError *g_dbus_error_new_for_dbus_error (const gchar *dbus_error_name,
+ const gchar *dbus_error_message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_error_set_dbus_error (GError **error,
+ const gchar *dbus_error_name,
+ const gchar *dbus_error_message,
+ const gchar *format,
+ ...) G_GNUC_PRINTF(4, 5);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_error_set_dbus_error_valist (GError **error,
+ const gchar *dbus_error_name,
+ const gchar *dbus_error_message,
+ const gchar *format,
+ va_list var_args) G_GNUC_PRINTF(4, 0);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_error_encode_gerror (const GError *error);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_ERROR_H__ */
diff --git a/include/glib/gio/gdbusinterface.h b/include/glib/gio/gdbusinterface.h
new file mode 100644
index 0000000000..b2f3c44056
--- /dev/null
+++ b/include/glib/gio/gdbusinterface.h
@@ -0,0 +1,81 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_INTERFACE_H__
+#define __G_DBUS_INTERFACE_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_INTERFACE (g_dbus_interface_get_type())
+#define G_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE, GDBusInterface))
+#define G_IS_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE))
+#define G_DBUS_INTERFACE_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_INTERFACE, GDBusInterfaceIface))
+
+/**
+ * GDBusInterface:
+ *
+ * Base type for D-Bus interfaces.
+ *
+ * Since: 2.30
+ */
+
+typedef struct _GDBusInterfaceIface GDBusInterfaceIface;
+
+/**
+ * GDBusInterfaceIface:
+ * @parent_iface: The parent interface.
+ * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info().
+ * @get_object: Gets the enclosing #GDBusObject. See g_dbus_interface_get_object().
+ * @set_object: Sets the enclosing #GDBusObject. See g_dbus_interface_set_object().
+ * @dup_object: Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32.
+ *
+ * Base type for D-Bus interfaces.
+ *
+ * Since: 2.30
+ */
+struct _GDBusInterfaceIface
+{
+ GTypeInterface parent_iface;
+
+ /* Virtual Functions */
+ GDBusInterfaceInfo *(*get_info) (GDBusInterface *interface_);
+ GDBusObject *(*get_object) (GDBusInterface *interface_);
+ void (*set_object) (GDBusInterface *interface_,
+ GDBusObject *object);
+ GDBusObject *(*dup_object) (GDBusInterface *interface_);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_interface_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceInfo *g_dbus_interface_get_info (GDBusInterface *interface_);
+GLIB_AVAILABLE_IN_ALL
+GDBusObject *g_dbus_interface_get_object (GDBusInterface *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_set_object (GDBusInterface *interface_,
+ GDBusObject *object);
+GLIB_AVAILABLE_IN_2_32
+GDBusObject *g_dbus_interface_dup_object (GDBusInterface *interface_);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_INTERFACE_H__ */
diff --git a/include/glib/gio/gdbusinterfaceskeleton.h b/include/glib/gio/gdbusinterfaceskeleton.h
new file mode 100644
index 0000000000..bf3b630e42
--- /dev/null
+++ b/include/glib/gio/gdbusinterfaceskeleton.h
@@ -0,0 +1,127 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_INTERFACE_SKELETON_H__
+#define __G_DBUS_INTERFACE_SKELETON_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_INTERFACE_SKELETON (g_dbus_interface_skeleton_get_type ())
+#define G_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeleton))
+#define G_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass))
+#define G_DBUS_INTERFACE_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass))
+#define G_IS_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE_SKELETON))
+#define G_IS_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_INTERFACE_SKELETON))
+
+typedef struct _GDBusInterfaceSkeletonClass GDBusInterfaceSkeletonClass;
+typedef struct _GDBusInterfaceSkeletonPrivate GDBusInterfaceSkeletonPrivate;
+
+/**
+ * GDBusInterfaceSkeleton:
+ *
+ * The #GDBusInterfaceSkeleton structure contains private data and should
+ * only be accessed using the provided API.
+ *
+ * Since: 2.30
+ */
+struct _GDBusInterfaceSkeleton
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusInterfaceSkeletonPrivate *priv;
+};
+
+/**
+ * GDBusInterfaceSkeletonClass:
+ * @parent_class: The parent class.
+ * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.
+ * @get_vtable: Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.
+ * @get_properties: Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties().
+ * @flush: Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().
+ * @g_authorize_method: Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal.
+ *
+ * Class structure for #GDBusInterfaceSkeleton.
+ *
+ * Since: 2.30
+ */
+struct _GDBusInterfaceSkeletonClass
+{
+ GObjectClass parent_class;
+
+ /* Virtual Functions */
+ GDBusInterfaceInfo *(*get_info) (GDBusInterfaceSkeleton *interface_);
+ GDBusInterfaceVTable *(*get_vtable) (GDBusInterfaceSkeleton *interface_);
+ GVariant *(*get_properties) (GDBusInterfaceSkeleton *interface_);
+ void (*flush) (GDBusInterfaceSkeleton *interface_);
+
+ /*< private >*/
+ gpointer vfunc_padding[8];
+ /*< public >*/
+
+ /* Signals */
+ gboolean (*g_authorize_method) (GDBusInterfaceSkeleton *interface_,
+ GDBusMethodInvocation *invocation);
+
+ /*< private >*/
+ gpointer signal_padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_interface_skeleton_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_,
+ GDBusInterfaceSkeletonFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceInfo *g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceVTable *g_dbus_interface_skeleton_get_vtable (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_interface_skeleton_get_properties (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_skeleton_flush (GDBusInterfaceSkeleton *interface_);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_,
+ GDBusConnection *connection,
+ const gchar *object_path,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_skeleton_unexport_from_connection (GDBusInterfaceSkeleton *interface_,
+ GDBusConnection *connection);
+
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_interface_skeleton_get_connection (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+GList *g_dbus_interface_skeleton_get_connections (GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_interface_skeleton_has_connection (GDBusInterfaceSkeleton *interface_,
+ GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_interface_skeleton_get_object_path (GDBusInterfaceSkeleton *interface_);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_INTERFACE_SKELETON_H */
diff --git a/include/glib/gio/gdbusintrospection.h b/include/glib/gio/gdbusintrospection.h
new file mode 100644
index 0000000000..14b171055e
--- /dev/null
+++ b/include/glib/gio/gdbusintrospection.h
@@ -0,0 +1,325 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_INTROSPECTION_H__
+#define __G_DBUS_INTROSPECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GDBusAnnotationInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @key: The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".
+ * @value: The value of the annotation.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about an annotation.
+ *
+ * Since: 2.26
+ */
+struct _GDBusAnnotationInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *key;
+ gchar *value;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusArgInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @name: Name of the argument, e.g. @unix_user_id.
+ * @signature: D-Bus signature of the argument (a single complete type).
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about an argument for a method or a signal.
+ *
+ * Since: 2.26
+ */
+struct _GDBusArgInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *name;
+ gchar *signature;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusMethodInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @name: The name of the D-Bus method, e.g. @RequestName.
+ * @in_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no in arguments.
+ * @out_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no out arguments.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about a method on an D-Bus interface.
+ *
+ * Since: 2.26
+ */
+struct _GDBusMethodInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *name;
+ GDBusArgInfo **in_args;
+ GDBusArgInfo **out_args;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusSignalInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @name: The name of the D-Bus signal, e.g. "NameOwnerChanged".
+ * @args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about a signal on a D-Bus interface.
+ *
+ * Since: 2.26
+ */
+struct _GDBusSignalInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *name;
+ GDBusArgInfo **args;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusPropertyInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @name: The name of the D-Bus property, e.g. "SupportedFilesystems".
+ * @signature: The D-Bus signature of the property (a single complete type).
+ * @flags: Access control flags for the property.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about a D-Bus property on a D-Bus interface.
+ *
+ * Since: 2.26
+ */
+struct _GDBusPropertyInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *name;
+ gchar *signature;
+ GDBusPropertyInfoFlags flags;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusInterfaceInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @name: The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties".
+ * @methods: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusMethodInfo structures or %NULL if there are no methods.
+ * @signals: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusSignalInfo structures or %NULL if there are no signals.
+ * @properties: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusPropertyInfo structures or %NULL if there are no properties.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about a D-Bus interface.
+ *
+ * Since: 2.26
+ */
+struct _GDBusInterfaceInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *name;
+ GDBusMethodInfo **methods;
+ GDBusSignalInfo **signals;
+ GDBusPropertyInfo **properties;
+ GDBusAnnotationInfo **annotations;
+};
+
+/**
+ * GDBusNodeInfo:
+ * @ref_count: The reference count or -1 if statically allocated.
+ * @path: The path of the node or %NULL if omitted. Note that this may be a relative path. See the D-Bus specification for more details.
+ * @interfaces: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces.
+ * @nodes: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes.
+ * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
+ *
+ * Information about nodes in a remote object hierarchy.
+ *
+ * Since: 2.26
+ */
+struct _GDBusNodeInfo
+{
+ /*< public >*/
+ volatile gint ref_count;
+ gchar *path;
+ GDBusInterfaceInfo **interfaces;
+ GDBusNodeInfo **nodes;
+ GDBusAnnotationInfo **annotations;
+};
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_annotation_info_lookup (GDBusAnnotationInfo **annotations,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GDBusMethodInfo *g_dbus_interface_info_lookup_method (GDBusInterfaceInfo *info,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GDBusSignalInfo *g_dbus_interface_info_lookup_signal (GDBusInterfaceInfo *info,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GDBusPropertyInfo *g_dbus_interface_info_lookup_property (GDBusInterfaceInfo *info,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_info_cache_build (GDBusInterfaceInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_info_cache_release (GDBusInterfaceInfo *info);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_info_generate_xml (GDBusInterfaceInfo *info,
+ guint indent,
+ GString *string_builder);
+
+GLIB_AVAILABLE_IN_ALL
+GDBusNodeInfo *g_dbus_node_info_new_for_xml (const gchar *xml_data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceInfo *g_dbus_node_info_lookup_interface (GDBusNodeInfo *info,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_node_info_generate_xml (GDBusNodeInfo *info,
+ guint indent,
+ GString *string_builder);
+
+GLIB_AVAILABLE_IN_ALL
+GDBusNodeInfo *g_dbus_node_info_ref (GDBusNodeInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceInfo *g_dbus_interface_info_ref (GDBusInterfaceInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusMethodInfo *g_dbus_method_info_ref (GDBusMethodInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusSignalInfo *g_dbus_signal_info_ref (GDBusSignalInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusPropertyInfo *g_dbus_property_info_ref (GDBusPropertyInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusArgInfo *g_dbus_arg_info_ref (GDBusArgInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GDBusAnnotationInfo *g_dbus_annotation_info_ref (GDBusAnnotationInfo *info);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_node_info_unref (GDBusNodeInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_interface_info_unref (GDBusInterfaceInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_info_unref (GDBusMethodInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_signal_info_unref (GDBusSignalInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_property_info_unref (GDBusPropertyInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_arg_info_unref (GDBusArgInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_annotation_info_unref (GDBusAnnotationInfo *info);
+
+/**
+ * G_TYPE_DBUS_NODE_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusNodeInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_NODE_INFO (g_dbus_node_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_INTERFACE_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusInterfaceInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_INTERFACE_INFO (g_dbus_interface_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_METHOD_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusMethodInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_METHOD_INFO (g_dbus_method_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_SIGNAL_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusSignalInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_SIGNAL_INFO (g_dbus_signal_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_PROPERTY_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusPropertyInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_PROPERTY_INFO (g_dbus_property_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_ARG_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusArgInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_ARG_INFO (g_dbus_arg_info_get_type ())
+
+/**
+ * G_TYPE_DBUS_ANNOTATION_INFO:
+ *
+ * The #GType for a boxed type holding a #GDBusAnnotationInfo.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ())
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_node_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_interface_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_method_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_signal_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_property_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_arg_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_annotation_info_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_DBUS_INTROSPECTION_H__ */
diff --git a/include/glib/gio/gdbusmenumodel.h b/include/glib/gio/gdbusmenumodel.h
new file mode 100644
index 0000000000..dd2882d224
--- /dev/null
+++ b/include/glib/gio/gdbusmenumodel.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2011 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_DBUS_MENU_MODEL_H__
+#define __G_DBUS_MENU_MODEL_H__
+
+#include <gio/gdbusconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_MENU_MODEL (g_dbus_menu_model_get_type ())
+#define G_DBUS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_DBUS_MENU_MODEL, GDBusMenuModel))
+#define G_IS_DBUS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_DBUS_MENU_MODEL))
+
+typedef struct _GDBusMenuModel GDBusMenuModel;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_menu_model_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GDBusMenuModel * g_dbus_menu_model_get (GDBusConnection *connection,
+ const gchar *bus_name,
+ const gchar *object_path);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_MENU_MODEL_H__ */
diff --git a/include/glib/gio/gdbusmessage.h b/include/glib/gio/gdbusmessage.h
new file mode 100644
index 0000000000..5f039dc910
--- /dev/null
+++ b/include/glib/gio/gdbusmessage.h
@@ -0,0 +1,197 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_MESSAGE_H__
+#define __G_DBUS_MESSAGE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_MESSAGE (g_dbus_message_get_type ())
+#define G_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_MESSAGE, GDBusMessage))
+#define G_IS_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_MESSAGE))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_message_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new (void);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_signal (const gchar *path,
+ const gchar *interface_,
+ const gchar *signal);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_method_call (const gchar *name,
+ const gchar *path,
+ const gchar *interface_,
+ const gchar *method);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_method_reply (GDBusMessage *method_call_message);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_method_error (GDBusMessage *method_call_message,
+ const gchar *error_name,
+ const gchar *error_message_format,
+ ...) G_GNUC_PRINTF(3, 4);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_method_error_valist (GDBusMessage *method_call_message,
+ const gchar *error_name,
+ const gchar *error_message_format,
+ va_list var_args);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message,
+ const gchar *error_name,
+ const gchar *error_message);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_message_print (GDBusMessage *message,
+ guint indent);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_message_get_locked (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_lock (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_copy (GDBusMessage *message,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessageByteOrder g_dbus_message_get_byte_order (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_byte_order (GDBusMessage *message,
+ GDBusMessageByteOrder byte_order);
+
+GLIB_AVAILABLE_IN_ALL
+GDBusMessageType g_dbus_message_get_message_type (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_message_type (GDBusMessage *message,
+ GDBusMessageType type);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessageFlags g_dbus_message_get_flags (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_flags (GDBusMessage *message,
+ GDBusMessageFlags flags);
+GLIB_AVAILABLE_IN_ALL
+guint32 g_dbus_message_get_serial (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_serial (GDBusMessage *message,
+ guint32 serial);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_message_get_header (GDBusMessage *message,
+ GDBusMessageHeaderField header_field);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_header (GDBusMessage *message,
+ GDBusMessageHeaderField header_field,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+guchar *g_dbus_message_get_header_fields (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_message_get_body (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_body (GDBusMessage *message,
+ GVariant *body);
+GLIB_AVAILABLE_IN_ALL
+GUnixFDList *g_dbus_message_get_unix_fd_list (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_unix_fd_list (GDBusMessage *message,
+ GUnixFDList *fd_list);
+
+GLIB_AVAILABLE_IN_ALL
+guint32 g_dbus_message_get_reply_serial (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_reply_serial (GDBusMessage *message,
+ guint32 value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_interface (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_interface (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_member (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_member (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_path (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_path (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_sender (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_sender (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_destination (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_destination (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_error_name (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_error_name (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_signature (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_signature (GDBusMessage *message,
+ const gchar *value);
+
+GLIB_AVAILABLE_IN_ALL
+guint32 g_dbus_message_get_num_unix_fds (GDBusMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_message_set_num_unix_fds (GDBusMessage *message,
+ guint32 value);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_message_get_arg0 (GDBusMessage *message);
+
+
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_message_new_from_blob (guchar *blob,
+ gsize blob_len,
+ GDBusCapabilityFlags capabilities,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_dbus_message_bytes_needed (guchar *blob,
+ gsize blob_len,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+guchar *g_dbus_message_to_blob (GDBusMessage *message,
+ gsize *out_size,
+ GDBusCapabilityFlags capabilities,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_message_to_gerror (GDBusMessage *message,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_MESSAGE_H__ */
diff --git a/include/glib/gio/gdbusmethodinvocation.h b/include/glib/gio/gdbusmethodinvocation.h
new file mode 100644
index 0000000000..061256ffe4
--- /dev/null
+++ b/include/glib/gio/gdbusmethodinvocation.h
@@ -0,0 +1,97 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_METHOD_INVOCATION_H__
+#define __G_DBUS_METHOD_INVOCATION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_METHOD_INVOCATION (g_dbus_method_invocation_get_type ())
+#define G_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocation))
+#define G_IS_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_METHOD_INVOCATION))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_method_invocation_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_method_invocation_get_object_path (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_method_invocation_get_interface_name (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+const GDBusMethodInfo *g_dbus_method_invocation_get_method_info (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_2_38
+const GDBusPropertyInfo *g_dbus_method_invocation_get_property_info (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+GDBusMessage *g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
+ GVariant *parameters);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_value_with_unix_fd_list (GDBusMethodInvocation *invocation,
+ GVariant *parameters,
+ GUnixFDList *fd_list);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF(4, 5);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_error_valist (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ va_list var_args)
+ G_GNUC_PRINTF(4, 0);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *message);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation,
+ const GError *error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation,
+ GError *error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
+ const gchar *error_name,
+ const gchar *error_message);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_METHOD_INVOCATION_H__ */
diff --git a/include/glib/gio/gdbusnameowning.h b/include/glib/gio/gdbusnameowning.h
new file mode 100644
index 0000000000..89c011a2fb
--- /dev/null
+++ b/include/glib/gio/gdbusnameowning.h
@@ -0,0 +1,115 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_NAME_OWNING_H__
+#define __G_DBUS_NAME_OWNING_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GBusAcquiredCallback:
+ * @connection: The #GDBusConnection to a message bus.
+ * @name: The name that is requested to be owned.
+ * @user_data: User data passed to g_bus_own_name().
+ *
+ * Invoked when a connection to a message bus has been obtained.
+ *
+ * Since: 2.26
+ */
+typedef void (*GBusAcquiredCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+/**
+ * GBusNameAcquiredCallback:
+ * @connection: The #GDBusConnection on which to acquired the name.
+ * @name: The name being owned.
+ * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
+ *
+ * Invoked when the name is acquired.
+ *
+ * Since: 2.26
+ */
+typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+/**
+ * GBusNameLostCallback:
+ * @connection: The #GDBusConnection on which to acquire the name or %NULL if
+ * the connection was disconnected.
+ * @name: The name being owned.
+ * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection().
+ *
+ * Invoked when the name is lost or @connection has been closed.
+ *
+ * Since: 2.26
+ */
+typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_own_name (GBusType bus_type,
+ const gchar *name,
+ GBusNameOwnerFlags flags,
+ GBusAcquiredCallback bus_acquired_handler,
+ GBusNameAcquiredCallback name_acquired_handler,
+ GBusNameLostCallback name_lost_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_own_name_on_connection (GDBusConnection *connection,
+ const gchar *name,
+ GBusNameOwnerFlags flags,
+ GBusNameAcquiredCallback name_acquired_handler,
+ GBusNameLostCallback name_lost_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_own_name_with_closures (GBusType bus_type,
+ const gchar *name,
+ GBusNameOwnerFlags flags,
+ GClosure *bus_acquired_closure,
+ GClosure *name_acquired_closure,
+ GClosure *name_lost_closure);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_own_name_on_connection_with_closures (
+ GDBusConnection *connection,
+ const gchar *name,
+ GBusNameOwnerFlags flags,
+ GClosure *name_acquired_closure,
+ GClosure *name_lost_closure);
+
+GLIB_AVAILABLE_IN_ALL
+void g_bus_unown_name (guint owner_id);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_NAME_OWNING_H__ */
diff --git a/include/glib/gio/gdbusnamewatching.h b/include/glib/gio/gdbusnamewatching.h
new file mode 100644
index 0000000000..19d57f2c51
--- /dev/null
+++ b/include/glib/gio/gdbusnamewatching.h
@@ -0,0 +1,102 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_NAME_WATCHING_H__
+#define __G_DBUS_NAME_WATCHING_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GBusNameAppearedCallback:
+ * @connection: The #GDBusConnection the name is being watched on.
+ * @name: The name being watched.
+ * @name_owner: Unique name of the owner of the name being watched.
+ * @user_data: User data passed to g_bus_watch_name().
+ *
+ * Invoked when the name being watched is known to have to have an owner.
+ *
+ * Since: 2.26
+ */
+typedef void (*GBusNameAppearedCallback) (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data);
+
+/**
+ * GBusNameVanishedCallback:
+ * @connection: The #GDBusConnection the name is being watched on, or
+ * %NULL.
+ * @name: The name being watched.
+ * @user_data: User data passed to g_bus_watch_name().
+ *
+ * Invoked when the name being watched is known not to have to have an owner.
+ *
+ * This is also invoked when the #GDBusConnection on which the watch was
+ * established has been closed. In that case, @connection will be
+ * %NULL.
+ *
+ * Since: 2.26
+ */
+typedef void (*GBusNameVanishedCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_watch_name (GBusType bus_type,
+ const gchar *name,
+ GBusNameWatcherFlags flags,
+ GBusNameAppearedCallback name_appeared_handler,
+ GBusNameVanishedCallback name_vanished_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_watch_name_on_connection (GDBusConnection *connection,
+ const gchar *name,
+ GBusNameWatcherFlags flags,
+ GBusNameAppearedCallback name_appeared_handler,
+ GBusNameVanishedCallback name_vanished_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func);
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_watch_name_with_closures (GBusType bus_type,
+ const gchar *name,
+ GBusNameWatcherFlags flags,
+ GClosure *name_appeared_closure,
+ GClosure *name_vanished_closure);
+GLIB_AVAILABLE_IN_ALL
+guint g_bus_watch_name_on_connection_with_closures (
+ GDBusConnection *connection,
+ const gchar *name,
+ GBusNameWatcherFlags flags,
+ GClosure *name_appeared_closure,
+ GClosure *name_vanished_closure);
+GLIB_AVAILABLE_IN_ALL
+void g_bus_unwatch_name (guint watcher_id);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_NAME_WATCHING_H__ */
diff --git a/include/glib/gio/gdbusobject.h b/include/glib/gio/gdbusobject.h
new file mode 100644
index 0000000000..157c52b1a8
--- /dev/null
+++ b/include/glib/gio/gdbusobject.h
@@ -0,0 +1,78 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_H__
+#define __G_DBUS_OBJECT_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT (g_dbus_object_get_type())
+#define G_DBUS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT, GDBusObject))
+#define G_IS_DBUS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT))
+#define G_DBUS_OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_OBJECT, GDBusObjectIface))
+
+typedef struct _GDBusObjectIface GDBusObjectIface;
+
+/**
+ * GDBusObjectIface:
+ * @parent_iface: The parent interface.
+ * @get_object_path: Returns the object path. See g_dbus_object_get_object_path().
+ * @get_interfaces: Returns all interfaces. See g_dbus_object_get_interfaces().
+ * @get_interface: Returns an interface by name. See g_dbus_object_get_interface().
+ * @interface_added: Signal handler for the #GDBusObject::interface-added signal.
+ * @interface_removed: Signal handler for the #GDBusObject::interface-removed signal.
+ *
+ * Base object type for D-Bus objects.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectIface
+{
+ GTypeInterface parent_iface;
+
+ /* Virtual Functions */
+ const gchar *(*get_object_path) (GDBusObject *object);
+ GList *(*get_interfaces) (GDBusObject *object);
+ GDBusInterface *(*get_interface) (GDBusObject *object,
+ const gchar *interface_name);
+
+ /* Signals */
+ void (*interface_added) (GDBusObject *object,
+ GDBusInterface *interface_);
+ void (*interface_removed) (GDBusObject *object,
+ GDBusInterface *interface_);
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_object_get_object_path (GDBusObject *object);
+GLIB_AVAILABLE_IN_ALL
+GList *g_dbus_object_get_interfaces (GDBusObject *object);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterface *g_dbus_object_get_interface (GDBusObject *object,
+ const gchar *interface_name);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_H__ */
diff --git a/include/glib/gio/gdbusobjectmanager.h b/include/glib/gio/gdbusobjectmanager.h
new file mode 100644
index 0000000000..260ae2ee67
--- /dev/null
+++ b/include/glib/gio/gdbusobjectmanager.h
@@ -0,0 +1,94 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_MANAGER_H__
+#define __G_DBUS_OBJECT_MANAGER_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT_MANAGER (g_dbus_object_manager_get_type())
+#define G_DBUS_OBJECT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER, GDBusObjectManager))
+#define G_IS_DBUS_OBJECT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER))
+#define G_DBUS_OBJECT_MANAGER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_OBJECT_MANAGER, GDBusObjectManagerIface))
+
+typedef struct _GDBusObjectManagerIface GDBusObjectManagerIface;
+
+/**
+ * GDBusObjectManagerIface:
+ * @parent_iface: The parent interface.
+ * @get_object_path: Virtual function for g_dbus_object_manager_get_object_path().
+ * @get_objects: Virtual function for g_dbus_object_manager_get_objects().
+ * @get_object: Virtual function for g_dbus_object_manager_get_object().
+ * @get_interface: Virtual function for g_dbus_object_manager_get_interface().
+ * @object_added: Signal handler for the #GDBusObjectManager::object-added signal.
+ * @object_removed: Signal handler for the #GDBusObjectManager::object-removed signal.
+ * @interface_added: Signal handler for the #GDBusObjectManager::interface-added signal.
+ * @interface_removed: Signal handler for the #GDBusObjectManager::interface-removed signal.
+ *
+ * Base type for D-Bus object managers.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectManagerIface
+{
+ GTypeInterface parent_iface;
+
+ /* Virtual Functions */
+ const gchar *(*get_object_path) (GDBusObjectManager *manager);
+ GList *(*get_objects) (GDBusObjectManager *manager);
+ GDBusObject *(*get_object) (GDBusObjectManager *manager,
+ const gchar *object_path);
+ GDBusInterface *(*get_interface) (GDBusObjectManager *manager,
+ const gchar *object_path,
+ const gchar *interface_name);
+
+ /* Signals */
+ void (*object_added) (GDBusObjectManager *manager,
+ GDBusObject *object);
+ void (*object_removed) (GDBusObjectManager *manager,
+ GDBusObject *object);
+
+ void (*interface_added) (GDBusObjectManager *manager,
+ GDBusObject *object,
+ GDBusInterface *interface_);
+ void (*interface_removed) (GDBusObjectManager *manager,
+ GDBusObject *object,
+ GDBusInterface *interface_);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_manager_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_object_manager_get_object_path (GDBusObjectManager *manager);
+GLIB_AVAILABLE_IN_ALL
+GList *g_dbus_object_manager_get_objects (GDBusObjectManager *manager);
+GLIB_AVAILABLE_IN_ALL
+GDBusObject *g_dbus_object_manager_get_object (GDBusObjectManager *manager,
+ const gchar *object_path);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterface *g_dbus_object_manager_get_interface (GDBusObjectManager *manager,
+ const gchar *object_path,
+ const gchar *interface_name);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_MANAGER_H__ */
diff --git a/include/glib/gio/gdbusobjectmanagerclient.h b/include/glib/gio/gdbusobjectmanagerclient.h
new file mode 100644
index 0000000000..eafabfbf15
--- /dev/null
+++ b/include/glib/gio/gdbusobjectmanagerclient.h
@@ -0,0 +1,146 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_MANAGER_CLIENT_H__
+#define __G_DBUS_OBJECT_MANAGER_CLIENT_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT_MANAGER_CLIENT (g_dbus_object_manager_client_get_type ())
+#define G_DBUS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClient))
+#define G_DBUS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClientClass))
+#define G_DBUS_OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClientClass))
+#define G_IS_DBUS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT))
+#define G_IS_DBUS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT))
+
+typedef struct _GDBusObjectManagerClientClass GDBusObjectManagerClientClass;
+typedef struct _GDBusObjectManagerClientPrivate GDBusObjectManagerClientPrivate;
+
+/**
+ * GDBusObjectManagerClient:
+ *
+ * The #GDBusObjectManagerClient structure contains private data and should
+ * only be accessed using the provided API.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectManagerClient
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusObjectManagerClientPrivate *priv;
+};
+
+/**
+ * GDBusObjectManagerClientClass:
+ * @parent_class: The parent class.
+ * @interface_proxy_signal: Signal class handler for the #GDBusObjectManagerClient::interface-proxy-signal signal.
+ * @interface_proxy_properties_changed: Signal class handler for the #GDBusObjectManagerClient::interface-proxy-properties-changed signal.
+ *
+ * Class structure for #GDBusObjectManagerClient.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectManagerClientClass
+{
+ GObjectClass parent_class;
+
+ /* signals */
+ void (*interface_proxy_signal) (GDBusObjectManagerClient *manager,
+ GDBusObjectProxy *object_proxy,
+ GDBusProxy *interface_proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters);
+
+ void (*interface_proxy_properties_changed) (GDBusObjectManagerClient *manager,
+ GDBusObjectProxy *object_proxy,
+ GDBusProxy *interface_proxy,
+ GVariant *changed_properties,
+ const gchar* const *invalidated_properties);
+
+ /*< private >*/
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_manager_client_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_manager_client_new (GDBusConnection *connection,
+ GDBusObjectManagerClientFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GDBusProxyTypeFunc get_proxy_type_func,
+ gpointer get_proxy_type_user_data,
+ GDestroyNotify get_proxy_type_destroy_notify,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManager *g_dbus_object_manager_client_new_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManager *g_dbus_object_manager_client_new_sync (GDBusConnection *connection,
+ GDBusObjectManagerClientFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GDBusProxyTypeFunc get_proxy_type_func,
+ gpointer get_proxy_type_user_data,
+ GDestroyNotify get_proxy_type_destroy_notify,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_manager_client_new_for_bus (GBusType bus_type,
+ GDBusObjectManagerClientFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GDBusProxyTypeFunc get_proxy_type_func,
+ gpointer get_proxy_type_user_data,
+ GDestroyNotify get_proxy_type_destroy_notify,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManager *g_dbus_object_manager_client_new_for_bus_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManager *g_dbus_object_manager_client_new_for_bus_sync (GBusType bus_type,
+ GDBusObjectManagerClientFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GDBusProxyTypeFunc get_proxy_type_func,
+ gpointer get_proxy_type_user_data,
+ GDestroyNotify get_proxy_type_destroy_notify,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager);
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManagerClientFlags g_dbus_object_manager_client_get_flags (GDBusObjectManagerClient *manager);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_object_manager_client_get_name (GDBusObjectManagerClient *manager);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_object_manager_client_get_name_owner (GDBusObjectManagerClient *manager);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_MANAGER_CLIENT_H */
diff --git a/include/glib/gio/gdbusobjectmanagerserver.h b/include/glib/gio/gdbusobjectmanagerserver.h
new file mode 100644
index 0000000000..dd725b737a
--- /dev/null
+++ b/include/glib/gio/gdbusobjectmanagerserver.h
@@ -0,0 +1,93 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_MANAGER_SERVER_H__
+#define __G_DBUS_OBJECT_MANAGER_SERVER_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT_MANAGER_SERVER (g_dbus_object_manager_server_get_type ())
+#define G_DBUS_OBJECT_MANAGER_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServer))
+#define G_DBUS_OBJECT_MANAGER_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServerClass))
+#define G_DBUS_OBJECT_MANAGER_SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServerClass))
+#define G_IS_DBUS_OBJECT_MANAGER_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER))
+#define G_IS_DBUS_OBJECT_MANAGER_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_MANAGER_SERVER))
+
+typedef struct _GDBusObjectManagerServerClass GDBusObjectManagerServerClass;
+typedef struct _GDBusObjectManagerServerPrivate GDBusObjectManagerServerPrivate;
+
+/**
+ * GDBusObjectManagerServer:
+ *
+ * The #GDBusObjectManagerServer structure contains private data and should
+ * only be accessed using the provided API.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectManagerServer
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusObjectManagerServerPrivate *priv;
+};
+
+/**
+ * GDBusObjectManagerServerClass:
+ * @parent_class: The parent class.
+ *
+ * Class structure for #GDBusObjectManagerServer.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectManagerServerClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_manager_server_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectManagerServer *g_dbus_object_manager_server_new (const gchar *object_path);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_manager_server_set_connection (GDBusObjectManagerServer *manager,
+ GDBusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager,
+ GDBusObjectSkeleton *object);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager,
+ GDBusObjectSkeleton *object);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_object_manager_server_is_exported (GDBusObjectManagerServer *manager,
+ GDBusObjectSkeleton *object);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
+ const gchar *object_path);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_MANAGER_SERVER_H */
diff --git a/include/glib/gio/gdbusobjectproxy.h b/include/glib/gio/gdbusobjectproxy.h
new file mode 100644
index 0000000000..38c8d51183
--- /dev/null
+++ b/include/glib/gio/gdbusobjectproxy.h
@@ -0,0 +1,79 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_PROXY_H__
+#define __G_DBUS_OBJECT_PROXY_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT_PROXY (g_dbus_object_proxy_get_type ())
+#define G_DBUS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxy))
+#define G_DBUS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxyClass))
+#define G_DBUS_OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxyClass))
+#define G_IS_DBUS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_PROXY))
+#define G_IS_DBUS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_PROXY))
+
+typedef struct _GDBusObjectProxyClass GDBusObjectProxyClass;
+typedef struct _GDBusObjectProxyPrivate GDBusObjectProxyPrivate;
+
+/**
+ * GDBusObjectProxy:
+ *
+ * The #GDBusObjectProxy structure contains private data and should
+ * only be accessed using the provided API.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectProxy
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusObjectProxyPrivate *priv;
+};
+
+/**
+ * GDBusObjectProxyClass:
+ * @parent_class: The parent class.
+ *
+ * Class structure for #GDBusObjectProxy.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectProxyClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_proxy_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectProxy *g_dbus_object_proxy_new (GDBusConnection *connection,
+ const gchar *object_path);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_object_proxy_get_connection (GDBusObjectProxy *proxy);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_PROXY_H */
diff --git a/include/glib/gio/gdbusobjectskeleton.h b/include/glib/gio/gdbusobjectskeleton.h
new file mode 100644
index 0000000000..fe6952f5a4
--- /dev/null
+++ b/include/glib/gio/gdbusobjectskeleton.h
@@ -0,0 +1,96 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_OBJECT_SKELETON_H__
+#define __G_DBUS_OBJECT_SKELETON_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_OBJECT_SKELETON (g_dbus_object_skeleton_get_type ())
+#define G_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeleton))
+#define G_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass))
+#define G_DBUS_OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass))
+#define G_IS_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_SKELETON))
+#define G_IS_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_SKELETON))
+
+typedef struct _GDBusObjectSkeletonClass GDBusObjectSkeletonClass;
+typedef struct _GDBusObjectSkeletonPrivate GDBusObjectSkeletonPrivate;
+
+/**
+ * GDBusObjectSkeleton:
+ *
+ * The #GDBusObjectSkeleton structure contains private data and should only be
+ * accessed using the provided API.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectSkeleton
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusObjectSkeletonPrivate *priv;
+};
+
+/**
+ * GDBusObjectSkeletonClass:
+ * @parent_class: The parent class.
+ * @authorize_method: Signal class handler for the #GDBusObjectSkeleton::authorize-method signal.
+ *
+ * Class structure for #GDBusObjectSkeleton.
+ *
+ * Since: 2.30
+ */
+struct _GDBusObjectSkeletonClass
+{
+ GObjectClass parent_class;
+
+ /* Signals */
+ gboolean (*authorize_method) (GDBusObjectSkeleton *object,
+ GDBusInterfaceSkeleton *interface_,
+ GDBusMethodInvocation *invocation);
+
+ /*< private >*/
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_object_skeleton_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusObjectSkeleton *g_dbus_object_skeleton_new (const gchar *object_path);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object,
+ GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_skeleton_remove_interface (GDBusObjectSkeleton *object,
+ GDBusInterfaceSkeleton *interface_);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_skeleton_remove_interface_by_name (GDBusObjectSkeleton *object,
+ const gchar *interface_name);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_object_skeleton_set_object_path (GDBusObjectSkeleton *object,
+ const gchar *object_path);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_OBJECT_SKELETON_H */
diff --git a/include/glib/gio/gdbusproxy.h b/include/glib/gio/gdbusproxy.h
new file mode 100644
index 0000000000..6be9871ec1
--- /dev/null
+++ b/include/glib/gio/gdbusproxy.h
@@ -0,0 +1,214 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_PROXY_H__
+#define __G_DBUS_PROXY_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+#include <gio/gdbusintrospection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_PROXY (g_dbus_proxy_get_type ())
+#define G_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_PROXY, GDBusProxy))
+#define G_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_PROXY, GDBusProxyClass))
+#define G_DBUS_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_PROXY, GDBusProxyClass))
+#define G_IS_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_PROXY))
+#define G_IS_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_PROXY))
+
+typedef struct _GDBusProxyClass GDBusProxyClass;
+typedef struct _GDBusProxyPrivate GDBusProxyPrivate;
+
+/**
+ * GDBusProxy:
+ *
+ * The #GDBusProxy structure contains only private data and
+ * should only be accessed using the provided API.
+ *
+ * Since: 2.26
+ */
+struct _GDBusProxy
+{
+ /*< private >*/
+ GObject parent_instance;
+ GDBusProxyPrivate *priv;
+};
+
+/**
+ * GDBusProxyClass:
+ * @g_properties_changed: Signal class handler for the #GDBusProxy::g-properties-changed signal.
+ * @g_signal: Signal class handler for the #GDBusProxy::g-signal signal.
+ *
+ * Class structure for #GDBusProxy.
+ *
+ * Since: 2.26
+ */
+struct _GDBusProxyClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* Signals */
+ void (*g_properties_changed) (GDBusProxy *proxy,
+ GVariant *changed_properties,
+ const gchar* const *invalidated_properties);
+ void (*g_signal) (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[32];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_proxy_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_new (GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ GDBusInterfaceInfo *info,
+ const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusProxy *g_dbus_proxy_new_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusProxy *g_dbus_proxy_new_sync (GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ GDBusInterfaceInfo *info,
+ const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_new_for_bus (GBusType bus_type,
+ GDBusProxyFlags flags,
+ GDBusInterfaceInfo *info,
+ const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GDBusProxy *g_dbus_proxy_new_for_bus_finish (GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusProxy *g_dbus_proxy_new_for_bus_sync (GBusType bus_type,
+ GDBusProxyFlags flags,
+ GDBusInterfaceInfo *info,
+ const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GDBusConnection *g_dbus_proxy_get_connection (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+GDBusProxyFlags g_dbus_proxy_get_flags (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_proxy_get_name (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_proxy_get_name_owner (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_proxy_get_object_path (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_proxy_get_interface_name (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+gint g_dbus_proxy_get_default_timeout (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_set_default_timeout (GDBusProxy *proxy,
+ gint timeout_msec);
+GLIB_AVAILABLE_IN_ALL
+GDBusInterfaceInfo *g_dbus_proxy_get_interface_info (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_set_interface_info (GDBusProxy *proxy,
+ GDBusInterfaceInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
+ const gchar *property_name);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_set_cached_property (GDBusProxy *proxy,
+ const gchar *property_name,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_call (GDBusProxy *proxy,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_proxy_call_finish (GDBusProxy *proxy,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_proxy_call_sync (GDBusProxy *proxy,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_proxy_call_with_unix_fd_list (GDBusProxy *proxy,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GUnixFDList *fd_list,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_proxy_call_with_unix_fd_list_finish (GDBusProxy *proxy,
+ GUnixFDList **out_fd_list,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_proxy_call_with_unix_fd_list_sync (GDBusProxy *proxy,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GUnixFDList *fd_list,
+ GUnixFDList **out_fd_list,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_PROXY_H__ */
diff --git a/include/glib/gio/gdbusserver.h b/include/glib/gio/gdbusserver.h
new file mode 100644
index 0000000000..123eac4da7
--- /dev/null
+++ b/include/glib/gio/gdbusserver.h
@@ -0,0 +1,60 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_SERVER_H__
+#define __G_DBUS_SERVER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DBUS_SERVER (g_dbus_server_get_type ())
+#define G_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_SERVER, GDBusServer))
+#define G_IS_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_SERVER))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_dbus_server_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GDBusServer *g_dbus_server_new_sync (const gchar *address,
+ GDBusServerFlags flags,
+ const gchar *guid,
+ GDBusAuthObserver *observer,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_server_get_client_address (GDBusServer *server);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dbus_server_get_guid (GDBusServer *server);
+GLIB_AVAILABLE_IN_ALL
+GDBusServerFlags g_dbus_server_get_flags (GDBusServer *server);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_server_start (GDBusServer *server);
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_server_stop (GDBusServer *server);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_server_is_active (GDBusServer *server);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_SERVER_H__ */
diff --git a/include/glib/gio/gdbusutils.h b/include/glib/gio/gdbusutils.h
new file mode 100644
index 0000000000..5aecb51421
--- /dev/null
+++ b/include/glib/gio/gdbusutils.h
@@ -0,0 +1,55 @@
+/* GDBus - GLib D-Bus Library
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DBUS_UTILS_H__
+#define __G_DBUS_UTILS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_guid (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_dbus_generate_guid (void);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_name (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_unique_name (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_member_name (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_dbus_is_interface_name (const gchar *string);
+
+GLIB_AVAILABLE_IN_ALL
+void g_dbus_gvariant_to_gvalue (GVariant *value,
+ GValue *out_gvalue);
+GLIB_AVAILABLE_IN_ALL
+GVariant *g_dbus_gvalue_to_gvariant (const GValue *gvalue,
+ const GVariantType *type);
+
+G_END_DECLS
+
+#endif /* __G_DBUS_UTILS_H__ */
diff --git a/include/glib/gio/gdrive.h b/include/glib/gio/gdrive.h
new file mode 100644
index 0000000000..ec92071c76
--- /dev/null
+++ b/include/glib/gio/gdrive.h
@@ -0,0 +1,272 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ * David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_DRIVE_H__
+#define __G_DRIVE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE:
+ *
+ * The string used to obtain a Unix device path with g_drive_get_identifier().
+ *
+ * Since: 2.58
+ */
+#define G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
+
+#define G_TYPE_DRIVE (g_drive_get_type ())
+#define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
+#define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
+#define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
+
+/**
+ * GDriveIface:
+ * @g_iface: The parent interface.
+ * @changed: Signal emitted when the drive is changed.
+ * @disconnected: The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.
+ * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
+ * @get_name: Returns the name for the given #GDrive.
+ * @get_icon: Returns a #GIcon for the given #GDrive.
+ * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
+ * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
+ * @is_removable: Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.
+ * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
+ * @has_media: Returns %TRUE if the #GDrive has media inserted.
+ * @is_media_check_automatic: Returns %TRUE if the #GDrive is capabable of automatically detecting media changes.
+ * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
+ * @can_eject: Returns %TRUE if the #GDrive can eject media.
+ * @eject: Ejects a #GDrive.
+ * @eject_finish: Finishes an eject operation.
+ * @poll_for_media: Poll for media insertion/removal on a #GDrive.
+ * @poll_for_media_finish: Finishes a media poll operation.
+ * @get_identifier: Returns the identifier of the given kind, or %NULL if
+ * the #GDrive doesn't have one.
+ * @enumerate_identifiers: Returns an array strings listing the kinds
+ * of identifiers which the #GDrive has.
+ * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
+ * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
+ * @stop: Stops a #GDrive. Since 2.22.
+ * @stop_finish: Finishes a stop operation. Since 2.22.
+ * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
+ * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
+ * @start: Starts a #GDrive. Since 2.22.
+ * @start_finish: Finishes a start operation. Since 2.22.
+ * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
+ * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
+ * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
+ * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
+ * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
+ *
+ * Interface for creating #GDrive implementations.
+ */
+typedef struct _GDriveIface GDriveIface;
+
+struct _GDriveIface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+ void (* changed) (GDrive *drive);
+ void (* disconnected) (GDrive *drive);
+ void (* eject_button) (GDrive *drive);
+
+ /* Virtual Table */
+ char * (* get_name) (GDrive *drive);
+ GIcon * (* get_icon) (GDrive *drive);
+ gboolean (* has_volumes) (GDrive *drive);
+ GList * (* get_volumes) (GDrive *drive);
+ gboolean (* is_media_removable) (GDrive *drive);
+ gboolean (* has_media) (GDrive *drive);
+ gboolean (* is_media_check_automatic) (GDrive *drive);
+ gboolean (* can_eject) (GDrive *drive);
+ gboolean (* can_poll_for_media) (GDrive *drive);
+ void (* eject) (GDrive *drive,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_finish) (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+ void (* poll_for_media) (GDrive *drive,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* poll_for_media_finish) (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+ char * (* get_identifier) (GDrive *drive,
+ const char *kind);
+ char ** (* enumerate_identifiers) (GDrive *drive);
+
+ GDriveStartStopType (* get_start_stop_type) (GDrive *drive);
+
+ gboolean (* can_start) (GDrive *drive);
+ gboolean (* can_start_degraded) (GDrive *drive);
+ void (* start) (GDrive *drive,
+ GDriveStartFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* start_finish) (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* can_stop) (GDrive *drive);
+ void (* stop) (GDrive *drive,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* stop_finish) (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+ /* signal, not VFunc */
+ void (* stop_button) (GDrive *drive);
+
+ void (* eject_with_operation) (GDrive *drive,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_with_operation_finish) (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+ const gchar * (* get_sort_key) (GDrive *drive);
+ GIcon * (* get_symbolic_icon) (GDrive *drive);
+ gboolean (* is_removable) (GDrive *drive);
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_drive_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+char * g_drive_get_name (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_drive_get_icon (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_drive_get_symbolic_icon (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_has_volumes (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+GList * g_drive_get_volumes (GDrive *drive);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_drive_is_removable (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_is_media_removable (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_has_media (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_is_media_check_automatic (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_can_poll_for_media (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_can_eject (GDrive *drive);
+GLIB_DEPRECATED_FOR(g_drive_eject_with_operation)
+void g_drive_eject (GDrive *drive,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_drive_eject_with_operation_finish)
+gboolean g_drive_eject_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_drive_poll_for_media (GDrive *drive,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_poll_for_media_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+char * g_drive_get_identifier (GDrive *drive,
+ const char *kind);
+GLIB_AVAILABLE_IN_ALL
+char ** g_drive_enumerate_identifiers (GDrive *drive);
+
+GLIB_AVAILABLE_IN_ALL
+GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_can_start (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_can_start_degraded (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+void g_drive_start (GDrive *drive,
+ GDriveStartFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_start_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_can_stop (GDrive *drive);
+GLIB_AVAILABLE_IN_ALL
+void g_drive_stop (GDrive *drive,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_stop_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_drive_eject_with_operation (GDrive *drive,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_drive_eject_with_operation_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+const gchar *g_drive_get_sort_key (GDrive *drive);
+
+G_END_DECLS
+
+#endif /* __G_DRIVE_H__ */
diff --git a/include/glib/gio/gdtlsclientconnection.h b/include/glib/gio/gdtlsclientconnection.h
new file mode 100644
index 0000000000..daf8e54ffe
--- /dev/null
+++ b/include/glib/gio/gdtlsclientconnection.h
@@ -0,0 +1,75 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2010 Red Hat, Inc.
+ * Copyright © 2015 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_DTLS_CLIENT_CONNECTION_H__
+#define __G_DTLS_CLIENT_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gdtlsconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DTLS_CLIENT_CONNECTION (g_dtls_client_connection_get_type ())
+#define G_DTLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CLIENT_CONNECTION, GDtlsClientConnection))
+#define G_IS_DTLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CLIENT_CONNECTION))
+#define G_DTLS_CLIENT_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CLIENT_CONNECTION, GDtlsClientConnectionInterface))
+
+typedef struct _GDtlsClientConnectionInterface GDtlsClientConnectionInterface;
+
+/**
+ * GDtlsClientConnectionInterface:
+ * @g_iface: The parent interface.
+ *
+ * vtable for a #GDtlsClientConnection implementation.
+ *
+ * Since: 2.48
+ */
+struct _GDtlsClientConnectionInterface
+{
+ GTypeInterface g_iface;
+};
+
+GLIB_AVAILABLE_IN_2_48
+GType g_dtls_client_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_48
+GDatagramBased *g_dtls_client_connection_new (GDatagramBased *base_socket,
+ GSocketConnectable *server_identity,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+GTlsCertificateFlags g_dtls_client_connection_get_validation_flags (GDtlsClientConnection *conn);
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_client_connection_set_validation_flags (GDtlsClientConnection *conn,
+ GTlsCertificateFlags flags);
+GLIB_AVAILABLE_IN_2_48
+GSocketConnectable *g_dtls_client_connection_get_server_identity (GDtlsClientConnection *conn);
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_client_connection_set_server_identity (GDtlsClientConnection *conn,
+ GSocketConnectable *identity);
+GLIB_AVAILABLE_IN_2_48
+GList * g_dtls_client_connection_get_accepted_cas (GDtlsClientConnection *conn);
+
+
+G_END_DECLS
+
+#endif /* __G_DTLS_CLIENT_CONNECTION_H__ */
diff --git a/include/glib/gio/gdtlsconnection.h b/include/glib/gio/gdtlsconnection.h
new file mode 100644
index 0000000000..3901cdc9ec
--- /dev/null
+++ b/include/glib/gio/gdtlsconnection.h
@@ -0,0 +1,206 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2010 Red Hat, Inc.
+ * Copyright © 2015 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_DTLS_CONNECTION_H__
+#define __G_DTLS_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gdatagrambased.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DTLS_CONNECTION (g_dtls_connection_get_type ())
+#define G_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnection))
+#define G_IS_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CONNECTION))
+#define G_DTLS_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnectionInterface))
+
+typedef struct _GDtlsConnectionInterface GDtlsConnectionInterface;
+
+/**
+ * GDtlsConnectionInterface:
+ * @g_iface: The parent interface.
+ * @accept_certificate: Check whether to accept a certificate.
+ * @handshake: Perform a handshake operation.
+ * @handshake_async: Start an asynchronous handshake operation.
+ * @handshake_finish: Finish an asynchronous handshake operation.
+ * @shutdown: Shut down one or both directions of the connection.
+ * @shutdown_async: Start an asynchronous shutdown operation.
+ * @shutdown_finish: Finish an asynchronous shutdown operation.
+ * @set_advertised_protocols: Set APLN protocol list
+ * @get_negotiated_protocol: Retrieve ALPN-negotiated protocol
+ *
+ * Virtual method table for a #GDtlsConnection implementation.
+ *
+ * Since: 2.48
+ */
+struct _GDtlsConnectionInterface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+ gboolean (*accept_certificate) (GDtlsConnection *connection,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors);
+
+ /* methods */
+ gboolean (*handshake) (GDtlsConnection *conn,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*handshake_async) (GDtlsConnection *conn,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*handshake_finish) (GDtlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (*shutdown) (GDtlsConnection *conn,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*shutdown_async) (GDtlsConnection *conn,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*shutdown_finish) (GDtlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+ void (*set_advertised_protocols) (GDtlsConnection *conn,
+ const gchar * const *protocols);
+ const gchar *(*get_negotiated_protocol) (GDtlsConnection *conn);
+};
+
+GLIB_AVAILABLE_IN_2_48
+GType g_dtls_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_set_database (GDtlsConnection *conn,
+ GTlsDatabase *database);
+GLIB_AVAILABLE_IN_2_48
+GTlsDatabase *g_dtls_connection_get_database (GDtlsConnection *conn);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_set_certificate (GDtlsConnection *conn,
+ GTlsCertificate *certificate);
+GLIB_AVAILABLE_IN_2_48
+GTlsCertificate *g_dtls_connection_get_certificate (GDtlsConnection *conn);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_set_interaction (GDtlsConnection *conn,
+ GTlsInteraction *interaction);
+GLIB_AVAILABLE_IN_2_48
+GTlsInteraction *g_dtls_connection_get_interaction (GDtlsConnection *conn);
+
+GLIB_AVAILABLE_IN_2_48
+GTlsCertificate *g_dtls_connection_get_peer_certificate (GDtlsConnection *conn);
+GLIB_AVAILABLE_IN_2_48
+GTlsCertificateFlags g_dtls_connection_get_peer_certificate_errors (GDtlsConnection *conn);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_set_require_close_notify (GDtlsConnection *conn,
+ gboolean require_close_notify);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_60
+void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
+ GTlsRehandshakeMode mode);
+GLIB_DEPRECATED_IN_2_60
+GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_handshake (GDtlsConnection *conn,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_handshake_async (GDtlsConnection *conn,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_handshake_finish (GDtlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_shutdown (GDtlsConnection *conn,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_shutdown_async (GDtlsConnection *conn,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_shutdown_finish (GDtlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_close (GDtlsConnection *conn,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+void g_dtls_connection_close_async (GDtlsConnection *conn,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_close_finish (GDtlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+/*< protected >*/
+GLIB_AVAILABLE_IN_2_48
+gboolean g_dtls_connection_emit_accept_certificate (GDtlsConnection *conn,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors);
+GLIB_AVAILABLE_IN_2_60
+void g_dtls_connection_set_advertised_protocols (GDtlsConnection *conn,
+ const gchar * const *protocols);
+
+GLIB_AVAILABLE_IN_2_60
+const gchar * g_dtls_connection_get_negotiated_protocol (GDtlsConnection *conn);
+
+G_END_DECLS
+
+#endif /* __G_DTLS_CONNECTION_H__ */
diff --git a/include/glib/gio/gdtlsserverconnection.h b/include/glib/gio/gdtlsserverconnection.h
new file mode 100644
index 0000000000..24ecb76c44
--- /dev/null
+++ b/include/glib/gio/gdtlsserverconnection.h
@@ -0,0 +1,69 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2010 Red Hat, Inc.
+ * Copyright © 2015 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_DTLS_SERVER_CONNECTION_H__
+#define __G_DTLS_SERVER_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gdtlsconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_DTLS_SERVER_CONNECTION (g_dtls_server_connection_get_type ())
+#define G_DTLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_SERVER_CONNECTION, GDtlsServerConnection))
+#define G_IS_DTLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_SERVER_CONNECTION))
+#define G_DTLS_SERVER_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_SERVER_CONNECTION, GDtlsServerConnectionInterface))
+
+/**
+ * GDtlsServerConnection:
+ *
+ * DTLS server-side connection. This is the server-side implementation
+ * of a #GDtlsConnection.
+ *
+ * Since: 2.48
+ */
+typedef struct _GDtlsServerConnectionInterface GDtlsServerConnectionInterface;
+
+/**
+ * GDtlsServerConnectionInterface:
+ * @g_iface: The parent interface.
+ *
+ * vtable for a #GDtlsServerConnection implementation.
+ *
+ * Since: 2.48
+ */
+struct _GDtlsServerConnectionInterface
+{
+ GTypeInterface g_iface;
+};
+
+GLIB_AVAILABLE_IN_2_48
+GType g_dtls_server_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_48
+GDatagramBased *g_dtls_server_connection_new (GDatagramBased *base_socket,
+ GTlsCertificate *certificate,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DTLS_SERVER_CONNECTION_H__ */
diff --git a/include/glib/gio/gemblem.h b/include/glib/gio/gemblem.h
new file mode 100644
index 0000000000..094f9cb87f
--- /dev/null
+++ b/include/glib/gio/gemblem.h
@@ -0,0 +1,61 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Clemens N. Buss <cebuzz@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __G_EMBLEM_H__
+#define __G_EMBLEM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gioenums.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_EMBLEM (g_emblem_get_type ())
+#define G_EMBLEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_EMBLEM, GEmblem))
+#define G_EMBLEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_EMBLEM, GEmblemClass))
+#define G_IS_EMBLEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_EMBLEM))
+#define G_IS_EMBLEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_EMBLEM))
+#define G_EMBLEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_EMBLEM, GEmblemClass))
+
+/**
+ * GEmblem:
+ *
+ * An object for Emblems
+ */
+typedef struct _GEmblem GEmblem;
+typedef struct _GEmblemClass GEmblemClass;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_emblem_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GEmblem *g_emblem_new (GIcon *icon);
+GLIB_AVAILABLE_IN_ALL
+GEmblem *g_emblem_new_with_origin (GIcon *icon,
+ GEmblemOrigin origin);
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_emblem_get_icon (GEmblem *emblem);
+GLIB_AVAILABLE_IN_ALL
+GEmblemOrigin g_emblem_get_origin (GEmblem *emblem);
+
+G_END_DECLS
+
+#endif /* __G_EMBLEM_H__ */
diff --git a/include/glib/gio/gemblemedicon.h b/include/glib/gio/gemblemedicon.h
new file mode 100644
index 0000000000..3374e0a68e
--- /dev/null
+++ b/include/glib/gio/gemblemedicon.h
@@ -0,0 +1,81 @@
+/* Gio - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Matthias Clasen <mclasen@redhat.com>
+ * Clemens N. Buss <cebuzz@gmail.com>
+ */
+
+#ifndef __G_EMBLEMED_ICON_H__
+#define __G_EMBLEMED_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gicon.h>
+#include <gio/gemblem.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_EMBLEMED_ICON (g_emblemed_icon_get_type ())
+#define G_EMBLEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_EMBLEMED_ICON, GEmblemedIcon))
+#define G_EMBLEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_EMBLEMED_ICON, GEmblemedIconClass))
+#define G_IS_EMBLEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_EMBLEMED_ICON))
+#define G_IS_EMBLEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_EMBLEMED_ICON))
+#define G_EMBLEMED_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_EMBLEMED_ICON, GEmblemedIconClass))
+
+/**
+ * GEmblemedIcon:
+ *
+ * An implementation of #GIcon for icons with emblems.
+ **/
+typedef struct _GEmblemedIcon GEmblemedIcon;
+typedef struct _GEmblemedIconClass GEmblemedIconClass;
+typedef struct _GEmblemedIconPrivate GEmblemedIconPrivate;
+
+struct _GEmblemedIcon
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GEmblemedIconPrivate *priv;
+};
+
+struct _GEmblemedIconClass
+{
+ GObjectClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_emblemed_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_emblemed_icon_new (GIcon *icon,
+ GEmblem *emblem);
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_emblemed_icon_get_icon (GEmblemedIcon *emblemed);
+GLIB_AVAILABLE_IN_ALL
+GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed);
+GLIB_AVAILABLE_IN_ALL
+void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed,
+ GEmblem *emblem);
+GLIB_AVAILABLE_IN_ALL
+void g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed);
+
+G_END_DECLS
+
+#endif /* __G_EMBLEMED_ICON_H__ */
diff --git a/include/glib/gio/gfile.h b/include/glib/gio/gfile.h
new file mode 100644
index 0000000000..8441d0bd1e
--- /dev/null
+++ b/include/glib/gio/gfile.h
@@ -0,0 +1,1285 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_H__
+#define __G_FILE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE (g_file_get_type ())
+#define G_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_FILE, GFile))
+#define G_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_FILE))
+#define G_FILE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_FILE, GFileIface))
+
+#if 0
+/**
+ * GFile:
+ *
+ * A handle to an object implementing the #GFileIface interface.
+ * Generally stores a location within the file system. Handles do not
+ * necessarily represent files or directories that currently exist.
+ **/
+typedef struct _GFile GFile; /* Dummy typedef */
+#endif
+typedef struct _GFileIface GFileIface;
+
+
+/**
+ * GFileIface:
+ * @g_iface: The parent interface.
+ * @dup: Duplicates a #GFile.
+ * @hash: Creates a hash of a #GFile.
+ * @equal: Checks equality of two given #GFiles.
+ * @is_native: Checks to see if a file is native to the system.
+ * @has_uri_scheme: Checks to see if a #GFile has a given URI scheme.
+ * @get_uri_scheme: Gets the URI scheme for a #GFile.
+ * @get_basename: Gets the basename for a given #GFile.
+ * @get_path: Gets the current path within a #GFile.
+ * @get_uri: Gets a URI for the path within a #GFile.
+ * @get_parse_name: Gets the parsed name for the #GFile.
+ * @get_parent: Gets the parent directory for the #GFile.
+ * @prefix_matches: Checks whether a #GFile contains a specified file.
+ * @get_relative_path: Gets the path for a #GFile relative to a given path.
+ * @resolve_relative_path: Resolves a relative path for a #GFile to an absolute path.
+ * @get_child_for_display_name: Gets the child #GFile for a given display name.
+ * @enumerate_children: Gets a #GFileEnumerator with the children of a #GFile.
+ * @enumerate_children_async: Asynchronously gets a #GFileEnumerator with the children of a #GFile.
+ * @enumerate_children_finish: Finishes asynchronously enumerating the children.
+ * @query_info: Gets the #GFileInfo for a #GFile.
+ * @query_info_async: Asynchronously gets the #GFileInfo for a #GFile.
+ * @query_info_finish: Finishes an asynchronous query info operation.
+ * @query_filesystem_info: Gets a #GFileInfo for the file system #GFile is on.
+ * @query_filesystem_info_async: Asynchronously gets a #GFileInfo for the file system #GFile is on.
+ * @query_filesystem_info_finish: Finishes asynchronously getting the file system info.
+ * @find_enclosing_mount: Gets a #GMount for the #GFile.
+ * @find_enclosing_mount_async: Asynchronously gets the #GMount for a #GFile.
+ * @find_enclosing_mount_finish: Finishes asynchronously getting the volume.
+ * @set_display_name: Sets the display name for a #GFile.
+ * @set_display_name_async: Asynchronously sets a #GFile's display name.
+ * @set_display_name_finish: Finishes asynchronously setting a #GFile's display name.
+ * @query_settable_attributes: Returns a list of #GFileAttributeInfos that can be set.
+ * @_query_settable_attributes_async: Asynchronously gets a list of #GFileAttributeInfos that can be set.
+ * @_query_settable_attributes_finish: Finishes asynchronously querying settable attributes.
+ * @query_writable_namespaces: Returns a list of #GFileAttributeInfo namespaces that are writable.
+ * @_query_writable_namespaces_async: Asynchronously gets a list of #GFileAttributeInfo namespaces that are writable.
+ * @_query_writable_namespaces_finish: Finishes asynchronously querying the writable namespaces.
+ * @set_attribute: Sets a #GFileAttributeInfo.
+ * @set_attributes_from_info: Sets a #GFileAttributeInfo with information from a #GFileInfo.
+ * @set_attributes_async: Asynchronously sets a file's attributes.
+ * @set_attributes_finish: Finishes setting a file's attributes asynchronously.
+ * @read_fn: Reads a file asynchronously.
+ * @read_async: Asynchronously reads a file.
+ * @read_finish: Finishes asynchronously reading a file.
+ * @append_to: Writes to the end of a file.
+ * @append_to_async: Asynchronously writes to the end of a file.
+ * @append_to_finish: Finishes an asynchronous file append operation.
+ * @create: Creates a new file.
+ * @create_async: Asynchronously creates a file.
+ * @create_finish: Finishes asynchronously creating a file.
+ * @replace: Replaces the contents of a file.
+ * @replace_async: Asynchronously replaces the contents of a file.
+ * @replace_finish: Finishes asynchronously replacing a file.
+ * @delete_file: Deletes a file.
+ * @delete_file_async: Asynchronously deletes a file.
+ * @delete_file_finish: Finishes an asynchronous delete.
+ * @trash: Sends a #GFile to the Trash location.
+ * @trash_async: Asynchronously sends a #GFile to the Trash location.
+ * @trash_finish: Finishes an asynchronous file trashing operation.
+ * @make_directory: Makes a directory.
+ * @make_directory_async: Asynchronously makes a directory.
+ * @make_directory_finish: Finishes making a directory asynchronously.
+ * @make_symbolic_link: Makes a symbolic link.
+ * @_make_symbolic_link_async: Asynchronously makes a symbolic link
+ * @_make_symbolic_link_finish: Finishes making a symbolic link asynchronously.
+ * @copy: Copies a file.
+ * @copy_async: Asynchronously copies a file.
+ * @copy_finish: Finishes an asynchronous copy operation.
+ * @move: Moves a file.
+ * @_move_async: Asynchronously moves a file.
+ * @_move_finish: Finishes an asynchronous move operation.
+ * @mount_mountable: Mounts a mountable object.
+ * @mount_mountable_finish: Finishes a mounting operation.
+ * @unmount_mountable: Unmounts a mountable object.
+ * @unmount_mountable_finish: Finishes an unmount operation.
+ * @eject_mountable: Ejects a mountable.
+ * @eject_mountable_finish: Finishes an eject operation.
+ * @mount_enclosing_volume: Mounts a specified location.
+ * @mount_enclosing_volume_finish: Finishes mounting a specified location.
+ * @monitor_dir: Creates a #GFileMonitor for the location.
+ * @monitor_file: Creates a #GFileMonitor for the location.
+ * @open_readwrite: Open file read/write. Since 2.22.
+ * @open_readwrite_async: Asynchronously opens file read/write. Since 2.22.
+ * @open_readwrite_finish: Finishes an asynchronous open read/write. Since 2.22.
+ * @create_readwrite: Creates file read/write. Since 2.22.
+ * @create_readwrite_async: Asynchronously creates file read/write. Since 2.22.
+ * @create_readwrite_finish: Finishes an asynchronous creates read/write. Since 2.22.
+ * @replace_readwrite: Replaces file read/write. Since 2.22.
+ * @replace_readwrite_async: Asynchronously replaces file read/write. Since 2.22.
+ * @replace_readwrite_finish: Finishes an asynchronous replace read/write. Since 2.22.
+ * @start_mountable: Starts a mountable object. Since 2.22.
+ * @start_mountable_finish: Finishes a start operation. Since 2.22.
+ * @stop_mountable: Stops a mountable. Since 2.22.
+ * @stop_mountable_finish: Finishes a stop operation. Since 2.22.
+ * @supports_thread_contexts: a boolean that indicates whether the #GFile implementation supports thread-default contexts. Since 2.22.
+ * @unmount_mountable_with_operation: Unmounts a mountable object using a #GMountOperation. Since 2.22.
+ * @unmount_mountable_with_operation_finish: Finishes an unmount operation using a #GMountOperation. Since 2.22.
+ * @eject_mountable_with_operation: Ejects a mountable object using a #GMountOperation. Since 2.22.
+ * @eject_mountable_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
+ * @poll_mountable: Polls a mountable object for media changes. Since 2.22.
+ * @poll_mountable_finish: Finishes a poll operation for media changes. Since 2.22.
+ * @measure_disk_usage: Recursively measures the disk usage of @file. Since 2.38
+ * @measure_disk_usage_async: Asynchronously recursively measures the disk usage of @file. Since 2.38
+ * @measure_disk_usage_finish: Finishes an asynchronous recursive measurement of the disk usage of @file. Since 2.38
+ *
+ * An interface for writing VFS file handles.
+ **/
+struct _GFileIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GFile * (* dup) (GFile *file);
+ guint (* hash) (GFile *file);
+ gboolean (* equal) (GFile *file1,
+ GFile *file2);
+ gboolean (* is_native) (GFile *file);
+ gboolean (* has_uri_scheme) (GFile *file,
+ const char *uri_scheme);
+ char * (* get_uri_scheme) (GFile *file);
+ char * (* get_basename) (GFile *file);
+ char * (* get_path) (GFile *file);
+ char * (* get_uri) (GFile *file);
+ char * (* get_parse_name) (GFile *file);
+ GFile * (* get_parent) (GFile *file);
+ gboolean (* prefix_matches) (GFile *prefix,
+ GFile *file);
+ char * (* get_relative_path) (GFile *parent,
+ GFile *descendant);
+ GFile * (* resolve_relative_path) (GFile *file,
+ const char *relative_path);
+ GFile * (* get_child_for_display_name) (GFile *file,
+ const char *display_name,
+ GError **error);
+
+ GFileEnumerator * (* enumerate_children) (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* enumerate_children_async) (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileEnumerator * (* enumerate_children_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileInfo * (* query_info) (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* query_info_async) (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInfo * (* query_info_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileInfo * (* query_filesystem_info) (GFile *file,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+ void (* query_filesystem_info_async) (GFile *file,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInfo * (* query_filesystem_info_finish)(GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GMount * (* find_enclosing_mount) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* find_enclosing_mount_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GMount * (* find_enclosing_mount_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFile * (* set_display_name) (GFile *file,
+ const char *display_name,
+ GCancellable *cancellable,
+ GError **error);
+ void (* set_display_name_async) (GFile *file,
+ const char *display_name,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFile * (* set_display_name_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileAttributeInfoList * (* query_settable_attributes) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* _query_settable_attributes_async) (void);
+ void (* _query_settable_attributes_finish) (void);
+
+ GFileAttributeInfoList * (* query_writable_namespaces) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* _query_writable_namespaces_async) (void);
+ void (* _query_writable_namespaces_finish) (void);
+
+ gboolean (* set_attribute) (GFile *file,
+ const char *attribute,
+ GFileAttributeType type,
+ gpointer value_p,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* set_attributes_from_info) (GFile *file,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* set_attributes_async) (GFile *file,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* set_attributes_finish) (GFile *file,
+ GAsyncResult *result,
+ GFileInfo **info,
+ GError **error);
+
+ GFileInputStream * (* read_fn) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* read_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInputStream * (* read_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileOutputStream * (* append_to) (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* append_to_async) (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileOutputStream * (* append_to_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileOutputStream * (* create) (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* create_async) (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileOutputStream * (* create_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ GFileOutputStream * (* replace) (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* replace_async) (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileOutputStream * (* replace_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ gboolean (* delete_file) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* delete_file_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* delete_file_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* trash) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* trash_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* trash_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* make_directory) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* make_directory_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* make_directory_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* make_symbolic_link) (GFile *file,
+ const char *symlink_value,
+ GCancellable *cancellable,
+ GError **error);
+ void (* _make_symbolic_link_async) (void);
+ void (* _make_symbolic_link_finish) (void);
+
+ gboolean (* copy) (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error);
+ void (* copy_async) (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* copy_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ gboolean (* move) (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error);
+ void (* _move_async) (void);
+ void (* _move_finish) (void);
+
+ void (* mount_mountable) (GFile *file,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFile * (* mount_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* unmount_mountable) (GFile *file,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* unmount_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* eject_mountable) (GFile *file,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* mount_enclosing_volume) (GFile *location,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* mount_enclosing_volume_finish) (GFile *location,
+ GAsyncResult *result,
+ GError **error);
+
+ GFileMonitor * (* monitor_dir) (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ GFileMonitor * (* monitor_file) (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ GFileIOStream * (* open_readwrite) (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+ void (* open_readwrite_async) (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileIOStream * (* open_readwrite_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+ GFileIOStream * (* create_readwrite) (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* create_readwrite_async) (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileIOStream * (* create_readwrite_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+ GFileIOStream * (* replace_readwrite) (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* replace_readwrite_async) (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileIOStream * (* replace_readwrite_finish) (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+
+ void (* start_mountable) (GFile *file,
+ GDriveStartFlags flags,
+ GMountOperation *start_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* start_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* stop_mountable) (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* stop_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean supports_thread_contexts;
+
+ void (* unmount_mountable_with_operation) (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* unmount_mountable_with_operation_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* eject_mountable_with_operation) (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_mountable_with_operation_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* poll_mountable) (GFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* poll_mountable_finish) (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* measure_disk_usage) (GFile *file,
+ GFileMeasureFlags flags,
+ GCancellable *cancellable,
+ GFileMeasureProgressCallback progress_callback,
+ gpointer progress_data,
+ guint64 *disk_usage,
+ guint64 *num_dirs,
+ guint64 *num_files,
+ GError **error);
+ void (* measure_disk_usage_async) (GFile *file,
+ GFileMeasureFlags flags,
+ gint io_priority,
+ GCancellable *cancellable,
+ GFileMeasureProgressCallback progress_callback,
+ gpointer progress_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* measure_disk_usage_finish) (GFile *file,
+ GAsyncResult *result,
+ guint64 *disk_usage,
+ guint64 *num_dirs,
+ guint64 *num_files,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_new_for_path (const char *path);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_new_for_uri (const char *uri);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_new_for_commandline_arg (const char *arg);
+GLIB_AVAILABLE_IN_2_36
+GFile * g_file_new_for_commandline_arg_and_cwd (const gchar *arg,
+ const gchar *cwd);
+GLIB_AVAILABLE_IN_2_32
+GFile * g_file_new_tmp (const char *tmpl,
+ GFileIOStream **iostream,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_parse_name (const char *parse_name);
+GLIB_AVAILABLE_IN_2_56
+GFile * g_file_new_build_filename (const gchar *first_element,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_dup (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+guint g_file_hash (gconstpointer file);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_equal (GFile *file1,
+ GFile *file2);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_basename (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_path (GFile *file);
+GLIB_AVAILABLE_IN_2_56
+const char * g_file_peek_path (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_uri (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_parse_name (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_get_parent (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_has_parent (GFile *file,
+ GFile *parent);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_get_child (GFile *file,
+ const char *name);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_get_child_for_display_name (GFile *file,
+ const char *display_name,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_has_prefix (GFile *file,
+ GFile *prefix);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_relative_path (GFile *parent,
+ GFile *descendant);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_resolve_relative_path (GFile *file,
+ const char *relative_path);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_is_native (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_has_uri_scheme (GFile *file,
+ const char *uri_scheme);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_get_uri_scheme (GFile *file);
+GLIB_AVAILABLE_IN_ALL
+GFileInputStream * g_file_read (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_read_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInputStream * g_file_read_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_append_to (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_create (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_replace (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_append_to_async (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_append_to_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_create_async (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_create_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_replace_async (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileOutputStream * g_file_replace_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_open_readwrite (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_open_readwrite_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_open_readwrite_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_create_readwrite (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_create_readwrite_async (GFile *file,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_create_readwrite_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_replace_readwrite (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_replace_readwrite_async (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileIOStream * g_file_replace_readwrite_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_query_exists (GFile *file,
+ GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+GFileType g_file_query_file_type (GFile *file,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_query_info (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_query_info_async (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_query_info_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_query_filesystem_info (GFile *file,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_query_filesystem_info_async (GFile *file,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_query_filesystem_info_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GMount * g_file_find_enclosing_mount (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_find_enclosing_mount_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GMount * g_file_find_enclosing_mount_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileEnumerator * g_file_enumerate_children (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_enumerate_children_async (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileEnumerator * g_file_enumerate_children_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_set_display_name (GFile *file,
+ const char *display_name,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_set_display_name_async (GFile *file,
+ const char *display_name,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_set_display_name_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_delete (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34
+void g_file_delete_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_34
+gboolean g_file_delete_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_trash (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_38
+void g_file_trash_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_38
+gboolean g_file_trash_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_copy (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_copy_async (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_copy_finish (GFile *file,
+ GAsyncResult *res,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_move (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_make_directory (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_38
+void g_file_make_directory_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_38
+gboolean g_file_make_directory_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_make_directory_with_parents (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_make_symbolic_link (GFile *file,
+ const char *symlink_value,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeInfoList *g_file_query_settable_attributes (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeInfoList *g_file_query_writable_namespaces (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute (GFile *file,
+ const char *attribute,
+ GFileAttributeType type,
+ gpointer value_p,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attributes_from_info (GFile *file,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_set_attributes_async (GFile *file,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attributes_finish (GFile *file,
+ GAsyncResult *result,
+ GFileInfo **info,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_string (GFile *file,
+ const char *attribute,
+ const char *value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_byte_string (GFile *file,
+ const char *attribute,
+ const char *value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_uint32 (GFile *file,
+ const char *attribute,
+ guint32 value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_int32 (GFile *file,
+ const char *attribute,
+ gint32 value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_uint64 (GFile *file,
+ const char *attribute,
+ guint64 value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_attribute_int64 (GFile *file,
+ const char *attribute,
+ gint64 value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_mount_enclosing_volume (GFile *location,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_mount_enclosing_volume_finish (GFile *location,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_mount_mountable (GFile *file,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_mount_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation)
+void g_file_unmount_mountable (GFile *file,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation_finish)
+gboolean g_file_unmount_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_unmount_mountable_with_operation (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_unmount_mountable_with_operation_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation)
+void g_file_eject_mountable (GFile *file,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation_finish)
+gboolean g_file_eject_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_eject_mountable_with_operation (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_eject_mountable_with_operation_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_copy_attributes (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+
+GLIB_AVAILABLE_IN_ALL
+GFileMonitor* g_file_monitor_directory (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileMonitor* g_file_monitor_file (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GFileMonitor* g_file_monitor (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_38
+gboolean g_file_measure_disk_usage (GFile *file,
+ GFileMeasureFlags flags,
+ GCancellable *cancellable,
+ GFileMeasureProgressCallback progress_callback,
+ gpointer progress_data,
+ guint64 *disk_usage,
+ guint64 *num_dirs,
+ guint64 *num_files,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_38
+void g_file_measure_disk_usage_async (GFile *file,
+ GFileMeasureFlags flags,
+ gint io_priority,
+ GCancellable *cancellable,
+ GFileMeasureProgressCallback progress_callback,
+ gpointer progress_data,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_38
+gboolean g_file_measure_disk_usage_finish (GFile *file,
+ GAsyncResult *result,
+ guint64 *disk_usage,
+ guint64 *num_dirs,
+ guint64 *num_files,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_file_start_mountable (GFile *file,
+ GDriveStartFlags flags,
+ GMountOperation *start_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_start_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_stop_mountable (GFile *file,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_stop_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_file_poll_mountable (GFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_poll_mountable_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+/* Utilities */
+
+GLIB_AVAILABLE_IN_ALL
+GAppInfo *g_file_query_default_handler (GFile *file,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+void g_file_query_default_handler_async (GFile *file,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_60
+GAppInfo *g_file_query_default_handler_finish (GFile *file,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_load_contents (GFile *file,
+ GCancellable *cancellable,
+ char **contents,
+ gsize *length,
+ char **etag_out,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_load_contents_async (GFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_load_contents_finish (GFile *file,
+ GAsyncResult *res,
+ char **contents,
+ gsize *length,
+ char **etag_out,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_load_partial_contents_async (GFile *file,
+ GCancellable *cancellable,
+ GFileReadMoreCallback read_more_callback,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_load_partial_contents_finish (GFile *file,
+ GAsyncResult *res,
+ char **contents,
+ gsize *length,
+ char **etag_out,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_replace_contents (GFile *file,
+ const char *contents,
+ gsize length,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ char **new_etag,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_replace_contents_async (GFile *file,
+ const char *contents,
+ gsize length,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_40
+void g_file_replace_contents_bytes_async (GFile *file,
+ GBytes *contents,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_replace_contents_finish (GFile *file,
+ GAsyncResult *res,
+ char **new_etag,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_supports_thread_contexts (GFile *file);
+
+GLIB_AVAILABLE_IN_2_56
+GBytes *g_file_load_bytes (GFile *file,
+ GCancellable *cancellable,
+ gchar **etag_out,
+ GError **error);
+GLIB_AVAILABLE_IN_2_56
+void g_file_load_bytes_async (GFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_56
+GBytes *g_file_load_bytes_finish (GFile *file,
+ GAsyncResult *result,
+ gchar **etag_out,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_FILE_H__ */
diff --git a/include/glib/gio/gfileattribute.h b/include/glib/gio/gfileattribute.h
new file mode 100644
index 0000000000..a551047015
--- /dev/null
+++ b/include/glib/gio/gfileattribute.h
@@ -0,0 +1,84 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_ATTRIBUTE_H__
+#define __G_FILE_ATTRIBUTE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GFileAttributeInfo:
+ * @name: the name of the attribute.
+ * @type: the #GFileAttributeType type of the attribute.
+ * @flags: a set of #GFileAttributeInfoFlags.
+ *
+ * Information about a specific attribute.
+ **/
+struct _GFileAttributeInfo
+{
+ char *name;
+ GFileAttributeType type;
+ GFileAttributeInfoFlags flags;
+};
+
+/**
+ * GFileAttributeInfoList:
+ * @infos: an array of #GFileAttributeInfos.
+ * @n_infos: the number of values in the array.
+ *
+ * Acts as a lightweight registry for possible valid file attributes.
+ * The registry stores Key-Value pair formats as #GFileAttributeInfos.
+ **/
+struct _GFileAttributeInfoList
+{
+ GFileAttributeInfo *infos;
+ int n_infos;
+};
+
+#define G_TYPE_FILE_ATTRIBUTE_INFO_LIST (g_file_attribute_info_list_get_type ())
+GLIB_AVAILABLE_IN_ALL
+GType g_file_attribute_info_list_get_type (void);
+
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeInfoList * g_file_attribute_info_list_new (void);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeInfoList * g_file_attribute_info_list_ref (GFileAttributeInfoList *list);
+GLIB_AVAILABLE_IN_ALL
+void g_file_attribute_info_list_unref (GFileAttributeInfoList *list);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeInfoList * g_file_attribute_info_list_dup (GFileAttributeInfoList *list);
+GLIB_AVAILABLE_IN_ALL
+const GFileAttributeInfo *g_file_attribute_info_list_lookup (GFileAttributeInfoList *list,
+ const char *name);
+GLIB_AVAILABLE_IN_ALL
+void g_file_attribute_info_list_add (GFileAttributeInfoList *list,
+ const char *name,
+ GFileAttributeType type,
+ GFileAttributeInfoFlags flags);
+
+G_END_DECLS
+
+#endif /* __G_FILE_INFO_H__ */
diff --git a/include/glib/gio/gfileenumerator.h b/include/glib/gio/gfileenumerator.h
new file mode 100644
index 0000000000..d4fd396b64
--- /dev/null
+++ b/include/glib/gio/gfileenumerator.h
@@ -0,0 +1,152 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_ENUMERATOR_H__
+#define __G_FILE_ENUMERATOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_ENUMERATOR (g_file_enumerator_get_type ())
+#define G_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumerator))
+#define G_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
+#define G_IS_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ENUMERATOR))
+#define G_IS_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ENUMERATOR))
+#define G_FILE_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass))
+
+/**
+ * GFileEnumerator:
+ *
+ * A per matched file iterator.
+ **/
+typedef struct _GFileEnumeratorClass GFileEnumeratorClass;
+typedef struct _GFileEnumeratorPrivate GFileEnumeratorPrivate;
+
+struct _GFileEnumerator
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GFileEnumeratorPrivate *priv;
+};
+
+struct _GFileEnumeratorClass
+{
+ GObjectClass parent_class;
+
+ /* Virtual Table */
+
+ GFileInfo * (* next_file) (GFileEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* close_fn) (GFileEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* next_files_async) (GFileEnumerator *enumerator,
+ int num_files,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GList * (* next_files_finish) (GFileEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+ void (* close_async) (GFileEnumerator *enumerator,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* close_finish) (GFileEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_enumerator_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_enumerator_next_file (GFileEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_enumerator_close (GFileEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_enumerator_next_files_async (GFileEnumerator *enumerator,
+ int num_files,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GList * g_file_enumerator_next_files_finish (GFileEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_enumerator_close_async (GFileEnumerator *enumerator,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_enumerator_close_finish (GFileEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_enumerator_is_closed (GFileEnumerator *enumerator);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_enumerator_has_pending (GFileEnumerator *enumerator);
+GLIB_AVAILABLE_IN_ALL
+void g_file_enumerator_set_pending (GFileEnumerator *enumerator,
+ gboolean pending);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_enumerator_get_container (GFileEnumerator *enumerator);
+GLIB_AVAILABLE_IN_2_36
+GFile * g_file_enumerator_get_child (GFileEnumerator *enumerator,
+ GFileInfo *info);
+
+GLIB_AVAILABLE_IN_2_44
+gboolean g_file_enumerator_iterate (GFileEnumerator *direnum,
+ GFileInfo **out_info,
+ GFile **out_child,
+ GCancellable *cancellable,
+ GError **error);
+
+
+G_END_DECLS
+
+#endif /* __G_FILE_ENUMERATOR_H__ */
diff --git a/include/glib/gio/gfileicon.h b/include/glib/gio/gfileicon.h
new file mode 100644
index 0000000000..08a4ea6cf6
--- /dev/null
+++ b/include/glib/gio/gfileicon.h
@@ -0,0 +1,57 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_ICON_H__
+#define __G_FILE_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_ICON (g_file_icon_get_type ())
+#define G_FILE_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ICON, GFileIcon))
+#define G_FILE_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ICON, GFileIconClass))
+#define G_IS_FILE_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ICON))
+#define G_IS_FILE_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ICON))
+#define G_FILE_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ICON, GFileIconClass))
+
+/**
+ * GFileIcon:
+ *
+ * Gets an icon for a #GFile. Implements #GLoadableIcon.
+ **/
+typedef struct _GFileIconClass GFileIconClass;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_file_icon_new (GFile *file);
+
+GLIB_AVAILABLE_IN_ALL
+GFile * g_file_icon_get_file (GFileIcon *icon);
+
+G_END_DECLS
+
+#endif /* __G_FILE_ICON_H__ */
diff --git a/include/glib/gio/gfileinfo.h b/include/glib/gio/gfileinfo.h
new file mode 100644
index 0000000000..1629a2edb1
--- /dev/null
+++ b/include/glib/gio/gfileinfo.h
@@ -0,0 +1,1144 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_INFO_H__
+#define __G_FILE_INFO_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_INFO (g_file_info_get_type ())
+#define G_FILE_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_INFO, GFileInfo))
+#define G_FILE_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_INFO, GFileInfoClass))
+#define G_IS_FILE_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_INFO))
+#define G_IS_FILE_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_INFO))
+#define G_FILE_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_INFO, GFileInfoClass))
+
+/**
+ * GFileInfo:
+ *
+ * Stores information about a file system object referenced by a #GFile.
+ **/
+typedef struct _GFileInfoClass GFileInfoClass;
+
+
+/* Common Attributes: */
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_TYPE:
+ *
+ * A key in the "standard" namespace for storing file types.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ * The value for this key should contain a #GFileType.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_TYPE "standard::type" /* uint32 (GFileType) */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN:
+ *
+ * A key in the "standard" namespace for checking if a file is hidden.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "standard::is-hidden" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP:
+ *
+ * A key in the "standard" namespace for checking if a file is a backup file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP "standard::is-backup" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK:
+ *
+ * A key in the "standard" namespace for checking if the file is a symlink.
+ * Typically the actual type is something else, if we followed the symlink
+ * to get the type.
+ * On Windows NTFS mountpoints are considered to be symlinks as well.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "standard::is-symlink" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL:
+ *
+ * A key in the "standard" namespace for checking if a file is virtual.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL "standard::is-virtual" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE:
+ *
+ * A key in the "standard" namespace for checking if a file is
+ * volatile. This is meant for opaque, non-POSIX-like backends to
+ * indicate that the URI is not persistent. Applications should look
+ * at #G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI.
+ *
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.46
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE "standard::is-volatile" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_NAME:
+ *
+ * A key in the "standard" namespace for getting the name of the file.
+ * The name is the on-disk filename which may not be in any known encoding,
+ * and can thus not be generally displayed as is.
+ * Use #G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the
+ * name in a user interface.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_NAME "standard::name" /* byte string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME:
+ *
+ * A key in the "standard" namespace for getting the display name of the file.
+ * A display name is guaranteed to be in UTF8 and can thus be displayed in
+ * the UI.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "standard::display-name" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME:
+ *
+ * A key in the "standard" namespace for edit name of the file.
+ * An edit name is similar to the display name, but it is meant to be
+ * used when you want to rename the file in the UI. The display name
+ * might contain information you don't want in the new filename (such as
+ * "(invalid unicode)" if the filename was in an invalid encoding).
+ *
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME "standard::edit-name" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_COPY_NAME:
+ *
+ * A key in the "standard" namespace for getting the copy name of the file.
+ * The copy name is an optional version of the name. If available it's always
+ * in UTF8, and corresponds directly to the original filename (only transcoded to
+ * UTF8). This is useful if you want to copy the file to another filesystem that
+ * might have a different encoding. If the filename is not a valid string in the
+ * encoding selected for the filesystem it is in then the copy name will not be set.
+ *
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_COPY_NAME "standard::copy-name" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION:
+ *
+ * A key in the "standard" namespace for getting the description of the file.
+ * The description is a utf8 string that describes the file, generally containing
+ * the filename, but can also contain furter information. Example descriptions
+ * could be "filename (on hostname)" for a remote file or "filename (in trash)"
+ * for a file in the trash. This is useful for instance as the window title
+ * when displaying a directory or for a bookmarks menu.
+ *
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION "standard::description" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_ICON:
+ *
+ * A key in the "standard" namespace for getting the icon for the file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT.
+ * The value for this key should contain a #GIcon.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_ICON "standard::icon" /* object (GIcon) */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON:
+ *
+ * A key in the "standard" namespace for getting the symbolic icon for the file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT.
+ * The value for this key should contain a #GIcon.
+ *
+ * Since: 2.34
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON "standard::symbolic-icon" /* object (GIcon) */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE:
+ *
+ * A key in the "standard" namespace for getting the content type of the file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ * The value for this key should contain a valid content type.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE:
+ *
+ * A key in the "standard" namespace for getting the fast content type.
+ * The fast content type isn't as reliable as the regular one, as it
+ * only uses the filename to guess it, but it is faster to calculate than the
+ * regular content type.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ *
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE "standard::fast-content-type" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_SIZE:
+ *
+ * A key in the "standard" namespace for getting the file's size (in bytes).
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_SIZE "standard::size" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE:
+ *
+ * A key in the "standard" namespace for getting the amount of disk space
+ * that is consumed by the file (in bytes). This will generally be larger
+ * than the file size (due to block size overhead) but can occasionally be
+ * smaller (for example, for sparse files).
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ *
+ * Since: 2.20
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE "standard::allocated-size" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET:
+ *
+ * A key in the "standard" namespace for getting the symlink target, if the file
+ * is a symlink. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "standard::symlink-target" /* byte string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_TARGET_URI:
+ *
+ * A key in the "standard" namespace for getting the target URI for the file, in
+ * the case of %G_FILE_TYPE_SHORTCUT or %G_FILE_TYPE_MOUNTABLE files.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_TARGET_URI "standard::target-uri" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER:
+ *
+ * A key in the "standard" namespace for setting the sort order of a file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_INT32.
+ * An example use would be in file managers, which would use this key
+ * to set the order files are displayed. Files with smaller sort order
+ * should be sorted first, and files without sort order as if sort order
+ * was zero.
+ **/
+#define G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER "standard::sort-order" /* int32 */
+
+/* Entity tags, used to avoid missing updates on save */
+
+/**
+ * G_FILE_ATTRIBUTE_ETAG_VALUE:
+ *
+ * A key in the "etag" namespace for getting the value of the file's
+ * entity tag. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_ETAG_VALUE "etag::value" /* string */
+
+/* File identifier, for e.g. avoiding loops when doing recursive
+ * directory scanning
+ */
+
+/**
+ * G_FILE_ATTRIBUTE_ID_FILE:
+ *
+ * A key in the "id" namespace for getting a file identifier.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ * An example use would be during listing files, to avoid recursive
+ * directory scanning.
+ **/
+#define G_FILE_ATTRIBUTE_ID_FILE "id::file" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_ID_FILESYSTEM:
+ *
+ * A key in the "id" namespace for getting the file system identifier.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ * An example use would be during drag and drop to see if the source
+ * and target are on the same filesystem (default to move) or not (default
+ * to copy).
+ **/
+#define G_FILE_ATTRIBUTE_ID_FILESYSTEM "id::filesystem" /* string */
+
+/* Calculated Access Rights for current user */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_READ:
+ *
+ * A key in the "access" namespace for getting read privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to read the file.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_READ "access::can-read" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE:
+ *
+ * A key in the "access" namespace for getting write privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to write to the file.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "access::can-write" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE:
+ *
+ * A key in the "access" namespace for getting execution privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to execute the file.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE "access::can-execute" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE:
+ *
+ * A key in the "access" namespace for checking deletion privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to delete the file.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE "access::can-delete" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH:
+ *
+ * A key in the "access" namespace for checking trashing privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to move the file to
+ * the trash.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH "access::can-trash" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME:
+ *
+ * A key in the "access" namespace for checking renaming privileges.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ * This attribute will be %TRUE if the user is able to rename the file.
+ **/
+#define G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME "access::can-rename" /* boolean */
+
+/* TODO: Should we have special version for directories? can_enumerate, etc */
+
+/* Mountable attributes */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) is mountable.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT "mountable::can-mount" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) is unmountable.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT "mountable::can-unmount" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be ejected.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT "mountable::can-eject" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE:
+ *
+ * A key in the "mountable" namespace for getting the unix device.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE "mountable::unix-device" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE:
+ *
+ * A key in the "mountable" namespace for getting the unix device file.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ *
+ * Since: 2.22
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE "mountable::unix-device-file" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI:
+ *
+ * A key in the "mountable" namespace for getting the HAL UDI for the mountable
+ * file. Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI "mountable::hal-udi" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be started.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START "mountable::can-start" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be started
+ * degraded.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED "mountable::can-start-degraded" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be stopped.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP "mountable::can-stop" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE:
+ *
+ * A key in the "mountable" namespace for getting the #GDriveStartStopType.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE "mountable::start-stop-type" /* uint32 (GDriveStartStopType) */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be polled.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL "mountable::can-poll" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC:
+ *
+ * A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE)
+ * is automatically polled for media.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.22
+ */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC "mountable::is-media-check-automatic" /* boolean */
+
+/* Time attributes */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_MODIFIED:
+ *
+ * A key in the "time" namespace for getting the time the file was last
+ * modified. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the time since the
+ * file was modified, in seconds since the UNIX epoch.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_MODIFIED "time::modified" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC:
+ *
+ * A key in the "time" namespace for getting the microseconds of the time
+ * the file was last modified. This should be used in conjunction with
+ * #G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC "time::modified-usec" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_ACCESS:
+ *
+ * A key in the "time" namespace for getting the time the file was last
+ * accessed. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the time since the
+ * file was last accessed, in seconds since the UNIX epoch.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_ACCESS "time::access" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_ACCESS_USEC:
+ *
+ * A key in the "time" namespace for getting the microseconds of the time
+ * the file was last accessed. This should be used in conjunction with
+ * #G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_ACCESS_USEC "time::access-usec" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_CHANGED:
+ *
+ * A key in the "time" namespace for getting the time the file was last
+ * changed. Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64,
+ * and contains the time since the file was last changed, in seconds since the
+ * UNIX epoch.
+ *
+ * This corresponds to the traditional UNIX ctime.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_CHANGED "time::changed" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_CHANGED_USEC:
+ *
+ * A key in the "time" namespace for getting the microseconds of the time
+ * the file was last changed. This should be used in conjunction with
+ * #G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_CHANGED_USEC "time::changed-usec" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_CREATED:
+ *
+ * A key in the "time" namespace for getting the time the file was created.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64,
+ * and contains the time since the file was created, in seconds since the UNIX
+ * epoch.
+ *
+ * This corresponds to the NTFS ctime.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_CREATED "time::created" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_TIME_CREATED_USEC:
+ *
+ * A key in the "time" namespace for getting the microseconds of the time
+ * the file was created. This should be used in conjunction with
+ * #G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_TIME_CREATED_USEC "time::created-usec" /* uint32 */
+
+/* Unix specific attributes */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_DEVICE:
+ *
+ * A key in the "unix" namespace for getting the device id of the device the
+ * file is located on (see stat() documentation). This attribute is only
+ * available for UNIX file systems. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_DEVICE "unix::device" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_INODE:
+ *
+ * A key in the "unix" namespace for getting the inode of the file.
+ * This attribute is only available for UNIX file systems. Corresponding
+ * #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_INODE "unix::inode" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_MODE:
+ *
+ * A key in the "unix" namespace for getting the mode of the file
+ * (e.g. whether the file is a regular file, symlink, etc). See lstat()
+ * documentation. This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_MODE "unix::mode" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_NLINK:
+ *
+ * A key in the "unix" namespace for getting the number of hard links
+ * for a file. See lstat() documentation. This attribute is only available
+ * for UNIX file systems. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_NLINK "unix::nlink" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_UID:
+ *
+ * A key in the "unix" namespace for getting the user ID for the file.
+ * This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_UID "unix::uid" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_GID:
+ *
+ * A key in the "unix" namespace for getting the group ID for the file.
+ * This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_GID "unix::gid" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_RDEV:
+ *
+ * A key in the "unix" namespace for getting the device ID for the file
+ * (if it is a special file). See lstat() documentation. This attribute
+ * is only available for UNIX file systems. Corresponding #GFileAttributeType
+ * is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_RDEV "unix::rdev" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE:
+ *
+ * A key in the "unix" namespace for getting the block size for the file
+ * system. This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE "unix::block-size" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_BLOCKS:
+ *
+ * A key in the "unix" namespace for getting the number of blocks allocated
+ * for the file. This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_BLOCKS "unix::blocks" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT:
+ *
+ * A key in the "unix" namespace for checking if the file represents a
+ * UNIX mount point. This attribute is %TRUE if the file is a UNIX mount
+ * point. Since 2.58, `/` is considered to be a mount point.
+ * This attribute is only available for UNIX file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT "unix::is-mountpoint" /* boolean */
+
+/* DOS specific attributes */
+
+/**
+ * G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE:
+ *
+ * A key in the "dos" namespace for checking if the file's archive flag
+ * is set. This attribute is %TRUE if the archive flag is set. This attribute
+ * is only available for DOS file systems. Corresponding #GFileAttributeType
+ * is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE "dos::is-archive" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_DOS_IS_SYSTEM:
+ *
+ * A key in the "dos" namespace for checking if the file's backup flag
+ * is set. This attribute is %TRUE if the backup flag is set. This attribute
+ * is only available for DOS file systems. Corresponding #GFileAttributeType
+ * is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM "dos::is-system" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT:
+ *
+ * A key in the "dos" namespace for checking if the file is a NTFS mount point
+ * (a volume mount or a junction point).
+ * This attribute is %TRUE if file is a reparse point of type
+ * [IO_REPARSE_TAG_MOUNT_POINT](https://msdn.microsoft.com/en-us/library/dd541667.aspx).
+ * This attribute is only available for DOS file systems.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.60
+ **/
+#define G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT "dos::is-mountpoint" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG:
+ *
+ * A key in the "dos" namespace for getting the file NTFS reparse tag.
+ * This value is 0 for files that are not reparse points.
+ * See the [Reparse Tags](https://msdn.microsoft.com/en-us/library/dd541667.aspx)
+ * page for possible reparse tag values. Corresponding #GFileAttributeType
+ * is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ *
+ * Since: 2.60
+ **/
+#define G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG "dos::reparse-point-tag" /* uint32 */
+
+/* Owner attributes */
+
+/**
+ * G_FILE_ATTRIBUTE_OWNER_USER:
+ *
+ * A key in the "owner" namespace for getting the user name of the
+ * file's owner. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_OWNER_USER "owner::user" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_OWNER_USER_REAL:
+ *
+ * A key in the "owner" namespace for getting the real name of the
+ * user that owns the file. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_OWNER_USER_REAL "owner::user-real" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_OWNER_GROUP:
+ *
+ * A key in the "owner" namespace for getting the file owner's group.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_OWNER_GROUP "owner::group" /* string */
+
+/* Thumbnails */
+
+/**
+ * G_FILE_ATTRIBUTE_THUMBNAIL_PATH:
+ *
+ * A key in the "thumbnail" namespace for getting the path to the thumbnail
+ * image. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_THUMBNAIL_PATH "thumbnail::path" /* bytestring */
+/**
+ * G_FILE_ATTRIBUTE_THUMBNAILING_FAILED:
+ *
+ * A key in the "thumbnail" namespace for checking if thumbnailing failed.
+ * This attribute is %TRUE if thumbnailing failed. Corresponding
+ * #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_THUMBNAILING_FAILED "thumbnail::failed" /* boolean */
+/**
+ * G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID:
+ *
+ * A key in the "thumbnail" namespace for checking whether the thumbnail is outdated.
+ * This attribute is %TRUE if the thumbnail is up-to-date with the file it represents,
+ * and %FALSE if the file has been modified since the thumbnail was generated.
+ *
+ * If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED is %TRUE and this attribute is %FALSE,
+ * it indicates that thumbnailing may be attempted again and may succeed.
+ *
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ *
+ * Since: 2.40
+ */
+#define G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID "thumbnail::is-valid" /* boolean */
+
+/* Preview */
+
+/**
+ * G_FILE_ATTRIBUTE_PREVIEW_ICON:
+ *
+ * A key in the "preview" namespace for getting a #GIcon that can be
+ * used to get preview of the file. For example, it may be a low
+ * resolution thumbnail without metadata. Corresponding
+ * #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT. The value
+ * for this key should contain a #GIcon.
+ *
+ * Since: 2.20
+ **/
+#define G_FILE_ATTRIBUTE_PREVIEW_ICON "preview::icon" /* object (GIcon) */
+
+/* File system info (for g_file_get_filesystem_info) */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_SIZE:
+ *
+ * A key in the "filesystem" namespace for getting the total size (in bytes) of the file system,
+ * used in g_file_query_filesystem_info(). Corresponding #GFileAttributeType
+ * is %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "filesystem::size" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_FREE:
+ *
+ * A key in the "filesystem" namespace for getting the number of bytes of free space left on the
+ * file system. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_FREE "filesystem::free" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_USED:
+ *
+ * A key in the "filesystem" namespace for getting the number of bytes of used on the
+ * file system. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_UINT64.
+ *
+ * Since: 2.32
+ */
+#define G_FILE_ATTRIBUTE_FILESYSTEM_USED "filesystem::used" /* uint64 */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_TYPE:
+ *
+ * A key in the "filesystem" namespace for getting the file system's type.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_TYPE "filesystem::type" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_READONLY:
+ *
+ * A key in the "filesystem" namespace for checking if the file system
+ * is read only. Is set to %TRUE if the file system is read only.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY "filesystem::readonly" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW:
+ *
+ * A key in the "filesystem" namespace for hinting a file manager
+ * application whether it should preview (e.g. thumbnail) files on the
+ * file system. The value for this key contain a
+ * #GFilesystemPreviewType.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW "filesystem::use-preview" /* uint32 (GFilesystemPreviewType) */
+
+/**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE:
+ *
+ * A key in the "filesystem" namespace for checking if the file system
+ * is remote. Is set to %TRUE if the file system is remote.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE "filesystem::remote" /* boolean */
+
+/**
+ * G_FILE_ATTRIBUTE_GVFS_BACKEND:
+ *
+ * A key in the "gvfs" namespace that gets the name of the current
+ * GVFS backend in use. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_STRING.
+ **/
+#define G_FILE_ATTRIBUTE_GVFS_BACKEND "gvfs::backend" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_SELINUX_CONTEXT:
+ *
+ * A key in the "selinux" namespace for getting the file's SELinux
+ * context. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_STRING. Note that this attribute is only
+ * available if GLib has been built with SELinux support.
+ **/
+#define G_FILE_ATTRIBUTE_SELINUX_CONTEXT "selinux::context" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT:
+ *
+ * A key in the "trash" namespace. When requested against
+ * `trash:///` returns the number of (toplevel) items in the trash folder.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
+ **/
+#define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT "trash::item-count" /* uint32 */
+
+/**
+ * G_FILE_ATTRIBUTE_TRASH_ORIG_PATH:
+ *
+ * A key in the "trash" namespace. When requested against
+ * items in `trash:///`, will return the original path to the file before it
+ * was trashed. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
+ *
+ * Since: 2.24
+ **/
+#define G_FILE_ATTRIBUTE_TRASH_ORIG_PATH "trash::orig-path" /* byte string */
+
+/**
+ * G_FILE_ATTRIBUTE_TRASH_DELETION_DATE:
+ *
+ * A key in the "trash" namespace. When requested against
+ * items in `trash:///`, will return the date and time when the file
+ * was trashed. The format of the returned string is YYYY-MM-DDThh:mm:ss.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
+ *
+ * Since: 2.24
+ **/
+#define G_FILE_ATTRIBUTE_TRASH_DELETION_DATE "trash::deletion-date" /* string */
+
+/**
+ * G_FILE_ATTRIBUTE_RECENT_MODIFIED:
+ *
+ * A key in the "recent" namespace for getting time, when the metadata for the
+ * file in `recent:///` was last changed. Corresponding #GFileAttributeType is
+ * %G_FILE_ATTRIBUTE_TYPE_INT64.
+ *
+ * Since: 2.52
+ **/
+#define G_FILE_ATTRIBUTE_RECENT_MODIFIED "recent::modified" /* int64 (time_t) */
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_info_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_info_new (void);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo * g_file_info_dup (GFileInfo *other);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_copy_into (GFileInfo *src_info,
+ GFileInfo *dest_info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_has_attribute (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_has_namespace (GFileInfo *info,
+ const char *name_space);
+GLIB_AVAILABLE_IN_ALL
+char ** g_file_info_list_attributes (GFileInfo *info,
+ const char *name_space);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_get_attribute_data (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeType *type,
+ gpointer *value_pp,
+ GFileAttributeStatus *status);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_remove_attribute (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_set_attribute_status (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeStatus status);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_info_get_attribute_as_string (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_attribute_string (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_attribute_byte_string (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_get_attribute_boolean (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+guint32 g_file_info_get_attribute_uint32 (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_file_info_get_attribute_int32 (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_file_info_get_attribute_uint64 (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_file_info_get_attribute_int64 (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+GObject * g_file_info_get_attribute_object (GFileInfo *info,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+char ** g_file_info_get_attribute_stringv (GFileInfo *info,
+ const char *attribute);
+
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeType type,
+ gpointer value_p);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_string (GFileInfo *info,
+ const char *attribute,
+ const char *attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_byte_string (GFileInfo *info,
+ const char *attribute,
+ const char *attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_boolean (GFileInfo *info,
+ const char *attribute,
+ gboolean attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_uint32 (GFileInfo *info,
+ const char *attribute,
+ guint32 attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_int32 (GFileInfo *info,
+ const char *attribute,
+ gint32 attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_uint64 (GFileInfo *info,
+ const char *attribute,
+ guint64 attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_int64 (GFileInfo *info,
+ const char *attribute,
+ gint64 attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_object (GFileInfo *info,
+ const char *attribute,
+ GObject *attr_value);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_stringv (GFileInfo *info,
+ const char *attribute,
+ char **attr_value);
+
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_clear_status (GFileInfo *info);
+
+/* Helper getters: */
+GLIB_AVAILABLE_IN_2_36
+GDateTime * g_file_info_get_deletion_date (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GFileType g_file_info_get_file_type (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_get_is_hidden (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_get_is_backup (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_info_get_is_symlink (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_name (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_display_name (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_edit_name (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_file_info_get_icon (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_file_info_get_symbolic_icon (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_content_type (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+goffset g_file_info_get_size (GFileInfo *info);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_file_info_get_modification_date_time)
+void g_file_info_get_modification_time (GFileInfo *info,
+ GTimeVal *result);
+G_GNUC_END_IGNORE_DEPRECATIONS
+GLIB_AVAILABLE_IN_2_62
+GDateTime * g_file_info_get_modification_date_time (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_symlink_target (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_info_get_etag (GFileInfo *info);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_file_info_get_sort_order (GFileInfo *info);
+
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_attribute_mask (GFileInfo *info,
+ GFileAttributeMatcher *mask);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_unset_attribute_mask (GFileInfo *info);
+
+/* Helper setters: */
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_file_type (GFileInfo *info,
+ GFileType type);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_is_hidden (GFileInfo *info,
+ gboolean is_hidden);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_is_symlink (GFileInfo *info,
+ gboolean is_symlink);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_name (GFileInfo *info,
+ const char *name);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_display_name (GFileInfo *info,
+ const char *display_name);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_edit_name (GFileInfo *info,
+ const char *edit_name);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_icon (GFileInfo *info,
+ GIcon *icon);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_symbolic_icon (GFileInfo *info,
+ GIcon *icon);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_content_type (GFileInfo *info,
+ const char *content_type);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_size (GFileInfo *info,
+ goffset size);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_file_info_set_modification_date_time)
+void g_file_info_set_modification_time (GFileInfo *info,
+ GTimeVal *mtime);
+G_GNUC_END_IGNORE_DEPRECATIONS
+GLIB_AVAILABLE_IN_2_62
+void g_file_info_set_modification_date_time (GFileInfo *info,
+ GDateTime *mtime);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_symlink_target (GFileInfo *info,
+ const char *symlink_target);
+GLIB_AVAILABLE_IN_ALL
+void g_file_info_set_sort_order (GFileInfo *info,
+ gint32 sort_order);
+
+#define G_TYPE_FILE_ATTRIBUTE_MATCHER (g_file_attribute_matcher_get_type ())
+GLIB_AVAILABLE_IN_ALL
+GType g_file_attribute_matcher_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeMatcher *g_file_attribute_matcher_new (const char *attributes);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeMatcher *g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher);
+GLIB_AVAILABLE_IN_ALL
+void g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher);
+GLIB_AVAILABLE_IN_ALL
+GFileAttributeMatcher *g_file_attribute_matcher_subtract (GFileAttributeMatcher *matcher,
+ GFileAttributeMatcher *subtract);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_attribute_matcher_matches_only (GFileAttributeMatcher *matcher,
+ const char *attribute);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher,
+ const char *ns);
+GLIB_AVAILABLE_IN_ALL
+const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher);
+GLIB_AVAILABLE_IN_2_32
+char * g_file_attribute_matcher_to_string (GFileAttributeMatcher *matcher);
+
+G_END_DECLS
+
+#endif /* __G_FILE_INFO_H__ */
diff --git a/include/glib/gio/gfileinputstream.h b/include/glib/gio/gfileinputstream.h
new file mode 100644
index 0000000000..f84eecce19
--- /dev/null
+++ b/include/glib/gio/gfileinputstream.h
@@ -0,0 +1,114 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_INPUT_STREAM_H__
+#define __G_FILE_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/ginputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_INPUT_STREAM (g_file_input_stream_get_type ())
+#define G_FILE_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_INPUT_STREAM, GFileInputStream))
+#define G_FILE_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_INPUT_STREAM, GFileInputStreamClass))
+#define G_IS_FILE_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_INPUT_STREAM))
+#define G_IS_FILE_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_INPUT_STREAM))
+#define G_FILE_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_INPUT_STREAM, GFileInputStreamClass))
+
+/**
+ * GFileInputStream:
+ *
+ * A subclass of GInputStream for opened files. This adds
+ * a few file-specific operations and seeking.
+ *
+ * #GFileInputStream implements #GSeekable.
+ **/
+typedef struct _GFileInputStreamClass GFileInputStreamClass;
+typedef struct _GFileInputStreamPrivate GFileInputStreamPrivate;
+
+struct _GFileInputStream
+{
+ GInputStream parent_instance;
+
+ /*< private >*/
+ GFileInputStreamPrivate *priv;
+};
+
+struct _GFileInputStreamClass
+{
+ GInputStreamClass parent_class;
+
+ goffset (* tell) (GFileInputStream *stream);
+ gboolean (* can_seek) (GFileInputStream *stream);
+ gboolean (* seek) (GFileInputStream *stream,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error);
+ GFileInfo * (* query_info) (GFileInputStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+ void (* query_info_async) (GFileInputStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInfo * (* query_info_finish) (GFileInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_input_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_input_stream_query_info (GFileInputStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_input_stream_query_info_async (GFileInputStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_input_stream_query_info_finish (GFileInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_FILE_FILE_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gfileiostream.h b/include/glib/gio/gfileiostream.h
new file mode 100644
index 0000000000..ca61db65de
--- /dev/null
+++ b/include/glib/gio/gfileiostream.h
@@ -0,0 +1,121 @@
+/* GIO - GLib Input, Io and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_IO_STREAM_H__
+#define __G_FILE_IO_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giostream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_IO_STREAM (g_file_io_stream_get_type ())
+#define G_FILE_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_IO_STREAM, GFileIOStream))
+#define G_FILE_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_IO_STREAM, GFileIOStreamClass))
+#define G_IS_FILE_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_IO_STREAM))
+#define G_IS_FILE_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_IO_STREAM))
+#define G_FILE_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_IO_STREAM, GFileIOStreamClass))
+
+/**
+ * GFileIOStream:
+ *
+ * A subclass of GIOStream for opened files. This adds
+ * a few file-specific operations and seeking and truncating.
+ *
+ * #GFileIOStream implements GSeekable.
+ **/
+typedef struct _GFileIOStreamClass GFileIOStreamClass;
+typedef struct _GFileIOStreamPrivate GFileIOStreamPrivate;
+
+struct _GFileIOStream
+{
+ GIOStream parent_instance;
+
+ /*< private >*/
+ GFileIOStreamPrivate *priv;
+};
+
+struct _GFileIOStreamClass
+{
+ GIOStreamClass parent_class;
+
+ goffset (* tell) (GFileIOStream *stream);
+ gboolean (* can_seek) (GFileIOStream *stream);
+ gboolean (* seek) (GFileIOStream *stream,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* can_truncate) (GFileIOStream *stream);
+ gboolean (* truncate_fn) (GFileIOStream *stream,
+ goffset size,
+ GCancellable *cancellable,
+ GError **error);
+ GFileInfo * (* query_info) (GFileIOStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+ void (* query_info_async) (GFileIOStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInfo * (* query_info_finish) (GFileIOStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ char * (* get_etag) (GFileIOStream *stream);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_io_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_io_stream_query_info (GFileIOStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_io_stream_query_info_async (GFileIOStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_io_stream_query_info_finish (GFileIOStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_io_stream_get_etag (GFileIOStream *stream);
+
+G_END_DECLS
+
+#endif /* __G_FILE_FILE_IO_STREAM_H__ */
diff --git a/include/glib/gio/gfilemonitor.h b/include/glib/gio/gfilemonitor.h
new file mode 100644
index 0000000000..724d8def83
--- /dev/null
+++ b/include/glib/gio/gfilemonitor.h
@@ -0,0 +1,98 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_MONITOR_H__
+#define __G_FILE_MONITOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_MONITOR (g_file_monitor_get_type ())
+#define G_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_MONITOR, GFileMonitor))
+#define G_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_MONITOR, GFileMonitorClass))
+#define G_IS_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_MONITOR))
+#define G_IS_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_MONITOR))
+#define G_FILE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_MONITOR, GFileMonitorClass))
+
+typedef struct _GFileMonitorClass GFileMonitorClass;
+typedef struct _GFileMonitorPrivate GFileMonitorPrivate;
+
+/**
+ * GFileMonitor:
+ *
+ * Watches for changes to a file.
+ **/
+struct _GFileMonitor
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GFileMonitorPrivate *priv;
+};
+
+struct _GFileMonitorClass
+{
+ GObjectClass parent_class;
+
+ /* Signals */
+ void (* changed) (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type);
+
+ /* Virtual Table */
+ gboolean (* cancel) (GFileMonitor *monitor);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_monitor_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_monitor_cancel (GFileMonitor *monitor);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_monitor_is_cancelled (GFileMonitor *monitor);
+GLIB_AVAILABLE_IN_ALL
+void g_file_monitor_set_rate_limit (GFileMonitor *monitor,
+ gint limit_msecs);
+
+
+/* For implementations */
+GLIB_AVAILABLE_IN_ALL
+void g_file_monitor_emit_event (GFileMonitor *monitor,
+ GFile *child,
+ GFile *other_file,
+ GFileMonitorEvent event_type);
+
+G_END_DECLS
+
+#endif /* __G_FILE_MONITOR_H__ */
diff --git a/include/glib/gio/gfilenamecompleter.h b/include/glib/gio/gfilenamecompleter.h
new file mode 100644
index 0000000000..b10f18de9a
--- /dev/null
+++ b/include/glib/gio/gfilenamecompleter.h
@@ -0,0 +1,79 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILENAME_COMPLETER_H__
+#define __G_FILENAME_COMPLETER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILENAME_COMPLETER (g_filename_completer_get_type ())
+#define G_FILENAME_COMPLETER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILENAME_COMPLETER, GFilenameCompleter))
+#define G_FILENAME_COMPLETER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILENAME_COMPLETER, GFilenameCompleterClass))
+#define G_FILENAME_COMPLETER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILENAME_COMPLETER, GFilenameCompleterClass))
+#define G_IS_FILENAME_COMPLETER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILENAME_COMPLETER))
+#define G_IS_FILENAME_COMPLETER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILENAME_COMPLETER))
+
+/**
+ * GFilenameCompleter:
+ *
+ * Completes filenames based on files that exist within the file system.
+ **/
+typedef struct _GFilenameCompleterClass GFilenameCompleterClass;
+
+struct _GFilenameCompleterClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* signals */
+ void (* got_completion_data) (GFilenameCompleter *filename_completer);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_filename_completer_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFilenameCompleter *g_filename_completer_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+char * g_filename_completer_get_completion_suffix (GFilenameCompleter *completer,
+ const char *initial_text);
+GLIB_AVAILABLE_IN_ALL
+char ** g_filename_completer_get_completions (GFilenameCompleter *completer,
+ const char *initial_text);
+GLIB_AVAILABLE_IN_ALL
+void g_filename_completer_set_dirs_only (GFilenameCompleter *completer,
+ gboolean dirs_only);
+
+G_END_DECLS
+
+#endif /* __G_FILENAME_COMPLETER_H__ */
diff --git a/include/glib/gio/gfileoutputstream.h b/include/glib/gio/gfileoutputstream.h
new file mode 100644
index 0000000000..5df63efba7
--- /dev/null
+++ b/include/glib/gio/gfileoutputstream.h
@@ -0,0 +1,122 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_OUTPUT_STREAM_H__
+#define __G_FILE_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/goutputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILE_OUTPUT_STREAM (g_file_output_stream_get_type ())
+#define G_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStream))
+#define G_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass))
+#define G_IS_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_OUTPUT_STREAM))
+#define G_IS_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_OUTPUT_STREAM))
+#define G_FILE_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass))
+
+/**
+ * GFileOutputStream:
+ *
+ * A subclass of GOutputStream for opened files. This adds
+ * a few file-specific operations and seeking and truncating.
+ *
+ * #GFileOutputStream implements GSeekable.
+ **/
+typedef struct _GFileOutputStreamClass GFileOutputStreamClass;
+typedef struct _GFileOutputStreamPrivate GFileOutputStreamPrivate;
+
+struct _GFileOutputStream
+{
+ GOutputStream parent_instance;
+
+ /*< private >*/
+ GFileOutputStreamPrivate *priv;
+};
+
+struct _GFileOutputStreamClass
+{
+ GOutputStreamClass parent_class;
+
+ goffset (* tell) (GFileOutputStream *stream);
+ gboolean (* can_seek) (GFileOutputStream *stream);
+ gboolean (* seek) (GFileOutputStream *stream,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* can_truncate) (GFileOutputStream *stream);
+ gboolean (* truncate_fn) (GFileOutputStream *stream,
+ goffset size,
+ GCancellable *cancellable,
+ GError **error);
+ GFileInfo * (* query_info) (GFileOutputStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+ void (* query_info_async) (GFileOutputStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GFileInfo * (* query_info_finish) (GFileOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ char * (* get_etag) (GFileOutputStream *stream);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_file_output_stream_get_type (void) G_GNUC_CONST;
+
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_output_stream_query_info (GFileOutputStream *stream,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_file_output_stream_query_info_async (GFileOutputStream *stream,
+ const char *attributes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_file_output_stream_query_info_finish (GFileOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+char * g_file_output_stream_get_etag (GFileOutputStream *stream);
+
+G_END_DECLS
+
+#endif /* __G_FILE_FILE_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gfilterinputstream.h b/include/glib/gio/gfilterinputstream.h
new file mode 100644
index 0000000000..b44a458916
--- /dev/null
+++ b/include/glib/gio/gfilterinputstream.h
@@ -0,0 +1,78 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_FILTER_INPUT_STREAM_H__
+#define __G_FILTER_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/ginputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILTER_INPUT_STREAM (g_filter_input_stream_get_type ())
+#define G_FILTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStream))
+#define G_FILTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamClass))
+#define G_IS_FILTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILTER_INPUT_STREAM))
+#define G_IS_FILTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILTER_INPUT_STREAM))
+#define G_FILTER_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamClass))
+
+/**
+ * GFilterInputStream:
+ *
+ * A base class for all input streams that work on an underlying stream.
+ **/
+typedef struct _GFilterInputStreamClass GFilterInputStreamClass;
+
+struct _GFilterInputStream
+{
+ GInputStream parent_instance;
+
+ /*<protected >*/
+ GInputStream *base_stream;
+};
+
+struct _GFilterInputStreamClass
+{
+ GInputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_filter_input_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GInputStream * g_filter_input_stream_get_base_stream (GFilterInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_filter_input_stream_get_close_base_stream (GFilterInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_filter_input_stream_set_close_base_stream (GFilterInputStream *stream,
+ gboolean close_base);
+
+G_END_DECLS
+
+#endif /* __G_FILTER_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gfilteroutputstream.h b/include/glib/gio/gfilteroutputstream.h
new file mode 100644
index 0000000000..105e72be22
--- /dev/null
+++ b/include/glib/gio/gfilteroutputstream.h
@@ -0,0 +1,78 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_FILTER_OUTPUT_STREAM_H__
+#define __G_FILTER_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/goutputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_FILTER_OUTPUT_STREAM (g_filter_output_stream_get_type ())
+#define G_FILTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStream))
+#define G_FILTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamClass))
+#define G_IS_FILTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILTER_OUTPUT_STREAM))
+#define G_IS_FILTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILTER_OUTPUT_STREAM))
+#define G_FILTER_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamClass))
+
+/**
+ * GFilterOutputStream:
+ *
+ * A base class for all output streams that work on an underlying stream.
+ **/
+typedef struct _GFilterOutputStreamClass GFilterOutputStreamClass;
+
+struct _GFilterOutputStream
+{
+ GOutputStream parent_instance;
+
+ /*< protected >*/
+ GOutputStream *base_stream;
+};
+
+struct _GFilterOutputStreamClass
+{
+ GOutputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_filter_output_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GOutputStream * g_filter_output_stream_get_base_stream (GFilterOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_filter_output_stream_get_close_base_stream (GFilterOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+void g_filter_output_stream_set_close_base_stream (GFilterOutputStream *stream,
+ gboolean close_base);
+
+G_END_DECLS
+
+#endif /* __G_FILTER_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gicon.h b/include/glib/gio/gicon.h
new file mode 100644
index 0000000000..a4a03cbec9
--- /dev/null
+++ b/include/glib/gio/gicon.h
@@ -0,0 +1,102 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_ICON_H__
+#define __G_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ICON (g_icon_get_type ())
+#define G_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ICON, GIcon))
+#define G_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ICON))
+#define G_ICON_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ICON, GIconIface))
+
+/**
+ * GIcon:
+ *
+ * An abstract type that specifies an icon.
+ **/
+typedef struct _GIconIface GIconIface;
+
+/**
+ * GIconIface:
+ * @g_iface: The parent interface.
+ * @hash: A hash for a given #GIcon.
+ * @equal: Checks if two #GIcons are equal.
+ * @to_tokens: Serializes a #GIcon into tokens. The tokens must not
+ * contain any whitespace. Don't implement if the #GIcon can't be
+ * serialized (Since 2.20).
+ * @from_tokens: Constructs a #GIcon from tokens. Set the #GError if
+ * the tokens are malformed. Don't implement if the #GIcon can't be
+ * serialized (Since 2.20).
+ * @serialize: Serializes a #GIcon into a #GVariant. Since: 2.38
+ *
+ * GIconIface is used to implement GIcon types for various
+ * different systems. See #GThemedIcon and #GLoadableIcon for
+ * examples of how to implement this interface.
+ */
+struct _GIconIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ guint (* hash) (GIcon *icon);
+ gboolean (* equal) (GIcon *icon1,
+ GIcon *icon2);
+ gboolean (* to_tokens) (GIcon *icon,
+ GPtrArray *tokens,
+ gint *out_version);
+ GIcon * (* from_tokens) (gchar **tokens,
+ gint num_tokens,
+ gint version,
+ GError **error);
+
+ GVariant * (* serialize) (GIcon *icon);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+guint g_icon_hash (gconstpointer icon);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_icon_equal (GIcon *icon1,
+ GIcon *icon2);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_icon_to_string (GIcon *icon);
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_icon_new_for_string (const gchar *str,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_38
+GVariant * g_icon_serialize (GIcon *icon);
+GLIB_AVAILABLE_IN_2_38
+GIcon * g_icon_deserialize (GVariant *value);
+
+G_END_DECLS
+
+#endif /* __G_ICON_H__ */
diff --git a/include/glib/gio/ginetaddress.h b/include/glib/gio/ginetaddress.h
new file mode 100644
index 0000000000..2963affa4b
--- /dev/null
+++ b/include/glib/gio/ginetaddress.h
@@ -0,0 +1,124 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ */
+
+#ifndef __G_INET_ADDRESS_H__
+#define __G_INET_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_INET_ADDRESS (g_inet_address_get_type ())
+#define G_INET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_ADDRESS, GInetAddress))
+#define G_INET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_ADDRESS, GInetAddressClass))
+#define G_IS_INET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_ADDRESS))
+#define G_IS_INET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_ADDRESS))
+#define G_INET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_ADDRESS, GInetAddressClass))
+
+typedef struct _GInetAddressClass GInetAddressClass;
+typedef struct _GInetAddressPrivate GInetAddressPrivate;
+
+struct _GInetAddress
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GInetAddressPrivate *priv;
+};
+
+struct _GInetAddressClass
+{
+ GObjectClass parent_class;
+
+ gchar * (*to_string) (GInetAddress *address);
+ const guint8 * (*to_bytes) (GInetAddress *address);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_inet_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GInetAddress * g_inet_address_new_from_string (const gchar *string);
+
+GLIB_AVAILABLE_IN_ALL
+GInetAddress * g_inet_address_new_from_bytes (const guint8 *bytes,
+ GSocketFamily family);
+
+GLIB_AVAILABLE_IN_ALL
+GInetAddress * g_inet_address_new_loopback (GSocketFamily family);
+
+GLIB_AVAILABLE_IN_ALL
+GInetAddress * g_inet_address_new_any (GSocketFamily family);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_equal (GInetAddress *address,
+ GInetAddress *other_address);
+
+GLIB_AVAILABLE_IN_ALL
+gchar * g_inet_address_to_string (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+const guint8 * g_inet_address_to_bytes (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_inet_address_get_native_size (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketFamily g_inet_address_get_family (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_any (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_loopback (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_link_local (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_site_local (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_multicast (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_mc_global (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_mc_link_local (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_mc_node_local (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_mc_org_local (GInetAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_inet_address_get_is_mc_site_local (GInetAddress *address);
+
+G_END_DECLS
+
+#endif /* __G_INET_ADDRESS_H__ */
+
diff --git a/include/glib/gio/ginetaddressmask.h b/include/glib/gio/ginetaddressmask.h
new file mode 100644
index 0000000000..ce5e285c6e
--- /dev/null
+++ b/include/glib/gio/ginetaddressmask.h
@@ -0,0 +1,85 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_INET_ADDRESS_MASK_H__
+#define __G_INET_ADDRESS_MASK_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_INET_ADDRESS_MASK (g_inet_address_mask_get_type ())
+#define G_INET_ADDRESS_MASK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_ADDRESS_MASK, GInetAddressMask))
+#define G_INET_ADDRESS_MASK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_ADDRESS_MASK, GInetAddressMaskClass))
+#define G_IS_INET_ADDRESS_MASK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_ADDRESS_MASK))
+#define G_IS_INET_ADDRESS_MASK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_ADDRESS_MASK))
+#define G_INET_ADDRESS_MASK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_ADDRESS_MASK, GInetAddressMaskClass))
+
+typedef struct _GInetAddressMaskClass GInetAddressMaskClass;
+typedef struct _GInetAddressMaskPrivate GInetAddressMaskPrivate;
+
+struct _GInetAddressMask
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GInetAddressMaskPrivate *priv;
+};
+
+struct _GInetAddressMaskClass
+{
+ GObjectClass parent_class;
+
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_inet_address_mask_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+GInetAddressMask *g_inet_address_mask_new (GInetAddress *addr,
+ guint length,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+GInetAddressMask *g_inet_address_mask_new_from_string (const gchar *mask_string,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gchar *g_inet_address_mask_to_string (GInetAddressMask *mask);
+
+GLIB_AVAILABLE_IN_2_32
+GSocketFamily g_inet_address_mask_get_family (GInetAddressMask *mask);
+GLIB_AVAILABLE_IN_2_32
+GInetAddress *g_inet_address_mask_get_address (GInetAddressMask *mask);
+GLIB_AVAILABLE_IN_2_32
+guint g_inet_address_mask_get_length (GInetAddressMask *mask);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_inet_address_mask_matches (GInetAddressMask *mask,
+ GInetAddress *address);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_inet_address_mask_equal (GInetAddressMask *mask,
+ GInetAddressMask *mask2);
+
+G_END_DECLS
+
+#endif /* __G_INET_ADDRESS_MASK_H__ */
+
diff --git a/include/glib/gio/ginetsocketaddress.h b/include/glib/gio/ginetsocketaddress.h
new file mode 100644
index 0000000000..e05ba09893
--- /dev/null
+++ b/include/glib/gio/ginetsocketaddress.h
@@ -0,0 +1,78 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ */
+
+#ifndef __G_INET_SOCKET_ADDRESS_H__
+#define __G_INET_SOCKET_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketaddress.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_INET_SOCKET_ADDRESS (g_inet_socket_address_get_type ())
+#define G_INET_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddress))
+#define G_INET_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddressClass))
+#define G_IS_INET_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_SOCKET_ADDRESS))
+#define G_IS_INET_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_SOCKET_ADDRESS))
+#define G_INET_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddressClass))
+
+typedef struct _GInetSocketAddressClass GInetSocketAddressClass;
+typedef struct _GInetSocketAddressPrivate GInetSocketAddressPrivate;
+
+struct _GInetSocketAddress
+{
+ GSocketAddress parent_instance;
+
+ /*< private >*/
+ GInetSocketAddressPrivate *priv;
+};
+
+struct _GInetSocketAddressClass
+{
+ GSocketAddressClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_inet_socket_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_inet_socket_address_new (GInetAddress *address,
+ guint16 port);
+GLIB_AVAILABLE_IN_2_40
+GSocketAddress *g_inet_socket_address_new_from_string (const char *address,
+ guint port);
+
+GLIB_AVAILABLE_IN_ALL
+GInetAddress * g_inet_socket_address_get_address (GInetSocketAddress *address);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_inet_socket_address_get_port (GInetSocketAddress *address);
+
+GLIB_AVAILABLE_IN_2_32
+guint32 g_inet_socket_address_get_flowinfo (GInetSocketAddress *address);
+GLIB_AVAILABLE_IN_2_32
+guint32 g_inet_socket_address_get_scope_id (GInetSocketAddress *address);
+
+G_END_DECLS
+
+#endif /* __G_INET_SOCKET_ADDRESS_H__ */
diff --git a/include/glib/gio/ginitable.h b/include/glib/gio/ginitable.h
new file mode 100644
index 0000000000..463bfcc5aa
--- /dev/null
+++ b/include/glib/gio/ginitable.h
@@ -0,0 +1,105 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_INITABLE_H__
+#define __G_INITABLE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_INITABLE (g_initable_get_type ())
+#define G_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_INITABLE, GInitable))
+#define G_IS_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_INITABLE))
+#define G_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_INITABLE, GInitableIface))
+#define G_TYPE_IS_INITABLE(type) (g_type_is_a ((type), G_TYPE_INITABLE))
+
+/**
+ * GInitable:
+ *
+ * Interface for initializable objects.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GInitableIface GInitableIface;
+
+/**
+ * GInitableIface:
+ * @g_iface: The parent interface.
+ * @init: Initializes the object.
+ *
+ * Provides an interface for initializing object such that initialization
+ * may fail.
+ *
+ * Since: 2.22
+ **/
+struct _GInitableIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ gboolean (* init) (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_initable_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_initable_init (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_initable_new (GType object_type,
+ GCancellable *cancellable,
+ GError **error,
+ const gchar *first_property_name,
+ ...);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_initable_init)
+gpointer g_initable_newv (GType object_type,
+ guint n_parameters,
+ GParameter *parameters,
+ GCancellable *cancellable,
+ GError **error);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+GObject* g_initable_new_valist (GType object_type,
+ const gchar *first_property_name,
+ va_list var_args,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+
+#endif /* __G_INITABLE_H__ */
diff --git a/include/glib/gio/ginputstream.h b/include/glib/gio/ginputstream.h
new file mode 100644
index 0000000000..53b14e3870
--- /dev/null
+++ b/include/glib/gio/ginputstream.h
@@ -0,0 +1,216 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_INPUT_STREAM_H__
+#define __G_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_INPUT_STREAM (g_input_stream_get_type ())
+#define G_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INPUT_STREAM, GInputStream))
+#define G_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INPUT_STREAM, GInputStreamClass))
+#define G_IS_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INPUT_STREAM))
+#define G_IS_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INPUT_STREAM))
+#define G_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INPUT_STREAM, GInputStreamClass))
+
+/**
+ * GInputStream:
+ *
+ * Base class for streaming input operations.
+ **/
+typedef struct _GInputStreamClass GInputStreamClass;
+typedef struct _GInputStreamPrivate GInputStreamPrivate;
+
+struct _GInputStream
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GInputStreamPrivate *priv;
+};
+
+struct _GInputStreamClass
+{
+ GObjectClass parent_class;
+
+ /* Sync ops: */
+
+ gssize (* read_fn) (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+ gssize (* skip) (GInputStream *stream,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* close_fn) (GInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+
+ /* Async ops: (optional in derived classes) */
+ void (* read_async) (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gssize (* read_finish) (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ void (* skip_async) (GInputStream *stream,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gssize (* skip_finish) (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ void (* close_async) (GInputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* close_finish) (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_input_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_input_stream_read (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_read_all (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ gsize *bytes_read,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+GBytes *g_input_stream_read_bytes (GInputStream *stream,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_input_stream_skip (GInputStream *stream,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_close (GInputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_input_stream_read_async (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gssize g_input_stream_read_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_44
+void g_input_stream_read_all_async (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_44
+gboolean g_input_stream_read_all_finish (GInputStream *stream,
+ GAsyncResult *result,
+ gsize *bytes_read,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34
+void g_input_stream_read_bytes_async (GInputStream *stream,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+GBytes *g_input_stream_read_bytes_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_input_stream_skip_async (GInputStream *stream,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gssize g_input_stream_skip_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_input_stream_close_async (GInputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_close_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+/* For implementations: */
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_is_closed (GInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_has_pending (GInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_input_stream_set_pending (GInputStream *stream,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_input_stream_clear_pending (GInputStream *stream);
+
+G_END_DECLS
+
+#endif /* __G_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gio-autocleanups.h b/include/glib/gio/gio-autocleanups.h
new file mode 100644
index 0000000000..ff407293f8
--- /dev/null
+++ b/include/glib/gio/gio-autocleanups.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright © 2015 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAction, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GActionMap, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppInfo, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppLaunchContext, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppInfoMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GApplicationCommandLine, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GApplication, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncInitable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBufferedInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBufferedOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytesIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCancellable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCharsetConverter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCredentials, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDatagramBased, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusActionGroup, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusAuthObserver, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusInterface, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusInterfaceSkeleton, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMenuModel, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMessage, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMethodInvocation, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusNodeInfo, g_dbus_node_info_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObject, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManagerClient, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManager, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManagerServer, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectProxy, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectSkeleton, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusProxy, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusServer, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDrive, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEmblemedIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEmblem, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFile, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileAttributeInfoList, g_file_attribute_info_list_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInfo, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIOStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilenameCompleter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilterInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilterOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetAddressMask, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetSocketAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOModule, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GLoadableIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenu, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuItem, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuModel, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuAttributeIter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuLinkIter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMountOperation, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNativeVolumeMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkService, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNotification, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPermission, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPollableInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPollableOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPropertyAction, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyAddressEnumerator, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxy, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyResolver, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRemoteActionGroup, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GResolver, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GResource, g_resource_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSeekable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsBackend, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchema, g_settings_schema_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchemaKey, g_settings_schema_key_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchemaSource, g_settings_schema_source_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettings, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleActionGroup, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleAction, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleAsyncResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimplePermission, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleProxyResolver, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddressEnumerator, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketClient, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketConnectable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketControlMessage, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketListener, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketService, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTcpConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTcpWrapperConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTestDBus, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThemedIcon, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThreadedSocketService, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsBackend, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsClientConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsFileDatabase, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsPassword, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsServerConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVfs, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolume, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolumeMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref)
diff --git a/include/glib/gio/gio.h b/include/glib/gio/gio.h
new file mode 100644
index 0000000000..8053768a00
--- /dev/null
+++ b/include/glib/gio/gio.h
@@ -0,0 +1,177 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_IO_H__
+#define __G_IO_H__
+
+#define __GIO_GIO_H_INSIDE__
+
+#include <gio/giotypes.h>
+
+#include <gio/gaction.h>
+#include <gio/gactiongroup.h>
+#include <gio/gactiongroupexporter.h>
+#include <gio/gactionmap.h>
+#include <gio/gappinfo.h>
+#include <gio/gapplication.h>
+#include <gio/gapplicationcommandline.h>
+#include <gio/gasyncinitable.h>
+#include <gio/gasyncresult.h>
+#include <gio/gbufferedinputstream.h>
+#include <gio/gbufferedoutputstream.h>
+#include <gio/gbytesicon.h>
+#include <gio/gcancellable.h>
+#include <gio/gcharsetconverter.h>
+#include <gio/gcontenttype.h>
+#include <gio/gconverter.h>
+#include <gio/gconverterinputstream.h>
+#include <gio/gconverteroutputstream.h>
+#include <gio/gcredentials.h>
+#include <gio/gdatagrambased.h>
+#include <gio/gdatainputstream.h>
+#include <gio/gdataoutputstream.h>
+#include <gio/gdbusaddress.h>
+#include <gio/gdbusauthobserver.h>
+#include <gio/gdbusconnection.h>
+#include <gio/gdbuserror.h>
+#include <gio/gdbusintrospection.h>
+#include <gio/gdbusmessage.h>
+#include <gio/gdbusmethodinvocation.h>
+#include <gio/gdbusnameowning.h>
+#include <gio/gdbusnamewatching.h>
+#include <gio/gdbusproxy.h>
+#include <gio/gdbusserver.h>
+#include <gio/gdbusutils.h>
+#include <gio/gdrive.h>
+#include <gio/gdtlsclientconnection.h>
+#include <gio/gdtlsconnection.h>
+#include <gio/gdtlsserverconnection.h>
+#include <gio/gemblemedicon.h>
+#include <gio/gfileattribute.h>
+#include <gio/gfileenumerator.h>
+#include <gio/gfile.h>
+#include <gio/gfileicon.h>
+#include <gio/gfileinfo.h>
+#include <gio/gfileinputstream.h>
+#include <gio/gfileiostream.h>
+#include <gio/gfilemonitor.h>
+#include <gio/gfilenamecompleter.h>
+#include <gio/gfileoutputstream.h>
+#include <gio/gfilterinputstream.h>
+#include <gio/gfilteroutputstream.h>
+#include <gio/gicon.h>
+#include <gio/ginetaddress.h>
+#include <gio/ginetaddressmask.h>
+#include <gio/ginetsocketaddress.h>
+#include <gio/ginitable.h>
+#include <gio/ginputstream.h>
+#include <gio/gioenums.h>
+#include <gio/gioenumtypes.h>
+#include <gio/gioerror.h>
+#include <gio/giomodule.h>
+#include <gio/gioscheduler.h>
+#include <gio/giostream.h>
+#include <gio/gloadableicon.h>
+#include <gio/gmemoryinputstream.h>
+#include <gio/gmemoryoutputstream.h>
+#include <gio/gmount.h>
+#include <gio/gmountoperation.h>
+#include <gio/gnativesocketaddress.h>
+#include <gio/gnativevolumemonitor.h>
+#include <gio/gnetworkaddress.h>
+#include <gio/gnetworkmonitor.h>
+#include <gio/gnetworkservice.h>
+#include <gio/goutputstream.h>
+#include <gio/gpermission.h>
+#include <gio/gpollableinputstream.h>
+#include <gio/gpollableoutputstream.h>
+#include <gio/gpollableutils.h>
+#include <gio/gpropertyaction.h>
+#include <gio/gproxy.h>
+#include <gio/gproxyaddress.h>
+#include <gio/gproxyaddressenumerator.h>
+#include <gio/gproxyresolver.h>
+#include <gio/gresolver.h>
+#include <gio/gresource.h>
+#include <gio/gseekable.h>
+#include <gio/gsettingsschema.h>
+#include <gio/gsettings.h>
+#include <gio/gsimpleaction.h>
+#include <gio/gsimpleactiongroup.h>
+#include <gio/gsimpleasyncresult.h>
+#include <gio/gsimpleiostream.h>
+#include <gio/gsimplepermission.h>
+#include <gio/gsocketaddressenumerator.h>
+#include <gio/gsocketaddress.h>
+#include <gio/gsocketclient.h>
+#include <gio/gsocketconnectable.h>
+#include <gio/gsocketconnection.h>
+#include <gio/gsocketcontrolmessage.h>
+#include <gio/gsocket.h>
+#include <gio/gsocketlistener.h>
+#include <gio/gsocketservice.h>
+#include <gio/gsrvtarget.h>
+#include <gio/gsimpleproxyresolver.h>
+#include <gio/gtask.h>
+#include <gio/gsubprocess.h>
+#include <gio/gsubprocesslauncher.h>
+#include <gio/gtcpconnection.h>
+#include <gio/gtcpwrapperconnection.h>
+#include <gio/gtestdbus.h>
+#include <gio/gthemedicon.h>
+#include <gio/gthreadedsocketservice.h>
+#include <gio/gtlsbackend.h>
+#include <gio/gtlscertificate.h>
+#include <gio/gtlsclientconnection.h>
+#include <gio/gtlsconnection.h>
+#include <gio/gtlsdatabase.h>
+#include <gio/gtlsfiledatabase.h>
+#include <gio/gtlsinteraction.h>
+#include <gio/gtlsserverconnection.h>
+#include <gio/gtlspassword.h>
+#include <gio/gvfs.h>
+#include <gio/gvolume.h>
+#include <gio/gvolumemonitor.h>
+#include <gio/gzlibcompressor.h>
+#include <gio/gzlibdecompressor.h>
+#include <gio/gdbusinterface.h>
+#include <gio/gdbusinterfaceskeleton.h>
+#include <gio/gdbusobject.h>
+#include <gio/gdbusobjectskeleton.h>
+#include <gio/gdbusobjectproxy.h>
+#include <gio/gdbusobjectmanager.h>
+#include <gio/gdbusobjectmanagerclient.h>
+#include <gio/gdbusobjectmanagerserver.h>
+#include <gio/gdbusactiongroup.h>
+#include <gio/gremoteactiongroup.h>
+#include <gio/gmenumodel.h>
+#include <gio/gmenu.h>
+#include <gio/gmenuexporter.h>
+#include <gio/gdbusmenumodel.h>
+#include <gio/gnotification.h>
+#include <gio/glistmodel.h>
+#include <gio/gliststore.h>
+
+#include <gio/gio-autocleanups.h>
+
+#undef __GIO_GIO_H_INSIDE__
+
+#endif /* __G_IO_H__ */
+
diff --git a/include/glib/gio/gioenums.h b/include/glib/gio/gioenums.h
new file mode 100644
index 0000000000..22fe7005c1
--- /dev/null
+++ b/include/glib/gio/gioenums.h
@@ -0,0 +1,1969 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __GIO_ENUMS_H__
+#define __GIO_ENUMS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+
+/**
+ * GAppInfoCreateFlags:
+ * @G_APP_INFO_CREATE_NONE: No flags.
+ * @G_APP_INFO_CREATE_NEEDS_TERMINAL: Application opens in a terminal window.
+ * @G_APP_INFO_CREATE_SUPPORTS_URIS: Application supports URI arguments.
+ * @G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION: Application supports startup notification. Since 2.26
+ *
+ * Flags used when creating a #GAppInfo.
+ */
+typedef enum {
+ G_APP_INFO_CREATE_NONE = 0, /*< nick=none >*/
+ G_APP_INFO_CREATE_NEEDS_TERMINAL = (1 << 0), /*< nick=needs-terminal >*/
+ G_APP_INFO_CREATE_SUPPORTS_URIS = (1 << 1), /*< nick=supports-uris >*/
+ G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION = (1 << 2) /*< nick=supports-startup-notification >*/
+} GAppInfoCreateFlags;
+
+/**
+ * GConverterFlags:
+ * @G_CONVERTER_NO_FLAGS: No flags.
+ * @G_CONVERTER_INPUT_AT_END: At end of input data
+ * @G_CONVERTER_FLUSH: Flush data
+ *
+ * Flags used when calling a g_converter_convert().
+ *
+ * Since: 2.24
+ */
+typedef enum {
+ G_CONVERTER_NO_FLAGS = 0, /*< nick=none >*/
+ G_CONVERTER_INPUT_AT_END = (1 << 0), /*< nick=input-at-end >*/
+ G_CONVERTER_FLUSH = (1 << 1) /*< nick=flush >*/
+} GConverterFlags;
+
+/**
+ * GConverterResult:
+ * @G_CONVERTER_ERROR: There was an error during conversion.
+ * @G_CONVERTER_CONVERTED: Some data was consumed or produced
+ * @G_CONVERTER_FINISHED: The conversion is finished
+ * @G_CONVERTER_FLUSHED: Flushing is finished
+ *
+ * Results returned from g_converter_convert().
+ *
+ * Since: 2.24
+ */
+typedef enum {
+ G_CONVERTER_ERROR = 0, /*< nick=error >*/
+ G_CONVERTER_CONVERTED = 1, /*< nick=converted >*/
+ G_CONVERTER_FINISHED = 2, /*< nick=finished >*/
+ G_CONVERTER_FLUSHED = 3 /*< nick=flushed >*/
+} GConverterResult;
+
+
+/**
+ * GDataStreamByteOrder:
+ * @G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: Selects Big Endian byte order.
+ * @G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: Selects Little Endian byte order.
+ * @G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: Selects endianness based on host machine's architecture.
+ *
+ * #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources
+ * across various machine architectures.
+ *
+ **/
+typedef enum {
+ G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN,
+ G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN,
+ G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN
+} GDataStreamByteOrder;
+
+
+/**
+ * GDataStreamNewlineType:
+ * @G_DATA_STREAM_NEWLINE_TYPE_LF: Selects "LF" line endings, common on most modern UNIX platforms.
+ * @G_DATA_STREAM_NEWLINE_TYPE_CR: Selects "CR" line endings.
+ * @G_DATA_STREAM_NEWLINE_TYPE_CR_LF: Selects "CR, LF" line ending, common on Microsoft Windows.
+ * @G_DATA_STREAM_NEWLINE_TYPE_ANY: Automatically try to handle any line ending type.
+ *
+ * #GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
+ **/
+typedef enum {
+ G_DATA_STREAM_NEWLINE_TYPE_LF,
+ G_DATA_STREAM_NEWLINE_TYPE_CR,
+ G_DATA_STREAM_NEWLINE_TYPE_CR_LF,
+ G_DATA_STREAM_NEWLINE_TYPE_ANY
+} GDataStreamNewlineType;
+
+
+/**
+ * GFileAttributeType:
+ * @G_FILE_ATTRIBUTE_TYPE_INVALID: indicates an invalid or uninitalized type.
+ * @G_FILE_ATTRIBUTE_TYPE_STRING: a null terminated UTF8 string.
+ * @G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: a zero terminated string of non-zero bytes.
+ * @G_FILE_ATTRIBUTE_TYPE_BOOLEAN: a boolean value.
+ * @G_FILE_ATTRIBUTE_TYPE_UINT32: an unsigned 4-byte/32-bit integer.
+ * @G_FILE_ATTRIBUTE_TYPE_INT32: a signed 4-byte/32-bit integer.
+ * @G_FILE_ATTRIBUTE_TYPE_UINT64: an unsigned 8-byte/64-bit integer.
+ * @G_FILE_ATTRIBUTE_TYPE_INT64: a signed 8-byte/64-bit integer.
+ * @G_FILE_ATTRIBUTE_TYPE_OBJECT: a #GObject.
+ * @G_FILE_ATTRIBUTE_TYPE_STRINGV: a %NULL terminated char **. Since 2.22
+ *
+ * The data types for file attributes.
+ **/
+typedef enum {
+ G_FILE_ATTRIBUTE_TYPE_INVALID = 0,
+ G_FILE_ATTRIBUTE_TYPE_STRING,
+ G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, /* zero terminated string of non-zero bytes */
+ G_FILE_ATTRIBUTE_TYPE_BOOLEAN,
+ G_FILE_ATTRIBUTE_TYPE_UINT32,
+ G_FILE_ATTRIBUTE_TYPE_INT32,
+ G_FILE_ATTRIBUTE_TYPE_UINT64,
+ G_FILE_ATTRIBUTE_TYPE_INT64,
+ G_FILE_ATTRIBUTE_TYPE_OBJECT,
+ G_FILE_ATTRIBUTE_TYPE_STRINGV
+} GFileAttributeType;
+
+
+/**
+ * GFileAttributeInfoFlags:
+ * @G_FILE_ATTRIBUTE_INFO_NONE: no flags set.
+ * @G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE: copy the attribute values when the file is copied.
+ * @G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED: copy the attribute values when the file is moved.
+ *
+ * Flags specifying the behaviour of an attribute.
+ **/
+typedef enum {
+ G_FILE_ATTRIBUTE_INFO_NONE = 0,
+ G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE = (1 << 0),
+ G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED = (1 << 1)
+} GFileAttributeInfoFlags;
+
+
+/**
+ * GFileAttributeStatus:
+ * @G_FILE_ATTRIBUTE_STATUS_UNSET: Attribute value is unset (empty).
+ * @G_FILE_ATTRIBUTE_STATUS_SET: Attribute value is set.
+ * @G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING: Indicates an error in setting the value.
+ *
+ * Used by g_file_set_attributes_from_info() when setting file attributes.
+ **/
+typedef enum {
+ G_FILE_ATTRIBUTE_STATUS_UNSET = 0,
+ G_FILE_ATTRIBUTE_STATUS_SET,
+ G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING
+} GFileAttributeStatus;
+
+
+/**
+ * GFileQueryInfoFlags:
+ * @G_FILE_QUERY_INFO_NONE: No flags set.
+ * @G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS: Don't follow symlinks.
+ *
+ * Flags used when querying a #GFileInfo.
+ */
+typedef enum {
+ G_FILE_QUERY_INFO_NONE = 0,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (1 << 0) /*< nick=nofollow-symlinks >*/
+} GFileQueryInfoFlags;
+
+
+/**
+ * GFileCreateFlags:
+ * @G_FILE_CREATE_NONE: No flags set.
+ * @G_FILE_CREATE_PRIVATE: Create a file that can only be
+ * accessed by the current user.
+ * @G_FILE_CREATE_REPLACE_DESTINATION: Replace the destination
+ * as if it didn't exist before. Don't try to keep any old
+ * permissions, replace instead of following links. This
+ * is generally useful if you're doing a "copy over"
+ * rather than a "save new version of" replace operation.
+ * You can think of it as "unlink destination" before
+ * writing to it, although the implementation may not
+ * be exactly like that. Since 2.20
+ *
+ * Flags used when an operation may create a file.
+ */
+typedef enum {
+ G_FILE_CREATE_NONE = 0,
+ G_FILE_CREATE_PRIVATE = (1 << 0),
+ G_FILE_CREATE_REPLACE_DESTINATION = (1 << 1)
+} GFileCreateFlags;
+
+/**
+ * GFileMeasureFlags:
+ * @G_FILE_MEASURE_NONE: No flags set.
+ * @G_FILE_MEASURE_REPORT_ANY_ERROR: Report any error encountered
+ * while traversing the directory tree. Normally errors are only
+ * reported for the toplevel file.
+ * @G_FILE_MEASURE_APPARENT_SIZE: Tally usage based on apparent file
+ * sizes. Normally, the block-size is used, if available, as this is a
+ * more accurate representation of disk space used.
+ * Compare with `du --apparent-size`.
+ * @G_FILE_MEASURE_NO_XDEV: Do not cross mount point boundaries.
+ * Compare with `du -x`.
+ *
+ * Flags that can be used with g_file_measure_disk_usage().
+ *
+ * Since: 2.38
+ **/
+typedef enum {
+ G_FILE_MEASURE_NONE = 0,
+ G_FILE_MEASURE_REPORT_ANY_ERROR = (1 << 1),
+ G_FILE_MEASURE_APPARENT_SIZE = (1 << 2),
+ G_FILE_MEASURE_NO_XDEV = (1 << 3)
+} GFileMeasureFlags;
+
+/**
+ * GMountMountFlags:
+ * @G_MOUNT_MOUNT_NONE: No flags set.
+ *
+ * Flags used when mounting a mount.
+ */
+typedef enum /*< flags >*/ {
+ G_MOUNT_MOUNT_NONE = 0
+} GMountMountFlags;
+
+
+/**
+ * GMountUnmountFlags:
+ * @G_MOUNT_UNMOUNT_NONE: No flags set.
+ * @G_MOUNT_UNMOUNT_FORCE: Unmount even if there are outstanding
+ * file operations on the mount.
+ *
+ * Flags used when an unmounting a mount.
+ */
+typedef enum {
+ G_MOUNT_UNMOUNT_NONE = 0,
+ G_MOUNT_UNMOUNT_FORCE = (1 << 0)
+} GMountUnmountFlags;
+
+/**
+ * GDriveStartFlags:
+ * @G_DRIVE_START_NONE: No flags set.
+ *
+ * Flags used when starting a drive.
+ *
+ * Since: 2.22
+ */
+typedef enum /*< flags >*/ {
+ G_DRIVE_START_NONE = 0
+} GDriveStartFlags;
+
+/**
+ * GDriveStartStopType:
+ * @G_DRIVE_START_STOP_TYPE_UNKNOWN: Unknown or drive doesn't support
+ * start/stop.
+ * @G_DRIVE_START_STOP_TYPE_SHUTDOWN: The stop method will physically
+ * shut down the drive and e.g. power down the port the drive is
+ * attached to.
+ * @G_DRIVE_START_STOP_TYPE_NETWORK: The start/stop methods are used
+ * for connecting/disconnect to the drive over the network.
+ * @G_DRIVE_START_STOP_TYPE_MULTIDISK: The start/stop methods will
+ * assemble/disassemble a virtual drive from several physical
+ * drives.
+ * @G_DRIVE_START_STOP_TYPE_PASSWORD: The start/stop methods will
+ * unlock/lock the disk (for example using the ATA <quote>SECURITY
+ * UNLOCK DEVICE</quote> command)
+ *
+ * Enumeration describing how a drive can be started/stopped.
+ *
+ * Since: 2.22
+ */
+typedef enum {
+ G_DRIVE_START_STOP_TYPE_UNKNOWN,
+ G_DRIVE_START_STOP_TYPE_SHUTDOWN,
+ G_DRIVE_START_STOP_TYPE_NETWORK,
+ G_DRIVE_START_STOP_TYPE_MULTIDISK,
+ G_DRIVE_START_STOP_TYPE_PASSWORD
+} GDriveStartStopType;
+
+/**
+ * GFileCopyFlags:
+ * @G_FILE_COPY_NONE: No flags set.
+ * @G_FILE_COPY_OVERWRITE: Overwrite any existing files
+ * @G_FILE_COPY_BACKUP: Make a backup of any existing files.
+ * @G_FILE_COPY_NOFOLLOW_SYMLINKS: Don't follow symlinks.
+ * @G_FILE_COPY_ALL_METADATA: Copy all file metadata instead of just default set used for copy (see #GFileInfo).
+ * @G_FILE_COPY_NO_FALLBACK_FOR_MOVE: Don't use copy and delete fallback if native move not supported.
+ * @G_FILE_COPY_TARGET_DEFAULT_PERMS: Leaves target file with default perms, instead of setting the source file perms.
+ *
+ * Flags used when copying or moving files.
+ */
+typedef enum {
+ G_FILE_COPY_NONE = 0, /*< nick=none >*/
+ G_FILE_COPY_OVERWRITE = (1 << 0),
+ G_FILE_COPY_BACKUP = (1 << 1),
+ G_FILE_COPY_NOFOLLOW_SYMLINKS = (1 << 2),
+ G_FILE_COPY_ALL_METADATA = (1 << 3),
+ G_FILE_COPY_NO_FALLBACK_FOR_MOVE = (1 << 4),
+ G_FILE_COPY_TARGET_DEFAULT_PERMS = (1 << 5)
+} GFileCopyFlags;
+
+
+/**
+ * GFileMonitorFlags:
+ * @G_FILE_MONITOR_NONE: No flags set.
+ * @G_FILE_MONITOR_WATCH_MOUNTS: Watch for mount events.
+ * @G_FILE_MONITOR_SEND_MOVED: Pair DELETED and CREATED events caused
+ * by file renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED
+ * event instead (NB: not supported on all backends; the default
+ * behaviour -without specifying this flag- is to send single DELETED
+ * and CREATED events). Deprecated since 2.46: use
+ * %G_FILE_MONITOR_WATCH_MOVES instead.
+ * @G_FILE_MONITOR_WATCH_HARD_LINKS: Watch for changes to the file made
+ * via another hard link. Since 2.36.
+ * @G_FILE_MONITOR_WATCH_MOVES: Watch for rename operations on a
+ * monitored directory. This causes %G_FILE_MONITOR_EVENT_RENAMED,
+ * %G_FILE_MONITOR_EVENT_MOVED_IN and %G_FILE_MONITOR_EVENT_MOVED_OUT
+ * events to be emitted when possible. Since: 2.46.
+ *
+ * Flags used to set what a #GFileMonitor will watch for.
+ */
+typedef enum {
+ G_FILE_MONITOR_NONE = 0,
+ G_FILE_MONITOR_WATCH_MOUNTS = (1 << 0),
+ G_FILE_MONITOR_SEND_MOVED = (1 << 1),
+ G_FILE_MONITOR_WATCH_HARD_LINKS = (1 << 2),
+ G_FILE_MONITOR_WATCH_MOVES = (1 << 3)
+} GFileMonitorFlags;
+
+
+/**
+ * GFileType:
+ * @G_FILE_TYPE_UNKNOWN: File's type is unknown.
+ * @G_FILE_TYPE_REGULAR: File handle represents a regular file.
+ * @G_FILE_TYPE_DIRECTORY: File handle represents a directory.
+ * @G_FILE_TYPE_SYMBOLIC_LINK: File handle represents a symbolic link
+ * (Unix systems).
+ * @G_FILE_TYPE_SPECIAL: File is a "special" file, such as a socket, fifo,
+ * block device, or character device.
+ * @G_FILE_TYPE_SHORTCUT: File is a shortcut (Windows systems).
+ * @G_FILE_TYPE_MOUNTABLE: File is a mountable location.
+ *
+ * Indicates the file's on-disk type.
+ *
+ * On Windows systems a file will never have %G_FILE_TYPE_SYMBOLIC_LINK type;
+ * use #GFileInfo and %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK to determine
+ * whether a file is a symlink or not. This is due to the fact that NTFS does
+ * not have a single filesystem object type for symbolic links - it has
+ * files that symlink to files, and directories that symlink to directories.
+ * #GFileType enumeration cannot precisely represent this important distinction,
+ * which is why all Windows symlinks will continue to be reported as
+ * %G_FILE_TYPE_REGULAR or %G_FILE_TYPE_DIRECTORY.
+ **/
+typedef enum {
+ G_FILE_TYPE_UNKNOWN = 0,
+ G_FILE_TYPE_REGULAR,
+ G_FILE_TYPE_DIRECTORY,
+ G_FILE_TYPE_SYMBOLIC_LINK,
+ G_FILE_TYPE_SPECIAL, /* socket, fifo, blockdev, chardev */
+ G_FILE_TYPE_SHORTCUT,
+ G_FILE_TYPE_MOUNTABLE
+} GFileType;
+
+
+/**
+ * GFilesystemPreviewType:
+ * @G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS: Only preview files if user has explicitly requested it.
+ * @G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL: Preview files if user has requested preview of "local" files.
+ * @G_FILESYSTEM_PREVIEW_TYPE_NEVER: Never preview files.
+ *
+ * Indicates a hint from the file system whether files should be
+ * previewed in a file manager. Returned as the value of the key
+ * #G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW.
+ **/
+typedef enum {
+ G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS = 0,
+ G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL,
+ G_FILESYSTEM_PREVIEW_TYPE_NEVER
+} GFilesystemPreviewType;
+
+
+/**
+ * GFileMonitorEvent:
+ * @G_FILE_MONITOR_EVENT_CHANGED: a file changed.
+ * @G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: a hint that this was probably the last change in a set of changes.
+ * @G_FILE_MONITOR_EVENT_DELETED: a file was deleted.
+ * @G_FILE_MONITOR_EVENT_CREATED: a file was created.
+ * @G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: a file attribute was changed.
+ * @G_FILE_MONITOR_EVENT_PRE_UNMOUNT: the file location will soon be unmounted.
+ * @G_FILE_MONITOR_EVENT_UNMOUNTED: the file location was unmounted.
+ * @G_FILE_MONITOR_EVENT_MOVED: the file was moved -- only sent if the
+ * (deprecated) %G_FILE_MONITOR_SEND_MOVED flag is set
+ * @G_FILE_MONITOR_EVENT_RENAMED: the file was renamed within the
+ * current directory -- only sent if the %G_FILE_MONITOR_WATCH_MOVES
+ * flag is set. Since: 2.46.
+ * @G_FILE_MONITOR_EVENT_MOVED_IN: the file was moved into the
+ * monitored directory from another location -- only sent if the
+ * %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46.
+ * @G_FILE_MONITOR_EVENT_MOVED_OUT: the file was moved out of the
+ * monitored directory to another location -- only sent if the
+ * %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46
+ *
+ * Specifies what type of event a monitor event is.
+ **/
+typedef enum {
+ G_FILE_MONITOR_EVENT_CHANGED,
+ G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT,
+ G_FILE_MONITOR_EVENT_DELETED,
+ G_FILE_MONITOR_EVENT_CREATED,
+ G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED,
+ G_FILE_MONITOR_EVENT_PRE_UNMOUNT,
+ G_FILE_MONITOR_EVENT_UNMOUNTED,
+ G_FILE_MONITOR_EVENT_MOVED,
+ G_FILE_MONITOR_EVENT_RENAMED,
+ G_FILE_MONITOR_EVENT_MOVED_IN,
+ G_FILE_MONITOR_EVENT_MOVED_OUT
+} GFileMonitorEvent;
+
+
+/* This enumeration conflicts with GIOError in giochannel.h. However,
+ * that is only used as a return value in some deprecated functions.
+ * So, we reuse the same prefix for the enumeration values, but call
+ * the actual enumeration (which is rarely used) GIOErrorEnum.
+ */
+/**
+ * GIOErrorEnum:
+ * @G_IO_ERROR_FAILED: Generic error condition for when an operation fails
+ * and no more specific #GIOErrorEnum value is defined.
+ * @G_IO_ERROR_NOT_FOUND: File not found.
+ * @G_IO_ERROR_EXISTS: File already exists.
+ * @G_IO_ERROR_IS_DIRECTORY: File is a directory.
+ * @G_IO_ERROR_NOT_DIRECTORY: File is not a directory.
+ * @G_IO_ERROR_NOT_EMPTY: File is a directory that isn't empty.
+ * @G_IO_ERROR_NOT_REGULAR_FILE: File is not a regular file.
+ * @G_IO_ERROR_NOT_SYMBOLIC_LINK: File is not a symbolic link.
+ * @G_IO_ERROR_NOT_MOUNTABLE_FILE: File cannot be mounted.
+ * @G_IO_ERROR_FILENAME_TOO_LONG: Filename is too many characters.
+ * @G_IO_ERROR_INVALID_FILENAME: Filename is invalid or contains invalid characters.
+ * @G_IO_ERROR_TOO_MANY_LINKS: File contains too many symbolic links.
+ * @G_IO_ERROR_NO_SPACE: No space left on drive.
+ * @G_IO_ERROR_INVALID_ARGUMENT: Invalid argument.
+ * @G_IO_ERROR_PERMISSION_DENIED: Permission denied.
+ * @G_IO_ERROR_NOT_SUPPORTED: Operation (or one of its parameters) not supported
+ * @G_IO_ERROR_NOT_MOUNTED: File isn't mounted.
+ * @G_IO_ERROR_ALREADY_MOUNTED: File is already mounted.
+ * @G_IO_ERROR_CLOSED: File was closed.
+ * @G_IO_ERROR_CANCELLED: Operation was cancelled. See #GCancellable.
+ * @G_IO_ERROR_PENDING: Operations are still pending.
+ * @G_IO_ERROR_READ_ONLY: File is read only.
+ * @G_IO_ERROR_CANT_CREATE_BACKUP: Backup couldn't be created.
+ * @G_IO_ERROR_WRONG_ETAG: File's Entity Tag was incorrect.
+ * @G_IO_ERROR_TIMED_OUT: Operation timed out.
+ * @G_IO_ERROR_WOULD_RECURSE: Operation would be recursive.
+ * @G_IO_ERROR_BUSY: File is busy.
+ * @G_IO_ERROR_WOULD_BLOCK: Operation would block.
+ * @G_IO_ERROR_HOST_NOT_FOUND: Host couldn't be found (remote operations).
+ * @G_IO_ERROR_WOULD_MERGE: Operation would merge files.
+ * @G_IO_ERROR_FAILED_HANDLED: Operation failed and a helper program has
+ * already interacted with the user. Do not display any error dialog.
+ * @G_IO_ERROR_TOO_MANY_OPEN_FILES: The current process has too many files
+ * open and can't open any more. Duplicate descriptors do count toward
+ * this limit. Since 2.20
+ * @G_IO_ERROR_NOT_INITIALIZED: The object has not been initialized. Since 2.22
+ * @G_IO_ERROR_ADDRESS_IN_USE: The requested address is already in use. Since 2.22
+ * @G_IO_ERROR_PARTIAL_INPUT: Need more input to finish operation. Since 2.24
+ * @G_IO_ERROR_INVALID_DATA: The input data was invalid. Since 2.24
+ * @G_IO_ERROR_DBUS_ERROR: A remote object generated an error that
+ * doesn't correspond to a locally registered #GError error
+ * domain. Use g_dbus_error_get_remote_error() to extract the D-Bus
+ * error name and g_dbus_error_strip_remote_error() to fix up the
+ * message so it matches what was received on the wire. Since 2.26.
+ * @G_IO_ERROR_HOST_UNREACHABLE: Host unreachable. Since 2.26
+ * @G_IO_ERROR_NETWORK_UNREACHABLE: Network unreachable. Since 2.26
+ * @G_IO_ERROR_CONNECTION_REFUSED: Connection refused. Since 2.26
+ * @G_IO_ERROR_PROXY_FAILED: Connection to proxy server failed. Since 2.26
+ * @G_IO_ERROR_PROXY_AUTH_FAILED: Proxy authentication failed. Since 2.26
+ * @G_IO_ERROR_PROXY_NEED_AUTH: Proxy server needs authentication. Since 2.26
+ * @G_IO_ERROR_PROXY_NOT_ALLOWED: Proxy connection is not allowed by ruleset.
+ * Since 2.26
+ * @G_IO_ERROR_BROKEN_PIPE: Broken pipe. Since 2.36
+ * @G_IO_ERROR_CONNECTION_CLOSED: Connection closed by peer. Note that this
+ * is the same code as %G_IO_ERROR_BROKEN_PIPE; before 2.44 some
+ * "connection closed" errors returned %G_IO_ERROR_BROKEN_PIPE, but others
+ * returned %G_IO_ERROR_FAILED. Now they should all return the same
+ * value, which has this more logical name. Since 2.44.
+ * @G_IO_ERROR_NOT_CONNECTED: Transport endpoint is not connected. Since 2.44
+ * @G_IO_ERROR_MESSAGE_TOO_LARGE: Message too large. Since 2.48.
+ *
+ * Error codes returned by GIO functions.
+ *
+ * Note that this domain may be extended in future GLib releases. In
+ * general, new error codes either only apply to new APIs, or else
+ * replace %G_IO_ERROR_FAILED in cases that were not explicitly
+ * distinguished before. You should therefore avoid writing code like
+ * |[<!-- language="C" -->
+ * if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED))
+ * {
+ * // Assume that this is EPRINTERONFIRE
+ * ...
+ * }
+ * ]|
+ * but should instead treat all unrecognized error codes the same as
+ * #G_IO_ERROR_FAILED.
+ *
+ * See also #GPollableReturn for a cheaper way of returning
+ * %G_IO_ERROR_WOULD_BLOCK to callers without allocating a #GError.
+ **/
+typedef enum {
+ G_IO_ERROR_FAILED,
+ G_IO_ERROR_NOT_FOUND,
+ G_IO_ERROR_EXISTS,
+ G_IO_ERROR_IS_DIRECTORY,
+ G_IO_ERROR_NOT_DIRECTORY,
+ G_IO_ERROR_NOT_EMPTY,
+ G_IO_ERROR_NOT_REGULAR_FILE,
+ G_IO_ERROR_NOT_SYMBOLIC_LINK,
+ G_IO_ERROR_NOT_MOUNTABLE_FILE,
+ G_IO_ERROR_FILENAME_TOO_LONG,
+ G_IO_ERROR_INVALID_FILENAME,
+ G_IO_ERROR_TOO_MANY_LINKS,
+ G_IO_ERROR_NO_SPACE,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ G_IO_ERROR_PERMISSION_DENIED,
+ G_IO_ERROR_NOT_SUPPORTED,
+ G_IO_ERROR_NOT_MOUNTED,
+ G_IO_ERROR_ALREADY_MOUNTED,
+ G_IO_ERROR_CLOSED,
+ G_IO_ERROR_CANCELLED,
+ G_IO_ERROR_PENDING,
+ G_IO_ERROR_READ_ONLY,
+ G_IO_ERROR_CANT_CREATE_BACKUP,
+ G_IO_ERROR_WRONG_ETAG,
+ G_IO_ERROR_TIMED_OUT,
+ G_IO_ERROR_WOULD_RECURSE,
+ G_IO_ERROR_BUSY,
+ G_IO_ERROR_WOULD_BLOCK,
+ G_IO_ERROR_HOST_NOT_FOUND,
+ G_IO_ERROR_WOULD_MERGE,
+ G_IO_ERROR_FAILED_HANDLED,
+ G_IO_ERROR_TOO_MANY_OPEN_FILES,
+ G_IO_ERROR_NOT_INITIALIZED,
+ G_IO_ERROR_ADDRESS_IN_USE,
+ G_IO_ERROR_PARTIAL_INPUT,
+ G_IO_ERROR_INVALID_DATA,
+ G_IO_ERROR_DBUS_ERROR,
+ G_IO_ERROR_HOST_UNREACHABLE,
+ G_IO_ERROR_NETWORK_UNREACHABLE,
+ G_IO_ERROR_CONNECTION_REFUSED,
+ G_IO_ERROR_PROXY_FAILED,
+ G_IO_ERROR_PROXY_AUTH_FAILED,
+ G_IO_ERROR_PROXY_NEED_AUTH,
+ G_IO_ERROR_PROXY_NOT_ALLOWED,
+ G_IO_ERROR_BROKEN_PIPE,
+ G_IO_ERROR_CONNECTION_CLOSED = G_IO_ERROR_BROKEN_PIPE,
+ G_IO_ERROR_NOT_CONNECTED,
+ G_IO_ERROR_MESSAGE_TOO_LARGE
+} GIOErrorEnum;
+
+
+/**
+ * GAskPasswordFlags:
+ * @G_ASK_PASSWORD_NEED_PASSWORD: operation requires a password.
+ * @G_ASK_PASSWORD_NEED_USERNAME: operation requires a username.
+ * @G_ASK_PASSWORD_NEED_DOMAIN: operation requires a domain.
+ * @G_ASK_PASSWORD_SAVING_SUPPORTED: operation supports saving settings.
+ * @G_ASK_PASSWORD_ANONYMOUS_SUPPORTED: operation supports anonymous users.
+ * @G_ASK_PASSWORD_TCRYPT: operation takes TCRYPT parameters (Since: 2.58)
+ *
+ * #GAskPasswordFlags are used to request specific information from the
+ * user, or to notify the user of their choices in an authentication
+ * situation.
+ **/
+typedef enum {
+ G_ASK_PASSWORD_NEED_PASSWORD = (1 << 0),
+ G_ASK_PASSWORD_NEED_USERNAME = (1 << 1),
+ G_ASK_PASSWORD_NEED_DOMAIN = (1 << 2),
+ G_ASK_PASSWORD_SAVING_SUPPORTED = (1 << 3),
+ G_ASK_PASSWORD_ANONYMOUS_SUPPORTED = (1 << 4),
+ G_ASK_PASSWORD_TCRYPT = (1 << 5),
+} GAskPasswordFlags;
+
+
+/**
+ * GPasswordSave:
+ * @G_PASSWORD_SAVE_NEVER: never save a password.
+ * @G_PASSWORD_SAVE_FOR_SESSION: save a password for the session.
+ * @G_PASSWORD_SAVE_PERMANENTLY: save a password permanently.
+ *
+ * #GPasswordSave is used to indicate the lifespan of a saved password.
+ *
+ * #Gvfs stores passwords in the Gnome keyring when this flag allows it
+ * to, and later retrieves it again from there.
+ **/
+typedef enum {
+ G_PASSWORD_SAVE_NEVER,
+ G_PASSWORD_SAVE_FOR_SESSION,
+ G_PASSWORD_SAVE_PERMANENTLY
+} GPasswordSave;
+
+
+/**
+ * GMountOperationResult:
+ * @G_MOUNT_OPERATION_HANDLED: The request was fulfilled and the
+ * user specified data is now available
+ * @G_MOUNT_OPERATION_ABORTED: The user requested the mount operation
+ * to be aborted
+ * @G_MOUNT_OPERATION_UNHANDLED: The request was unhandled (i.e. not
+ * implemented)
+ *
+ * #GMountOperationResult is returned as a result when a request for
+ * information is send by the mounting operation.
+ **/
+typedef enum {
+ G_MOUNT_OPERATION_HANDLED,
+ G_MOUNT_OPERATION_ABORTED,
+ G_MOUNT_OPERATION_UNHANDLED
+} GMountOperationResult;
+
+
+/**
+ * GOutputStreamSpliceFlags:
+ * @G_OUTPUT_STREAM_SPLICE_NONE: Do not close either stream.
+ * @G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE: Close the source stream after
+ * the splice.
+ * @G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET: Close the target stream after
+ * the splice.
+ *
+ * GOutputStreamSpliceFlags determine how streams should be spliced.
+ **/
+typedef enum {
+ G_OUTPUT_STREAM_SPLICE_NONE = 0,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE = (1 << 0),
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET = (1 << 1)
+} GOutputStreamSpliceFlags;
+
+
+/**
+ * GIOStreamSpliceFlags:
+ * @G_IO_STREAM_SPLICE_NONE: Do not close either stream.
+ * @G_IO_STREAM_SPLICE_CLOSE_STREAM1: Close the first stream after
+ * the splice.
+ * @G_IO_STREAM_SPLICE_CLOSE_STREAM2: Close the second stream after
+ * the splice.
+ * @G_IO_STREAM_SPLICE_WAIT_FOR_BOTH: Wait for both splice operations to finish
+ * before calling the callback.
+ *
+ * GIOStreamSpliceFlags determine how streams should be spliced.
+ *
+ * Since: 2.28
+ **/
+typedef enum {
+ G_IO_STREAM_SPLICE_NONE = 0,
+ G_IO_STREAM_SPLICE_CLOSE_STREAM1 = (1 << 0),
+ G_IO_STREAM_SPLICE_CLOSE_STREAM2 = (1 << 1),
+ G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2)
+} GIOStreamSpliceFlags;
+
+/**
+ * GEmblemOrigin:
+ * @G_EMBLEM_ORIGIN_UNKNOWN: Emblem of unknown origin
+ * @G_EMBLEM_ORIGIN_DEVICE: Emblem adds device-specific information
+ * @G_EMBLEM_ORIGIN_LIVEMETADATA: Emblem depicts live metadata, such as "readonly"
+ * @G_EMBLEM_ORIGIN_TAG: Emblem comes from a user-defined tag, e.g. set by nautilus (in the future)
+ *
+ * GEmblemOrigin is used to add information about the origin of the emblem
+ * to #GEmblem.
+ *
+ * Since: 2.18
+ */
+typedef enum {
+ G_EMBLEM_ORIGIN_UNKNOWN,
+ G_EMBLEM_ORIGIN_DEVICE,
+ G_EMBLEM_ORIGIN_LIVEMETADATA,
+ G_EMBLEM_ORIGIN_TAG
+} GEmblemOrigin;
+
+/**
+ * GResolverError:
+ * @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not
+ * found
+ * @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not
+ * be looked up due to a network error or similar problem
+ * @G_RESOLVER_ERROR_INTERNAL: unknown error
+ *
+ * An error code used with %G_RESOLVER_ERROR in a #GError returned
+ * from a #GResolver routine.
+ *
+ * Since: 2.22
+ */
+typedef enum {
+ G_RESOLVER_ERROR_NOT_FOUND,
+ G_RESOLVER_ERROR_TEMPORARY_FAILURE,
+ G_RESOLVER_ERROR_INTERNAL
+} GResolverError;
+
+/**
+ * GResolverRecordType:
+ * @G_RESOLVER_RECORD_SRV: look up DNS SRV records for a domain
+ * @G_RESOLVER_RECORD_MX: look up DNS MX records for a domain
+ * @G_RESOLVER_RECORD_TXT: look up DNS TXT records for a name
+ * @G_RESOLVER_RECORD_SOA: look up DNS SOA records for a zone
+ * @G_RESOLVER_RECORD_NS: look up DNS NS records for a domain
+ *
+ * The type of record that g_resolver_lookup_records() or
+ * g_resolver_lookup_records_async() should retrieve. The records are returned
+ * as lists of #GVariant tuples. Each record type has different values in
+ * the variant tuples returned.
+ *
+ * %G_RESOLVER_RECORD_SRV records are returned as variants with the signature
+ * `(qqqs)`, containing a `guint16` with the priority, a `guint16` with the
+ * weight, a `guint16` with the port, and a string of the hostname.
+ *
+ * %G_RESOLVER_RECORD_MX records are returned as variants with the signature
+ * `(qs)`, representing a `guint16` with the preference, and a string containing
+ * the mail exchanger hostname.
+ *
+ * %G_RESOLVER_RECORD_TXT records are returned as variants with the signature
+ * `(as)`, representing an array of the strings in the text record. Note: Most TXT
+ * records only contain a single string, but
+ * [RFC 1035](https://tools.ietf.org/html/rfc1035#section-3.3.14) does allow a
+ * record to contain multiple strings. The RFC which defines the interpretation
+ * of a specific TXT record will likely require concatenation of multiple
+ * strings if they are present, as with
+ * [RFC 7208](https://tools.ietf.org/html/rfc7208#section-3.3).
+ *
+ * %G_RESOLVER_RECORD_SOA records are returned as variants with the signature
+ * `(ssuuuuu)`, representing a string containing the primary name server, a
+ * string containing the administrator, the serial as a `guint32`, the refresh
+ * interval as a `guint32`, the retry interval as a `guint32`, the expire timeout
+ * as a `guint32`, and the TTL as a `guint32`.
+ *
+ * %G_RESOLVER_RECORD_NS records are returned as variants with the signature
+ * `(s)`, representing a string of the hostname of the name server.
+ *
+ * Since: 2.34
+ */
+typedef enum {
+ G_RESOLVER_RECORD_SRV = 1,
+ G_RESOLVER_RECORD_MX,
+ G_RESOLVER_RECORD_TXT,
+ G_RESOLVER_RECORD_SOA,
+ G_RESOLVER_RECORD_NS
+} GResolverRecordType;
+
+/**
+ * GResourceError:
+ * @G_RESOURCE_ERROR_NOT_FOUND: no file was found at the requested path
+ * @G_RESOURCE_ERROR_INTERNAL: unknown error
+ *
+ * An error code used with %G_RESOURCE_ERROR in a #GError returned
+ * from a #GResource routine.
+ *
+ * Since: 2.32
+ */
+typedef enum {
+ G_RESOURCE_ERROR_NOT_FOUND,
+ G_RESOURCE_ERROR_INTERNAL
+} GResourceError;
+
+/**
+ * GResourceFlags:
+ * @G_RESOURCE_FLAGS_NONE: No flags set.
+ * @G_RESOURCE_FLAGS_COMPRESSED: The file is compressed.
+ *
+ * GResourceFlags give information about a particular file inside a resource
+ * bundle.
+ *
+ * Since: 2.32
+ **/
+typedef enum {
+ G_RESOURCE_FLAGS_NONE = 0,
+ G_RESOURCE_FLAGS_COMPRESSED = (1<<0)
+} GResourceFlags;
+
+/**
+ * GResourceLookupFlags:
+ * @G_RESOURCE_LOOKUP_FLAGS_NONE: No flags set.
+ *
+ * GResourceLookupFlags determine how resource path lookups are handled.
+ *
+ * Since: 2.32
+ **/
+typedef enum /*< flags >*/ {
+ G_RESOURCE_LOOKUP_FLAGS_NONE = 0
+} GResourceLookupFlags;
+
+/**
+ * GSocketFamily:
+ * @G_SOCKET_FAMILY_INVALID: no address family
+ * @G_SOCKET_FAMILY_IPV4: the IPv4 family
+ * @G_SOCKET_FAMILY_IPV6: the IPv6 family
+ * @G_SOCKET_FAMILY_UNIX: the UNIX domain family
+ *
+ * The protocol family of a #GSocketAddress. (These values are
+ * identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
+ * if available.)
+ *
+ * Since: 2.22
+ */
+typedef enum {
+ G_SOCKET_FAMILY_INVALID,
+ G_SOCKET_FAMILY_UNIX = GLIB_SYSDEF_AF_UNIX,
+ G_SOCKET_FAMILY_IPV4 = GLIB_SYSDEF_AF_INET,
+ G_SOCKET_FAMILY_IPV6 = GLIB_SYSDEF_AF_INET6
+} GSocketFamily;
+
+/**
+ * GSocketType:
+ * @G_SOCKET_TYPE_INVALID: Type unknown or wrong
+ * @G_SOCKET_TYPE_STREAM: Reliable connection-based byte streams (e.g. TCP).
+ * @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing.
+ * (e.g. UDP)
+ * @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams
+ * of fixed maximum length (e.g. SCTP).
+ *
+ * Flags used when creating a #GSocket. Some protocols may not implement
+ * all the socket types.
+ *
+ * Since: 2.22
+ */
+typedef enum
+{
+ G_SOCKET_TYPE_INVALID,
+ G_SOCKET_TYPE_STREAM,
+ G_SOCKET_TYPE_DATAGRAM,
+ G_SOCKET_TYPE_SEQPACKET
+} GSocketType;
+
+/**
+ * GSocketMsgFlags:
+ * @G_SOCKET_MSG_NONE: No flags.
+ * @G_SOCKET_MSG_OOB: Request to send/receive out of band data.
+ * @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from
+ * the queue.
+ * @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet,
+ * only send to hosts on directly connected networks.
+ *
+ * Flags used in g_socket_receive_message() and g_socket_send_message().
+ * The flags listed in the enum are some commonly available flags, but the
+ * values used for them are the same as on the platform, and any other flags
+ * are passed in/out as is. So to use a platform specific flag, just include
+ * the right system header and pass in the flag.
+ *
+ * Since: 2.22
+ */
+typedef enum /*< flags >*/
+{
+ G_SOCKET_MSG_NONE,
+ G_SOCKET_MSG_OOB = GLIB_SYSDEF_MSG_OOB,
+ G_SOCKET_MSG_PEEK = GLIB_SYSDEF_MSG_PEEK,
+ G_SOCKET_MSG_DONTROUTE = GLIB_SYSDEF_MSG_DONTROUTE
+} GSocketMsgFlags;
+
+/**
+ * GSocketProtocol:
+ * @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown
+ * @G_SOCKET_PROTOCOL_DEFAULT: The default protocol for the family/type
+ * @G_SOCKET_PROTOCOL_TCP: TCP over IP
+ * @G_SOCKET_PROTOCOL_UDP: UDP over IP
+ * @G_SOCKET_PROTOCOL_SCTP: SCTP over IP
+ *
+ * A protocol identifier is specified when creating a #GSocket, which is a
+ * family/type specific identifier, where 0 means the default protocol for
+ * the particular family/type.
+ *
+ * This enum contains a set of commonly available and used protocols. You
+ * can also pass any other identifiers handled by the platform in order to
+ * use protocols not listed here.
+ *
+ * Since: 2.22
+ */
+typedef enum {
+ G_SOCKET_PROTOCOL_UNKNOWN = -1,
+ G_SOCKET_PROTOCOL_DEFAULT = 0,
+ G_SOCKET_PROTOCOL_TCP = 6,
+ G_SOCKET_PROTOCOL_UDP = 17,
+ G_SOCKET_PROTOCOL_SCTP = 132
+} GSocketProtocol;
+
+/**
+ * GZlibCompressorFormat:
+ * @G_ZLIB_COMPRESSOR_FORMAT_ZLIB: deflate compression with zlib header
+ * @G_ZLIB_COMPRESSOR_FORMAT_GZIP: gzip file format
+ * @G_ZLIB_COMPRESSOR_FORMAT_RAW: deflate compression with no header
+ *
+ * Used to select the type of data format to use for #GZlibDecompressor
+ * and #GZlibCompressor.
+ *
+ * Since: 2.24
+ */
+typedef enum {
+ G_ZLIB_COMPRESSOR_FORMAT_ZLIB,
+ G_ZLIB_COMPRESSOR_FORMAT_GZIP,
+ G_ZLIB_COMPRESSOR_FORMAT_RAW
+} GZlibCompressorFormat;
+
+/**
+ * GUnixSocketAddressType:
+ * @G_UNIX_SOCKET_ADDRESS_INVALID: invalid
+ * @G_UNIX_SOCKET_ADDRESS_ANONYMOUS: anonymous
+ * @G_UNIX_SOCKET_ADDRESS_PATH: a filesystem path
+ * @G_UNIX_SOCKET_ADDRESS_ABSTRACT: an abstract name
+ * @G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED: an abstract name, 0-padded
+ * to the full length of a unix socket name
+ *
+ * The type of name used by a #GUnixSocketAddress.
+ * %G_UNIX_SOCKET_ADDRESS_PATH indicates a traditional unix domain
+ * socket bound to a filesystem path. %G_UNIX_SOCKET_ADDRESS_ANONYMOUS
+ * indicates a socket not bound to any name (eg, a client-side socket,
+ * or a socket created with socketpair()).
+ *
+ * For abstract sockets, there are two incompatible ways of naming
+ * them; the man pages suggest using the entire `struct sockaddr_un`
+ * as the name, padding the unused parts of the %sun_path field with
+ * zeroes; this corresponds to %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED.
+ * However, many programs instead just use a portion of %sun_path, and
+ * pass an appropriate smaller length to bind() or connect(). This is
+ * %G_UNIX_SOCKET_ADDRESS_ABSTRACT.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_UNIX_SOCKET_ADDRESS_INVALID,
+ G_UNIX_SOCKET_ADDRESS_ANONYMOUS,
+ G_UNIX_SOCKET_ADDRESS_PATH,
+ G_UNIX_SOCKET_ADDRESS_ABSTRACT,
+ G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED
+} GUnixSocketAddressType;
+
+/**
+ * GBusType:
+ * @G_BUS_TYPE_STARTER: An alias for the message bus that activated the process, if any.
+ * @G_BUS_TYPE_NONE: Not a message bus.
+ * @G_BUS_TYPE_SYSTEM: The system-wide message bus.
+ * @G_BUS_TYPE_SESSION: The login session message bus.
+ *
+ * An enumeration for well-known message buses.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_BUS_TYPE_STARTER = -1,
+ G_BUS_TYPE_NONE = 0,
+ G_BUS_TYPE_SYSTEM = 1,
+ G_BUS_TYPE_SESSION = 2
+} GBusType;
+
+/**
+ * GBusNameOwnerFlags:
+ * @G_BUS_NAME_OWNER_FLAGS_NONE: No flags set.
+ * @G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT: Allow another message bus connection to claim the name.
+ * @G_BUS_NAME_OWNER_FLAGS_REPLACE: If another message bus connection owns the name and have
+ * specified #G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection.
+ * @G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE: If another message bus connection owns the name, immediately
+ * return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54)
+ *
+ * Flags used in g_bus_own_name().
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_BUS_NAME_OWNER_FLAGS_NONE = 0, /*< nick=none >*/
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT = (1<<0), /*< nick=allow-replacement >*/
+ G_BUS_NAME_OWNER_FLAGS_REPLACE = (1<<1), /*< nick=replace >*/
+ G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE = (1<<2) /*< nick=do-not-queue >*/
+} GBusNameOwnerFlags;
+/* When adding new flags, their numeric values must currently match those
+ * used in the D-Bus Specification. */
+
+/**
+ * GBusNameWatcherFlags:
+ * @G_BUS_NAME_WATCHER_FLAGS_NONE: No flags set.
+ * @G_BUS_NAME_WATCHER_FLAGS_AUTO_START: If no-one owns the name when
+ * beginning to watch the name, ask the bus to launch an owner for the
+ * name.
+ *
+ * Flags used in g_bus_watch_name().
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_BUS_NAME_WATCHER_FLAGS_NONE = 0,
+ G_BUS_NAME_WATCHER_FLAGS_AUTO_START = (1<<0)
+} GBusNameWatcherFlags;
+
+/**
+ * GDBusProxyFlags:
+ * @G_DBUS_PROXY_FLAGS_NONE: No flags set.
+ * @G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES: Don't load properties.
+ * @G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS: Don't connect to signals on the remote object.
+ * @G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START: If the proxy is for a well-known name,
+ * do not ask the bus to launch an owner during proxy initialization or a method call.
+ * This flag is only meaningful in proxies for well-known names.
+ * @G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES: If set, the property value for any __invalidated property__ will be (asynchronously) retrieved upon receiving the [`PropertiesChanged`](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) D-Bus signal and the property will not cause emission of the #GDBusProxy::g-properties-changed signal. When the value is received the #GDBusProxy::g-properties-changed signal is emitted for the property along with the retrieved value. Since 2.32.
+ * @G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION: If the proxy is for a well-known name,
+ * do not ask the bus to launch an owner during proxy initialization, but allow it to be
+ * autostarted by a method call. This flag is only meaningful in proxies for well-known names,
+ * and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified.
+ *
+ * Flags used when constructing an instance of a #GDBusProxy derived class.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_PROXY_FLAGS_NONE = 0,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES = (1<<0),
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS = (1<<1),
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START = (1<<2),
+ G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES = (1<<3),
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION = (1<<4)
+} GDBusProxyFlags;
+
+/**
+ * GDBusError:
+ * @G_DBUS_ERROR_FAILED:
+ * A generic error; "something went wrong" - see the error message for
+ * more.
+ * @G_DBUS_ERROR_NO_MEMORY:
+ * There was not enough memory to complete an operation.
+ * @G_DBUS_ERROR_SERVICE_UNKNOWN:
+ * The bus doesn't know how to launch a service to supply the bus name
+ * you wanted.
+ * @G_DBUS_ERROR_NAME_HAS_NO_OWNER:
+ * The bus name you referenced doesn't exist (i.e. no application owns
+ * it).
+ * @G_DBUS_ERROR_NO_REPLY:
+ * No reply to a message expecting one, usually means a timeout occurred.
+ * @G_DBUS_ERROR_IO_ERROR:
+ * Something went wrong reading or writing to a socket, for example.
+ * @G_DBUS_ERROR_BAD_ADDRESS:
+ * A D-Bus bus address was malformed.
+ * @G_DBUS_ERROR_NOT_SUPPORTED:
+ * Requested operation isn't supported (like ENOSYS on UNIX).
+ * @G_DBUS_ERROR_LIMITS_EXCEEDED:
+ * Some limited resource is exhausted.
+ * @G_DBUS_ERROR_ACCESS_DENIED:
+ * Security restrictions don't allow doing what you're trying to do.
+ * @G_DBUS_ERROR_AUTH_FAILED:
+ * Authentication didn't work.
+ * @G_DBUS_ERROR_NO_SERVER:
+ * Unable to connect to server (probably caused by ECONNREFUSED on a
+ * socket).
+ * @G_DBUS_ERROR_TIMEOUT:
+ * Certain timeout errors, possibly ETIMEDOUT on a socket. Note that
+ * %G_DBUS_ERROR_NO_REPLY is used for message reply timeouts. Warning:
+ * this is confusingly-named given that %G_DBUS_ERROR_TIMED_OUT also
+ * exists. We can't fix it for compatibility reasons so just be
+ * careful.
+ * @G_DBUS_ERROR_NO_NETWORK:
+ * No network access (probably ENETUNREACH on a socket).
+ * @G_DBUS_ERROR_ADDRESS_IN_USE:
+ * Can't bind a socket since its address is in use (i.e. EADDRINUSE).
+ * @G_DBUS_ERROR_DISCONNECTED:
+ * The connection is disconnected and you're trying to use it.
+ * @G_DBUS_ERROR_INVALID_ARGS:
+ * Invalid arguments passed to a method call.
+ * @G_DBUS_ERROR_FILE_NOT_FOUND:
+ * Missing file.
+ * @G_DBUS_ERROR_FILE_EXISTS:
+ * Existing file and the operation you're using does not silently overwrite.
+ * @G_DBUS_ERROR_UNKNOWN_METHOD:
+ * Method name you invoked isn't known by the object you invoked it on.
+ * @G_DBUS_ERROR_UNKNOWN_OBJECT:
+ * Object you invoked a method on isn't known. Since 2.42
+ * @G_DBUS_ERROR_UNKNOWN_INTERFACE:
+ * Interface you invoked a method on isn't known by the object. Since 2.42
+ * @G_DBUS_ERROR_UNKNOWN_PROPERTY:
+ * Property you tried to access isn't known by the object. Since 2.42
+ * @G_DBUS_ERROR_PROPERTY_READ_ONLY:
+ * Property you tried to set is read-only. Since 2.42
+ * @G_DBUS_ERROR_TIMED_OUT:
+ * Certain timeout errors, e.g. while starting a service. Warning: this is
+ * confusingly-named given that %G_DBUS_ERROR_TIMEOUT also exists. We
+ * can't fix it for compatibility reasons so just be careful.
+ * @G_DBUS_ERROR_MATCH_RULE_NOT_FOUND:
+ * Tried to remove or modify a match rule that didn't exist.
+ * @G_DBUS_ERROR_MATCH_RULE_INVALID:
+ * The match rule isn't syntactically valid.
+ * @G_DBUS_ERROR_SPAWN_EXEC_FAILED:
+ * While starting a new process, the exec() call failed.
+ * @G_DBUS_ERROR_SPAWN_FORK_FAILED:
+ * While starting a new process, the fork() call failed.
+ * @G_DBUS_ERROR_SPAWN_CHILD_EXITED:
+ * While starting a new process, the child exited with a status code.
+ * @G_DBUS_ERROR_SPAWN_CHILD_SIGNALED:
+ * While starting a new process, the child exited on a signal.
+ * @G_DBUS_ERROR_SPAWN_FAILED:
+ * While starting a new process, something went wrong.
+ * @G_DBUS_ERROR_SPAWN_SETUP_FAILED:
+ * We failed to setup the environment correctly.
+ * @G_DBUS_ERROR_SPAWN_CONFIG_INVALID:
+ * We failed to setup the config parser correctly.
+ * @G_DBUS_ERROR_SPAWN_SERVICE_INVALID:
+ * Bus name was not valid.
+ * @G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND:
+ * Service file not found in system-services directory.
+ * @G_DBUS_ERROR_SPAWN_PERMISSIONS_INVALID:
+ * Permissions are incorrect on the setuid helper.
+ * @G_DBUS_ERROR_SPAWN_FILE_INVALID:
+ * Service file invalid (Name, User or Exec missing).
+ * @G_DBUS_ERROR_SPAWN_NO_MEMORY:
+ * Tried to get a UNIX process ID and it wasn't available.
+ * @G_DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN:
+ * Tried to get a UNIX process ID and it wasn't available.
+ * @G_DBUS_ERROR_INVALID_SIGNATURE:
+ * A type signature is not valid.
+ * @G_DBUS_ERROR_INVALID_FILE_CONTENT:
+ * A file contains invalid syntax or is otherwise broken.
+ * @G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
+ * Asked for SELinux security context and it wasn't available.
+ * @G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN:
+ * Asked for ADT audit data and it wasn't available.
+ * @G_DBUS_ERROR_OBJECT_PATH_IN_USE:
+ * There's already an object with the requested object path.
+ *
+ * Error codes for the %G_DBUS_ERROR error domain.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ /* Well-known errors in the org.freedesktop.DBus.Error namespace */
+ G_DBUS_ERROR_FAILED, /* org.freedesktop.DBus.Error.Failed */
+ G_DBUS_ERROR_NO_MEMORY, /* org.freedesktop.DBus.Error.NoMemory */
+ G_DBUS_ERROR_SERVICE_UNKNOWN, /* org.freedesktop.DBus.Error.ServiceUnknown */
+ G_DBUS_ERROR_NAME_HAS_NO_OWNER, /* org.freedesktop.DBus.Error.NameHasNoOwner */
+ G_DBUS_ERROR_NO_REPLY, /* org.freedesktop.DBus.Error.NoReply */
+ G_DBUS_ERROR_IO_ERROR, /* org.freedesktop.DBus.Error.IOError */
+ G_DBUS_ERROR_BAD_ADDRESS, /* org.freedesktop.DBus.Error.BadAddress */
+ G_DBUS_ERROR_NOT_SUPPORTED, /* org.freedesktop.DBus.Error.NotSupported */
+ G_DBUS_ERROR_LIMITS_EXCEEDED, /* org.freedesktop.DBus.Error.LimitsExceeded */
+ G_DBUS_ERROR_ACCESS_DENIED, /* org.freedesktop.DBus.Error.AccessDenied */
+ G_DBUS_ERROR_AUTH_FAILED, /* org.freedesktop.DBus.Error.AuthFailed */
+ G_DBUS_ERROR_NO_SERVER, /* org.freedesktop.DBus.Error.NoServer */
+ G_DBUS_ERROR_TIMEOUT, /* org.freedesktop.DBus.Error.Timeout */
+ G_DBUS_ERROR_NO_NETWORK, /* org.freedesktop.DBus.Error.NoNetwork */
+ G_DBUS_ERROR_ADDRESS_IN_USE, /* org.freedesktop.DBus.Error.AddressInUse */
+ G_DBUS_ERROR_DISCONNECTED, /* org.freedesktop.DBus.Error.Disconnected */
+ G_DBUS_ERROR_INVALID_ARGS, /* org.freedesktop.DBus.Error.InvalidArgs */
+ G_DBUS_ERROR_FILE_NOT_FOUND, /* org.freedesktop.DBus.Error.FileNotFound */
+ G_DBUS_ERROR_FILE_EXISTS, /* org.freedesktop.DBus.Error.FileExists */
+ G_DBUS_ERROR_UNKNOWN_METHOD, /* org.freedesktop.DBus.Error.UnknownMethod */
+ G_DBUS_ERROR_TIMED_OUT, /* org.freedesktop.DBus.Error.TimedOut */
+ G_DBUS_ERROR_MATCH_RULE_NOT_FOUND, /* org.freedesktop.DBus.Error.MatchRuleNotFound */
+ G_DBUS_ERROR_MATCH_RULE_INVALID, /* org.freedesktop.DBus.Error.MatchRuleInvalid */
+ G_DBUS_ERROR_SPAWN_EXEC_FAILED, /* org.freedesktop.DBus.Error.Spawn.ExecFailed */
+ G_DBUS_ERROR_SPAWN_FORK_FAILED, /* org.freedesktop.DBus.Error.Spawn.ForkFailed */
+ G_DBUS_ERROR_SPAWN_CHILD_EXITED, /* org.freedesktop.DBus.Error.Spawn.ChildExited */
+ G_DBUS_ERROR_SPAWN_CHILD_SIGNALED, /* org.freedesktop.DBus.Error.Spawn.ChildSignaled */
+ G_DBUS_ERROR_SPAWN_FAILED, /* org.freedesktop.DBus.Error.Spawn.Failed */
+ G_DBUS_ERROR_SPAWN_SETUP_FAILED, /* org.freedesktop.DBus.Error.Spawn.FailedToSetup */
+ G_DBUS_ERROR_SPAWN_CONFIG_INVALID, /* org.freedesktop.DBus.Error.Spawn.ConfigInvalid */
+ G_DBUS_ERROR_SPAWN_SERVICE_INVALID, /* org.freedesktop.DBus.Error.Spawn.ServiceNotValid */
+ G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND, /* org.freedesktop.DBus.Error.Spawn.ServiceNotFound */
+ G_DBUS_ERROR_SPAWN_PERMISSIONS_INVALID, /* org.freedesktop.DBus.Error.Spawn.PermissionsInvalid */
+ G_DBUS_ERROR_SPAWN_FILE_INVALID, /* org.freedesktop.DBus.Error.Spawn.FileInvalid */
+ G_DBUS_ERROR_SPAWN_NO_MEMORY, /* org.freedesktop.DBus.Error.Spawn.NoMemory */
+ G_DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, /* org.freedesktop.DBus.Error.UnixProcessIdUnknown */
+ G_DBUS_ERROR_INVALID_SIGNATURE, /* org.freedesktop.DBus.Error.InvalidSignature */
+ G_DBUS_ERROR_INVALID_FILE_CONTENT, /* org.freedesktop.DBus.Error.InvalidFileContent */
+ G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN, /* org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown */
+ G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN, /* org.freedesktop.DBus.Error.AdtAuditDataUnknown */
+ G_DBUS_ERROR_OBJECT_PATH_IN_USE, /* org.freedesktop.DBus.Error.ObjectPathInUse */
+ G_DBUS_ERROR_UNKNOWN_OBJECT, /* org.freedesktop.DBus.Error.UnknownObject */
+ G_DBUS_ERROR_UNKNOWN_INTERFACE, /* org.freedesktop.DBus.Error.UnknownInterface */
+ G_DBUS_ERROR_UNKNOWN_PROPERTY, /* org.freedesktop.DBus.Error.UnknownProperty */
+ G_DBUS_ERROR_PROPERTY_READ_ONLY /* org.freedesktop.DBus.Error.PropertyReadOnly */
+} GDBusError;
+/* Remember to update g_dbus_error_quark() in gdbuserror.c if you extend this enumeration */
+
+/**
+ * GDBusConnectionFlags:
+ * @G_DBUS_CONNECTION_FLAGS_NONE: No flags set.
+ * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT: Perform authentication against server.
+ * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER: Perform authentication against client.
+ * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS: When
+ * authenticating as a server, allow the anonymous authentication
+ * method.
+ * @G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION: Pass this flag if connecting to a peer that is a
+ * message bus. This means that the Hello() method will be invoked as part of the connection setup.
+ * @G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING: If set, processing of D-Bus messages is
+ * delayed until g_dbus_connection_start_message_processing() is called.
+ *
+ * Flags used when creating a new #GDBusConnection.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_CONNECTION_FLAGS_NONE = 0,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT = (1<<0),
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER = (1<<1),
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<2),
+ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1<<3),
+ G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING = (1<<4)
+} GDBusConnectionFlags;
+
+/**
+ * GDBusCapabilityFlags:
+ * @G_DBUS_CAPABILITY_FLAGS_NONE: No flags set.
+ * @G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING: The connection
+ * supports exchanging UNIX file descriptors with the remote peer.
+ *
+ * Capabilities negotiated with the remote peer.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_CAPABILITY_FLAGS_NONE = 0,
+ G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING = (1<<0)
+} GDBusCapabilityFlags;
+
+/**
+ * GDBusCallFlags:
+ * @G_DBUS_CALL_FLAGS_NONE: No flags set.
+ * @G_DBUS_CALL_FLAGS_NO_AUTO_START: The bus must not launch
+ * an owner for the destination name in response to this method
+ * invocation.
+ * @G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION: the caller is prepared to
+ * wait for interactive authorization. Since 2.46.
+ *
+ * Flags used in g_dbus_connection_call() and similar APIs.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_CALL_FLAGS_NONE = 0,
+ G_DBUS_CALL_FLAGS_NO_AUTO_START = (1<<0),
+ G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION = (1<<1)
+} GDBusCallFlags;
+/* (1<<31) is reserved for internal use by GDBusConnection, do not use it. */
+
+/**
+ * GDBusMessageType:
+ * @G_DBUS_MESSAGE_TYPE_INVALID: Message is of invalid type.
+ * @G_DBUS_MESSAGE_TYPE_METHOD_CALL: Method call.
+ * @G_DBUS_MESSAGE_TYPE_METHOD_RETURN: Method reply.
+ * @G_DBUS_MESSAGE_TYPE_ERROR: Error reply.
+ * @G_DBUS_MESSAGE_TYPE_SIGNAL: Signal emission.
+ *
+ * Message types used in #GDBusMessage.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_MESSAGE_TYPE_INVALID,
+ G_DBUS_MESSAGE_TYPE_METHOD_CALL,
+ G_DBUS_MESSAGE_TYPE_METHOD_RETURN,
+ G_DBUS_MESSAGE_TYPE_ERROR,
+ G_DBUS_MESSAGE_TYPE_SIGNAL
+} GDBusMessageType;
+
+/**
+ * GDBusMessageFlags:
+ * @G_DBUS_MESSAGE_FLAGS_NONE: No flags set.
+ * @G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED: A reply is not expected.
+ * @G_DBUS_MESSAGE_FLAGS_NO_AUTO_START: The bus must not launch an
+ * owner for the destination name in response to this message.
+ * @G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION: If set on a method
+ * call, this flag means that the caller is prepared to wait for interactive
+ * authorization. Since 2.46.
+ *
+ * Message flags used in #GDBusMessage.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_MESSAGE_FLAGS_NONE = 0,
+ G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
+ G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1),
+ G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION = (1<<2)
+} GDBusMessageFlags;
+
+/**
+ * GDBusMessageHeaderField:
+ * @G_DBUS_MESSAGE_HEADER_FIELD_INVALID: Not a valid header field.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_PATH: The object path.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE: The interface name.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_MEMBER: The method or signal name.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME: The name of the error that occurred.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL: The serial number the message is a reply to.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION: The name the message is intended for.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_SENDER: Unique name of the sender of the message (filled in by the bus).
+ * @G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE: The signature of the message body.
+ * @G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS: The number of UNIX file descriptors that accompany the message.
+ *
+ * Header fields used in #GDBusMessage.
+ *
+ * Since: 2.26
+ */
+typedef enum {
+ G_DBUS_MESSAGE_HEADER_FIELD_INVALID,
+ G_DBUS_MESSAGE_HEADER_FIELD_PATH,
+ G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE,
+ G_DBUS_MESSAGE_HEADER_FIELD_MEMBER,
+ G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME,
+ G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL,
+ G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION,
+ G_DBUS_MESSAGE_HEADER_FIELD_SENDER,
+ G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE,
+ G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS
+} GDBusMessageHeaderField;
+
+/**
+ * GDBusPropertyInfoFlags:
+ * @G_DBUS_PROPERTY_INFO_FLAGS_NONE: No flags set.
+ * @G_DBUS_PROPERTY_INFO_FLAGS_READABLE: Property is readable.
+ * @G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE: Property is writable.
+ *
+ * Flags describing the access control of a D-Bus property.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_PROPERTY_INFO_FLAGS_NONE = 0,
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE = (1<<0),
+ G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE = (1<<1)
+} GDBusPropertyInfoFlags;
+
+/**
+ * GDBusSubtreeFlags:
+ * @G_DBUS_SUBTREE_FLAGS_NONE: No flags set.
+ * @G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES: Method calls to objects not in the enumerated range
+ * will still be dispatched. This is useful if you want
+ * to dynamically spawn objects in the subtree.
+ *
+ * Flags passed to g_dbus_connection_register_subtree().
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_SUBTREE_FLAGS_NONE = 0,
+ G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES = (1<<0)
+} GDBusSubtreeFlags;
+
+/**
+ * GDBusServerFlags:
+ * @G_DBUS_SERVER_FLAGS_NONE: No flags set.
+ * @G_DBUS_SERVER_FLAGS_RUN_IN_THREAD: All #GDBusServer::new-connection
+ * signals will run in separated dedicated threads (see signal for
+ * details).
+ * @G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS: Allow the anonymous
+ * authentication method.
+ *
+ * Flags used when creating a #GDBusServer.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_SERVER_FLAGS_NONE = 0,
+ G_DBUS_SERVER_FLAGS_RUN_IN_THREAD = (1<<0),
+ G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1)
+} GDBusServerFlags;
+
+/**
+ * GDBusSignalFlags:
+ * @G_DBUS_SIGNAL_FLAGS_NONE: No flags set.
+ * @G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE: Don't actually send the AddMatch
+ * D-Bus call for this signal subscription. This gives you more control
+ * over which match rules you add (but you must add them manually).
+ * @G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE: Match first arguments that
+ * contain a bus or interface name with the given namespace.
+ * @G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH: Match first arguments that
+ * contain an object path that is either equivalent to the given path,
+ * or one of the paths is a subpath of the other.
+ *
+ * Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().
+ *
+ * Since: 2.26
+ */
+typedef enum /*< flags >*/
+{
+ G_DBUS_SIGNAL_FLAGS_NONE = 0,
+ G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE = (1<<0),
+ G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE = (1<<1),
+ G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH = (1<<2)
+} GDBusSignalFlags;
+
+/**
+ * GDBusSendMessageFlags:
+ * @G_DBUS_SEND_MESSAGE_FLAGS_NONE: No flags set.
+ * @G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL: Do not automatically
+ * assign a serial number from the #GDBusConnection object when
+ * sending a message.
+ *
+ * Flags used when sending #GDBusMessages on a #GDBusConnection.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
+ G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0)
+} GDBusSendMessageFlags;
+/* (1<<31) is reserved for internal use by GDBusConnection, do not use it. */
+
+/**
+ * GCredentialsType:
+ * @G_CREDENTIALS_TYPE_INVALID: Indicates an invalid native credential type.
+ * @G_CREDENTIALS_TYPE_LINUX_UCRED: The native credentials type is a struct ucred.
+ * @G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED: The native credentials type is a struct cmsgcred.
+ * @G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED: The native credentials type is a struct sockpeercred. Added in 2.30.
+ * @G_CREDENTIALS_TYPE_SOLARIS_UCRED: The native credentials type is a ucred_t. Added in 2.40.
+ * @G_CREDENTIALS_TYPE_NETBSD_UNPCBID: The native credentials type is a struct unpcbid.
+ *
+ * Enumeration describing different kinds of native credential types.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_CREDENTIALS_TYPE_INVALID,
+ G_CREDENTIALS_TYPE_LINUX_UCRED,
+ G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED,
+ G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED,
+ G_CREDENTIALS_TYPE_SOLARIS_UCRED,
+ G_CREDENTIALS_TYPE_NETBSD_UNPCBID
+} GCredentialsType;
+
+/**
+ * GDBusMessageByteOrder:
+ * @G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN: The byte order is big endian.
+ * @G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN: The byte order is little endian.
+ *
+ * Enumeration used to describe the byte order of a D-Bus message.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B',
+ G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
+} GDBusMessageByteOrder;
+
+/**
+ * GApplicationFlags:
+ * @G_APPLICATION_FLAGS_NONE: Default
+ * @G_APPLICATION_IS_SERVICE: Run as a service. In this mode, registration
+ * fails if the service is already running, and the application
+ * will initially wait up to 10 seconds for an initial activation
+ * message to arrive.
+ * @G_APPLICATION_IS_LAUNCHER: Don't try to become the primary instance.
+ * @G_APPLICATION_HANDLES_OPEN: This application handles opening files (in
+ * the primary instance). Note that this flag only affects the default
+ * implementation of local_command_line(), and has no effect if
+ * %G_APPLICATION_HANDLES_COMMAND_LINE is given.
+ * See g_application_run() for details.
+ * @G_APPLICATION_HANDLES_COMMAND_LINE: This application handles command line
+ * arguments (in the primary instance). Note that this flag only affect
+ * the default implementation of local_command_line().
+ * See g_application_run() for details.
+ * @G_APPLICATION_SEND_ENVIRONMENT: Send the environment of the
+ * launching process to the primary instance. Set this flag if your
+ * application is expected to behave differently depending on certain
+ * environment variables. For instance, an editor might be expected
+ * to use the `GIT_COMMITTER_NAME` environment variable
+ * when editing a git commit message. The environment is available
+ * to the #GApplication::command-line signal handler, via
+ * g_application_command_line_getenv().
+ * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical
+ * single-instance application negotiation, even if the application
+ * ID is given. The application neither attempts to become the
+ * owner of the application ID nor does it check if an existing
+ * owner already exists. Everything occurs in the local process.
+ * Since: 2.30.
+ * @G_APPLICATION_CAN_OVERRIDE_APP_ID: Allow users to override the
+ * application ID from the command line with `--gapplication-app-id`.
+ * Since: 2.48
+ * @G_APPLICATION_ALLOW_REPLACEMENT: Allow another instance to take over
+ * the bus name. Since: 2.60
+ * @G_APPLICATION_REPLACE: Take over from another instance. This flag is
+ * usually set by passing `--gapplication-replace` on the commandline.
+ * Since: 2.60
+ *
+ * Flags used to define the behaviour of a #GApplication.
+ *
+ * Since: 2.28
+ **/
+typedef enum
+{
+ G_APPLICATION_FLAGS_NONE,
+ G_APPLICATION_IS_SERVICE = (1 << 0),
+ G_APPLICATION_IS_LAUNCHER = (1 << 1),
+
+ G_APPLICATION_HANDLES_OPEN = (1 << 2),
+ G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3),
+ G_APPLICATION_SEND_ENVIRONMENT = (1 << 4),
+
+ G_APPLICATION_NON_UNIQUE = (1 << 5),
+
+ G_APPLICATION_CAN_OVERRIDE_APP_ID = (1 << 6),
+ G_APPLICATION_ALLOW_REPLACEMENT = (1 << 7),
+ G_APPLICATION_REPLACE = (1 << 8)
+} GApplicationFlags;
+
+/**
+ * GTlsError:
+ * @G_TLS_ERROR_UNAVAILABLE: No TLS provider is available
+ * @G_TLS_ERROR_MISC: Miscellaneous TLS error
+ * @G_TLS_ERROR_BAD_CERTIFICATE: The certificate presented could not
+ * be parsed or failed validation.
+ * @G_TLS_ERROR_NOT_TLS: The TLS handshake failed because the
+ * peer does not seem to be a TLS server.
+ * @G_TLS_ERROR_HANDSHAKE: The TLS handshake failed because the
+ * peer's certificate was not acceptable.
+ * @G_TLS_ERROR_CERTIFICATE_REQUIRED: The TLS handshake failed because
+ * the server requested a client-side certificate, but none was
+ * provided. See g_tls_connection_set_certificate().
+ * @G_TLS_ERROR_EOF: The TLS connection was closed without proper
+ * notice, which may indicate an attack. See
+ * g_tls_connection_set_require_close_notify().
+ * @G_TLS_ERROR_INAPPROPRIATE_FALLBACK: The TLS handshake failed
+ * because the client sent the fallback SCSV, indicating a protocol
+ * downgrade attack. Since: 2.60
+ *
+ * An error code used with %G_TLS_ERROR in a #GError returned from a
+ * TLS-related routine.
+ *
+ * Since: 2.28
+ */
+typedef enum {
+ G_TLS_ERROR_UNAVAILABLE,
+ G_TLS_ERROR_MISC,
+ G_TLS_ERROR_BAD_CERTIFICATE,
+ G_TLS_ERROR_NOT_TLS,
+ G_TLS_ERROR_HANDSHAKE,
+ G_TLS_ERROR_CERTIFICATE_REQUIRED,
+ G_TLS_ERROR_EOF,
+ G_TLS_ERROR_INAPPROPRIATE_FALLBACK
+} GTlsError;
+
+/**
+ * GTlsCertificateFlags:
+ * @G_TLS_CERTIFICATE_UNKNOWN_CA: The signing certificate authority is
+ * not known.
+ * @G_TLS_CERTIFICATE_BAD_IDENTITY: The certificate does not match the
+ * expected identity of the site that it was retrieved from.
+ * @G_TLS_CERTIFICATE_NOT_ACTIVATED: The certificate's activation time
+ * is still in the future
+ * @G_TLS_CERTIFICATE_EXPIRED: The certificate has expired
+ * @G_TLS_CERTIFICATE_REVOKED: The certificate has been revoked
+ * according to the #GTlsConnection's certificate revocation list.
+ * @G_TLS_CERTIFICATE_INSECURE: The certificate's algorithm is
+ * considered insecure.
+ * @G_TLS_CERTIFICATE_GENERIC_ERROR: Some other error occurred validating
+ * the certificate
+ * @G_TLS_CERTIFICATE_VALIDATE_ALL: the combination of all of the above
+ * flags
+ *
+ * A set of flags describing TLS certification validation. This can be
+ * used to set which validation steps to perform (eg, with
+ * g_tls_client_connection_set_validation_flags()), or to describe why
+ * a particular certificate was rejected (eg, in
+ * #GTlsConnection::accept-certificate).
+ *
+ * Since: 2.28
+ */
+typedef enum {
+ G_TLS_CERTIFICATE_UNKNOWN_CA = (1 << 0),
+ G_TLS_CERTIFICATE_BAD_IDENTITY = (1 << 1),
+ G_TLS_CERTIFICATE_NOT_ACTIVATED = (1 << 2),
+ G_TLS_CERTIFICATE_EXPIRED = (1 << 3),
+ G_TLS_CERTIFICATE_REVOKED = (1 << 4),
+ G_TLS_CERTIFICATE_INSECURE = (1 << 5),
+ G_TLS_CERTIFICATE_GENERIC_ERROR = (1 << 6),
+
+ G_TLS_CERTIFICATE_VALIDATE_ALL = 0x007f
+} GTlsCertificateFlags;
+
+/**
+ * GTlsAuthenticationMode:
+ * @G_TLS_AUTHENTICATION_NONE: client authentication not required
+ * @G_TLS_AUTHENTICATION_REQUESTED: client authentication is requested
+ * @G_TLS_AUTHENTICATION_REQUIRED: client authentication is required
+ *
+ * The client authentication mode for a #GTlsServerConnection.
+ *
+ * Since: 2.28
+ */
+typedef enum {
+ G_TLS_AUTHENTICATION_NONE,
+ G_TLS_AUTHENTICATION_REQUESTED,
+ G_TLS_AUTHENTICATION_REQUIRED
+} GTlsAuthenticationMode;
+
+/**
+ * GTlsRehandshakeMode:
+ * @G_TLS_REHANDSHAKE_NEVER: Never allow rehandshaking
+ * @G_TLS_REHANDSHAKE_SAFELY: Allow safe rehandshaking only
+ * @G_TLS_REHANDSHAKE_UNSAFELY: Allow unsafe rehandshaking
+ *
+ * When to allow rehandshaking. See
+ * g_tls_connection_set_rehandshake_mode().
+ *
+ * Since: 2.28
+ *
+ * Deprecated: 2.60. Changing the rehandshake mode is no longer
+ * required for compatibility. Also, rehandshaking has been removed
+ * from the TLS protocol in TLS 1.3.
+ */
+typedef enum {
+ G_TLS_REHANDSHAKE_NEVER,
+ G_TLS_REHANDSHAKE_SAFELY,
+ G_TLS_REHANDSHAKE_UNSAFELY
+} GTlsRehandshakeMode GLIB_DEPRECATED_TYPE_IN_2_60;
+
+/**
+ * GTlsPasswordFlags:
+ * @G_TLS_PASSWORD_NONE: No flags
+ * @G_TLS_PASSWORD_RETRY: The password was wrong, and the user should retry.
+ * @G_TLS_PASSWORD_MANY_TRIES: Hint to the user that the password has been
+ * wrong many times, and the user may not have many chances left.
+ * @G_TLS_PASSWORD_FINAL_TRY: Hint to the user that this is the last try to get
+ * this password right.
+ *
+ * Various flags for the password.
+ *
+ * Since: 2.30
+ */
+
+typedef enum _GTlsPasswordFlags
+{
+ G_TLS_PASSWORD_NONE = 0,
+ G_TLS_PASSWORD_RETRY = 1 << 1,
+ G_TLS_PASSWORD_MANY_TRIES = 1 << 2,
+ G_TLS_PASSWORD_FINAL_TRY = 1 << 3
+} GTlsPasswordFlags;
+
+/**
+ * GTlsInteractionResult:
+ * @G_TLS_INTERACTION_UNHANDLED: The interaction was unhandled (i.e. not
+ * implemented).
+ * @G_TLS_INTERACTION_HANDLED: The interaction completed, and resulting data
+ * is available.
+ * @G_TLS_INTERACTION_FAILED: The interaction has failed, or was cancelled.
+ * and the operation should be aborted.
+ *
+ * #GTlsInteractionResult is returned by various functions in #GTlsInteraction
+ * when finishing an interaction request.
+ *
+ * Since: 2.30
+ */
+typedef enum {
+ G_TLS_INTERACTION_UNHANDLED,
+ G_TLS_INTERACTION_HANDLED,
+ G_TLS_INTERACTION_FAILED
+} GTlsInteractionResult;
+
+/**
+ * GDBusInterfaceSkeletonFlags:
+ * @G_DBUS_INTERFACE_SKELETON_FLAGS_NONE: No flags set.
+ * @G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD: Each method invocation is handled in
+ * a thread dedicated to the invocation. This means that the method implementation can use blocking IO
+ * without blocking any other part of the process. It also means that the method implementation must
+ * use locking to access data structures used by other threads.
+ *
+ * Flags describing the behavior of a #GDBusInterfaceSkeleton instance.
+ *
+ * Since: 2.30
+ */
+typedef enum
+{
+ G_DBUS_INTERFACE_SKELETON_FLAGS_NONE = 0,
+ G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD = (1<<0)
+} GDBusInterfaceSkeletonFlags;
+
+/**
+ * GDBusObjectManagerClientFlags:
+ * @G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE: No flags set.
+ * @G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START: If not set and the
+ * manager is for a well-known name, then request the bus to launch
+ * an owner for the name if no-one owns the name. This flag can only
+ * be used in managers for well-known names.
+ *
+ * Flags used when constructing a #GDBusObjectManagerClient.
+ *
+ * Since: 2.30
+ */
+typedef enum
+{
+ G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE = 0,
+ G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START = (1<<0)
+} GDBusObjectManagerClientFlags;
+
+/**
+ * GTlsDatabaseVerifyFlags:
+ * @G_TLS_DATABASE_VERIFY_NONE: No verification flags
+ *
+ * Flags for g_tls_database_verify_chain().
+ *
+ * Since: 2.30
+ */
+typedef enum /*< flags >*/ {
+ G_TLS_DATABASE_VERIFY_NONE = 0
+} GTlsDatabaseVerifyFlags;
+
+/**
+ * GTlsDatabaseLookupFlags:
+ * @G_TLS_DATABASE_LOOKUP_NONE: No lookup flags
+ * @G_TLS_DATABASE_LOOKUP_KEYPAIR: Restrict lookup to certificates that have
+ * a private key.
+ *
+ * Flags for g_tls_database_lookup_certificate_for_handle(),
+ * g_tls_database_lookup_certificate_issuer(),
+ * and g_tls_database_lookup_certificates_issued_by().
+ *
+ * Since: 2.30
+ */
+typedef enum {
+ G_TLS_DATABASE_LOOKUP_NONE = 0,
+ G_TLS_DATABASE_LOOKUP_KEYPAIR = 1
+} GTlsDatabaseLookupFlags;
+
+/**
+ * GTlsCertificateRequestFlags:
+ * @G_TLS_CERTIFICATE_REQUEST_NONE: No flags
+ *
+ * Flags for g_tls_interaction_request_certificate(),
+ * g_tls_interaction_request_certificate_async(), and
+ * g_tls_interaction_invoke_request_certificate().
+ *
+ * Since: 2.40
+ */
+typedef enum {
+ G_TLS_CERTIFICATE_REQUEST_NONE = 0
+} GTlsCertificateRequestFlags;
+
+/**
+ * GIOModuleScopeFlags:
+ * @G_IO_MODULE_SCOPE_NONE: No module scan flags
+ * @G_IO_MODULE_SCOPE_BLOCK_DUPLICATES: When using this scope to load or
+ * scan modules, automatically block a modules which has the same base
+ * basename as previously loaded module.
+ *
+ * Flags for use with g_io_module_scope_new().
+ *
+ * Since: 2.30
+ */
+typedef enum {
+ G_IO_MODULE_SCOPE_NONE,
+ G_IO_MODULE_SCOPE_BLOCK_DUPLICATES
+} GIOModuleScopeFlags;
+
+/**
+ * GSocketClientEvent:
+ * @G_SOCKET_CLIENT_RESOLVING: The client is doing a DNS lookup.
+ * @G_SOCKET_CLIENT_RESOLVED: The client has completed a DNS lookup.
+ * @G_SOCKET_CLIENT_CONNECTING: The client is connecting to a remote
+ * host (either a proxy or the destination server).
+ * @G_SOCKET_CLIENT_CONNECTED: The client has connected to a remote
+ * host.
+ * @G_SOCKET_CLIENT_PROXY_NEGOTIATING: The client is negotiating
+ * with a proxy to connect to the destination server.
+ * @G_SOCKET_CLIENT_PROXY_NEGOTIATED: The client has negotiated
+ * with the proxy server.
+ * @G_SOCKET_CLIENT_TLS_HANDSHAKING: The client is performing a
+ * TLS handshake.
+ * @G_SOCKET_CLIENT_TLS_HANDSHAKED: The client has performed a
+ * TLS handshake.
+ * @G_SOCKET_CLIENT_COMPLETE: The client is done with a particular
+ * #GSocketConnectable.
+ *
+ * Describes an event occurring on a #GSocketClient. See the
+ * #GSocketClient::event signal for more details.
+ *
+ * Additional values may be added to this type in the future.
+ *
+ * Since: 2.32
+ */
+typedef enum {
+ G_SOCKET_CLIENT_RESOLVING,
+ G_SOCKET_CLIENT_RESOLVED,
+ G_SOCKET_CLIENT_CONNECTING,
+ G_SOCKET_CLIENT_CONNECTED,
+ G_SOCKET_CLIENT_PROXY_NEGOTIATING,
+ G_SOCKET_CLIENT_PROXY_NEGOTIATED,
+ G_SOCKET_CLIENT_TLS_HANDSHAKING,
+ G_SOCKET_CLIENT_TLS_HANDSHAKED,
+ G_SOCKET_CLIENT_COMPLETE
+} GSocketClientEvent;
+
+/**
+ * GSocketListenerEvent:
+ * @G_SOCKET_LISTENER_BINDING: The listener is about to bind a socket.
+ * @G_SOCKET_LISTENER_BOUND: The listener has bound a socket.
+ * @G_SOCKET_LISTENER_LISTENING: The listener is about to start
+ * listening on this socket.
+ * @G_SOCKET_LISTENER_LISTENED: The listener is now listening on
+ * this socket.
+ *
+ * Describes an event occurring on a #GSocketListener. See the
+ * #GSocketListener::event signal for more details.
+ *
+ * Additional values may be added to this type in the future.
+ *
+ * Since: 2.46
+ */
+typedef enum {
+ G_SOCKET_LISTENER_BINDING,
+ G_SOCKET_LISTENER_BOUND,
+ G_SOCKET_LISTENER_LISTENING,
+ G_SOCKET_LISTENER_LISTENED
+} GSocketListenerEvent;
+
+/**
+ * GTestDBusFlags:
+ * @G_TEST_DBUS_NONE: No flags.
+ *
+ * Flags to define future #GTestDBus behaviour.
+ *
+ * Since: 2.34
+ */
+typedef enum /*< flags >*/ {
+ G_TEST_DBUS_NONE = 0
+} GTestDBusFlags;
+
+/**
+ * GSubprocessFlags:
+ * @G_SUBPROCESS_FLAGS_NONE: No flags.
+ * @G_SUBPROCESS_FLAGS_STDIN_PIPE: create a pipe for the stdin of the
+ * spawned process that can be accessed with
+ * g_subprocess_get_stdin_pipe().
+ * @G_SUBPROCESS_FLAGS_STDIN_INHERIT: stdin is inherited from the
+ * calling process.
+ * @G_SUBPROCESS_FLAGS_STDOUT_PIPE: create a pipe for the stdout of the
+ * spawned process that can be accessed with
+ * g_subprocess_get_stdout_pipe().
+ * @G_SUBPROCESS_FLAGS_STDOUT_SILENCE: silence the stdout of the spawned
+ * process (ie: redirect to `/dev/null`).
+ * @G_SUBPROCESS_FLAGS_STDERR_PIPE: create a pipe for the stderr of the
+ * spawned process that can be accessed with
+ * g_subprocess_get_stderr_pipe().
+ * @G_SUBPROCESS_FLAGS_STDERR_SILENCE: silence the stderr of the spawned
+ * process (ie: redirect to `/dev/null`).
+ * @G_SUBPROCESS_FLAGS_STDERR_MERGE: merge the stderr of the spawned
+ * process with whatever the stdout happens to be. This is a good way
+ * of directing both streams to a common log file, for example.
+ * @G_SUBPROCESS_FLAGS_INHERIT_FDS: spawned processes will inherit the
+ * file descriptors of their parent, unless those descriptors have
+ * been explicitly marked as close-on-exec. This flag has no effect
+ * over the "standard" file descriptors (stdin, stdout, stderr).
+ *
+ * Flags to define the behaviour of a #GSubprocess.
+ *
+ * Note that the default for stdin is to redirect from `/dev/null`. For
+ * stdout and stderr the default are for them to inherit the
+ * corresponding descriptor from the calling process.
+ *
+ * Note that it is a programmer error to mix 'incompatible' flags. For
+ * example, you may not request both %G_SUBPROCESS_FLAGS_STDOUT_PIPE and
+ * %G_SUBPROCESS_FLAGS_STDOUT_SILENCE.
+ *
+ * Since: 2.40
+ **/
+typedef enum {
+ G_SUBPROCESS_FLAGS_NONE = 0,
+ G_SUBPROCESS_FLAGS_STDIN_PIPE = (1u << 0),
+ G_SUBPROCESS_FLAGS_STDIN_INHERIT = (1u << 1),
+ G_SUBPROCESS_FLAGS_STDOUT_PIPE = (1u << 2),
+ G_SUBPROCESS_FLAGS_STDOUT_SILENCE = (1u << 3),
+ G_SUBPROCESS_FLAGS_STDERR_PIPE = (1u << 4),
+ G_SUBPROCESS_FLAGS_STDERR_SILENCE = (1u << 5),
+ G_SUBPROCESS_FLAGS_STDERR_MERGE = (1u << 6),
+ G_SUBPROCESS_FLAGS_INHERIT_FDS = (1u << 7)
+} GSubprocessFlags;
+
+/**
+ * GNotificationPriority:
+ * @G_NOTIFICATION_PRIORITY_LOW: for notifications that do not require
+ * immediate attention - typically used for contextual background
+ * information, such as contact birthdays or local weather
+ * @G_NOTIFICATION_PRIORITY_NORMAL: the default priority, to be used for the
+ * majority of notifications (for example email messages, software updates,
+ * completed download/sync operations)
+ * @G_NOTIFICATION_PRIORITY_HIGH: for events that require more attention,
+ * usually because responses are time-sensitive (for example chat and SMS
+ * messages or alarms)
+ * @G_NOTIFICATION_PRIORITY_URGENT: for urgent notifications, or notifications
+ * that require a response in a short space of time (for example phone calls
+ * or emergency warnings)
+ *
+ * Priority levels for #GNotifications.
+ *
+ * Since: 2.42
+ */
+typedef enum {
+ G_NOTIFICATION_PRIORITY_NORMAL,
+ G_NOTIFICATION_PRIORITY_LOW,
+ G_NOTIFICATION_PRIORITY_HIGH,
+ G_NOTIFICATION_PRIORITY_URGENT
+} GNotificationPriority;
+
+/**
+ * GNetworkConnectivity:
+ * @G_NETWORK_CONNECTIVITY_LOCAL: The host is not configured with a
+ * route to the Internet; it may or may not be connected to a local
+ * network.
+ * @G_NETWORK_CONNECTIVITY_LIMITED: The host is connected to a network, but
+ * does not appear to be able to reach the full Internet, perhaps
+ * due to upstream network problems.
+ * @G_NETWORK_CONNECTIVITY_PORTAL: The host is behind a captive portal and
+ * cannot reach the full Internet.
+ * @G_NETWORK_CONNECTIVITY_FULL: The host is connected to a network, and
+ * appears to be able to reach the full Internet.
+ *
+ * The host's network connectivity state, as reported by #GNetworkMonitor.
+ *
+ * Since: 2.44
+ */
+typedef enum {
+ G_NETWORK_CONNECTIVITY_LOCAL = 1,
+ G_NETWORK_CONNECTIVITY_LIMITED = 2,
+ G_NETWORK_CONNECTIVITY_PORTAL = 3,
+ G_NETWORK_CONNECTIVITY_FULL = 4
+} GNetworkConnectivity;
+
+/**
+ * GPollableReturn:
+ * @G_POLLABLE_RETURN_FAILED: Generic error condition for when an operation fails.
+ * @G_POLLABLE_RETURN_OK: The operation was successfully finished.
+ * @G_POLLABLE_RETURN_WOULD_BLOCK: The operation would block.
+ *
+ * Return value for various IO operations that signal errors via the
+ * return value and not necessarily via a #GError.
+ *
+ * This enum exists to be able to return errors to callers without having to
+ * allocate a #GError. Allocating #GErrors can be quite expensive for
+ * regularly happening errors like %G_IO_ERROR_WOULD_BLOCK.
+ *
+ * In case of %G_POLLABLE_RETURN_FAILED a #GError should be set for the
+ * operation to give details about the error that happened.
+ *
+ * Since: 2.60
+ */
+typedef enum {
+ G_POLLABLE_RETURN_FAILED = 0,
+ G_POLLABLE_RETURN_OK = 1,
+ G_POLLABLE_RETURN_WOULD_BLOCK = -G_IO_ERROR_WOULD_BLOCK
+} GPollableReturn;
+
+G_END_DECLS
+
+#endif /* __GIO_ENUMS_H__ */
diff --git a/include/glib/gio/gioenumtypes.h b/include/glib/gio/gioenumtypes.h
new file mode 100644
index 0000000000..bbf9ff7a67
--- /dev/null
+++ b/include/glib/gio/gioenumtypes.h
@@ -0,0 +1,177 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#ifndef __GIO_ENUM_TYPES_H__
+#define __GIO_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "../gio/gioenums.h" */
+GLIB_AVAILABLE_IN_ALL GType g_app_info_create_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_APP_INFO_CREATE_FLAGS (g_app_info_create_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_converter_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_CONVERTER_FLAGS (g_converter_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_converter_result_get_type (void) G_GNUC_CONST;
+#define G_TYPE_CONVERTER_RESULT (g_converter_result_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_data_stream_byte_order_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DATA_STREAM_BYTE_ORDER (g_data_stream_byte_order_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_data_stream_newline_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DATA_STREAM_NEWLINE_TYPE (g_data_stream_newline_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_attribute_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_ATTRIBUTE_TYPE (g_file_attribute_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_attribute_info_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS (g_file_attribute_info_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_attribute_status_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_ATTRIBUTE_STATUS (g_file_attribute_status_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_query_info_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_QUERY_INFO_FLAGS (g_file_query_info_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_create_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_CREATE_FLAGS (g_file_create_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_measure_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_MEASURE_FLAGS (g_file_measure_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_mount_mount_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_MOUNT_MOUNT_FLAGS (g_mount_mount_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_mount_unmount_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_MOUNT_UNMOUNT_FLAGS (g_mount_unmount_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_drive_start_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DRIVE_START_FLAGS (g_drive_start_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_drive_start_stop_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DRIVE_START_STOP_TYPE (g_drive_start_stop_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_copy_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_COPY_FLAGS (g_file_copy_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_monitor_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_MONITOR_FLAGS (g_file_monitor_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_TYPE (g_file_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_filesystem_preview_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILESYSTEM_PREVIEW_TYPE (g_filesystem_preview_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_file_monitor_event_get_type (void) G_GNUC_CONST;
+#define G_TYPE_FILE_MONITOR_EVENT (g_file_monitor_event_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_io_error_enum_get_type (void) G_GNUC_CONST;
+#define G_TYPE_IO_ERROR_ENUM (g_io_error_enum_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_ask_password_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_ASK_PASSWORD_FLAGS (g_ask_password_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_password_save_get_type (void) G_GNUC_CONST;
+#define G_TYPE_PASSWORD_SAVE (g_password_save_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_mount_operation_result_get_type (void) G_GNUC_CONST;
+#define G_TYPE_MOUNT_OPERATION_RESULT (g_mount_operation_result_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_output_stream_splice_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS (g_output_stream_splice_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_io_stream_splice_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_IO_STREAM_SPLICE_FLAGS (g_io_stream_splice_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_emblem_origin_get_type (void) G_GNUC_CONST;
+#define G_TYPE_EMBLEM_ORIGIN (g_emblem_origin_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_resolver_error_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOLVER_ERROR (g_resolver_error_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_resolver_record_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOLVER_RECORD_TYPE (g_resolver_record_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_resource_error_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOURCE_ERROR (g_resource_error_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_resource_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOURCE_FLAGS (g_resource_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_resource_lookup_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOURCE_LOOKUP_FLAGS (g_resource_lookup_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_family_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_FAMILY (g_socket_family_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_TYPE (g_socket_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_msg_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_MSG_FLAGS (g_socket_msg_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_protocol_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_PROTOCOL (g_socket_protocol_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_zlib_compressor_format_get_type (void) G_GNUC_CONST;
+#define G_TYPE_ZLIB_COMPRESSOR_FORMAT (g_zlib_compressor_format_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_unix_socket_address_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_UNIX_SOCKET_ADDRESS_TYPE (g_unix_socket_address_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_bus_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_BUS_TYPE (g_bus_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_bus_name_owner_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_BUS_NAME_OWNER_FLAGS (g_bus_name_owner_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_bus_name_watcher_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_BUS_NAME_WATCHER_FLAGS (g_bus_name_watcher_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_proxy_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_PROXY_FLAGS (g_dbus_proxy_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_error_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_ERROR (g_dbus_error_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_connection_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_CONNECTION_FLAGS (g_dbus_connection_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_capability_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_CAPABILITY_FLAGS (g_dbus_capability_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_call_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_CALL_FLAGS (g_dbus_call_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_message_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_MESSAGE_TYPE (g_dbus_message_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_message_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_MESSAGE_FLAGS (g_dbus_message_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_message_header_field_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_MESSAGE_HEADER_FIELD (g_dbus_message_header_field_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_property_info_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_PROPERTY_INFO_FLAGS (g_dbus_property_info_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_subtree_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_SUBTREE_FLAGS (g_dbus_subtree_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_server_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_SERVER_FLAGS (g_dbus_server_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_signal_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_SIGNAL_FLAGS (g_dbus_signal_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_send_message_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_SEND_MESSAGE_FLAGS (g_dbus_send_message_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_credentials_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_CREDENTIALS_TYPE (g_credentials_type_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_message_byte_order_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_MESSAGE_BYTE_ORDER (g_dbus_message_byte_order_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_application_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_APPLICATION_FLAGS (g_application_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_error_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_ERROR (g_tls_error_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_certificate_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_CERTIFICATE_FLAGS (g_tls_certificate_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_authentication_mode_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_AUTHENTICATION_MODE (g_tls_authentication_mode_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_rehandshake_mode_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_REHANDSHAKE_MODE (g_tls_rehandshake_mode_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_password_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_PASSWORD_FLAGS (g_tls_password_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_interaction_result_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_INTERACTION_RESULT (g_tls_interaction_result_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_interface_skeleton_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS (g_dbus_interface_skeleton_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_dbus_object_manager_client_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS (g_dbus_object_manager_client_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_database_verify_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_DATABASE_VERIFY_FLAGS (g_tls_database_verify_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_database_lookup_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_DATABASE_LOOKUP_FLAGS (g_tls_database_lookup_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_tls_certificate_request_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TLS_CERTIFICATE_REQUEST_FLAGS (g_tls_certificate_request_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_io_module_scope_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_IO_MODULE_SCOPE_FLAGS (g_io_module_scope_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_client_event_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_CLIENT_EVENT (g_socket_client_event_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_socket_listener_event_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SOCKET_LISTENER_EVENT (g_socket_listener_event_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_test_dbus_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_TEST_DBUS_FLAGS (g_test_dbus_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_subprocess_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SUBPROCESS_FLAGS (g_subprocess_flags_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_notification_priority_get_type (void) G_GNUC_CONST;
+#define G_TYPE_NOTIFICATION_PRIORITY (g_notification_priority_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_network_connectivity_get_type (void) G_GNUC_CONST;
+#define G_TYPE_NETWORK_CONNECTIVITY (g_network_connectivity_get_type ())
+GLIB_AVAILABLE_IN_ALL GType g_pollable_return_get_type (void) G_GNUC_CONST;
+#define G_TYPE_POLLABLE_RETURN (g_pollable_return_get_type ())
+
+/* enumerations from "../gio/gresolver.h" */
+GLIB_AVAILABLE_IN_ALL GType g_resolver_name_lookup_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_RESOLVER_NAME_LOOKUP_FLAGS (g_resolver_name_lookup_flags_get_type ())
+
+/* enumerations from "../gio/gsettings.h" */
+GLIB_AVAILABLE_IN_ALL GType g_settings_bind_flags_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SETTINGS_BIND_FLAGS (g_settings_bind_flags_get_type ())
+G_END_DECLS
+
+#endif /* __GIO_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/include/glib/gio/gioerror.h b/include/glib/gio/gioerror.h
new file mode 100644
index 0000000000..b3d6446461
--- /dev/null
+++ b/include/glib/gio/gioerror.h
@@ -0,0 +1,53 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_IO_ERROR_H__
+#define __G_IO_ERROR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <glib.h>
+#include <gio/gioenums.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_IO_ERROR:
+ *
+ * Error domain for GIO. Errors in this domain will be from the #GIOErrorEnum enumeration.
+ * See #GError for more information on error domains.
+ **/
+#define G_IO_ERROR g_io_error_quark()
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_io_error_quark (void);
+GLIB_AVAILABLE_IN_ALL
+GIOErrorEnum g_io_error_from_errno (gint err_no);
+
+#ifdef G_OS_WIN32
+GLIB_AVAILABLE_IN_ALL
+GIOErrorEnum g_io_error_from_win32_error (gint error_code);
+#endif
+
+G_END_DECLS
+
+#endif /* __G_IO_ERROR_H__ */
diff --git a/include/glib/gio/giomodule.h b/include/glib/gio/giomodule.h
new file mode 100644
index 0000000000..e94b8099db
--- /dev/null
+++ b/include/glib/gio/giomodule.h
@@ -0,0 +1,193 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_IO_MODULE_H__
+#define __G_IO_MODULE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+#include <gmodule.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GIOModuleScope GIOModuleScope;
+
+GLIB_AVAILABLE_IN_2_30
+GIOModuleScope * g_io_module_scope_new (GIOModuleScopeFlags flags);
+GLIB_AVAILABLE_IN_2_30
+void g_io_module_scope_free (GIOModuleScope *scope);
+GLIB_AVAILABLE_IN_2_30
+void g_io_module_scope_block (GIOModuleScope *scope,
+ const gchar *basename);
+
+#define G_IO_TYPE_MODULE (g_io_module_get_type ())
+#define G_IO_MODULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_IO_TYPE_MODULE, GIOModule))
+#define G_IO_MODULE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_IO_TYPE_MODULE, GIOModuleClass))
+#define G_IO_IS_MODULE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_IO_TYPE_MODULE))
+#define G_IO_IS_MODULE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_IO_TYPE_MODULE))
+#define G_IO_MODULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_IO_TYPE_MODULE, GIOModuleClass))
+
+/**
+ * GIOModule:
+ *
+ * Opaque module base class for extending GIO.
+ **/
+typedef struct _GIOModuleClass GIOModuleClass;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_io_module_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GIOModule *g_io_module_new (const gchar *filename);
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_modules_scan_all_in_directory (const char *dirname);
+GLIB_AVAILABLE_IN_ALL
+GList *g_io_modules_load_all_in_directory (const gchar *dirname);
+
+GLIB_AVAILABLE_IN_2_30
+void g_io_modules_scan_all_in_directory_with_scope (const gchar *dirname,
+ GIOModuleScope *scope);
+GLIB_AVAILABLE_IN_2_30
+GList *g_io_modules_load_all_in_directory_with_scope (const gchar *dirname,
+ GIOModuleScope *scope);
+
+GLIB_AVAILABLE_IN_ALL
+GIOExtensionPoint *g_io_extension_point_register (const char *name);
+GLIB_AVAILABLE_IN_ALL
+GIOExtensionPoint *g_io_extension_point_lookup (const char *name);
+GLIB_AVAILABLE_IN_ALL
+void g_io_extension_point_set_required_type (GIOExtensionPoint *extension_point,
+ GType type);
+GLIB_AVAILABLE_IN_ALL
+GType g_io_extension_point_get_required_type (GIOExtensionPoint *extension_point);
+GLIB_AVAILABLE_IN_ALL
+GList *g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point);
+GLIB_AVAILABLE_IN_ALL
+GIOExtension * g_io_extension_point_get_extension_by_name (GIOExtensionPoint *extension_point,
+ const char *name);
+GLIB_AVAILABLE_IN_ALL
+GIOExtension * g_io_extension_point_implement (const char *extension_point_name,
+ GType type,
+ const char *extension_name,
+ gint priority);
+
+GLIB_AVAILABLE_IN_ALL
+GType g_io_extension_get_type (GIOExtension *extension);
+GLIB_AVAILABLE_IN_ALL
+const char * g_io_extension_get_name (GIOExtension *extension);
+GLIB_AVAILABLE_IN_ALL
+gint g_io_extension_get_priority (GIOExtension *extension);
+GLIB_AVAILABLE_IN_ALL
+GTypeClass* g_io_extension_ref_class (GIOExtension *extension);
+
+
+/* API for the modules to implement */
+
+/**
+ * g_io_module_load:
+ * @module: a #GIOModule.
+ *
+ * Required API for GIO modules to implement.
+ *
+ * This function is run after the module has been loaded into GIO,
+ * to initialize the module. Typically, this function will call
+ * g_io_extension_point_implement().
+ *
+ * Since 2.56, this function should be named `g_io_<modulename>_load`, where
+ * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
+ * everything after the first dot removed, and with `-` replaced with `_`
+ * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
+ * Using the new symbol names avoids name clashes when building modules
+ * statically. The old symbol names continue to be supported, but cannot be used
+ * for static builds.
+ **/
+GLIB_AVAILABLE_IN_ALL
+void g_io_module_load (GIOModule *module);
+
+/**
+ * g_io_module_unload:
+ * @module: a #GIOModule.
+ *
+ * Required API for GIO modules to implement.
+ *
+ * This function is run when the module is being unloaded from GIO,
+ * to finalize the module.
+ *
+ * Since 2.56, this function should be named `g_io_<modulename>_unload`, where
+ * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
+ * everything after the first dot removed, and with `-` replaced with `_`
+ * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
+ * Using the new symbol names avoids name clashes when building modules
+ * statically. The old symbol names continue to be supported, but cannot be used
+ * for static builds.
+ **/
+GLIB_AVAILABLE_IN_ALL
+void g_io_module_unload (GIOModule *module);
+
+/**
+ * g_io_module_query:
+ *
+ * Optional API for GIO modules to implement.
+ *
+ * Should return a list of all the extension points that may be
+ * implemented in this module.
+ *
+ * This method will not be called in normal use, however it may be
+ * called when probing existing modules and recording which extension
+ * points that this model is used for. This means we won't have to
+ * load and initialize this module unless its needed.
+ *
+ * If this function is not implemented by the module the module will
+ * always be loaded, initialized and then unloaded on application
+ * startup so that it can register its extension points during init.
+ *
+ * Note that a module need not actually implement all the extension
+ * points that g_io_module_query() returns, since the exact list of
+ * extension may depend on runtime issues. However all extension
+ * points actually implemented must be returned by g_io_module_query()
+ * (if defined).
+ *
+ * When installing a module that implements g_io_module_query() you must
+ * run gio-querymodules in order to build the cache files required for
+ * lazy loading.
+ *
+ * Since 2.56, this function should be named `g_io_<modulename>_query`, where
+ * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and
+ * everything after the first dot removed, and with `-` replaced with `_`
+ * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`.
+ * Using the new symbol names avoids name clashes when building modules
+ * statically. The old symbol names continue to be supported, but cannot be used
+ * for static builds.
+ *
+ * Returns: (transfer full): A %NULL-terminated array of strings,
+ * listing the supported extension points of the module. The array
+ * must be suitable for freeing with g_strfreev().
+ *
+ * Since: 2.24
+ **/
+GLIB_AVAILABLE_IN_ALL
+char **g_io_module_query (void);
+
+G_END_DECLS
+
+#endif /* __G_IO_MODULE_H__ */
diff --git a/include/glib/gio/gioscheduler.h b/include/glib/gio/gioscheduler.h
new file mode 100644
index 0000000000..d58cff6035
--- /dev/null
+++ b/include/glib/gio/gioscheduler.h
@@ -0,0 +1,54 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_IO_SCHEDULER_H__
+#define __G_IO_SCHEDULER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+
+GLIB_DEPRECATED_IN_2_36_FOR ("GThreadPool or g_task_run_in_thread")
+void g_io_scheduler_push_job (GIOSchedulerJobFunc job_func,
+ gpointer user_data,
+ GDestroyNotify notify,
+ gint io_priority,
+ GCancellable *cancellable);
+GLIB_DEPRECATED_IN_2_36
+void g_io_scheduler_cancel_all_jobs (void);
+GLIB_DEPRECATED_IN_2_36_FOR (g_main_context_invoke)
+gboolean g_io_scheduler_job_send_to_mainloop (GIOSchedulerJob *job,
+ GSourceFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GLIB_DEPRECATED_IN_2_36_FOR (g_main_context_invoke)
+void g_io_scheduler_job_send_to_mainloop_async (GIOSchedulerJob *job,
+ GSourceFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+G_END_DECLS
+
+#endif /* __G_IO_SCHEDULER_H__ */
diff --git a/include/glib/gio/giostream.h b/include/glib/gio/giostream.h
new file mode 100644
index 0000000000..5dbe0e6e6c
--- /dev/null
+++ b/include/glib/gio/giostream.h
@@ -0,0 +1,135 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2008, 2009 Codethink Limited
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * See the included COPYING file for more information.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_IO_STREAM_H__
+#define __G_IO_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/ginputstream.h>
+#include <gio/goutputstream.h>
+#include <gio/gcancellable.h>
+#include <gio/gioerror.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_IO_STREAM (g_io_stream_get_type ())
+#define G_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_IO_STREAM, GIOStream))
+#define G_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_IO_STREAM, GIOStreamClass))
+#define G_IS_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_IO_STREAM))
+#define G_IS_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_IO_STREAM))
+#define G_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_IO_STREAM, GIOStreamClass))
+
+typedef struct _GIOStreamPrivate GIOStreamPrivate;
+typedef struct _GIOStreamClass GIOStreamClass;
+
+/**
+ * GIOStream:
+ *
+ * Base class for read-write streams.
+ **/
+struct _GIOStream
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GIOStreamPrivate *priv;
+};
+
+struct _GIOStreamClass
+{
+ GObjectClass parent_class;
+
+ GInputStream * (*get_input_stream) (GIOStream *stream);
+ GOutputStream * (*get_output_stream) (GIOStream *stream);
+
+ gboolean (* close_fn) (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+ void (* close_async) (GIOStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* close_finish) (GIOStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+ void (*_g_reserved8) (void);
+ void (*_g_reserved9) (void);
+ void (*_g_reserved10) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_io_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
+GLIB_AVAILABLE_IN_ALL
+GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_stream_splice_async (GIOStream *stream1,
+ GIOStream *stream2,
+ GIOStreamSpliceFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_splice_finish (GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_stream_close_async (GIOStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_close_finish (GIOStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_is_closed (GIOStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_has_pending (GIOStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_stream_set_pending (GIOStream *stream,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_io_stream_clear_pending (GIOStream *stream);
+
+G_END_DECLS
+
+#endif /* __G_IO_STREAM_H__ */
diff --git a/include/glib/gio/giotypes.h b/include/glib/gio/giotypes.h
new file mode 100644
index 0000000000..c9ad8dd90e
--- /dev/null
+++ b/include/glib/gio/giotypes.h
@@ -0,0 +1,654 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __GIO_TYPES_H__
+#define __GIO_TYPES_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gioenums.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GAppLaunchContext GAppLaunchContext;
+typedef struct _GAppInfo GAppInfo; /* Dummy typedef */
+typedef struct _GAsyncResult GAsyncResult; /* Dummy typedef */
+typedef struct _GAsyncInitable GAsyncInitable;
+typedef struct _GBufferedInputStream GBufferedInputStream;
+typedef struct _GBufferedOutputStream GBufferedOutputStream;
+typedef struct _GCancellable GCancellable;
+typedef struct _GCharsetConverter GCharsetConverter;
+typedef struct _GConverter GConverter;
+typedef struct _GConverterInputStream GConverterInputStream;
+typedef struct _GConverterOutputStream GConverterOutputStream;
+typedef struct _GDatagramBased GDatagramBased;
+typedef struct _GDataInputStream GDataInputStream;
+typedef struct _GSimplePermission GSimplePermission;
+typedef struct _GZlibCompressor GZlibCompressor;
+typedef struct _GZlibDecompressor GZlibDecompressor;
+
+typedef struct _GSimpleActionGroup GSimpleActionGroup;
+typedef struct _GRemoteActionGroup GRemoteActionGroup;
+typedef struct _GDBusActionGroup GDBusActionGroup;
+typedef struct _GActionMap GActionMap;
+typedef struct _GActionGroup GActionGroup;
+typedef struct _GPropertyAction GPropertyAction;
+typedef struct _GSimpleAction GSimpleAction;
+typedef struct _GAction GAction;
+typedef struct _GApplication GApplication;
+typedef struct _GApplicationCommandLine GApplicationCommandLine;
+typedef struct _GSettingsBackend GSettingsBackend;
+typedef struct _GSettings GSettings;
+typedef struct _GPermission GPermission;
+
+typedef struct _GMenuModel GMenuModel;
+typedef struct _GNotification GNotification;
+
+/**
+ * GDrive:
+ *
+ * Opaque drive object.
+ **/
+typedef struct _GDrive GDrive; /* Dummy typedef */
+typedef struct _GFileEnumerator GFileEnumerator;
+typedef struct _GFileMonitor GFileMonitor;
+typedef struct _GFilterInputStream GFilterInputStream;
+typedef struct _GFilterOutputStream GFilterOutputStream;
+
+/**
+ * GFile:
+ *
+ * A handle to an object implementing the #GFileIface interface.
+ * Generally stores a location within the file system. Handles do not
+ * necessarily represent files or directories that currently exist.
+ **/
+typedef struct _GFile GFile; /* Dummy typedef */
+typedef struct _GFileInfo GFileInfo;
+
+/**
+ * GFileAttributeMatcher:
+ *
+ * Determines if a string matches a file attribute.
+ **/
+typedef struct _GFileAttributeMatcher GFileAttributeMatcher;
+typedef struct _GFileAttributeInfo GFileAttributeInfo;
+typedef struct _GFileAttributeInfoList GFileAttributeInfoList;
+typedef struct _GFileDescriptorBased GFileDescriptorBased;
+typedef struct _GFileInputStream GFileInputStream;
+typedef struct _GFileOutputStream GFileOutputStream;
+typedef struct _GFileIOStream GFileIOStream;
+typedef struct _GFileIcon GFileIcon;
+typedef struct _GFilenameCompleter GFilenameCompleter;
+
+
+typedef struct _GIcon GIcon; /* Dummy typedef */
+typedef struct _GInetAddress GInetAddress;
+typedef struct _GInetAddressMask GInetAddressMask;
+typedef struct _GInetSocketAddress GInetSocketAddress;
+typedef struct _GNativeSocketAddress GNativeSocketAddress;
+typedef struct _GInputStream GInputStream;
+typedef struct _GInitable GInitable;
+typedef struct _GIOModule GIOModule;
+typedef struct _GIOExtensionPoint GIOExtensionPoint;
+typedef struct _GIOExtension GIOExtension;
+
+/**
+ * GIOSchedulerJob:
+ *
+ * Opaque class for defining and scheduling IO jobs.
+ **/
+typedef struct _GIOSchedulerJob GIOSchedulerJob;
+typedef struct _GIOStreamAdapter GIOStreamAdapter;
+typedef struct _GLoadableIcon GLoadableIcon; /* Dummy typedef */
+typedef struct _GBytesIcon GBytesIcon;
+typedef struct _GMemoryInputStream GMemoryInputStream;
+typedef struct _GMemoryOutputStream GMemoryOutputStream;
+
+/**
+ * GMount:
+ *
+ * A handle to an object implementing the #GMountIface interface.
+ **/
+typedef struct _GMount GMount; /* Dummy typedef */
+typedef struct _GMountOperation GMountOperation;
+typedef struct _GNetworkAddress GNetworkAddress;
+typedef struct _GNetworkMonitor GNetworkMonitor;
+typedef struct _GNetworkService GNetworkService;
+typedef struct _GOutputStream GOutputStream;
+typedef struct _GIOStream GIOStream;
+typedef struct _GSimpleIOStream GSimpleIOStream;
+typedef struct _GPollableInputStream GPollableInputStream; /* Dummy typedef */
+typedef struct _GPollableOutputStream GPollableOutputStream; /* Dummy typedef */
+typedef struct _GResolver GResolver;
+
+/**
+ * GResource:
+ *
+ * A resource bundle.
+ *
+ * Since: 2.32
+ */
+typedef struct _GResource GResource;
+typedef struct _GSeekable GSeekable;
+typedef struct _GSimpleAsyncResult GSimpleAsyncResult;
+
+/**
+ * GSocket:
+ *
+ * A lowlevel network socket object.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GSocket GSocket;
+
+/**
+ * GSocketControlMessage:
+ *
+ * Base class for socket-type specific control messages that can be sent and
+ * received over #GSocket.
+ **/
+typedef struct _GSocketControlMessage GSocketControlMessage;
+/**
+ * GSocketClient:
+ *
+ * A helper class for network clients to make connections.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GSocketClient GSocketClient;
+/**
+ * GSocketConnection:
+ *
+ * A socket connection GIOStream object for connection-oriented sockets.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GSocketConnection GSocketConnection;
+/**
+ * GSocketListener:
+ *
+ * A helper class for network servers to listen for and accept connections.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GSocketListener GSocketListener;
+/**
+ * GSocketService:
+ *
+ * A helper class for handling accepting incomming connections in the
+ * glib mainloop.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GSocketService GSocketService;
+typedef struct _GSocketAddress GSocketAddress;
+typedef struct _GSocketAddressEnumerator GSocketAddressEnumerator;
+typedef struct _GSocketConnectable GSocketConnectable;
+typedef struct _GSrvTarget GSrvTarget;
+typedef struct _GTask GTask;
+/**
+ * GTcpConnection:
+ *
+ * A #GSocketConnection for TCP/IP connections.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GTcpConnection GTcpConnection;
+typedef struct _GTcpWrapperConnection GTcpWrapperConnection;
+/**
+ * GThreadedSocketService:
+ *
+ * A helper class for handling accepting incoming connections in the
+ * glib mainloop and handling them in a thread.
+ *
+ * Since: 2.22
+ **/
+typedef struct _GThreadedSocketService GThreadedSocketService;
+typedef struct _GDtlsConnection GDtlsConnection;
+typedef struct _GDtlsClientConnection GDtlsClientConnection; /* Dummy typedef */
+typedef struct _GDtlsServerConnection GDtlsServerConnection; /* Dummy typedef */
+typedef struct _GThemedIcon GThemedIcon;
+typedef struct _GTlsCertificate GTlsCertificate;
+typedef struct _GTlsClientConnection GTlsClientConnection; /* Dummy typedef */
+typedef struct _GTlsConnection GTlsConnection;
+typedef struct _GTlsDatabase GTlsDatabase;
+typedef struct _GTlsFileDatabase GTlsFileDatabase;
+typedef struct _GTlsInteraction GTlsInteraction;
+typedef struct _GTlsPassword GTlsPassword;
+typedef struct _GTlsServerConnection GTlsServerConnection; /* Dummy typedef */
+typedef struct _GVfs GVfs; /* Dummy typedef */
+
+/**
+ * GProxyResolver:
+ *
+ * A helper class to enumerate proxies base on URI.
+ *
+ * Since: 2.26
+ **/
+typedef struct _GProxyResolver GProxyResolver;
+typedef struct _GProxy GProxy;
+typedef struct _GProxyAddress GProxyAddress;
+typedef struct _GProxyAddressEnumerator GProxyAddressEnumerator;
+
+/**
+ * GVolume:
+ *
+ * Opaque mountable volume object.
+ **/
+typedef struct _GVolume GVolume; /* Dummy typedef */
+typedef struct _GVolumeMonitor GVolumeMonitor;
+
+/**
+ * GAsyncReadyCallback:
+ * @source_object: (nullable): the object the asynchronous operation was started with.
+ * @res: a #GAsyncResult.
+ * @user_data: user data passed to the callback.
+ *
+ * Type definition for a function that will be called back when an asynchronous
+ * operation within GIO has been completed. #GAsyncReadyCallback
+ * callbacks from #GTask are guaranteed to be invoked in a later
+ * iteration of the
+ * [thread-default main context][g-main-context-push-thread-default]
+ * where the #GTask was created. All other users of
+ * #GAsyncReadyCallback must likewise call it asynchronously in a
+ * later iteration of the main context.
+ **/
+typedef void (*GAsyncReadyCallback) (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data);
+
+/**
+ * GFileProgressCallback:
+ * @current_num_bytes: the current number of bytes in the operation.
+ * @total_num_bytes: the total number of bytes in the operation.
+ * @user_data: user data passed to the callback.
+ *
+ * When doing file operations that may take a while, such as moving
+ * a file or copying a file, a progress callback is used to pass how
+ * far along that operation is to the application.
+ **/
+typedef void (*GFileProgressCallback) (goffset current_num_bytes,
+ goffset total_num_bytes,
+ gpointer user_data);
+
+/**
+ * GFileReadMoreCallback:
+ * @file_contents: the data as currently read.
+ * @file_size: the size of the data currently read.
+ * @callback_data: (closure): data passed to the callback.
+ *
+ * When loading the partial contents of a file with g_file_load_partial_contents_async(),
+ * it may become necessary to determine if any more data from the file should be loaded.
+ * A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data
+ * should be read, or %FALSE otherwise.
+ *
+ * Returns: %TRUE if more data should be read back. %FALSE otherwise.
+ **/
+typedef gboolean (* GFileReadMoreCallback) (const char *file_contents,
+ goffset file_size,
+ gpointer callback_data);
+
+/**
+ * GFileMeasureProgressCallback:
+ * @reporting: %TRUE if more reports will come
+ * @current_size: the current cumulative size measurement
+ * @num_dirs: the number of directories visited so far
+ * @num_files: the number of non-directory files encountered
+ * @user_data: the data passed to the original request for this callback
+ *
+ * This callback type is used by g_file_measure_disk_usage() to make
+ * periodic progress reports when measuring the amount of disk spaced
+ * used by a directory.
+ *
+ * These calls are made on a best-effort basis and not all types of
+ * #GFile will support them. At the minimum, however, one call will
+ * always be made immediately.
+ *
+ * In the case that there is no support, @reporting will be set to
+ * %FALSE (and the other values undefined) and no further calls will be
+ * made. Otherwise, the @reporting will be %TRUE and the other values
+ * all-zeros during the first (immediate) call. In this way, you can
+ * know which type of progress UI to show without a delay.
+ *
+ * For g_file_measure_disk_usage() the callback is made directly. For
+ * g_file_measure_disk_usage_async() the callback is made via the
+ * default main context of the calling thread (ie: the same way that the
+ * final async result would be reported).
+ *
+ * @current_size is in the same units as requested by the operation (see
+ * %G_FILE_MEASURE_APPARENT_SIZE).
+ *
+ * The frequency of the updates is implementation defined, but is
+ * ideally about once every 200ms.
+ *
+ * The last progress callback may or may not be equal to the final
+ * result. Always check the async result to get the final value.
+ *
+ * Since: 2.38
+ **/
+typedef void (* GFileMeasureProgressCallback) (gboolean reporting,
+ guint64 current_size,
+ guint64 num_dirs,
+ guint64 num_files,
+ gpointer user_data);
+
+/**
+ * GIOSchedulerJobFunc:
+ * @job: a #GIOSchedulerJob.
+ * @cancellable: optional #GCancellable object, %NULL to ignore.
+ * @user_data: the data to pass to callback function
+ *
+ * I/O Job function.
+ *
+ * Long-running jobs should periodically check the @cancellable
+ * to see if they have been cancelled.
+ *
+ * Returns: %TRUE if this function should be called again to
+ * complete the job, %FALSE if the job is complete (or cancelled)
+ **/
+typedef gboolean (*GIOSchedulerJobFunc) (GIOSchedulerJob *job,
+ GCancellable *cancellable,
+ gpointer user_data);
+
+/**
+ * GSimpleAsyncThreadFunc:
+ * @res: a #GSimpleAsyncResult.
+ * @object: a #GObject.
+ * @cancellable: optional #GCancellable object, %NULL to ignore.
+ *
+ * Simple thread function that runs an asynchronous operation and
+ * checks for cancellation.
+ **/
+typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable);
+
+/**
+ * GSocketSourceFunc:
+ * @socket: the #GSocket
+ * @condition: the current condition at the source fired.
+ * @user_data: data passed in by the user.
+ *
+ * This is the function type of the callback used for the #GSource
+ * returned by g_socket_create_source().
+ *
+ * Returns: it should return %FALSE if the source should be removed.
+ *
+ * Since: 2.22
+ */
+typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
+ GIOCondition condition,
+ gpointer user_data);
+
+/**
+ * GDatagramBasedSourceFunc:
+ * @datagram_based: the #GDatagramBased
+ * @condition: the current condition at the source fired
+ * @user_data: data passed in by the user
+ *
+ * This is the function type of the callback used for the #GSource
+ * returned by g_datagram_based_create_source().
+ *
+ * Returns: %G_SOURCE_REMOVE if the source should be removed,
+ * %G_SOURCE_CONTINUE otherwise
+ *
+ * Since: 2.48
+ */
+typedef gboolean (*GDatagramBasedSourceFunc) (GDatagramBased *datagram_based,
+ GIOCondition condition,
+ gpointer user_data);
+
+/**
+ * GInputVector:
+ * @buffer: Pointer to a buffer where data will be written.
+ * @size: the available size in @buffer.
+ *
+ * Structure used for scatter/gather data input.
+ * You generally pass in an array of #GInputVectors
+ * and the operation will store the read data starting in the
+ * first buffer, switching to the next as needed.
+ *
+ * Since: 2.22
+ */
+typedef struct _GInputVector GInputVector;
+
+struct _GInputVector {
+ gpointer buffer;
+ gsize size;
+};
+
+/**
+ * GInputMessage:
+ * @address: (optional) (out) (transfer full): return location
+ * for a #GSocketAddress, or %NULL
+ * @vectors: (array length=num_vectors) (out): pointer to an
+ * array of input vectors
+ * @num_vectors: the number of input vectors pointed to by @vectors
+ * @bytes_received: (out): will be set to the number of bytes that have been
+ * received
+ * @flags: (out): collection of #GSocketMsgFlags for the received message,
+ * outputted by the call
+ * @control_messages: (array length=num_control_messages) (optional)
+ * (out) (transfer full): return location for a
+ * caller-allocated array of #GSocketControlMessages, or %NULL
+ * @num_control_messages: (out) (optional): return location for the number of
+ * elements in @control_messages
+ *
+ * Structure used for scatter/gather data input when receiving multiple
+ * messages or packets in one go. You generally pass in an array of empty
+ * #GInputVectors and the operation will use all the buffers as if they
+ * were one buffer, and will set @bytes_received to the total number of bytes
+ * received across all #GInputVectors.
+ *
+ * This structure closely mirrors `struct mmsghdr` and `struct msghdr` from
+ * the POSIX sockets API (see `man 2 recvmmsg`).
+ *
+ * If @address is non-%NULL then it is set to the source address the message
+ * was received from, and the caller must free it afterwards.
+ *
+ * If @control_messages is non-%NULL then it is set to an array of control
+ * messages received with the message (if any), and the caller must free it
+ * afterwards. @num_control_messages is set to the number of elements in
+ * this array, which may be zero.
+ *
+ * Flags relevant to this message will be returned in @flags. For example,
+ * `MSG_EOR` or `MSG_TRUNC`.
+ *
+ * Since: 2.48
+ */
+typedef struct _GInputMessage GInputMessage;
+
+struct _GInputMessage {
+ GSocketAddress **address;
+
+ GInputVector *vectors;
+ guint num_vectors;
+
+ gsize bytes_received;
+ gint flags;
+
+ GSocketControlMessage ***control_messages;
+ guint *num_control_messages;
+};
+
+/**
+ * GOutputVector:
+ * @buffer: Pointer to a buffer of data to read.
+ * @size: the size of @buffer.
+ *
+ * Structure used for scatter/gather data output.
+ * You generally pass in an array of #GOutputVectors
+ * and the operation will use all the buffers as if they were
+ * one buffer.
+ *
+ * Since: 2.22
+ */
+typedef struct _GOutputVector GOutputVector;
+
+struct _GOutputVector {
+ gconstpointer buffer;
+ gsize size;
+};
+
+/**
+ * GOutputMessage:
+ * @address: (nullable): a #GSocketAddress, or %NULL
+ * @vectors: pointer to an array of output vectors
+ * @num_vectors: the number of output vectors pointed to by @vectors.
+ * @bytes_sent: initialize to 0. Will be set to the number of bytes
+ * that have been sent
+ * @control_messages: (array length=num_control_messages) (nullable): a pointer
+ * to an array of #GSocketControlMessages, or %NULL.
+ * @num_control_messages: number of elements in @control_messages.
+ *
+ * Structure used for scatter/gather data output when sending multiple
+ * messages or packets in one go. You generally pass in an array of
+ * #GOutputVectors and the operation will use all the buffers as if they
+ * were one buffer.
+ *
+ * If @address is %NULL then the message is sent to the default receiver
+ * (as previously set by g_socket_connect()).
+ *
+ * Since: 2.44
+ */
+typedef struct _GOutputMessage GOutputMessage;
+
+struct _GOutputMessage {
+ GSocketAddress *address;
+
+ GOutputVector *vectors;
+ guint num_vectors;
+
+ guint bytes_sent;
+
+ GSocketControlMessage **control_messages;
+ guint num_control_messages;
+};
+
+typedef struct _GCredentials GCredentials;
+typedef struct _GUnixCredentialsMessage GUnixCredentialsMessage;
+typedef struct _GUnixFDList GUnixFDList;
+typedef struct _GDBusMessage GDBusMessage;
+typedef struct _GDBusConnection GDBusConnection;
+typedef struct _GDBusProxy GDBusProxy;
+typedef struct _GDBusMethodInvocation GDBusMethodInvocation;
+typedef struct _GDBusServer GDBusServer;
+typedef struct _GDBusAuthObserver GDBusAuthObserver;
+typedef struct _GDBusErrorEntry GDBusErrorEntry;
+typedef struct _GDBusInterfaceVTable GDBusInterfaceVTable;
+typedef struct _GDBusSubtreeVTable GDBusSubtreeVTable;
+typedef struct _GDBusAnnotationInfo GDBusAnnotationInfo;
+typedef struct _GDBusArgInfo GDBusArgInfo;
+typedef struct _GDBusMethodInfo GDBusMethodInfo;
+typedef struct _GDBusSignalInfo GDBusSignalInfo;
+typedef struct _GDBusPropertyInfo GDBusPropertyInfo;
+typedef struct _GDBusInterfaceInfo GDBusInterfaceInfo;
+typedef struct _GDBusNodeInfo GDBusNodeInfo;
+
+/**
+ * GCancellableSourceFunc:
+ * @cancellable: the #GCancellable
+ * @user_data: data passed in by the user.
+ *
+ * This is the function type of the callback used for the #GSource
+ * returned by g_cancellable_source_new().
+ *
+ * Returns: it should return %FALSE if the source should be removed.
+ *
+ * Since: 2.28
+ */
+typedef gboolean (*GCancellableSourceFunc) (GCancellable *cancellable,
+ gpointer user_data);
+
+/**
+ * GPollableSourceFunc:
+ * @pollable_stream: the #GPollableInputStream or #GPollableOutputStream
+ * @user_data: data passed in by the user.
+ *
+ * This is the function type of the callback used for the #GSource
+ * returned by g_pollable_input_stream_create_source() and
+ * g_pollable_output_stream_create_source().
+ *
+ * Returns: it should return %FALSE if the source should be removed.
+ *
+ * Since: 2.28
+ */
+typedef gboolean (*GPollableSourceFunc) (GObject *pollable_stream,
+ gpointer user_data);
+
+typedef struct _GDBusInterface GDBusInterface; /* Dummy typedef */
+typedef struct _GDBusInterfaceSkeleton GDBusInterfaceSkeleton;
+typedef struct _GDBusObject GDBusObject; /* Dummy typedef */
+typedef struct _GDBusObjectSkeleton GDBusObjectSkeleton;
+typedef struct _GDBusObjectProxy GDBusObjectProxy;
+typedef struct _GDBusObjectManager GDBusObjectManager; /* Dummy typedef */
+typedef struct _GDBusObjectManagerClient GDBusObjectManagerClient;
+typedef struct _GDBusObjectManagerServer GDBusObjectManagerServer;
+
+/**
+ * GDBusProxyTypeFunc:
+ * @manager: A #GDBusObjectManagerClient.
+ * @object_path: The object path of the remote object.
+ * @interface_name: (nullable): The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested.
+ * @user_data: User data.
+ *
+ * Function signature for a function used to determine the #GType to
+ * use for an interface proxy (if @interface_name is not %NULL) or
+ * object proxy (if @interface_name is %NULL).
+ *
+ * This function is called in the
+ * [thread-default main loop][g-main-context-push-thread-default]
+ * that @manager was constructed in.
+ *
+ * Returns: A #GType to use for the remote object. The returned type
+ * must be a #GDBusProxy or #GDBusObjectProxy -derived
+ * type.
+ *
+ * Since: 2.30
+ */
+typedef GType (*GDBusProxyTypeFunc) (GDBusObjectManagerClient *manager,
+ const gchar *object_path,
+ const gchar *interface_name,
+ gpointer user_data);
+
+typedef struct _GTestDBus GTestDBus;
+
+/**
+ * GSubprocess:
+ *
+ * A child process.
+ *
+ * Since: 2.40
+ */
+typedef struct _GSubprocess GSubprocess;
+/**
+ * GSubprocessLauncher:
+ *
+ * Options for launching a child process.
+ *
+ * Since: 2.40
+ */
+typedef struct _GSubprocessLauncher GSubprocessLauncher;
+
+G_END_DECLS
+
+#endif /* __GIO_TYPES_H__ */
diff --git a/include/glib/gio/glistmodel.h b/include/glib/gio/glistmodel.h
new file mode 100644
index 0000000000..48348afd54
--- /dev/null
+++ b/include/glib/gio/glistmodel.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 Lars Uebernickel
+ * Copyright 2015 Ryan Lortie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Lars Uebernickel <lars@uebernic.de>
+ * Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_LIST_MODEL_H__
+#define __G_LIST_MODEL_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_LIST_MODEL g_list_model_get_type ()
+GLIB_AVAILABLE_IN_2_44
+G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject)
+
+struct _GListModelInterface
+{
+ GTypeInterface g_iface;
+
+ GType (* get_item_type) (GListModel *list);
+
+ guint (* get_n_items) (GListModel *list);
+
+ gpointer (* get_item) (GListModel *list,
+ guint position);
+};
+
+GLIB_AVAILABLE_IN_2_44
+GType g_list_model_get_item_type (GListModel *list);
+
+GLIB_AVAILABLE_IN_2_44
+guint g_list_model_get_n_items (GListModel *list);
+
+GLIB_AVAILABLE_IN_2_44
+gpointer g_list_model_get_item (GListModel *list,
+ guint position);
+
+GLIB_AVAILABLE_IN_2_44
+GObject * g_list_model_get_object (GListModel *list,
+ guint position);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_model_items_changed (GListModel *list,
+ guint position,
+ guint removed,
+ guint added);
+
+G_END_DECLS
+
+#endif /* __G_LIST_MODEL_H__ */
diff --git a/include/glib/gio/gliststore.h b/include/glib/gio/gliststore.h
new file mode 100644
index 0000000000..407d542fbb
--- /dev/null
+++ b/include/glib/gio/gliststore.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 Lars Uebernickel
+ * Copyright 2015 Ryan Lortie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Lars Uebernickel <lars@uebernic.de>
+ * Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_LIST_STORE_H__
+#define __G_LIST_STORE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_LIST_STORE (g_list_store_get_type ())
+GLIB_AVAILABLE_IN_2_44
+G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject)
+
+GLIB_AVAILABLE_IN_2_44
+GListStore * g_list_store_new (GType item_type);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_store_insert (GListStore *store,
+ guint position,
+ gpointer item);
+
+GLIB_AVAILABLE_IN_2_44
+guint g_list_store_insert_sorted (GListStore *store,
+ gpointer item,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_46
+void g_list_store_sort (GListStore *store,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_store_append (GListStore *store,
+ gpointer item);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_store_remove (GListStore *store,
+ guint position);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_store_remove_all (GListStore *store);
+
+GLIB_AVAILABLE_IN_2_44
+void g_list_store_splice (GListStore *store,
+ guint position,
+ guint n_removals,
+ gpointer *additions,
+ guint n_additions);
+
+G_END_DECLS
+
+#endif /* __G_LIST_STORE_H__ */
diff --git a/include/glib/gio/gloadableicon.h b/include/glib/gio/gloadableicon.h
new file mode 100644
index 0000000000..c2951c991b
--- /dev/null
+++ b/include/glib/gio/gloadableicon.h
@@ -0,0 +1,99 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_LOADABLE_ICON_H__
+#define __G_LOADABLE_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_LOADABLE_ICON (g_loadable_icon_get_type ())
+#define G_LOADABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_LOADABLE_ICON, GLoadableIcon))
+#define G_IS_LOADABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_LOADABLE_ICON))
+#define G_LOADABLE_ICON_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_LOADABLE_ICON, GLoadableIconIface))
+
+/**
+ * GLoadableIcon:
+ *
+ * Generic type for all kinds of icons that can be loaded
+ * as a stream.
+ **/
+typedef struct _GLoadableIconIface GLoadableIconIface;
+
+/**
+ * GLoadableIconIface:
+ * @g_iface: The parent interface.
+ * @load: Loads an icon.
+ * @load_async: Loads an icon asynchronously.
+ * @load_finish: Finishes an asynchronous icon load.
+ *
+ * Interface for icons that can be loaded as a stream.
+ **/
+struct _GLoadableIconIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GInputStream * (* load) (GLoadableIcon *icon,
+ int size,
+ char **type,
+ GCancellable *cancellable,
+ GError **error);
+ void (* load_async) (GLoadableIcon *icon,
+ int size,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GInputStream * (* load_finish) (GLoadableIcon *icon,
+ GAsyncResult *res,
+ char **type,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_loadable_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GInputStream *g_loadable_icon_load (GLoadableIcon *icon,
+ int size,
+ char **type,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_loadable_icon_load_async (GLoadableIcon *icon,
+ int size,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GInputStream *g_loadable_icon_load_finish (GLoadableIcon *icon,
+ GAsyncResult *res,
+ char **type,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_LOADABLE_ICON_H__ */
diff --git a/include/glib/gio/gmemoryinputstream.h b/include/glib/gio/gmemoryinputstream.h
new file mode 100644
index 0000000000..7563fd6488
--- /dev/null
+++ b/include/glib/gio/gmemoryinputstream.h
@@ -0,0 +1,90 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_MEMORY_INPUT_STREAM_H__
+#define __G_MEMORY_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/ginputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_MEMORY_INPUT_STREAM (g_memory_input_stream_get_type ())
+#define G_MEMORY_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStream))
+#define G_MEMORY_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStreamClass))
+#define G_IS_MEMORY_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MEMORY_INPUT_STREAM))
+#define G_IS_MEMORY_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MEMORY_INPUT_STREAM))
+#define G_MEMORY_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStreamClass))
+
+/**
+ * GMemoryInputStream:
+ *
+ * Implements #GInputStream for arbitrary memory chunks.
+ **/
+typedef struct _GMemoryInputStreamClass GMemoryInputStreamClass;
+typedef struct _GMemoryInputStreamPrivate GMemoryInputStreamPrivate;
+
+struct _GMemoryInputStream
+{
+ GInputStream parent_instance;
+
+ /*< private >*/
+ GMemoryInputStreamPrivate *priv;
+};
+
+struct _GMemoryInputStreamClass
+{
+ GInputStreamClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_memory_input_stream_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GInputStream * g_memory_input_stream_new (void);
+GLIB_AVAILABLE_IN_ALL
+GInputStream * g_memory_input_stream_new_from_data (const void *data,
+ gssize len,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_2_34
+GInputStream * g_memory_input_stream_new_from_bytes (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_ALL
+void g_memory_input_stream_add_data (GMemoryInputStream *stream,
+ const void *data,
+ gssize len,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_2_34
+void g_memory_input_stream_add_bytes (GMemoryInputStream *stream,
+ GBytes *bytes);
+
+G_END_DECLS
+
+#endif /* __G_MEMORY_INPUT_STREAM_H__ */
diff --git a/include/glib/gio/gmemoryoutputstream.h b/include/glib/gio/gmemoryoutputstream.h
new file mode 100644
index 0000000000..5418d23d8a
--- /dev/null
+++ b/include/glib/gio/gmemoryoutputstream.h
@@ -0,0 +1,107 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christian Kellner <gicmo@gnome.org>
+ */
+
+#ifndef __G_MEMORY_OUTPUT_STREAM_H__
+#define __G_MEMORY_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/goutputstream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_MEMORY_OUTPUT_STREAM (g_memory_output_stream_get_type ())
+#define G_MEMORY_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStream))
+#define G_MEMORY_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStreamClass))
+#define G_IS_MEMORY_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MEMORY_OUTPUT_STREAM))
+#define G_IS_MEMORY_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MEMORY_OUTPUT_STREAM))
+#define G_MEMORY_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStreamClass))
+
+/**
+ * GMemoryOutputStream:
+ *
+ * Implements #GOutputStream for arbitrary memory chunks.
+ **/
+typedef struct _GMemoryOutputStreamClass GMemoryOutputStreamClass;
+typedef struct _GMemoryOutputStreamPrivate GMemoryOutputStreamPrivate;
+
+struct _GMemoryOutputStream
+{
+ GOutputStream parent_instance;
+
+ /*< private >*/
+ GMemoryOutputStreamPrivate *priv;
+};
+
+struct _GMemoryOutputStreamClass
+{
+ GOutputStreamClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+/**
+ * GReallocFunc:
+ * @data: memory block to reallocate
+ * @size: size to reallocate @data to
+ *
+ * Changes the size of the memory block pointed to by @data to
+ * @size bytes.
+ *
+ * The function should have the same semantics as realloc().
+ *
+ * Returns: a pointer to the reallocated memory
+ */
+typedef gpointer (* GReallocFunc) (gpointer data,
+ gsize size);
+
+GLIB_AVAILABLE_IN_ALL
+GType g_memory_output_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GOutputStream *g_memory_output_stream_new (gpointer data,
+ gsize size,
+ GReallocFunc realloc_function,
+ GDestroyNotify destroy_function);
+GLIB_AVAILABLE_IN_2_36
+GOutputStream *g_memory_output_stream_new_resizable (void);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_memory_output_stream_get_data (GMemoryOutputStream *ostream);
+GLIB_AVAILABLE_IN_ALL
+gsize g_memory_output_stream_get_size (GMemoryOutputStream *ostream);
+GLIB_AVAILABLE_IN_ALL
+gsize g_memory_output_stream_get_data_size (GMemoryOutputStream *ostream);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_memory_output_stream_steal_data (GMemoryOutputStream *ostream);
+
+GLIB_AVAILABLE_IN_2_34
+GBytes * g_memory_output_stream_steal_as_bytes (GMemoryOutputStream *ostream);
+
+G_END_DECLS
+
+#endif /* __G_MEMORY_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gmenu.h b/include/glib/gio/gmenu.h
new file mode 100644
index 0000000000..660943834b
--- /dev/null
+++ b/include/glib/gio/gmenu.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright © 2011 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_MENU_H__
+#define __G_MENU_H__
+
+#include <gio/gmenumodel.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_MENU (g_menu_get_type ())
+#define G_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_MENU, GMenu))
+#define G_IS_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_MENU))
+
+#define G_TYPE_MENU_ITEM (g_menu_item_get_type ())
+#define G_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_MENU_ITEM, GMenuItem))
+#define G_IS_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_MENU_ITEM))
+
+typedef struct _GMenuItem GMenuItem;
+typedef struct _GMenu GMenu;
+
+GLIB_AVAILABLE_IN_2_32
+GType g_menu_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_32
+GMenu * g_menu_new (void);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_freeze (GMenu *menu);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_insert_item (GMenu *menu,
+ gint position,
+ GMenuItem *item);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_prepend_item (GMenu *menu,
+ GMenuItem *item);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_append_item (GMenu *menu,
+ GMenuItem *item);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_remove (GMenu *menu,
+ gint position);
+
+GLIB_AVAILABLE_IN_2_38
+void g_menu_remove_all (GMenu *menu);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_insert (GMenu *menu,
+ gint position,
+ const gchar *label,
+ const gchar *detailed_action);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_prepend (GMenu *menu,
+ const gchar *label,
+ const gchar *detailed_action);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_append (GMenu *menu,
+ const gchar *label,
+ const gchar *detailed_action);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_insert_section (GMenu *menu,
+ gint position,
+ const gchar *label,
+ GMenuModel *section);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_prepend_section (GMenu *menu,
+ const gchar *label,
+ GMenuModel *section);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_append_section (GMenu *menu,
+ const gchar *label,
+ GMenuModel *section);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_insert_submenu (GMenu *menu,
+ gint position,
+ const gchar *label,
+ GMenuModel *submenu);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_prepend_submenu (GMenu *menu,
+ const gchar *label,
+ GMenuModel *submenu);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_append_submenu (GMenu *menu,
+ const gchar *label,
+ GMenuModel *submenu);
+
+
+GLIB_AVAILABLE_IN_2_32
+GType g_menu_item_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_32
+GMenuItem * g_menu_item_new (const gchar *label,
+ const gchar *detailed_action);
+
+GLIB_AVAILABLE_IN_2_34
+GMenuItem * g_menu_item_new_from_model (GMenuModel *model,
+ gint item_index);
+
+GLIB_AVAILABLE_IN_2_32
+GMenuItem * g_menu_item_new_submenu (const gchar *label,
+ GMenuModel *submenu);
+
+GLIB_AVAILABLE_IN_2_32
+GMenuItem * g_menu_item_new_section (const gchar *label,
+ GMenuModel *section);
+
+GLIB_AVAILABLE_IN_2_34
+GVariant * g_menu_item_get_attribute_value (GMenuItem *menu_item,
+ const gchar *attribute,
+ const GVariantType *expected_type);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_menu_item_get_attribute (GMenuItem *menu_item,
+ const gchar *attribute,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_34
+GMenuModel *g_menu_item_get_link (GMenuItem *menu_item,
+ const gchar *link);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_attribute_value (GMenuItem *menu_item,
+ const gchar *attribute,
+ GVariant *value);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_attribute (GMenuItem *menu_item,
+ const gchar *attribute,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_link (GMenuItem *menu_item,
+ const gchar *link,
+ GMenuModel *model);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_label (GMenuItem *menu_item,
+ const gchar *label);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_submenu (GMenuItem *menu_item,
+ GMenuModel *submenu);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_section (GMenuItem *menu_item,
+ GMenuModel *section);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_action_and_target_value (GMenuItem *menu_item,
+ const gchar *action,
+ GVariant *target_value);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_action_and_target (GMenuItem *menu_item,
+ const gchar *action,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_32
+void g_menu_item_set_detailed_action (GMenuItem *menu_item,
+ const gchar *detailed_action);
+
+GLIB_AVAILABLE_IN_2_38
+void g_menu_item_set_icon (GMenuItem *menu_item,
+ GIcon *icon);
+
+G_END_DECLS
+
+#endif /* __G_MENU_H__ */
diff --git a/include/glib/gio/gmenuexporter.h b/include/glib/gio/gmenuexporter.h
new file mode 100644
index 0000000000..650aaf0ed6
--- /dev/null
+++ b/include/glib/gio/gmenuexporter.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2011 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_MENU_EXPORTER_H__
+#define __G_MENU_EXPORTER_H__
+
+#include <gio/gdbusconnection.h>
+#include <gio/gmenumodel.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_32
+guint g_dbus_connection_export_menu_model (GDBusConnection *connection,
+ const gchar *object_path,
+ GMenuModel *menu,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+void g_dbus_connection_unexport_menu_model (GDBusConnection *connection,
+ guint export_id);
+
+G_END_DECLS
+
+#endif /* __G_MENU_EXPORTER_H__ */
diff --git a/include/glib/gio/gmenumodel.h b/include/glib/gio/gmenumodel.h
new file mode 100644
index 0000000000..34c8d0f39a
--- /dev/null
+++ b/include/glib/gio/gmenumodel.h
@@ -0,0 +1,305 @@
+/*
+ * Copyright © 2011 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_MENU_MODEL_H__
+#define __G_MENU_MODEL_H__
+
+#include <glib-object.h>
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_MENU_ATTRIBUTE_ACTION:
+ *
+ * The menu item attribute which holds the action name of the item. Action
+ * names are namespaced with an identifier for the action group in which the
+ * action resides. For example, "win." for window-specific actions and "app."
+ * for application-wide actions.
+ *
+ * See also g_menu_model_get_item_attribute() and g_menu_item_set_attribute().
+ *
+ * Since: 2.32
+ **/
+#define G_MENU_ATTRIBUTE_ACTION "action"
+
+/**
+ * G_MENU_ATTRIBUTE_ACTION_NAMESPACE:
+ *
+ * The menu item attribute that holds the namespace for all action names in
+ * menus that are linked from this item.
+ *
+ * Since: 2.36
+ **/
+#define G_MENU_ATTRIBUTE_ACTION_NAMESPACE "action-namespace"
+
+/**
+ * G_MENU_ATTRIBUTE_TARGET:
+ *
+ * The menu item attribute which holds the target with which the item's action
+ * will be activated.
+ *
+ * See also g_menu_item_set_action_and_target()
+ *
+ * Since: 2.32
+ **/
+#define G_MENU_ATTRIBUTE_TARGET "target"
+
+/**
+ * G_MENU_ATTRIBUTE_LABEL:
+ *
+ * The menu item attribute which holds the label of the item.
+ *
+ * Since: 2.32
+ **/
+#define G_MENU_ATTRIBUTE_LABEL "label"
+
+/**
+ * G_MENU_ATTRIBUTE_ICON:
+ *
+ * The menu item attribute which holds the icon of the item.
+ *
+ * The icon is stored in the format returned by g_icon_serialize().
+ *
+ * This attribute is intended only to represent 'noun' icons such as
+ * favicons for a webpage, or application icons. It should not be used
+ * for 'verbs' (ie: stock icons).
+ *
+ * Since: 2.38
+ **/
+#define G_MENU_ATTRIBUTE_ICON "icon"
+
+/**
+ * G_MENU_LINK_SUBMENU:
+ *
+ * The name of the link that associates a menu item with a submenu.
+ *
+ * See also g_menu_item_set_link().
+ *
+ * Since: 2.32
+ **/
+#define G_MENU_LINK_SUBMENU "submenu"
+
+/**
+ * G_MENU_LINK_SECTION:
+ *
+ * The name of the link that associates a menu item with a section. The linked
+ * menu will usually be shown in place of the menu item, using the item's label
+ * as a header.
+ *
+ * See also g_menu_item_set_link().
+ *
+ * Since: 2.32
+ **/
+#define G_MENU_LINK_SECTION "section"
+
+#define G_TYPE_MENU_MODEL (g_menu_model_get_type ())
+#define G_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_MENU_MODEL, GMenuModel))
+#define G_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_MENU_MODEL, GMenuModelClass))
+#define G_IS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_MENU_MODEL))
+#define G_IS_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_MENU_MODEL))
+#define G_MENU_MODEL_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_MENU_MODEL, GMenuModelClass))
+
+typedef struct _GMenuModelPrivate GMenuModelPrivate;
+typedef struct _GMenuModelClass GMenuModelClass;
+
+typedef struct _GMenuAttributeIterPrivate GMenuAttributeIterPrivate;
+typedef struct _GMenuAttributeIterClass GMenuAttributeIterClass;
+typedef struct _GMenuAttributeIter GMenuAttributeIter;
+
+typedef struct _GMenuLinkIterPrivate GMenuLinkIterPrivate;
+typedef struct _GMenuLinkIterClass GMenuLinkIterClass;
+typedef struct _GMenuLinkIter GMenuLinkIter;
+
+struct _GMenuModel
+{
+ GObject parent_instance;
+ GMenuModelPrivate *priv;
+};
+
+/**
+ * GMenuModelClass::get_item_attributes:
+ * @model: the #GMenuModel to query
+ * @item_index: The #GMenuItem to query
+ * @attributes: (out) (element-type utf8 GLib.Variant): Attributes on the item
+ *
+ * Gets all the attributes associated with the item in the menu model.
+ */
+/**
+ * GMenuModelClass::get_item_links:
+ * @model: the #GMenuModel to query
+ * @item_index: The #GMenuItem to query
+ * @links: (out) (element-type utf8 Gio.MenuModel): Links from the item
+ *
+ * Gets all the links associated with the item in the menu model.
+ */
+struct _GMenuModelClass
+{
+ GObjectClass parent_class;
+
+ gboolean (*is_mutable) (GMenuModel *model);
+ gint (*get_n_items) (GMenuModel *model);
+ void (*get_item_attributes) (GMenuModel *model,
+ gint item_index,
+ GHashTable **attributes);
+ GMenuAttributeIter * (*iterate_item_attributes) (GMenuModel *model,
+ gint item_index);
+ GVariant * (*get_item_attribute_value) (GMenuModel *model,
+ gint item_index,
+ const gchar *attribute,
+ const GVariantType *expected_type);
+ void (*get_item_links) (GMenuModel *model,
+ gint item_index,
+ GHashTable **links);
+ GMenuLinkIter * (*iterate_item_links) (GMenuModel *model,
+ gint item_index);
+ GMenuModel * (*get_item_link) (GMenuModel *model,
+ gint item_index,
+ const gchar *link);
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_menu_model_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_model_is_mutable (GMenuModel *model);
+GLIB_AVAILABLE_IN_2_32
+gint g_menu_model_get_n_items (GMenuModel *model);
+
+GLIB_AVAILABLE_IN_2_32
+GMenuAttributeIter * g_menu_model_iterate_item_attributes (GMenuModel *model,
+ gint item_index);
+GLIB_AVAILABLE_IN_2_32
+GVariant * g_menu_model_get_item_attribute_value (GMenuModel *model,
+ gint item_index,
+ const gchar *attribute,
+ const GVariantType *expected_type);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_model_get_item_attribute (GMenuModel *model,
+ gint item_index,
+ const gchar *attribute,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_32
+GMenuLinkIter * g_menu_model_iterate_item_links (GMenuModel *model,
+ gint item_index);
+GLIB_AVAILABLE_IN_2_32
+GMenuModel * g_menu_model_get_item_link (GMenuModel *model,
+ gint item_index,
+ const gchar *link);
+
+GLIB_AVAILABLE_IN_2_32
+void g_menu_model_items_changed (GMenuModel *model,
+ gint position,
+ gint removed,
+ gint added);
+
+
+#define G_TYPE_MENU_ATTRIBUTE_ITER (g_menu_attribute_iter_get_type ())
+#define G_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIter))
+#define G_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass))
+#define G_IS_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_MENU_ATTRIBUTE_ITER))
+#define G_IS_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_MENU_ATTRIBUTE_ITER))
+#define G_MENU_ATTRIBUTE_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass))
+
+struct _GMenuAttributeIter
+{
+ GObject parent_instance;
+ GMenuAttributeIterPrivate *priv;
+};
+
+struct _GMenuAttributeIterClass
+{
+ GObjectClass parent_class;
+
+ gboolean (*get_next) (GMenuAttributeIter *iter,
+ const gchar **out_name,
+ GVariant **value);
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_menu_attribute_iter_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_attribute_iter_get_next (GMenuAttributeIter *iter,
+ const gchar **out_name,
+ GVariant **value);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_attribute_iter_next (GMenuAttributeIter *iter);
+GLIB_AVAILABLE_IN_2_32
+const gchar * g_menu_attribute_iter_get_name (GMenuAttributeIter *iter);
+GLIB_AVAILABLE_IN_2_32
+GVariant * g_menu_attribute_iter_get_value (GMenuAttributeIter *iter);
+
+
+#define G_TYPE_MENU_LINK_ITER (g_menu_link_iter_get_type ())
+#define G_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_MENU_LINK_ITER, GMenuLinkIter))
+#define G_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass))
+#define G_IS_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_MENU_LINK_ITER))
+#define G_IS_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_MENU_LINK_ITER))
+#define G_MENU_LINK_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass))
+
+struct _GMenuLinkIter
+{
+ GObject parent_instance;
+ GMenuLinkIterPrivate *priv;
+};
+
+struct _GMenuLinkIterClass
+{
+ GObjectClass parent_class;
+
+ gboolean (*get_next) (GMenuLinkIter *iter,
+ const gchar **out_link,
+ GMenuModel **value);
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_menu_link_iter_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_link_iter_get_next (GMenuLinkIter *iter,
+ const gchar **out_link,
+ GMenuModel **value);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_menu_link_iter_next (GMenuLinkIter *iter);
+GLIB_AVAILABLE_IN_2_32
+const gchar * g_menu_link_iter_get_name (GMenuLinkIter *iter);
+GLIB_AVAILABLE_IN_2_32
+GMenuModel * g_menu_link_iter_get_value (GMenuLinkIter *iter);
+
+G_END_DECLS
+
+#endif /* __G_MENU_MODEL_H__ */
diff --git a/include/glib/gio/gmount.h b/include/glib/gio/gmount.h
new file mode 100644
index 0000000000..c376a6135a
--- /dev/null
+++ b/include/glib/gio/gmount.h
@@ -0,0 +1,276 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ * David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_MOUNT_H__
+#define __G_MOUNT_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_MOUNT (g_mount_get_type ())
+#define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
+#define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
+#define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
+
+typedef struct _GMountIface GMountIface;
+
+/**
+ * GMountIface:
+ * @g_iface: The parent interface.
+ * @changed: Changed signal that is emitted when the mount's state has changed.
+ * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
+ * @pre_unmount: The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
+ * @get_root: Gets a #GFile to the root directory of the #GMount.
+ * @get_name: Gets a string containing the name of the #GMount.
+ * @get_icon: Gets a #GIcon for the #GMount.
+ * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
+ * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
+ * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
+ * @can_unmount: Checks if a #GMount can be unmounted.
+ * @can_eject: Checks if a #GMount can be ejected.
+ * @unmount: Starts unmounting a #GMount.
+ * @unmount_finish: Finishes an unmounting operation.
+ * @eject: Starts ejecting a #GMount.
+ * @eject_finish: Finishes an eject operation.
+ * @remount: Starts remounting a #GMount.
+ * @remount_finish: Finishes a remounting operation.
+ * @guess_content_type: Starts guessing the type of the content of a #GMount.
+ * See g_mount_guess_content_type() for more information on content
+ * type guessing. This operation was added in 2.18.
+ * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
+ * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
+ * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
+ * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
+ * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
+ * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
+ * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
+ * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
+ * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34.
+ *
+ * Interface for implementing operations for mounts.
+ **/
+struct _GMountIface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+
+ void (* changed) (GMount *mount);
+ void (* unmounted) (GMount *mount);
+
+ /* Virtual Table */
+
+ GFile * (* get_root) (GMount *mount);
+ char * (* get_name) (GMount *mount);
+ GIcon * (* get_icon) (GMount *mount);
+ char * (* get_uuid) (GMount *mount);
+ GVolume * (* get_volume) (GMount *mount);
+ GDrive * (* get_drive) (GMount *mount);
+ gboolean (* can_unmount) (GMount *mount);
+ gboolean (* can_eject) (GMount *mount);
+
+ void (* unmount) (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* unmount_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* eject) (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* remount) (GMount *mount,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* remount_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* guess_content_type) (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gchar ** (* guess_content_type_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+ gchar ** (* guess_content_type_sync) (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GError **error);
+
+ /* Signal, not VFunc */
+ void (* pre_unmount) (GMount *mount);
+
+ void (* unmount_with_operation) (GMount *mount,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* unmount_with_operation_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+ void (* eject_with_operation) (GMount *mount,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_with_operation_finish) (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+ GFile * (* get_default_location) (GMount *mount);
+
+ const gchar * (* get_sort_key) (GMount *mount);
+ GIcon * (* get_symbolic_icon) (GMount *mount);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_mount_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GFile * g_mount_get_root (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_mount_get_default_location (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+char * g_mount_get_name (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_mount_get_icon (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_mount_get_symbolic_icon (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+char * g_mount_get_uuid (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+GVolume * g_mount_get_volume (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+GDrive * g_mount_get_drive (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_can_unmount (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_can_eject (GMount *mount);
+
+GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation)
+void g_mount_unmount (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
+gboolean g_mount_unmount_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_DEPRECATED_FOR(g_mount_eject_with_operation)
+void g_mount_eject (GMount *mount,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
+gboolean g_mount_eject_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_mount_remount (GMount *mount,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_remount_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_mount_guess_content_type (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_mount_guess_content_type_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_mount_guess_content_type_sync (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_is_shadowed (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_shadow (GMount *mount);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_unshadow (GMount *mount);
+
+GLIB_AVAILABLE_IN_ALL
+void g_mount_unmount_with_operation (GMount *mount,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_unmount_with_operation_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_mount_eject_with_operation (GMount *mount,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_eject_with_operation_finish (GMount *mount,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_mount_get_sort_key (GMount *mount);
+
+G_END_DECLS
+
+#endif /* __G_MOUNT_H__ */
diff --git a/include/glib/gio/gmountoperation.h b/include/glib/gio/gmountoperation.h
new file mode 100644
index 0000000000..56db2a577f
--- /dev/null
+++ b/include/glib/gio/gmountoperation.h
@@ -0,0 +1,177 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_MOUNT_OPERATION_H__
+#define __G_MOUNT_OPERATION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_MOUNT_OPERATION (g_mount_operation_get_type ())
+#define G_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MOUNT_OPERATION, GMountOperation))
+#define G_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
+#define G_IS_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MOUNT_OPERATION))
+#define G_IS_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MOUNT_OPERATION))
+#define G_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MOUNT_OPERATION, GMountOperationClass))
+
+/**
+ * GMountOperation:
+ *
+ * Class for providing authentication methods for mounting operations,
+ * such as mounting a file locally, or authenticating with a server.
+ **/
+typedef struct _GMountOperationClass GMountOperationClass;
+typedef struct _GMountOperationPrivate GMountOperationPrivate;
+
+struct _GMountOperation
+{
+ GObject parent_instance;
+
+ GMountOperationPrivate *priv;
+};
+
+struct _GMountOperationClass
+{
+ GObjectClass parent_class;
+
+ /* signals: */
+
+ void (* ask_password) (GMountOperation *op,
+ const char *message,
+ const char *default_user,
+ const char *default_domain,
+ GAskPasswordFlags flags);
+
+ /**
+ * GMountOperationClass::ask_question:
+ * @op: a #GMountOperation
+ * @message: string containing a message to display to the user
+ * @choices: (array zero-terminated=1) (element-type utf8): an array of
+ * strings for each possible choice
+ *
+ * Virtual implementation of #GMountOperation::ask-question.
+ */
+ void (* ask_question) (GMountOperation *op,
+ const char *message,
+ const char *choices[]);
+
+ void (* reply) (GMountOperation *op,
+ GMountOperationResult result);
+
+ void (* aborted) (GMountOperation *op);
+
+ /**
+ * GMountOperationClass::show_processes:
+ * @op: a #GMountOperation
+ * @message: string containing a message to display to the user
+ * @processes: (element-type GPid): an array of #GPid for processes blocking
+ * the operation
+ * @choices: (array zero-terminated=1) (element-type utf8): an array of
+ * strings for each possible choice
+ *
+ * Virtual implementation of #GMountOperation::show-processes.
+ *
+ * Since: 2.22
+ */
+ void (* show_processes) (GMountOperation *op,
+ const gchar *message,
+ GArray *processes,
+ const gchar *choices[]);
+
+ void (* show_unmount_progress) (GMountOperation *op,
+ const gchar *message,
+ gint64 time_left,
+ gint64 bytes_left);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+ void (*_g_reserved8) (void);
+ void (*_g_reserved9) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_mount_operation_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GMountOperation * g_mount_operation_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+const char * g_mount_operation_get_username (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_username (GMountOperation *op,
+ const char *username);
+GLIB_AVAILABLE_IN_ALL
+const char * g_mount_operation_get_password (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_password (GMountOperation *op,
+ const char *password);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mount_operation_get_anonymous (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_anonymous (GMountOperation *op,
+ gboolean anonymous);
+GLIB_AVAILABLE_IN_ALL
+const char * g_mount_operation_get_domain (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_domain (GMountOperation *op,
+ const char *domain);
+GLIB_AVAILABLE_IN_ALL
+GPasswordSave g_mount_operation_get_password_save (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_password_save (GMountOperation *op,
+ GPasswordSave save);
+GLIB_AVAILABLE_IN_ALL
+int g_mount_operation_get_choice (GMountOperation *op);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_set_choice (GMountOperation *op,
+ int choice);
+GLIB_AVAILABLE_IN_ALL
+void g_mount_operation_reply (GMountOperation *op,
+ GMountOperationResult result);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_mount_operation_get_is_tcrypt_hidden_volume (GMountOperation *op);
+GLIB_AVAILABLE_IN_2_58
+void g_mount_operation_set_is_tcrypt_hidden_volume (GMountOperation *op,
+ gboolean hidden_volume);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_mount_operation_get_is_tcrypt_system_volume (GMountOperation *op);
+GLIB_AVAILABLE_IN_2_58
+void g_mount_operation_set_is_tcrypt_system_volume (GMountOperation *op,
+ gboolean system_volume);
+GLIB_AVAILABLE_IN_2_58
+guint g_mount_operation_get_pim (GMountOperation *op);
+GLIB_AVAILABLE_IN_2_58
+void g_mount_operation_set_pim (GMountOperation *op,
+ guint pim);
+
+G_END_DECLS
+
+#endif /* __G_MOUNT_OPERATION_H__ */
diff --git a/include/glib/gio/gnativesocketaddress.h b/include/glib/gio/gnativesocketaddress.h
new file mode 100644
index 0000000000..032cd00a45
--- /dev/null
+++ b/include/glib/gio/gnativesocketaddress.h
@@ -0,0 +1,65 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ */
+
+#ifndef __G_NATIVE_SOCKET_ADDRESS_H__
+#define __G_NATIVE_SOCKET_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketaddress.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_NATIVE_SOCKET_ADDRESS (g_native_socket_address_get_type ())
+#define G_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddress))
+#define G_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass))
+#define G_IS_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NATIVE_SOCKET_ADDRESS))
+#define G_IS_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NATIVE_SOCKET_ADDRESS))
+#define G_NATIVE_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass))
+
+typedef struct _GNativeSocketAddressClass GNativeSocketAddressClass;
+typedef struct _GNativeSocketAddressPrivate GNativeSocketAddressPrivate;
+
+struct _GNativeSocketAddress
+{
+ GSocketAddress parent_instance;
+
+ /*< private >*/
+ GNativeSocketAddressPrivate *priv;
+};
+
+struct _GNativeSocketAddressClass
+{
+ GSocketAddressClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_2_46
+GType g_native_socket_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_46
+GSocketAddress *g_native_socket_address_new (gpointer native,
+ gsize len);
+
+G_END_DECLS
+
+#endif /* __G_NATIVE_SOCKET_ADDRESS_H__ */
diff --git a/include/glib/gio/gnativevolumemonitor.h b/include/glib/gio/gnativevolumemonitor.h
new file mode 100644
index 0000000000..739054705c
--- /dev/null
+++ b/include/glib/gio/gnativevolumemonitor.h
@@ -0,0 +1,61 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_NATIVE_VOLUME_MONITOR_H__
+#define __G_NATIVE_VOLUME_MONITOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gvolumemonitor.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_NATIVE_VOLUME_MONITOR (g_native_volume_monitor_get_type ())
+#define G_NATIVE_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NATIVE_VOLUME_MONITOR, GNativeVolumeMonitor))
+#define G_NATIVE_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NATIVE_VOLUME_MONITOR, GNativeVolumeMonitorClass))
+#define G_IS_NATIVE_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NATIVE_VOLUME_MONITOR))
+#define G_IS_NATIVE_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NATIVE_VOLUME_MONITOR))
+
+#define G_NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-native-volume-monitor"
+
+typedef struct _GNativeVolumeMonitor GNativeVolumeMonitor;
+typedef struct _GNativeVolumeMonitorClass GNativeVolumeMonitorClass;
+
+struct _GNativeVolumeMonitor
+{
+ GVolumeMonitor parent_instance;
+};
+
+struct _GNativeVolumeMonitorClass
+{
+ GVolumeMonitorClass parent_class;
+
+ GMount * (* get_mount_for_mount_path) (const char *mount_path,
+ GCancellable *cancellable);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_native_volume_monitor_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_NATIVE_VOLUME_MONITOR_H__ */
diff --git a/include/glib/gio/gnetworkaddress.h b/include/glib/gio/gnetworkaddress.h
new file mode 100644
index 0000000000..10bb0b5021
--- /dev/null
+++ b/include/glib/gio/gnetworkaddress.h
@@ -0,0 +1,80 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_NETWORK_ADDRESS_H__
+#define __G_NETWORK_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_NETWORK_ADDRESS (g_network_address_get_type ())
+#define G_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddress))
+#define G_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass))
+#define G_IS_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_ADDRESS))
+#define G_IS_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NETWORK_ADDRESS))
+#define G_NETWORK_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass))
+
+typedef struct _GNetworkAddressClass GNetworkAddressClass;
+typedef struct _GNetworkAddressPrivate GNetworkAddressPrivate;
+
+struct _GNetworkAddress
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GNetworkAddressPrivate *priv;
+};
+
+struct _GNetworkAddressClass
+{
+ GObjectClass parent_class;
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_network_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnectable *g_network_address_new (const gchar *hostname,
+ guint16 port);
+GLIB_AVAILABLE_IN_2_44
+GSocketConnectable *g_network_address_new_loopback (guint16 port);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnectable *g_network_address_parse (const gchar *host_and_port,
+ guint16 default_port,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnectable *g_network_address_parse_uri (const gchar *uri,
+ guint16 default_port,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_network_address_get_port (GNetworkAddress *addr);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_address_get_scheme (GNetworkAddress *addr);
+
+
+G_END_DECLS
+
+#endif /* __G_NETWORK_ADDRESS_H__ */
diff --git a/include/glib/gio/gnetworking.h b/include/glib/gio/gnetworking.h
new file mode 100644
index 0000000000..1327c9931f
--- /dev/null
+++ b/include/glib/gio/gnetworking.h
@@ -0,0 +1,82 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008-2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_NETWORKING_H__
+#define __G_NETWORKING_H__
+
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windns.h>
+#include <mswsock.h>
+#include <wspiapi.h>
+#include <iphlpapi.h>
+#undef interface
+
+#else /* !G_OS_WIN32 */
+
+#include <sys/types.h>
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <resolv.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <net/if.h>
+
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+
+#ifndef T_SRV
+#define T_SRV 33
+#endif
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF "/etc/resolv.conf"
+#endif
+
+#ifndef CMSG_LEN
+/* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
+ * some older platforms.
+ */
+#define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
+
+/* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
+ * adds. We overestimate here.
+ */
+#define GLIB_ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
+#define CMSG_SPACE(len) GLIB_ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
+#endif
+#endif
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_36
+void g_networking_init (void);
+
+G_END_DECLS
+
+#endif /* __G_NETWORKING_H__ */
diff --git a/include/glib/gio/gnetworkmonitor.h b/include/glib/gio/gnetworkmonitor.h
new file mode 100644
index 0000000000..dcaeaad33f
--- /dev/null
+++ b/include/glib/gio/gnetworkmonitor.h
@@ -0,0 +1,99 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_NETWORK_MONITOR_H__
+#define __G_NETWORK_MONITOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_NETWORK_MONITOR_EXTENSION_POINT_NAME:
+ *
+ * Extension point for network status monitoring functionality.
+ * See [Extending GIO][extending-gio].
+ *
+ * Since: 2.30
+ */
+#define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor"
+
+#define G_TYPE_NETWORK_MONITOR (g_network_monitor_get_type ())
+#define G_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitor))
+#define G_IS_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_MONITOR))
+#define G_NETWORK_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitorInterface))
+
+typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface;
+
+struct _GNetworkMonitorInterface {
+ GTypeInterface g_iface;
+
+ void (*network_changed) (GNetworkMonitor *monitor,
+ gboolean network_available);
+
+ gboolean (*can_reach) (GNetworkMonitor *monitor,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GError **error);
+ void (*can_reach_async) (GNetworkMonitor *monitor,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*can_reach_finish) (GNetworkMonitor *monitor,
+ GAsyncResult *result,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_network_monitor_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_32
+GNetworkMonitor *g_network_monitor_get_default (void);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_network_monitor_get_network_available (GNetworkMonitor *monitor);
+
+GLIB_AVAILABLE_IN_2_46
+gboolean g_network_monitor_get_network_metered (GNetworkMonitor *monitor);
+
+GLIB_AVAILABLE_IN_2_44
+GNetworkConnectivity g_network_monitor_get_connectivity (GNetworkMonitor *monitor);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_network_monitor_can_reach (GNetworkMonitor *monitor,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+void g_network_monitor_can_reach_async (GNetworkMonitor *monitor,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_network_monitor_can_reach_finish (GNetworkMonitor *monitor,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_NETWORK_MONITOR_H__ */
diff --git a/include/glib/gio/gnetworkservice.h b/include/glib/gio/gnetworkservice.h
new file mode 100644
index 0000000000..9cdb4ab47b
--- /dev/null
+++ b/include/glib/gio/gnetworkservice.h
@@ -0,0 +1,76 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_NETWORK_SERVICE_H__
+#define __G_NETWORK_SERVICE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_NETWORK_SERVICE (g_network_service_get_type ())
+#define G_NETWORK_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_SERVICE, GNetworkService))
+#define G_NETWORK_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NETWORK_SERVICE, GNetworkServiceClass))
+#define G_IS_NETWORK_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_SERVICE))
+#define G_IS_NETWORK_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NETWORK_SERVICE))
+#define G_NETWORK_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NETWORK_SERVICE, GNetworkServiceClass))
+
+typedef struct _GNetworkServiceClass GNetworkServiceClass;
+typedef struct _GNetworkServicePrivate GNetworkServicePrivate;
+
+struct _GNetworkService
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GNetworkServicePrivate *priv;
+};
+
+struct _GNetworkServiceClass
+{
+ GObjectClass parent_class;
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_network_service_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnectable *g_network_service_new (const gchar *service,
+ const gchar *protocol,
+ const gchar *domain);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_service_get_service (GNetworkService *srv);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_service_get_protocol (GNetworkService *srv);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_service_get_domain (GNetworkService *srv);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_network_service_get_scheme (GNetworkService *srv);
+GLIB_AVAILABLE_IN_ALL
+void g_network_service_set_scheme (GNetworkService *srv, const gchar *scheme);
+
+G_END_DECLS
+
+#endif /* __G_NETWORK_SERVICE_H__ */
+
diff --git a/include/glib/gio/gnotification.h b/include/glib/gio/gnotification.h
new file mode 100644
index 0000000000..55e6830128
--- /dev/null
+++ b/include/glib/gio/gnotification.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2013 Lars Uebernickel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Lars Uebernickel <lars@uebernic.de>
+ */
+
+#ifndef __G_NOTIFICATION_H__
+#define __G_NOTIFICATION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+#include <gio/gioenums.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_NOTIFICATION (g_notification_get_type ())
+#define G_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NOTIFICATION, GNotification))
+#define G_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NOTIFICATION))
+
+GLIB_AVAILABLE_IN_2_40
+GType g_notification_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_40
+GNotification * g_notification_new (const gchar *title);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_title (GNotification *notification,
+ const gchar *title);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_body (GNotification *notification,
+ const gchar *body);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_icon (GNotification *notification,
+ GIcon *icon);
+
+GLIB_DEPRECATED_IN_2_42_FOR(g_notification_set_priority)
+void g_notification_set_urgent (GNotification *notification,
+ gboolean urgent);
+
+GLIB_AVAILABLE_IN_2_42
+void g_notification_set_priority (GNotification *notification,
+ GNotificationPriority priority);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_add_button (GNotification *notification,
+ const gchar *label,
+ const gchar *detailed_action);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_add_button_with_target (GNotification *notification,
+ const gchar *label,
+ const gchar *action,
+ const gchar *target_format,
+ ...);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_add_button_with_target_value (GNotification *notification,
+ const gchar *label,
+ const gchar *action,
+ GVariant *target);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_default_action (GNotification *notification,
+ const gchar *detailed_action);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_default_action_and_target (GNotification *notification,
+ const gchar *action,
+ const gchar *target_format,
+ ...);
+
+GLIB_AVAILABLE_IN_2_40
+void g_notification_set_default_action_and_target_value (GNotification *notification,
+ const gchar *action,
+ GVariant *target);
+
+G_END_DECLS
+
+#endif
diff --git a/include/glib/gio/goutputstream.h b/include/glib/gio/goutputstream.h
new file mode 100644
index 0000000000..dc0f4925af
--- /dev/null
+++ b/include/glib/gio/goutputstream.h
@@ -0,0 +1,332 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_OUTPUT_STREAM_H__
+#define __G_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_OUTPUT_STREAM (g_output_stream_get_type ())
+#define G_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_OUTPUT_STREAM, GOutputStream))
+#define G_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_OUTPUT_STREAM, GOutputStreamClass))
+#define G_IS_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_OUTPUT_STREAM))
+#define G_IS_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_OUTPUT_STREAM))
+#define G_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_OUTPUT_STREAM, GOutputStreamClass))
+
+/**
+ * GOutputStream:
+ *
+ * Base class for writing output.
+ *
+ * All classes derived from GOutputStream should implement synchronous
+ * writing, splicing, flushing and closing streams, but may implement
+ * asynchronous versions.
+ **/
+typedef struct _GOutputStreamClass GOutputStreamClass;
+typedef struct _GOutputStreamPrivate GOutputStreamPrivate;
+
+struct _GOutputStream
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GOutputStreamPrivate *priv;
+};
+
+
+struct _GOutputStreamClass
+{
+ GObjectClass parent_class;
+
+ /* Sync ops: */
+
+ gssize (* write_fn) (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+ gssize (* splice) (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* flush) (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean (* close_fn) (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+
+ /* Async ops: (optional in derived classes) */
+
+ void (* write_async) (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gssize (* write_finish) (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ void (* splice_async) (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gssize (* splice_finish) (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ void (* flush_async) (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* flush_finish) (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+ void (* close_async) (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* close_finish) (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* writev_fn) (GOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* writev_async) (GOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ gboolean (* writev_finish) (GOutputStream *stream,
+ GAsyncResult *result,
+ gsize *bytes_written,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+ void (*_g_reserved8) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_output_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_output_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_write_all (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_60
+gboolean g_output_stream_writev (GOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+gboolean g_output_stream_writev_all (GOutputStream *stream,
+ GOutputVector *vectors,
+ gsize n_vectors,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_output_stream_printf (GOutputStream *stream,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (5, 6);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_output_stream_vprintf (GOutputStream *stream,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error,
+ const gchar *format,
+ va_list args) G_GNUC_PRINTF (5, 0);
+GLIB_AVAILABLE_IN_2_34
+gssize g_output_stream_write_bytes (GOutputStream *stream,
+ GBytes *bytes,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_output_stream_splice (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_flush (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_close (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_output_stream_write_async (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gssize g_output_stream_write_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_44
+void g_output_stream_write_all_async (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_44
+gboolean g_output_stream_write_all_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ gsize *bytes_written,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_60
+void g_output_stream_writev_async (GOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_60
+gboolean g_output_stream_writev_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ gsize *bytes_written,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_60
+void g_output_stream_writev_all_async (GOutputStream *stream,
+ GOutputVector *vectors,
+ gsize n_vectors,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_60
+gboolean g_output_stream_writev_all_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ gsize *bytes_written,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34
+void g_output_stream_write_bytes_async (GOutputStream *stream,
+ GBytes *bytes,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+gssize g_output_stream_write_bytes_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_output_stream_splice_async (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gssize g_output_stream_splice_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_output_stream_flush_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_flush_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_output_stream_close_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_close_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_is_closed (GOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_is_closing (GOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_has_pending (GOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_output_stream_set_pending (GOutputStream *stream,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_output_stream_clear_pending (GOutputStream *stream);
+
+
+G_END_DECLS
+
+#endif /* __G_OUTPUT_STREAM_H__ */
diff --git a/include/glib/gio/gpermission.h b/include/glib/gio/gpermission.h
new file mode 100644
index 0000000000..0c2b0bdf5d
--- /dev/null
+++ b/include/glib/gio/gpermission.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_PERMISSION_H__
+#define __G_PERMISSION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PERMISSION (g_permission_get_type ())
+#define G_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_PERMISSION, GPermission))
+#define G_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_PERMISSION, GPermissionClass))
+#define G_IS_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_PERMISSION))
+#define G_IS_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_PERMISSION))
+#define G_PERMISSION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_PERMISSION, GPermissionClass))
+
+typedef struct _GPermissionPrivate GPermissionPrivate;
+typedef struct _GPermissionClass GPermissionClass;
+
+struct _GPermission
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GPermissionPrivate *priv;
+};
+
+struct _GPermissionClass {
+ GObjectClass parent_class;
+
+ gboolean (*acquire) (GPermission *permission,
+ GCancellable *cancellable,
+ GError **error);
+ void (*acquire_async) (GPermission *permission,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*acquire_finish) (GPermission *permission,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (*release) (GPermission *permission,
+ GCancellable *cancellable,
+ GError **error);
+ void (*release_async) (GPermission *permission,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*release_finish) (GPermission *permission,
+ GAsyncResult *result,
+ GError **error);
+
+ gpointer reserved[16];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_permission_get_type (void);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_acquire (GPermission *permission,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_permission_acquire_async (GPermission *permission,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_acquire_finish (GPermission *permission,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_release (GPermission *permission,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_permission_release_async (GPermission *permission,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_release_finish (GPermission *permission,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_get_allowed (GPermission *permission);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_get_can_acquire (GPermission *permission);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_permission_get_can_release (GPermission *permission);
+
+GLIB_AVAILABLE_IN_ALL
+void g_permission_impl_update (GPermission *permission,
+ gboolean allowed,
+ gboolean can_acquire,
+ gboolean can_release);
+
+G_END_DECLS
+
+#endif /* __G_PERMISSION_H__ */
diff --git a/include/glib/gio/gpollableinputstream.h b/include/glib/gio/gpollableinputstream.h
new file mode 100644
index 0000000000..ce50312e7b
--- /dev/null
+++ b/include/glib/gio/gpollableinputstream.h
@@ -0,0 +1,105 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_POLLABLE_INPUT_STREAM_H__
+#define __G_POLLABLE_INPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_POLLABLE_INPUT_STREAM (g_pollable_input_stream_get_type ())
+#define G_POLLABLE_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_POLLABLE_INPUT_STREAM, GPollableInputStream))
+#define G_IS_POLLABLE_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_POLLABLE_INPUT_STREAM))
+#define G_POLLABLE_INPUT_STREAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_POLLABLE_INPUT_STREAM, GPollableInputStreamInterface))
+
+/**
+ * GPollableInputStream:
+ *
+ * An interface for a #GInputStream that can be polled for readability.
+ *
+ * Since: 2.28
+ */
+typedef struct _GPollableInputStreamInterface GPollableInputStreamInterface;
+
+/**
+ * GPollableInputStreamInterface:
+ * @g_iface: The parent interface.
+ * @can_poll: Checks if the #GPollableInputStream instance is actually pollable
+ * @is_readable: Checks if the stream is readable
+ * @create_source: Creates a #GSource to poll the stream
+ * @read_nonblocking: Does a non-blocking read or returns
+ * %G_IO_ERROR_WOULD_BLOCK
+ *
+ * The interface for pollable input streams.
+ *
+ * The default implementation of @can_poll always returns %TRUE.
+ *
+ * The default implementation of @read_nonblocking calls
+ * g_pollable_input_stream_is_readable(), and then calls
+ * g_input_stream_read() if it returns %TRUE. This means you only need
+ * to override it if it is possible that your @is_readable
+ * implementation may return %TRUE when the stream is not actually
+ * readable.
+ *
+ * Since: 2.28
+ */
+struct _GPollableInputStreamInterface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+ gboolean (*can_poll) (GPollableInputStream *stream);
+
+ gboolean (*is_readable) (GPollableInputStream *stream);
+ GSource * (*create_source) (GPollableInputStream *stream,
+ GCancellable *cancellable);
+ gssize (*read_nonblocking) (GPollableInputStream *stream,
+ void *buffer,
+ gsize count,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_pollable_input_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pollable_input_stream_can_poll (GPollableInputStream *stream);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pollable_input_stream_is_readable (GPollableInputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_pollable_input_stream_create_source (GPollableInputStream *stream,
+ GCancellable *cancellable);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_pollable_input_stream_read_nonblocking (GPollableInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+
+#endif /* __G_POLLABLE_INPUT_STREAM_H__ */
+
diff --git a/include/glib/gio/gpollableoutputstream.h b/include/glib/gio/gpollableoutputstream.h
new file mode 100644
index 0000000000..c282afdec4
--- /dev/null
+++ b/include/glib/gio/gpollableoutputstream.h
@@ -0,0 +1,126 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_POLLABLE_OUTPUT_STREAM_H__
+#define __G_POLLABLE_OUTPUT_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_POLLABLE_OUTPUT_STREAM (g_pollable_output_stream_get_type ())
+#define G_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStream))
+#define G_IS_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM))
+#define G_POLLABLE_OUTPUT_STREAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStreamInterface))
+
+/**
+ * GPollableOutputStream:
+ *
+ * An interface for a #GOutputStream that can be polled for writeability.
+ *
+ * Since: 2.28
+ */
+typedef struct _GPollableOutputStreamInterface GPollableOutputStreamInterface;
+
+/**
+ * GPollableOutputStreamInterface:
+ * @g_iface: The parent interface.
+ * @can_poll: Checks if the #GPollableOutputStream instance is actually pollable
+ * @is_writable: Checks if the stream is writable
+ * @create_source: Creates a #GSource to poll the stream
+ * @write_nonblocking: Does a non-blocking write or returns
+ * %G_IO_ERROR_WOULD_BLOCK
+ * @writev_nonblocking: Does a vectored non-blocking write, or returns
+ * %G_POLLABLE_RETURN_WOULD_BLOCK
+ *
+ * The interface for pollable output streams.
+ *
+ * The default implementation of @can_poll always returns %TRUE.
+ *
+ * The default implementation of @write_nonblocking calls
+ * g_pollable_output_stream_is_writable(), and then calls
+ * g_output_stream_write() if it returns %TRUE. This means you only
+ * need to override it if it is possible that your @is_writable
+ * implementation may return %TRUE when the stream is not actually
+ * writable.
+ *
+ * The default implementation of @writev_nonblocking calls
+ * g_pollable_output_stream_write_nonblocking() for each vector, and converts
+ * its return value and error (if set) to a #GPollableReturn. You should
+ * override this where possible to avoid having to allocate a #GError to return
+ * %G_IO_ERROR_WOULD_BLOCK.
+ *
+ * Since: 2.28
+ */
+struct _GPollableOutputStreamInterface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+ gboolean (*can_poll) (GPollableOutputStream *stream);
+
+ gboolean (*is_writable) (GPollableOutputStream *stream);
+ GSource * (*create_source) (GPollableOutputStream *stream,
+ GCancellable *cancellable);
+ gssize (*write_nonblocking) (GPollableOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GError **error);
+ GPollableReturn (*writev_nonblocking) (GPollableOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ gsize *bytes_written,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_pollable_output_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pollable_output_stream_can_poll (GPollableOutputStream *stream);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pollable_output_stream_is_writable (GPollableOutputStream *stream);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_pollable_output_stream_create_source (GPollableOutputStream *stream,
+ GCancellable *cancellable);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_pollable_output_stream_write_nonblocking (GPollableOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_60
+GPollableReturn g_pollable_output_stream_writev_nonblocking (GPollableOutputStream *stream,
+ const GOutputVector *vectors,
+ gsize n_vectors,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+
+#endif /* __G_POLLABLE_OUTPUT_STREAM_H__ */
+
diff --git a/include/glib/gio/gpollableutils.h b/include/glib/gio/gpollableutils.h
new file mode 100644
index 0000000000..007048cf16
--- /dev/null
+++ b/include/glib/gio/gpollableutils.h
@@ -0,0 +1,64 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_POLLABLE_UTILS_H__
+#define __G_POLLABLE_UTILS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+GSource *g_pollable_source_new (GObject *pollable_stream);
+
+GLIB_AVAILABLE_IN_2_34
+GSource *g_pollable_source_new_full (gpointer pollable_stream,
+ GSource *child_source,
+ GCancellable *cancellable);
+
+GLIB_AVAILABLE_IN_2_34
+gssize g_pollable_stream_read (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34
+gssize g_pollable_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_pollable_stream_write_all (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ gboolean blocking,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* _G_POLLABLE_UTILS_H_ */
diff --git a/include/glib/gio/gpropertyaction.h b/include/glib/gio/gpropertyaction.h
new file mode 100644
index 0000000000..6fb4e63307
--- /dev/null
+++ b/include/glib/gio/gpropertyaction.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2013 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_PROPERTY_ACTION_H__
+#define __G_PROPERTY_ACTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PROPERTY_ACTION (g_property_action_get_type ())
+#define G_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_PROPERTY_ACTION, GPropertyAction))
+#define G_IS_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_PROPERTY_ACTION))
+
+GLIB_AVAILABLE_IN_2_38
+GType g_property_action_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_38
+GPropertyAction * g_property_action_new (const gchar *name,
+ gpointer object,
+ const gchar *property_name);
+
+G_END_DECLS
+
+#endif /* __G_PROPERTY_ACTION_H__ */
diff --git a/include/glib/gio/gproxy.h b/include/glib/gio/gproxy.h
new file mode 100644
index 0000000000..5589f21dcd
--- /dev/null
+++ b/include/glib/gio/gproxy.h
@@ -0,0 +1,128 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
+ */
+
+#ifndef __G_PROXY_H__
+#define __G_PROXY_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PROXY (g_proxy_get_type ())
+#define G_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY, GProxy))
+#define G_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY))
+#define G_PROXY_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_PROXY, GProxyInterface))
+
+/**
+ * G_PROXY_EXTENSION_POINT_NAME:
+ *
+ * Extension point for proxy functionality.
+ * See [Extending GIO][extending-gio].
+ *
+ * Since: 2.26
+ */
+#define G_PROXY_EXTENSION_POINT_NAME "gio-proxy"
+
+/**
+ * GProxy:
+ *
+ * Interface that handles proxy connection and payload.
+ *
+ * Since: 2.26
+ */
+typedef struct _GProxyInterface GProxyInterface;
+
+/**
+ * GProxyInterface:
+ * @g_iface: The parent interface.
+ * @connect: Connect to proxy server and wrap (if required) the #connection
+ * to handle payload.
+ * @connect_async: Same as connect() but asynchronous.
+ * @connect_finish: Returns the result of connect_async()
+ * @supports_hostname: Returns whether the proxy supports hostname lookups.
+ *
+ * Provides an interface for handling proxy connection and payload.
+ *
+ * Since: 2.26
+ */
+struct _GProxyInterface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GIOStream * (* connect) (GProxy *proxy,
+ GIOStream *connection,
+ GProxyAddress *proxy_address,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* connect_async) (GProxy *proxy,
+ GIOStream *connection,
+ GProxyAddress *proxy_address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GIOStream * (* connect_finish) (GProxy *proxy,
+ GAsyncResult *result,
+ GError **error);
+
+ gboolean (* supports_hostname) (GProxy *proxy);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_proxy_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GProxy *g_proxy_get_default_for_protocol (const gchar *protocol);
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_proxy_connect (GProxy *proxy,
+ GIOStream *connection,
+ GProxyAddress *proxy_address,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_proxy_connect_async (GProxy *proxy,
+ GIOStream *connection,
+ GProxyAddress *proxy_address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_proxy_connect_finish (GProxy *proxy,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_proxy_supports_hostname (GProxy *proxy);
+
+G_END_DECLS
+
+#endif /* __G_PROXY_H__ */
diff --git a/include/glib/gio/gproxyaddress.h b/include/glib/gio/gproxyaddress.h
new file mode 100644
index 0000000000..21b1992ea7
--- /dev/null
+++ b/include/glib/gio/gproxyaddress.h
@@ -0,0 +1,86 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
+ */
+
+#ifndef __G_PROXY_ADDRESS_H__
+#define __G_PROXY_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/ginetsocketaddress.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PROXY_ADDRESS (g_proxy_address_get_type ())
+#define G_PROXY_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_ADDRESS, GProxyAddress))
+#define G_PROXY_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_PROXY_ADDRESS, GProxyAddressClass))
+#define G_IS_PROXY_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_ADDRESS))
+#define G_IS_PROXY_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_PROXY_ADDRESS))
+#define G_PROXY_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_PROXY_ADDRESS, GProxyAddressClass))
+
+typedef struct _GProxyAddressClass GProxyAddressClass;
+typedef struct _GProxyAddressPrivate GProxyAddressPrivate;
+
+struct _GProxyAddress
+{
+ GInetSocketAddress parent_instance;
+
+ /*< private >*/
+ GProxyAddressPrivate *priv;
+};
+
+struct _GProxyAddressClass
+{
+ GInetSocketAddressClass parent_class;
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_proxy_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_proxy_address_new (GInetAddress *inetaddr,
+ guint16 port,
+ const gchar *protocol,
+ const gchar *dest_hostname,
+ guint16 dest_port,
+ const gchar *username,
+ const gchar *password);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_proxy_address_get_protocol (GProxyAddress *proxy);
+GLIB_AVAILABLE_IN_2_34
+const gchar *g_proxy_address_get_destination_protocol (GProxyAddress *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_proxy_address_get_destination_hostname (GProxyAddress *proxy);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_proxy_address_get_destination_port (GProxyAddress *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_proxy_address_get_username (GProxyAddress *proxy);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_proxy_address_get_password (GProxyAddress *proxy);
+
+GLIB_AVAILABLE_IN_2_34
+const gchar *g_proxy_address_get_uri (GProxyAddress *proxy);
+
+G_END_DECLS
+
+#endif /* __G_PROXY_ADDRESS_H__ */
diff --git a/include/glib/gio/gproxyaddressenumerator.h b/include/glib/gio/gproxyaddressenumerator.h
new file mode 100644
index 0000000000..470f1dc66e
--- /dev/null
+++ b/include/glib/gio/gproxyaddressenumerator.h
@@ -0,0 +1,81 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
+ */
+
+#ifndef __G_PROXY_ADDRESS_ENUMERATOR_H__
+#define __G_PROXY_ADDRESS_ENUMERATOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketaddressenumerator.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PROXY_ADDRESS_ENUMERATOR (g_proxy_address_enumerator_get_type ())
+#define G_PROXY_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumerator))
+#define G_PROXY_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumeratorClass))
+#define G_IS_PROXY_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR))
+#define G_IS_PROXY_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_PROXY_ADDRESS_ENUMERATOR))
+#define G_PROXY_ADDRESS_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumeratorClass))
+
+/**
+ * GProxyAddressEnumerator:
+ *
+ * A subclass of #GSocketAddressEnumerator that takes another address
+ * enumerator and wraps each of its results in a #GProxyAddress as
+ * directed by the default #GProxyResolver.
+ */
+
+typedef struct _GProxyAddressEnumeratorClass GProxyAddressEnumeratorClass;
+typedef struct _GProxyAddressEnumeratorPrivate GProxyAddressEnumeratorPrivate;
+
+struct _GProxyAddressEnumerator
+{
+ /*< private >*/
+ GSocketAddressEnumerator parent_instance;
+ GProxyAddressEnumeratorPrivate *priv;
+};
+
+/**
+ * GProxyAddressEnumeratorClass:
+ *
+ * Class structure for #GProxyAddressEnumerator.
+ */
+struct _GProxyAddressEnumeratorClass
+{
+ /*< private >*/
+ GSocketAddressEnumeratorClass parent_class;
+
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_proxy_address_enumerator_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_PROXY_ADDRESS_ENUMERATOR_H__ */
diff --git a/include/glib/gio/gproxyresolver.h b/include/glib/gio/gproxyresolver.h
new file mode 100644
index 0000000000..c8ed82812c
--- /dev/null
+++ b/include/glib/gio/gproxyresolver.h
@@ -0,0 +1,95 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
+ */
+
+#ifndef __G_PROXY_RESOLVER_H__
+#define __G_PROXY_RESOLVER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_PROXY_RESOLVER (g_proxy_resolver_get_type ())
+#define G_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_RESOLVER, GProxyResolver))
+#define G_IS_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_RESOLVER))
+#define G_PROXY_RESOLVER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_PROXY_RESOLVER, GProxyResolverInterface))
+
+/**
+ * G_PROXY_RESOLVER_EXTENSION_POINT_NAME:
+ *
+ * Extension point for proxy resolving functionality.
+ * See [Extending GIO][extending-gio].
+ */
+#define G_PROXY_RESOLVER_EXTENSION_POINT_NAME "gio-proxy-resolver"
+
+typedef struct _GProxyResolverInterface GProxyResolverInterface;
+
+struct _GProxyResolverInterface {
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+ gboolean (* is_supported) (GProxyResolver *resolver);
+
+ gchar ** (* lookup) (GProxyResolver *resolver,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* lookup_async) (GProxyResolver *resolver,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ gchar ** (* lookup_finish) (GProxyResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_proxy_resolver_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GProxyResolver *g_proxy_resolver_get_default (void);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_proxy_resolver_lookup (GProxyResolver *resolver,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_proxy_resolver_lookup_async (GProxyResolver *resolver,
+ const gchar *uri,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_proxy_resolver_lookup_finish (GProxyResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+
+
+G_END_DECLS
+
+#endif /* __G_PROXY_RESOLVER_H__ */
diff --git a/include/glib/gio/gremoteactiongroup.h b/include/glib/gio/gremoteactiongroup.h
new file mode 100644
index 0000000000..206c737344
--- /dev/null
+++ b/include/glib/gio/gremoteactiongroup.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2011 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_REMOTE_ACTION_GROUP_H__
+#define __G_REMOTE_ACTION_GROUP_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+
+#define G_TYPE_REMOTE_ACTION_GROUP (g_remote_action_group_get_type ())
+#define G_REMOTE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_REMOTE_ACTION_GROUP, GRemoteActionGroup))
+#define G_IS_REMOTE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_REMOTE_ACTION_GROUP))
+#define G_REMOTE_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+ G_TYPE_REMOTE_ACTION_GROUP, \
+ GRemoteActionGroupInterface))
+
+typedef struct _GRemoteActionGroupInterface GRemoteActionGroupInterface;
+
+struct _GRemoteActionGroupInterface
+{
+ GTypeInterface g_iface;
+
+ void (* activate_action_full) (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *parameter,
+ GVariant *platform_data);
+
+ void (* change_action_state_full) (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *value,
+ GVariant *platform_data);
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_remote_action_group_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+void g_remote_action_group_activate_action_full (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *parameter,
+ GVariant *platform_data);
+
+GLIB_AVAILABLE_IN_2_32
+void g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *value,
+ GVariant *platform_data);
+
+G_END_DECLS
+
+#endif /* __G_REMOTE_ACTION_GROUP_H__ */
diff --git a/include/glib/gio/gresolver.h b/include/glib/gio/gresolver.h
new file mode 100644
index 0000000000..dc4ba59a14
--- /dev/null
+++ b/include/glib/gio/gresolver.h
@@ -0,0 +1,292 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_RESOLVER_H__
+#define __G_RESOLVER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_RESOLVER (g_resolver_get_type ())
+#define G_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_RESOLVER, GResolver))
+#define G_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_RESOLVER, GResolverClass))
+#define G_IS_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_RESOLVER))
+#define G_IS_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_RESOLVER))
+#define G_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_RESOLVER, GResolverClass))
+
+typedef struct _GResolverPrivate GResolverPrivate;
+typedef struct _GResolverClass GResolverClass;
+
+struct _GResolver {
+ GObject parent_instance;
+
+ GResolverPrivate *priv;
+};
+
+/**
+ * GResolverNameLookupFlags:
+ * @G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT: default behavior (same as g_resolver_lookup_by_name())
+ * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY: only resolve ipv4 addresses
+ * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY: only resolve ipv6 addresses
+ *
+ * Flags to modify lookup behavior.
+ *
+ * Since: 2.60
+ */
+typedef enum {
+ G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT = 0,
+ G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY = 1 << 0,
+ G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY = 1 << 1,
+} GResolverNameLookupFlags;
+
+struct _GResolverClass {
+ GObjectClass parent_class;
+
+ /* Signals */
+ void ( *reload) (GResolver *resolver);
+
+ /* Virtual methods */
+ GList * ( *lookup_by_name) (GResolver *resolver,
+ const gchar *hostname,
+ GCancellable *cancellable,
+ GError **error);
+ void ( *lookup_by_name_async) (GResolver *resolver,
+ const gchar *hostname,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GList * ( *lookup_by_name_finish) (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+
+ gchar * ( *lookup_by_address) (GResolver *resolver,
+ GInetAddress *address,
+ GCancellable *cancellable,
+ GError **error);
+ void ( *lookup_by_address_async) (GResolver *resolver,
+ GInetAddress *address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gchar * ( *lookup_by_address_finish) (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+
+ GList * ( *lookup_service) (GResolver *resolver,
+ const gchar *rrname,
+ GCancellable *cancellable,
+ GError **error);
+ void ( *lookup_service_async) (GResolver *resolver,
+ const gchar *rrname,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GList * ( *lookup_service_finish) (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+
+ GList * ( *lookup_records) (GResolver *resolver,
+ const gchar *rrname,
+ GResolverRecordType record_type,
+ GCancellable *cancellable,
+ GError **error);
+
+ void ( *lookup_records_async) (GResolver *resolver,
+ const gchar *rrname,
+ GResolverRecordType record_type,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GList * ( *lookup_records_finish) (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+ /**
+ * GResolverClass::lookup_by_name_with_flags_async:
+ * @resolver: a #GResolver
+ * @hostname: the hostname to resolve
+ * @flags: extra #GResolverNameLookupFlags to modify the lookup
+ * @cancellable: (nullable): a #GCancellable
+ * @callback: (scope async): a #GAsyncReadyCallback to call when completed
+ * @user_data: (closure): data to pass to @callback
+ *
+ * Asynchronous version of GResolverClass::lookup_by_name_with_flags
+ *
+ * GResolverClass::lookup_by_name_with_flags_finish will be called to get
+ * the result.
+ *
+ * Since: 2.60
+ */
+ void ( *lookup_by_name_with_flags_async) (GResolver *resolver,
+ const gchar *hostname,
+ GResolverNameLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ /**
+ * GResolverClass::lookup_by_name_with_flags_finish:
+ * @resolver: a #GResolver
+ * @result: a #GAsyncResult
+ * @error: (nullable): a pointer to a %NULL #GError
+ *
+ * Gets the result from GResolverClass::lookup_by_name_with_flags_async
+ *
+ * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress.
+ * Since: 2.60
+ */
+ GList * ( *lookup_by_name_with_flags_finish) (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+ /**
+ * GResolverClass::lookup_by_name_with_flags:
+ * @resolver: a #GResolver
+ * @hostname: the hostname to resolve
+ * @flags: extra #GResolverNameLookupFlags to modify the lookup
+ * @cancellable: (nullable): a #GCancellable
+ * @error: (nullable): a pointer to a %NULL #GError
+ *
+ * This is identical to GResolverClass::lookup_by_name except it takes
+ * @flags which modifies the behavior of the lookup. See #GResolverNameLookupFlags
+ * for more details.
+ *
+ * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress.
+ * Since: 2.60
+ */
+ GList * ( *lookup_by_name_with_flags) (GResolver *resolver,
+ const gchar *hostname,
+ GResolverNameLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_resolver_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GResolver *g_resolver_get_default (void);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_set_default (GResolver *resolver);
+GLIB_AVAILABLE_IN_ALL
+GList *g_resolver_lookup_by_name (GResolver *resolver,
+ const gchar *hostname,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_lookup_by_name_async (GResolver *resolver,
+ const gchar *hostname,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GList *g_resolver_lookup_by_name_finish (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+void g_resolver_lookup_by_name_with_flags_async (GResolver *resolver,
+ const gchar *hostname,
+ GResolverNameLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_60
+GList *g_resolver_lookup_by_name_with_flags_finish (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+GList *g_resolver_lookup_by_name_with_flags (GResolver *resolver,
+ const gchar *hostname,
+ GResolverNameLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_free_addresses (GList *addresses);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_resolver_lookup_by_address (GResolver *resolver,
+ GInetAddress *address,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_lookup_by_address_async (GResolver *resolver,
+ GInetAddress *address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_resolver_lookup_by_address_finish (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GList *g_resolver_lookup_service (GResolver *resolver,
+ const gchar *service,
+ const gchar *protocol,
+ const gchar *domain,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_lookup_service_async (GResolver *resolver,
+ const gchar *service,
+ const gchar *protocol,
+ const gchar *domain,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GList *g_resolver_lookup_service_finish (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+GList *g_resolver_lookup_records (GResolver *resolver,
+ const gchar *rrname,
+ GResolverRecordType record_type,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_34
+void g_resolver_lookup_records_async (GResolver *resolver,
+ const gchar *rrname,
+ GResolverRecordType record_type,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+GList *g_resolver_lookup_records_finish (GResolver *resolver,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_resolver_free_targets (GList *targets);
+
+
+/**
+ * G_RESOLVER_ERROR:
+ *
+ * Error domain for #GResolver. Errors in this domain will be from the
+ * #GResolverError enumeration. See #GError for more information on
+ * error domains.
+ */
+#define G_RESOLVER_ERROR (g_resolver_error_quark ())
+GLIB_AVAILABLE_IN_ALL
+GQuark g_resolver_error_quark (void);
+
+G_END_DECLS
+
+#endif /* __G_RESOLVER_H__ */
diff --git a/include/glib/gio/gresource.h b/include/glib/gio/gresource.h
new file mode 100644
index 0000000000..e9870c1488
--- /dev/null
+++ b/include/glib/gio/gresource.h
@@ -0,0 +1,130 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_RESOURCE_H__
+#define __G_RESOURCE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_TYPE_RESOURCE:
+ *
+ * The #GType for #GResource.
+ */
+#define G_TYPE_RESOURCE (g_resource_get_type ())
+
+
+/**
+ * G_RESOURCE_ERROR:
+ *
+ * Error domain for #GResource. Errors in this domain will be from the
+ * #GResourceError enumeration. See #GError for more information on
+ * error domains.
+ */
+#define G_RESOURCE_ERROR (g_resource_error_quark ())
+GLIB_AVAILABLE_IN_2_32
+GQuark g_resource_error_quark (void);
+
+typedef struct _GStaticResource GStaticResource;
+
+struct _GStaticResource {
+ /*< private >*/
+ const guint8 *data;
+ gsize data_len;
+ GResource *resource;
+ GStaticResource *next;
+ gpointer padding;
+};
+
+GLIB_AVAILABLE_IN_2_32
+GType g_resource_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_32
+GResource * g_resource_new_from_data (GBytes *data,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+GResource * g_resource_ref (GResource *resource);
+GLIB_AVAILABLE_IN_2_32
+void g_resource_unref (GResource *resource);
+GLIB_AVAILABLE_IN_2_32
+GResource * g_resource_load (const gchar *filename,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+GInputStream *g_resource_open_stream (GResource *resource,
+ const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+GBytes * g_resource_lookup_data (GResource *resource,
+ const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+char ** g_resource_enumerate_children (GResource *resource,
+ const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_resource_get_info (GResource *resource,
+ const char *path,
+ GResourceLookupFlags lookup_flags,
+ gsize *size,
+ guint32 *flags,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+void g_resources_register (GResource *resource);
+GLIB_AVAILABLE_IN_2_32
+void g_resources_unregister (GResource *resource);
+GLIB_AVAILABLE_IN_2_32
+GInputStream *g_resources_open_stream (const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+GBytes * g_resources_lookup_data (const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+char ** g_resources_enumerate_children (const char *path,
+ GResourceLookupFlags lookup_flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_resources_get_info (const char *path,
+ GResourceLookupFlags lookup_flags,
+ gsize *size,
+ guint32 *flags,
+ GError **error);
+
+
+GLIB_AVAILABLE_IN_2_32
+void g_static_resource_init (GStaticResource *static_resource);
+GLIB_AVAILABLE_IN_2_32
+void g_static_resource_fini (GStaticResource *static_resource);
+GLIB_AVAILABLE_IN_2_32
+GResource *g_static_resource_get_resource (GStaticResource *static_resource);
+
+G_END_DECLS
+
+#endif /* __G_RESOURCE_H__ */
diff --git a/include/glib/gio/gseekable.h b/include/glib/gio/gseekable.h
new file mode 100644
index 0000000000..191f3cca2f
--- /dev/null
+++ b/include/glib/gio/gseekable.h
@@ -0,0 +1,103 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SEEKABLE_H__
+#define __G_SEEKABLE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SEEKABLE (g_seekable_get_type ())
+#define G_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SEEKABLE, GSeekable))
+#define G_IS_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SEEKABLE))
+#define G_SEEKABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SEEKABLE, GSeekableIface))
+
+/**
+ * GSeekable:
+ *
+ * Seek object for streaming operations.
+ **/
+typedef struct _GSeekableIface GSeekableIface;
+
+/**
+ * GSeekableIface:
+ * @g_iface: The parent interface.
+ * @tell: Tells the current location within a stream.
+ * @can_seek: Checks if seeking is supported by the stream.
+ * @seek: Seeks to a location within a stream.
+ * @can_truncate: Checks if truncation is supported by the stream.
+ * @truncate_fn: Truncates a stream.
+ *
+ * Provides an interface for implementing seekable functionality on I/O Streams.
+ **/
+struct _GSeekableIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ goffset (* tell) (GSeekable *seekable);
+
+ gboolean (* can_seek) (GSeekable *seekable);
+ gboolean (* seek) (GSeekable *seekable,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error);
+
+ gboolean (* can_truncate) (GSeekable *seekable);
+ gboolean (* truncate_fn) (GSeekable *seekable,
+ goffset offset,
+ GCancellable *cancellable,
+ GError **error);
+
+ /* TODO: Async seek/truncate */
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_seekable_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+goffset g_seekable_tell (GSeekable *seekable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_seekable_can_seek (GSeekable *seekable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_seekable_seek (GSeekable *seekable,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_seekable_can_truncate (GSeekable *seekable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_seekable_truncate (GSeekable *seekable,
+ goffset offset,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+
+#endif /* __G_SEEKABLE_H__ */
diff --git a/include/glib/gio/gsettings.h b/include/glib/gio/gsettings.h
new file mode 100644
index 0000000000..d3d5a076fd
--- /dev/null
+++ b/include/glib/gio/gsettings.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright © 2009, 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SETTINGS_H__
+#define __G_SETTINGS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsettingsschema.h>
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SETTINGS (g_settings_get_type ())
+#define G_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SETTINGS, GSettings))
+#define G_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SETTINGS, GSettingsClass))
+#define G_IS_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_SETTINGS))
+#define G_IS_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_SETTINGS))
+#define G_SETTINGS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SETTINGS, GSettingsClass))
+
+typedef struct _GSettingsPrivate GSettingsPrivate;
+typedef struct _GSettingsClass GSettingsClass;
+
+struct _GSettingsClass
+{
+ GObjectClass parent_class;
+
+ /* Signals */
+ void (*writable_changed) (GSettings *settings,
+ const gchar *key);
+ void (*changed) (GSettings *settings,
+ const gchar *key);
+ gboolean (*writable_change_event) (GSettings *settings,
+ GQuark key);
+ gboolean (*change_event) (GSettings *settings,
+ const GQuark *keys,
+ gint n_keys);
+
+ gpointer padding[20];
+};
+
+struct _GSettings
+{
+ GObject parent_instance;
+ GSettingsPrivate *priv;
+};
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_settings_get_type (void);
+
+GLIB_DEPRECATED_IN_2_40_FOR(g_settings_schema_source_list_schemas)
+const gchar * const * g_settings_list_schemas (void);
+GLIB_DEPRECATED_IN_2_40_FOR(g_settings_schema_source_list_schemas)
+const gchar * const * g_settings_list_relocatable_schemas (void);
+GLIB_AVAILABLE_IN_ALL
+GSettings * g_settings_new (const gchar *schema_id);
+GLIB_AVAILABLE_IN_ALL
+GSettings * g_settings_new_with_path (const gchar *schema_id,
+ const gchar *path);
+GLIB_AVAILABLE_IN_ALL
+GSettings * g_settings_new_with_backend (const gchar *schema_id,
+ GSettingsBackend *backend);
+GLIB_AVAILABLE_IN_ALL
+GSettings * g_settings_new_with_backend_and_path (const gchar *schema_id,
+ GSettingsBackend *backend,
+ const gchar *path);
+GLIB_AVAILABLE_IN_2_32
+GSettings * g_settings_new_full (GSettingsSchema *schema,
+ GSettingsBackend *backend,
+ const gchar *path);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_settings_list_children (GSettings *settings);
+GLIB_DEPRECATED_IN_2_46_FOR(g_settings_schema_list_keys)
+gchar ** g_settings_list_keys (GSettings *settings);
+GLIB_DEPRECATED_IN_2_40_FOR(g_settings_schema_key_get_range)
+GVariant * g_settings_get_range (GSettings *settings,
+ const gchar *key);
+GLIB_DEPRECATED_IN_2_40_FOR(g_settings_schema_key_range_check)
+gboolean g_settings_range_check (GSettings *settings,
+ const gchar *key,
+ GVariant *value);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_value (GSettings *settings,
+ const gchar *key,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_settings_get_value (GSettings *settings,
+ const gchar *key);
+
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_settings_get_user_value (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_settings_get_default_value (GSettings *settings,
+ const gchar *key);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set (GSettings *settings,
+ const gchar *key,
+ const gchar *format,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_get (GSettings *settings,
+ const gchar *key,
+ const gchar *format,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_reset (GSettings *settings,
+ const gchar *key);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_settings_get_int (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_int (GSettings *settings,
+ const gchar *key,
+ gint value);
+GLIB_AVAILABLE_IN_2_50
+gint64 g_settings_get_int64 (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_settings_set_int64 (GSettings *settings,
+ const gchar *key,
+ gint64 value);
+GLIB_AVAILABLE_IN_2_32
+guint g_settings_get_uint (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_settings_set_uint (GSettings *settings,
+ const gchar *key,
+ guint value);
+GLIB_AVAILABLE_IN_2_50
+guint64 g_settings_get_uint64 (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_settings_set_uint64 (GSettings *settings,
+ const gchar *key,
+ guint64 value);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_settings_get_string (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_string (GSettings *settings,
+ const gchar *key,
+ const gchar *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_get_boolean (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_boolean (GSettings *settings,
+ const gchar *key,
+ gboolean value);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_settings_get_double (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_double (GSettings *settings,
+ const gchar *key,
+ gdouble value);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_settings_get_strv (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_strv (GSettings *settings,
+ const gchar *key,
+ const gchar *const *value);
+GLIB_AVAILABLE_IN_ALL
+gint g_settings_get_enum (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_enum (GSettings *settings,
+ const gchar *key,
+ gint value);
+GLIB_AVAILABLE_IN_ALL
+guint g_settings_get_flags (GSettings *settings,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_set_flags (GSettings *settings,
+ const gchar *key,
+ guint value);
+GLIB_AVAILABLE_IN_ALL
+GSettings * g_settings_get_child (GSettings *settings,
+ const gchar *name);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_is_writable (GSettings *settings,
+ const gchar *name);
+
+GLIB_AVAILABLE_IN_ALL
+void g_settings_delay (GSettings *settings);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_apply (GSettings *settings);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_revert (GSettings *settings);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_settings_get_has_unapplied (GSettings *settings);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_sync (void);
+
+/**
+ * GSettingsBindSetMapping:
+ * @value: a #GValue containing the property value to map
+ * @expected_type: the #GVariantType to create
+ * @user_data: user data that was specified when the binding was created
+ *
+ * The type for the function that is used to convert an object property
+ * value to a #GVariant for storing it in #GSettings.
+ *
+ * Returns: a new #GVariant holding the data from @value,
+ * or %NULL in case of an error
+ */
+typedef GVariant * (*GSettingsBindSetMapping) (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data);
+
+/**
+ * GSettingsBindGetMapping:
+ * @value: return location for the property value
+ * @variant: the #GVariant
+ * @user_data: user data that was specified when the binding was created
+ *
+ * The type for the function that is used to convert from #GSettings to
+ * an object property. The @value is already initialized to hold values
+ * of the appropriate type.
+ *
+ * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error
+ */
+typedef gboolean (*GSettingsBindGetMapping) (GValue *value,
+ GVariant *variant,
+ gpointer user_data);
+
+/**
+ * GSettingsGetMapping:
+ * @value: the #GVariant to map, or %NULL
+ * @result: (out): the result of the mapping
+ * @user_data: (closure): the user data that was passed to
+ * g_settings_get_mapped()
+ *
+ * The type of the function that is used to convert from a value stored
+ * in a #GSettings to a value that is useful to the application.
+ *
+ * If the value is successfully mapped, the result should be stored at
+ * @result and %TRUE returned. If mapping fails (for example, if @value
+ * is not in the right format) then %FALSE should be returned.
+ *
+ * If @value is %NULL then it means that the mapping function is being
+ * given a "last chance" to successfully return a valid value. %TRUE
+ * must be returned in this case.
+ *
+ * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error
+ **/
+typedef gboolean (*GSettingsGetMapping) (GVariant *value,
+ gpointer *result,
+ gpointer user_data);
+
+/**
+ * GSettingsBindFlags:
+ * @G_SETTINGS_BIND_DEFAULT: Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
+ * @G_SETTINGS_BIND_GET: Update the #GObject property when the setting changes.
+ * It is an error to use this flag if the property is not writable.
+ * @G_SETTINGS_BIND_SET: Update the setting when the #GObject property changes.
+ * It is an error to use this flag if the property is not readable.
+ * @G_SETTINGS_BIND_NO_SENSITIVITY: Do not try to bind a "sensitivity" property to the writability of the setting
+ * @G_SETTINGS_BIND_GET_NO_CHANGES: When set in addition to #G_SETTINGS_BIND_GET, set the #GObject property
+ * value initially from the setting, but do not listen for changes of the setting
+ * @G_SETTINGS_BIND_INVERT_BOOLEAN: When passed to g_settings_bind(), uses a pair of mapping functions that invert
+ * the boolean value when mapping between the setting and the property. The setting and property must both
+ * be booleans. You cannot pass this flag to g_settings_bind_with_mapping().
+ *
+ * Flags used when creating a binding. These flags determine in which
+ * direction the binding works. The default is to synchronize in both
+ * directions.
+ */
+typedef enum
+{
+ G_SETTINGS_BIND_DEFAULT,
+ G_SETTINGS_BIND_GET = (1<<0),
+ G_SETTINGS_BIND_SET = (1<<1),
+ G_SETTINGS_BIND_NO_SENSITIVITY = (1<<2),
+ G_SETTINGS_BIND_GET_NO_CHANGES = (1<<3),
+ G_SETTINGS_BIND_INVERT_BOOLEAN = (1<<4)
+} GSettingsBindFlags;
+
+GLIB_AVAILABLE_IN_ALL
+void g_settings_bind (GSettings *settings,
+ const gchar *key,
+ gpointer object,
+ const gchar *property,
+ GSettingsBindFlags flags);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_bind_with_mapping (GSettings *settings,
+ const gchar *key,
+ gpointer object,
+ const gchar *property,
+ GSettingsBindFlags flags,
+ GSettingsBindGetMapping get_mapping,
+ GSettingsBindSetMapping set_mapping,
+ gpointer user_data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_bind_writable (GSettings *settings,
+ const gchar *key,
+ gpointer object,
+ const gchar *property,
+ gboolean inverted);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_unbind (gpointer object,
+ const gchar *property);
+
+GLIB_AVAILABLE_IN_2_32
+GAction * g_settings_create_action (GSettings *settings,
+ const gchar *key);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_settings_get_mapped (GSettings *settings,
+ const gchar *key,
+ GSettingsGetMapping mapping,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_SETTINGS_H__ */
diff --git a/include/glib/gio/gsettingsbackend.h b/include/glib/gio/gsettingsbackend.h
new file mode 100644
index 0000000000..34bae6b609
--- /dev/null
+++ b/include/glib/gio/gsettingsbackend.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright © 2009, 2010 Codethink Limited
+ * Copyright © 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ * Matthias Clasen <mclasen@redhat.com>
+ */
+
+#ifndef __G_SETTINGS_BACKEND_H__
+#define __G_SETTINGS_BACKEND_H__
+
+#if !defined (G_SETTINGS_ENABLE_BACKEND) && !defined (GIO_COMPILATION)
+#error "You must define G_SETTINGS_ENABLE_BACKEND before including <gio/gsettingsbackend.h>."
+#endif
+
+#define __GIO_GIO_H_INSIDE__
+#include <gio/giotypes.h>
+#undef __GIO_GIO_H_INSIDE__
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SETTINGS_BACKEND (g_settings_backend_get_type ())
+#define G_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SETTINGS_BACKEND, GSettingsBackend))
+#define G_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
+#define G_IS_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SETTINGS_BACKEND))
+#define G_IS_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SETTINGS_BACKEND))
+#define G_SETTINGS_BACKEND_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
+
+/**
+ * G_SETTINGS_BACKEND_EXTENSION_POINT_NAME:
+ *
+ * Extension point for #GSettingsBackend functionality.
+ **/
+#define G_SETTINGS_BACKEND_EXTENSION_POINT_NAME "gsettings-backend"
+
+/**
+ * GSettingsBackend:
+ *
+ * An implementation of a settings storage repository.
+ **/
+typedef struct _GSettingsBackendPrivate GSettingsBackendPrivate;
+typedef struct _GSettingsBackendClass GSettingsBackendClass;
+
+/**
+ * GSettingsBackendClass:
+ * @read: virtual method to read a key's value
+ * @get_writable: virtual method to get if a key is writable
+ * @write: virtual method to change key's value
+ * @write_tree: virtual method to change a tree of keys
+ * @reset: virtual method to reset state
+ * @subscribe: virtual method to subscribe to key changes
+ * @unsubscribe: virtual method to unsubscribe to key changes
+ * @sync: virtual method to sync state
+ * @get_permission: virtual method to get permission of a key
+ * @read_user_value: virtual method to read user's key value
+ *
+ * Class structure for #GSettingsBackend.
+ */
+struct _GSettingsBackendClass
+{
+ GObjectClass parent_class;
+
+ GVariant * (*read) (GSettingsBackend *backend,
+ const gchar *key,
+ const GVariantType *expected_type,
+ gboolean default_value);
+
+ gboolean (*get_writable) (GSettingsBackend *backend,
+ const gchar *key);
+
+ gboolean (*write) (GSettingsBackend *backend,
+ const gchar *key,
+ GVariant *value,
+ gpointer origin_tag);
+ gboolean (*write_tree) (GSettingsBackend *backend,
+ GTree *tree,
+ gpointer origin_tag);
+ void (*reset) (GSettingsBackend *backend,
+ const gchar *key,
+ gpointer origin_tag);
+
+ void (*subscribe) (GSettingsBackend *backend,
+ const gchar *name);
+ void (*unsubscribe) (GSettingsBackend *backend,
+ const gchar *name);
+ void (*sync) (GSettingsBackend *backend);
+
+ GPermission * (*get_permission) (GSettingsBackend *backend,
+ const gchar *path);
+
+ GVariant * (*read_user_value) (GSettingsBackend *backend,
+ const gchar *key,
+ const GVariantType *expected_type);
+
+ /*< private >*/
+ gpointer padding[23];
+};
+
+struct _GSettingsBackend
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GSettingsBackendPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_settings_backend_get_type (void);
+
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_changed (GSettingsBackend *backend,
+ const gchar *key,
+ gpointer origin_tag);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_path_changed (GSettingsBackend *backend,
+ const gchar *path,
+ gpointer origin_tag);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_flatten_tree (GTree *tree,
+ gchar **path,
+ const gchar ***keys,
+ GVariant ***values);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_keys_changed (GSettingsBackend *backend,
+ const gchar *path,
+ gchar const * const *items,
+ gpointer origin_tag);
+
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_path_writable_changed (GSettingsBackend *backend,
+ const gchar *path);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_writable_changed (GSettingsBackend *backend,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+void g_settings_backend_changed_tree (GSettingsBackend *backend,
+ GTree *tree,
+ gpointer origin_tag);
+
+GLIB_AVAILABLE_IN_ALL
+GSettingsBackend * g_settings_backend_get_default (void);
+
+GLIB_AVAILABLE_IN_ALL
+GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename,
+ const gchar *root_path,
+ const gchar *root_group);
+
+GLIB_AVAILABLE_IN_ALL
+GSettingsBackend * g_null_settings_backend_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+GSettingsBackend * g_memory_settings_backend_new (void);
+
+G_END_DECLS
+
+#endif /* __G_SETTINGS_BACKEND_H__ */
diff --git a/include/glib/gio/gsettingsschema.h b/include/glib/gio/gsettingsschema.h
new file mode 100644
index 0000000000..219e30914e
--- /dev/null
+++ b/include/glib/gio/gsettingsschema.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ * Copyright © 2011 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SETTINGS_SCHEMA_H__
+#define __G_SETTINGS_SCHEMA_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GSettingsSchemaSource GSettingsSchemaSource;
+typedef struct _GSettingsSchema GSettingsSchema;
+typedef struct _GSettingsSchemaKey GSettingsSchemaKey;
+
+#define G_TYPE_SETTINGS_SCHEMA_SOURCE (g_settings_schema_source_get_type ())
+GLIB_AVAILABLE_IN_2_32
+GType g_settings_schema_source_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+GSettingsSchemaSource * g_settings_schema_source_get_default (void);
+GLIB_AVAILABLE_IN_2_32
+GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source);
+GLIB_AVAILABLE_IN_2_32
+void g_settings_schema_source_unref (GSettingsSchemaSource *source);
+
+GLIB_AVAILABLE_IN_2_32
+GSettingsSchemaSource * g_settings_schema_source_new_from_directory (const gchar *directory,
+ GSettingsSchemaSource *parent,
+ gboolean trusted,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source,
+ const gchar *schema_id,
+ gboolean recursive);
+
+GLIB_AVAILABLE_IN_2_40
+void g_settings_schema_source_list_schemas (GSettingsSchemaSource *source,
+ gboolean recursive,
+ gchar ***non_relocatable,
+ gchar ***relocatable);
+
+#define G_TYPE_SETTINGS_SCHEMA (g_settings_schema_get_type ())
+GLIB_AVAILABLE_IN_2_32
+GType g_settings_schema_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema);
+GLIB_AVAILABLE_IN_2_32
+void g_settings_schema_unref (GSettingsSchema *schema);
+
+GLIB_AVAILABLE_IN_2_32
+const gchar * g_settings_schema_get_id (GSettingsSchema *schema);
+GLIB_AVAILABLE_IN_2_32
+const gchar * g_settings_schema_get_path (GSettingsSchema *schema);
+GLIB_AVAILABLE_IN_2_40
+GSettingsSchemaKey * g_settings_schema_get_key (GSettingsSchema *schema,
+ const gchar *name);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_settings_schema_has_key (GSettingsSchema *schema,
+ const gchar *name);
+GLIB_AVAILABLE_IN_2_46
+gchar** g_settings_schema_list_keys (GSettingsSchema *schema);
+
+
+GLIB_AVAILABLE_IN_2_44
+gchar ** g_settings_schema_list_children (GSettingsSchema *schema);
+
+#define G_TYPE_SETTINGS_SCHEMA_KEY (g_settings_schema_key_get_type ())
+GLIB_AVAILABLE_IN_2_40
+GType g_settings_schema_key_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_40
+GSettingsSchemaKey * g_settings_schema_key_ref (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+void g_settings_schema_key_unref (GSettingsSchemaKey *key);
+
+GLIB_AVAILABLE_IN_2_40
+const GVariantType * g_settings_schema_key_get_value_type (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_settings_schema_key_get_default_value (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_settings_schema_key_get_range (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_settings_schema_key_range_check (GSettingsSchemaKey *key,
+ GVariant *value);
+
+GLIB_AVAILABLE_IN_2_44
+const gchar * g_settings_schema_key_get_name (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+const gchar * g_settings_schema_key_get_summary (GSettingsSchemaKey *key);
+GLIB_AVAILABLE_IN_2_40
+const gchar * g_settings_schema_key_get_description (GSettingsSchemaKey *key);
+
+G_END_DECLS
+
+#endif /* __G_SETTINGS_SCHEMA_H__ */
diff --git a/include/glib/gio/gsimpleaction.h b/include/glib/gio/gsimpleaction.h
new file mode 100644
index 0000000000..041eb7ecc8
--- /dev/null
+++ b/include/glib/gio/gsimpleaction.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SIMPLE_ACTION_H__
+#define __G_SIMPLE_ACTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_ACTION (g_simple_action_get_type ())
+#define G_SIMPLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SIMPLE_ACTION, GSimpleAction))
+#define G_IS_SIMPLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SIMPLE_ACTION))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_simple_action_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSimpleAction * g_simple_action_new (const gchar *name,
+ const GVariantType *parameter_type);
+
+GLIB_AVAILABLE_IN_ALL
+GSimpleAction * g_simple_action_new_stateful (const gchar *name,
+ const GVariantType *parameter_type,
+ GVariant *state);
+
+GLIB_AVAILABLE_IN_ALL
+void g_simple_action_set_enabled (GSimpleAction *simple,
+ gboolean enabled);
+
+GLIB_AVAILABLE_IN_2_30
+void g_simple_action_set_state (GSimpleAction *simple,
+ GVariant *value);
+
+GLIB_AVAILABLE_IN_2_44
+void g_simple_action_set_state_hint (GSimpleAction *simple,
+ GVariant *state_hint);
+
+G_END_DECLS
+
+#endif /* __G_SIMPLE_ACTION_H__ */
diff --git a/include/glib/gio/gsimpleactiongroup.h b/include/glib/gio/gsimpleactiongroup.h
new file mode 100644
index 0000000000..6ad46e7da2
--- /dev/null
+++ b/include/glib/gio/gsimpleactiongroup.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SIMPLE_ACTION_GROUP_H__
+#define __G_SIMPLE_ACTION_GROUP_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include "gactiongroup.h"
+#include "gactionmap.h"
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_ACTION_GROUP (g_simple_action_group_get_type ())
+#define G_SIMPLE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroup))
+#define G_SIMPLE_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroupClass))
+#define G_IS_SIMPLE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SIMPLE_ACTION_GROUP))
+#define G_IS_SIMPLE_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SIMPLE_ACTION_GROUP))
+#define G_SIMPLE_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroupClass))
+
+typedef struct _GSimpleActionGroupPrivate GSimpleActionGroupPrivate;
+typedef struct _GSimpleActionGroupClass GSimpleActionGroupClass;
+
+/**
+ * GSimpleActionGroup:
+ *
+ * The #GSimpleActionGroup structure contains private data and should only be accessed using the provided API.
+ *
+ * Since: 2.28
+ */
+struct _GSimpleActionGroup
+{
+ /*< private >*/
+ GObject parent_instance;
+
+ GSimpleActionGroupPrivate *priv;
+};
+
+struct _GSimpleActionGroupClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer padding[12];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_simple_action_group_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSimpleActionGroup * g_simple_action_group_new (void);
+
+GLIB_DEPRECATED_IN_2_38_FOR (g_action_map_lookup_action)
+GAction * g_simple_action_group_lookup (GSimpleActionGroup *simple,
+ const gchar *action_name);
+
+GLIB_DEPRECATED_IN_2_38_FOR (g_action_map_add_action)
+void g_simple_action_group_insert (GSimpleActionGroup *simple,
+ GAction *action);
+
+GLIB_DEPRECATED_IN_2_38_FOR (g_action_map_remove_action)
+void g_simple_action_group_remove (GSimpleActionGroup *simple,
+ const gchar *action_name);
+
+GLIB_DEPRECATED_IN_2_38_FOR (g_action_map_add_action_entries)
+void g_simple_action_group_add_entries (GSimpleActionGroup *simple,
+ const GActionEntry *entries,
+ gint n_entries,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_SIMPLE_ACTION_GROUP_H__ */
diff --git a/include/glib/gio/gsimpleasyncresult.h b/include/glib/gio/gsimpleasyncresult.h
new file mode 100644
index 0000000000..8daa91d400
--- /dev/null
+++ b/include/glib/gio/gsimpleasyncresult.h
@@ -0,0 +1,162 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SIMPLE_ASYNC_RESULT_H__
+#define __G_SIMPLE_ASYNC_RESULT_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_ASYNC_RESULT (g_simple_async_result_get_type ())
+#define G_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
+#define G_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
+#define G_IS_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
+#define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
+#define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
+
+/**
+ * GSimpleAsyncResult:
+ *
+ * A simple implementation of #GAsyncResult.
+ **/
+typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
+
+
+GLIB_AVAILABLE_IN_ALL
+GType g_simple_async_result_get_type (void) G_GNUC_CONST;
+
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
+GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ gpointer source_tag);
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
+GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...) G_GNUC_PRINTF (6, 7);
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
+GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ const GError *error);
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
+GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GError *error);
+
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
+ gpointer op_res,
+ GDestroyNotify destroy_op_res);
+GLIB_DEPRECATED_IN_2_46
+gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
+
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
+ gssize op_res);
+GLIB_DEPRECATED_IN_2_46
+gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
+
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
+ gboolean op_res);
+GLIB_DEPRECATED_IN_2_46
+gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
+
+
+
+GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
+void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
+ GCancellable *check_cancellable);
+GLIB_DEPRECATED_IN_2_46
+gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
+ gboolean handle_cancellation);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_complete (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
+ GSimpleAsyncThreadFunc func,
+ int io_priority,
+ GCancellable *cancellable);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
+ const GError *error);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
+ GError *error);
+GLIB_DEPRECATED_IN_2_46
+gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
+ GError **dest);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...) G_GNUC_PRINTF (4, 5);
+GLIB_DEPRECATED_IN_2_46
+void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
+ GQuark domain,
+ gint code,
+ const char *format,
+ va_list args)
+ G_GNUC_PRINTF(4, 0);
+GLIB_DEPRECATED_IN_2_46
+gboolean g_simple_async_result_is_valid (GAsyncResult *result,
+ GObject *source,
+ gpointer source_tag);
+
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
+void g_simple_async_report_error_in_idle (GObject *object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...) G_GNUC_PRINTF(6, 7);
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
+void g_simple_async_report_gerror_in_idle (GObject *object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ const GError *error);
+GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
+void g_simple_async_report_take_gerror_in_idle (GObject *object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GError *error);
+
+G_END_DECLS
+
+
+
+#endif /* __G_SIMPLE_ASYNC_RESULT_H__ */
diff --git a/include/glib/gio/gsimpleiostream.h b/include/glib/gio/gsimpleiostream.h
new file mode 100644
index 0000000000..37919d32f5
--- /dev/null
+++ b/include/glib/gio/gsimpleiostream.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2014 NICE s.r.l.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ignacio Casal Quinteiro <ignacio.casal@nice-software.com>
+ */
+
+#ifndef __G_SIMPLE_IO_STREAM_H__
+#define __G_SIMPLE_IO_STREAM_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+#include <gio/giostream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_IO_STREAM (g_simple_io_stream_get_type ())
+#define G_SIMPLE_IO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SIMPLE_IO_STREAM, GSimpleIOStream))
+#define G_IS_SIMPLE_IO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SIMPLE_IO_STREAM))
+
+GLIB_AVAILABLE_IN_2_44
+GType g_simple_io_stream_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_44
+GIOStream *g_simple_io_stream_new (GInputStream *input_stream,
+ GOutputStream *output_stream);
+
+G_END_DECLS
+
+#endif /* __G_SIMPLE_IO_STREAM_H__ */
diff --git a/include/glib/gio/gsimplepermission.h b/include/glib/gio/gsimplepermission.h
new file mode 100644
index 0000000000..11b8d1224a
--- /dev/null
+++ b/include/glib/gio/gsimplepermission.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SIMPLE_PERMISSION_H__
+#define __G_SIMPLE_PERMISSION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_PERMISSION (g_simple_permission_get_type ())
+#define G_SIMPLE_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SIMPLE_PERMISSION, \
+ GSimplePermission))
+#define G_IS_SIMPLE_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SIMPLE_PERMISSION))
+
+GLIB_AVAILABLE_IN_ALL
+GType g_simple_permission_get_type (void);
+GLIB_AVAILABLE_IN_ALL
+GPermission * g_simple_permission_new (gboolean allowed);
+
+G_END_DECLS
+
+#endif /* __G_SIMPLE_PERMISSION_H__ */
diff --git a/include/glib/gio/gsimpleproxyresolver.h b/include/glib/gio/gsimpleproxyresolver.h
new file mode 100644
index 0000000000..e1bb199fa7
--- /dev/null
+++ b/include/glib/gio/gsimpleproxyresolver.h
@@ -0,0 +1,89 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright 2010, 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SIMPLE_PROXY_RESOLVER_H__
+#define __G_SIMPLE_PROXY_RESOLVER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gproxyresolver.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SIMPLE_PROXY_RESOLVER (g_simple_proxy_resolver_get_type ())
+#define G_SIMPLE_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolver))
+#define G_SIMPLE_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolverClass))
+#define G_IS_SIMPLE_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_PROXY_RESOLVER))
+#define G_IS_SIMPLE_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_PROXY_RESOLVER))
+#define G_SIMPLE_PROXY_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolverClass))
+
+/**
+ * GSimpleProxyResolver:
+ *
+ * A #GProxyResolver implementation for using a fixed set of proxies.
+ **/
+typedef struct _GSimpleProxyResolver GSimpleProxyResolver;
+typedef struct _GSimpleProxyResolverPrivate GSimpleProxyResolverPrivate;
+typedef struct _GSimpleProxyResolverClass GSimpleProxyResolverClass;
+
+struct _GSimpleProxyResolver
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GSimpleProxyResolverPrivate *priv;
+};
+
+struct _GSimpleProxyResolverClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+GLIB_AVAILABLE_IN_2_36
+GType g_simple_proxy_resolver_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_36
+GProxyResolver *g_simple_proxy_resolver_new (const gchar *default_proxy,
+ gchar **ignore_hosts);
+
+GLIB_AVAILABLE_IN_2_36
+void g_simple_proxy_resolver_set_default_proxy (GSimpleProxyResolver *resolver,
+ const gchar *default_proxy);
+
+GLIB_AVAILABLE_IN_2_36
+void g_simple_proxy_resolver_set_ignore_hosts (GSimpleProxyResolver *resolver,
+ gchar **ignore_hosts);
+
+GLIB_AVAILABLE_IN_2_36
+void g_simple_proxy_resolver_set_uri_proxy (GSimpleProxyResolver *resolver,
+ const gchar *uri_scheme,
+ const gchar *proxy);
+
+G_END_DECLS
+
+#endif /* __G_SIMPLE_PROXY_RESOLVER_H__ */
diff --git a/include/glib/gio/gsocket.h b/include/glib/gio/gsocket.h
new file mode 100644
index 0000000000..97411355d7
--- /dev/null
+++ b/include/glib/gio/gsocket.h
@@ -0,0 +1,328 @@
+/*
+ * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
+ * Copyright © 2009 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ * Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SOCKET_H__
+#define __G_SOCKET_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET (g_socket_get_type ())
+#define G_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET, GSocket))
+#define G_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET, GSocketClass))
+#define G_IS_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET))
+#define G_IS_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET))
+#define G_SOCKET_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET, GSocketClass))
+
+typedef struct _GSocketPrivate GSocketPrivate;
+typedef struct _GSocketClass GSocketClass;
+
+struct _GSocketClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+ void (*_g_reserved8) (void);
+ void (*_g_reserved9) (void);
+ void (*_g_reserved10) (void);
+};
+
+struct _GSocket
+{
+ GObject parent_instance;
+ GSocketPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GSocket * g_socket_new (GSocketFamily family,
+ GSocketType type,
+ GSocketProtocol protocol,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocket * g_socket_new_from_fd (gint fd,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+int g_socket_get_fd (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GSocketFamily g_socket_get_family (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GSocketType g_socket_get_socket_type (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GSocketProtocol g_socket_get_protocol (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress * g_socket_get_local_address (GSocket *socket,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress * g_socket_get_remote_address (GSocket *socket,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_set_blocking (GSocket *socket,
+ gboolean blocking);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_get_blocking (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_set_keepalive (GSocket *socket,
+ gboolean keepalive);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_get_keepalive (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+gint g_socket_get_listen_backlog (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_set_listen_backlog (GSocket *socket,
+ gint backlog);
+GLIB_AVAILABLE_IN_ALL
+guint g_socket_get_timeout (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_set_timeout (GSocket *socket,
+ guint timeout);
+
+GLIB_AVAILABLE_IN_2_32
+guint g_socket_get_ttl (GSocket *socket);
+GLIB_AVAILABLE_IN_2_32
+void g_socket_set_ttl (GSocket *socket,
+ guint ttl);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_get_broadcast (GSocket *socket);
+GLIB_AVAILABLE_IN_2_32
+void g_socket_set_broadcast (GSocket *socket,
+ gboolean broadcast);
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_get_multicast_loopback (GSocket *socket);
+GLIB_AVAILABLE_IN_2_32
+void g_socket_set_multicast_loopback (GSocket *socket,
+ gboolean loopback);
+GLIB_AVAILABLE_IN_2_32
+guint g_socket_get_multicast_ttl (GSocket *socket);
+GLIB_AVAILABLE_IN_2_32
+void g_socket_set_multicast_ttl (GSocket *socket,
+ guint ttl);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_is_connected (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_bind (GSocket *socket,
+ GSocketAddress *address,
+ gboolean allow_reuse,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_join_multicast_group (GSocket *socket,
+ GInetAddress *group,
+ gboolean source_specific,
+ const gchar *iface,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_leave_multicast_group (GSocket *socket,
+ GInetAddress *group,
+ gboolean source_specific,
+ const gchar *iface,
+ GError **error);
+GLIB_AVAILABLE_IN_2_56
+gboolean g_socket_join_multicast_group_ssm (GSocket *socket,
+ GInetAddress *group,
+ GInetAddress *source_specific,
+ const gchar *iface,
+ GError **error);
+GLIB_AVAILABLE_IN_2_56
+gboolean g_socket_leave_multicast_group_ssm (GSocket *socket,
+ GInetAddress *group,
+ GInetAddress *source_specific,
+ const gchar *iface,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_connect (GSocket *socket,
+ GSocketAddress *address,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_check_connect_result (GSocket *socket,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_get_available_bytes (GSocket *socket);
+
+GLIB_AVAILABLE_IN_ALL
+GIOCondition g_socket_condition_check (GSocket *socket,
+ GIOCondition condition);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_condition_wait (GSocket *socket,
+ GIOCondition condition,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_condition_timed_wait (GSocket *socket,
+ GIOCondition condition,
+ gint64 timeout_us,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocket * g_socket_accept (GSocket *socket,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_listen (GSocket *socket,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_receive (GSocket *socket,
+ gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_receive_from (GSocket *socket,
+ GSocketAddress **address,
+ gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_send (GSocket *socket,
+ const gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_send_to (GSocket *socket,
+ GSocketAddress *address,
+ const gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_receive_message (GSocket *socket,
+ GSocketAddress **address,
+ GInputVector *vectors,
+ gint num_vectors,
+ GSocketControlMessage ***messages,
+ gint *num_messages,
+ gint *flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_send_message (GSocket *socket,
+ GSocketAddress *address,
+ GOutputVector *vectors,
+ gint num_vectors,
+ GSocketControlMessage **messages,
+ gint num_messages,
+ gint flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_48
+gint g_socket_receive_messages (GSocket *socket,
+ GInputMessage *messages,
+ guint num_messages,
+ gint flags,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_44
+gint g_socket_send_messages (GSocket *socket,
+ GOutputMessage *messages,
+ guint num_messages,
+ gint flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_close (GSocket *socket,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_shutdown (GSocket *socket,
+ gboolean shutdown_read,
+ gboolean shutdown_write,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_is_closed (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GSource * g_socket_create_source (GSocket *socket,
+ GIOCondition condition,
+ GCancellable *cancellable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_speaks_ipv4 (GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GCredentials *g_socket_get_credentials (GSocket *socket,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_receive_with_blocking (GSocket *socket,
+ gchar *buffer,
+ gsize size,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_send_with_blocking (GSocket *socket,
+ const gchar *buffer,
+ gsize size,
+ gboolean blocking,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_60
+GPollableReturn g_socket_send_message_with_timeout (GSocket *socket,
+ GSocketAddress *address,
+ const GOutputVector *vectors,
+ gint num_vectors,
+ GSocketControlMessage **messages,
+ gint num_messages,
+ gint flags,
+ gint64 timeout_us,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_socket_get_option (GSocket *socket,
+ gint level,
+ gint optname,
+ gint *value,
+ GError **error);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_socket_set_option (GSocket *socket,
+ gint level,
+ gint optname,
+ gint value,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_H__ */
diff --git a/include/glib/gio/gsocketaddress.h b/include/glib/gio/gsocketaddress.h
new file mode 100644
index 0000000000..ca2dbdae2f
--- /dev/null
+++ b/include/glib/gio/gsocketaddress.h
@@ -0,0 +1,82 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ */
+
+#ifndef __G_SOCKET_ADDRESS_H__
+#define __G_SOCKET_ADDRESS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_ADDRESS (g_socket_address_get_type ())
+#define G_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SOCKET_ADDRESS, GSocketAddress))
+#define G_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SOCKET_ADDRESS, GSocketAddressClass))
+#define G_IS_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SOCKET_ADDRESS))
+#define G_IS_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SOCKET_ADDRESS))
+#define G_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SOCKET_ADDRESS, GSocketAddressClass))
+
+typedef struct _GSocketAddressClass GSocketAddressClass;
+
+struct _GSocketAddress
+{
+ GObject parent_instance;
+};
+
+struct _GSocketAddressClass
+{
+ GObjectClass parent_class;
+
+ GSocketFamily (*get_family) (GSocketAddress *address);
+
+ gssize (*get_native_size) (GSocketAddress *address);
+
+ gboolean (*to_native) (GSocketAddress *address,
+ gpointer dest,
+ gsize destlen,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_address_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketFamily g_socket_address_get_family (GSocketAddress *address);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress * g_socket_address_new_from_native (gpointer native,
+ gsize len);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_address_to_native (GSocketAddress *address,
+ gpointer dest,
+ gsize destlen,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_socket_address_get_native_size (GSocketAddress *address);
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_ADDRESS_H__ */
diff --git a/include/glib/gio/gsocketaddressenumerator.h b/include/glib/gio/gsocketaddressenumerator.h
new file mode 100644
index 0000000000..2a180fdf50
--- /dev/null
+++ b/include/glib/gio/gsocketaddressenumerator.h
@@ -0,0 +1,101 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SOCKET_ADDRESS_ENUMERATOR_H__
+#define __G_SOCKET_ADDRESS_ENUMERATOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_ADDRESS_ENUMERATOR (g_socket_address_enumerator_get_type ())
+#define G_SOCKET_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumerator))
+#define G_SOCKET_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumeratorClass))
+#define G_IS_SOCKET_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR))
+#define G_IS_SOCKET_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SOCKET_ADDRESS_ENUMERATOR))
+#define G_SOCKET_ADDRESS_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumeratorClass))
+
+/**
+ * GSocketAddressEnumerator:
+ *
+ * Enumerator type for objects that contain or generate
+ * #GSocketAddress instances.
+ */
+typedef struct _GSocketAddressEnumeratorClass GSocketAddressEnumeratorClass;
+
+struct _GSocketAddressEnumerator
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+/**
+ * GSocketAddressEnumeratorClass:
+ * @next: Virtual method for g_socket_address_enumerator_next().
+ * @next_async: Virtual method for g_socket_address_enumerator_next_async().
+ * @next_finish: Virtual method for g_socket_address_enumerator_next_finish().
+ *
+ * Class structure for #GSocketAddressEnumerator.
+ */
+struct _GSocketAddressEnumeratorClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* Virtual Table */
+
+ GSocketAddress * (* next) (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* next_async) (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ GSocketAddress * (* next_finish) (GSocketAddressEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_address_enumerator_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+
+#endif /* __G_SOCKET_ADDRESS_ENUMERATOR_H__ */
diff --git a/include/glib/gio/gsocketclient.h b/include/glib/gio/gsocketclient.h
new file mode 100644
index 0000000000..f0153450d9
--- /dev/null
+++ b/include/glib/gio/gsocketclient.h
@@ -0,0 +1,197 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2008, 2009 Codethink Limited
+ * Copyright © 2009 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SOCKET_CLIENT_H__
+#define __G_SOCKET_CLIENT_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_CLIENT (g_socket_client_get_type ())
+#define G_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET_CLIENT, GSocketClient))
+#define G_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET_CLIENT, GSocketClientClass))
+#define G_IS_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET_CLIENT))
+#define G_IS_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET_CLIENT))
+#define G_SOCKET_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET_CLIENT, GSocketClientClass))
+
+typedef struct _GSocketClientPrivate GSocketClientPrivate;
+typedef struct _GSocketClientClass GSocketClientClass;
+
+struct _GSocketClientClass
+{
+ GObjectClass parent_class;
+
+ void (* event) (GSocketClient *client,
+ GSocketClientEvent event,
+ GSocketConnectable *connectable,
+ GIOStream *connection);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+};
+
+struct _GSocketClient
+{
+ GObject parent_instance;
+ GSocketClientPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_client_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketClient *g_socket_client_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketFamily g_socket_client_get_family (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_family (GSocketClient *client,
+ GSocketFamily family);
+GLIB_AVAILABLE_IN_ALL
+GSocketType g_socket_client_get_socket_type (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_socket_type (GSocketClient *client,
+ GSocketType type);
+GLIB_AVAILABLE_IN_ALL
+GSocketProtocol g_socket_client_get_protocol (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_protocol (GSocketClient *client,
+ GSocketProtocol protocol);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_socket_client_get_local_address (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_local_address (GSocketClient *client,
+ GSocketAddress *address);
+GLIB_AVAILABLE_IN_ALL
+guint g_socket_client_get_timeout (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_timeout (GSocketClient *client,
+ guint timeout);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_client_get_enable_proxy (GSocketClient *client);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_set_enable_proxy (GSocketClient *client,
+ gboolean enable);
+
+GLIB_AVAILABLE_IN_2_28
+gboolean g_socket_client_get_tls (GSocketClient *client);
+GLIB_AVAILABLE_IN_2_28
+void g_socket_client_set_tls (GSocketClient *client,
+ gboolean tls);
+GLIB_AVAILABLE_IN_2_28
+GTlsCertificateFlags g_socket_client_get_tls_validation_flags (GSocketClient *client);
+GLIB_AVAILABLE_IN_2_28
+void g_socket_client_set_tls_validation_flags (GSocketClient *client,
+ GTlsCertificateFlags flags);
+GLIB_AVAILABLE_IN_2_36
+GProxyResolver *g_socket_client_get_proxy_resolver (GSocketClient *client);
+GLIB_AVAILABLE_IN_2_36
+void g_socket_client_set_proxy_resolver (GSocketClient *client,
+ GProxyResolver *proxy_resolver);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect (GSocketClient *client,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
+ const gchar *host_and_port,
+ guint16 default_port,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
+ const gchar *domain,
+ const gchar *service,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_26
+GSocketConnection * g_socket_client_connect_to_uri (GSocketClient *client,
+ const gchar *uri,
+ guint16 default_port,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_connect_async (GSocketClient *client,
+ GSocketConnectable *connectable,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_connect_to_host_async (GSocketClient *client,
+ const gchar *host_and_port,
+ guint16 default_port,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_to_host_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_connect_to_service_async (GSocketClient *client,
+ const gchar *domain,
+ const gchar *service,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_to_service_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_connect_to_uri_async (GSocketClient *client,
+ const gchar *uri,
+ guint16 default_port,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_client_connect_to_uri_finish (GSocketClient *client,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_client_add_application_proxy (GSocketClient *client,
+ const gchar *protocol);
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_CLIENT_H___ */
diff --git a/include/glib/gio/gsocketconnectable.h b/include/glib/gio/gsocketconnectable.h
new file mode 100644
index 0000000000..da882143a3
--- /dev/null
+++ b/include/glib/gio/gsocketconnectable.h
@@ -0,0 +1,81 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SOCKET_CONNECTABLE_H__
+#define __G_SOCKET_CONNECTABLE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_CONNECTABLE (g_socket_connectable_get_type ())
+#define G_SOCKET_CONNECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SOCKET_CONNECTABLE, GSocketConnectable))
+#define G_IS_SOCKET_CONNECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SOCKET_CONNECTABLE))
+#define G_SOCKET_CONNECTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SOCKET_CONNECTABLE, GSocketConnectableIface))
+
+/**
+ * GSocketConnectable:
+ *
+ * Interface for objects that contain or generate a #GSocketAddress.
+ */
+typedef struct _GSocketConnectableIface GSocketConnectableIface;
+
+/**
+ * GSocketConnectableIface:
+ * @g_iface: The parent interface.
+ * @enumerate: Creates a #GSocketAddressEnumerator
+ * @proxy_enumerate: Creates a #GProxyAddressEnumerator
+ * @to_string: Format the connectable’s address as a string for debugging.
+ * Implementing this is optional. (Since: 2.48)
+ *
+ * Provides an interface for returning a #GSocketAddressEnumerator
+ * and #GProxyAddressEnumerator
+ */
+struct _GSocketConnectableIface
+{
+ GTypeInterface g_iface;
+
+ /* Virtual Table */
+
+ GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
+
+ GSocketAddressEnumerator * (* proxy_enumerate) (GSocketConnectable *connectable);
+
+ gchar * (* to_string) (GSocketConnectable *connectable);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_connectable_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddressEnumerator *g_socket_connectable_enumerate (GSocketConnectable *connectable);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketAddressEnumerator *g_socket_connectable_proxy_enumerate (GSocketConnectable *connectable);
+
+GLIB_AVAILABLE_IN_2_48
+gchar *g_socket_connectable_to_string (GSocketConnectable *connectable);
+
+G_END_DECLS
+
+
+#endif /* __G_SOCKET_CONNECTABLE_H__ */
diff --git a/include/glib/gio/gsocketconnection.h b/include/glib/gio/gsocketconnection.h
new file mode 100644
index 0000000000..bc7a076009
--- /dev/null
+++ b/include/glib/gio/gsocketconnection.h
@@ -0,0 +1,115 @@
+/* GIO - GLib Input, Output and Streaming Library
+ * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
+ * Copyright © 2009 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ * Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SOCKET_CONNECTION_H__
+#define __G_SOCKET_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+#include <gio/gsocket.h>
+#include <gio/giostream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_CONNECTION (g_socket_connection_get_type ())
+#define G_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET_CONNECTION, GSocketConnection))
+#define G_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
+#define G_IS_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET_CONNECTION))
+#define G_IS_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET_CONNECTION))
+#define G_SOCKET_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
+
+typedef struct _GSocketConnectionPrivate GSocketConnectionPrivate;
+typedef struct _GSocketConnectionClass GSocketConnectionClass;
+
+struct _GSocketConnectionClass
+{
+ GIOStreamClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+struct _GSocketConnection
+{
+ GIOStream parent_instance;
+ GSocketConnectionPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_connection_is_connected (GSocketConnection *connection);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_connection_connect (GSocketConnection *connection,
+ GSocketAddress *address,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_2_32
+void g_socket_connection_connect_async (GSocketConnection *connection,
+ GSocketAddress *address,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_socket_connection_connect_finish (GSocketConnection *connection,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GSocket *g_socket_connection_get_socket (GSocketConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_connection_factory_register_type (GType g_type,
+ GSocketFamily family,
+ GSocketType type,
+ gint protocol);
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_connection_factory_lookup_type (GSocketFamily family,
+ GSocketType type,
+ gint protocol_id);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket);
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_CONNECTION_H__ */
diff --git a/include/glib/gio/gsocketcontrolmessage.h b/include/glib/gio/gsocketcontrolmessage.h
new file mode 100644
index 0000000000..a4a5d0194c
--- /dev/null
+++ b/include/glib/gio/gsocketcontrolmessage.h
@@ -0,0 +1,111 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2009 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_SOCKET_CONTROL_MESSAGE_H__
+#define __G_SOCKET_CONTROL_MESSAGE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_CONTROL_MESSAGE (g_socket_control_message_get_type ())
+#define G_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET_CONTROL_MESSAGE, \
+ GSocketControlMessage))
+#define G_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET_CONTROL_MESSAGE, \
+ GSocketControlMessageClass))
+#define G_IS_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET_CONTROL_MESSAGE))
+#define G_IS_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET_CONTROL_MESSAGE))
+#define G_SOCKET_CONTROL_MESSAGE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET_CONTROL_MESSAGE, \
+ GSocketControlMessageClass))
+
+typedef struct _GSocketControlMessagePrivate GSocketControlMessagePrivate;
+typedef struct _GSocketControlMessageClass GSocketControlMessageClass;
+
+/**
+ * GSocketControlMessageClass:
+ * @get_size: gets the size of the message.
+ * @get_level: gets the protocol of the message.
+ * @get_type: gets the protocol specific type of the message.
+ * @serialize: Writes out the message data.
+ * @deserialize: Tries to deserialize a message.
+ *
+ * Class structure for #GSocketControlMessage.
+ **/
+
+struct _GSocketControlMessageClass
+{
+ GObjectClass parent_class;
+
+ gsize (* get_size) (GSocketControlMessage *message);
+ int (* get_level) (GSocketControlMessage *message);
+ int (* get_type) (GSocketControlMessage *message);
+ void (* serialize) (GSocketControlMessage *message,
+ gpointer data);
+ GSocketControlMessage *(* deserialize) (int level,
+ int type,
+ gsize size,
+ gpointer data);
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+struct _GSocketControlMessage
+{
+ GObject parent_instance;
+ GSocketControlMessagePrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_control_message_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gsize g_socket_control_message_get_size (GSocketControlMessage *message);
+GLIB_AVAILABLE_IN_ALL
+int g_socket_control_message_get_level (GSocketControlMessage *message);
+GLIB_AVAILABLE_IN_ALL
+int g_socket_control_message_get_msg_type (GSocketControlMessage *message);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_control_message_serialize (GSocketControlMessage *message,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GSocketControlMessage *g_socket_control_message_deserialize (int level,
+ int type,
+ gsize size,
+ gpointer data);
+
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_CONTROL_MESSAGE_H__ */
diff --git a/include/glib/gio/gsocketlistener.h b/include/glib/gio/gsocketlistener.h
new file mode 100644
index 0000000000..e5185c28d8
--- /dev/null
+++ b/include/glib/gio/gsocketlistener.h
@@ -0,0 +1,155 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
+ * Copyright © 2009 Codethink Limited
+ * Copyright © 2009 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Kellner <gicmo@gnome.org>
+ * Samuel Cormier-Iijima <sciyoshi@gmail.com>
+ * Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SOCKET_LISTENER_H__
+#define __G_SOCKET_LISTENER_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_LISTENER (g_socket_listener_get_type ())
+#define G_SOCKET_LISTENER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET_LISTENER, GSocketListener))
+#define G_SOCKET_LISTENER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET_LISTENER, GSocketListenerClass))
+#define G_IS_SOCKET_LISTENER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET_LISTENER))
+#define G_IS_SOCKET_LISTENER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET_LISTENER))
+#define G_SOCKET_LISTENER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET_LISTENER, GSocketListenerClass))
+
+typedef struct _GSocketListenerPrivate GSocketListenerPrivate;
+typedef struct _GSocketListenerClass GSocketListenerClass;
+
+/**
+ * GSocketListenerClass:
+ * @changed: virtual method called when the set of socket listened to changes
+ *
+ * Class structure for #GSocketListener.
+ **/
+struct _GSocketListenerClass
+{
+ GObjectClass parent_class;
+
+ void (* changed) (GSocketListener *listener);
+
+ void (* event) (GSocketListener *listener,
+ GSocketListenerEvent event,
+ GSocket *socket);
+
+ /* Padding for future expansion */
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+struct _GSocketListener
+{
+ GObject parent_instance;
+ GSocketListenerPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_listener_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketListener * g_socket_listener_new (void);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_listener_set_backlog (GSocketListener *listener,
+ int listen_backlog);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_listener_add_socket (GSocketListener *listener,
+ GSocket *socket,
+ GObject *source_object,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_listener_add_address (GSocketListener *listener,
+ GSocketAddress *address,
+ GSocketType type,
+ GSocketProtocol protocol,
+ GObject *source_object,
+ GSocketAddress **effective_address,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_listener_add_inet_port (GSocketListener *listener,
+ guint16 port,
+ GObject *source_object,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_socket_listener_add_any_inet_port (GSocketListener *listener,
+ GObject *source_object,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GSocket * g_socket_listener_accept_socket (GSocketListener *listener,
+ GObject **source_object,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_listener_accept_socket_async (GSocketListener *listener,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSocket * g_socket_listener_accept_socket_finish (GSocketListener *listener,
+ GAsyncResult *result,
+ GObject **source_object,
+ GError **error);
+
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_listener_accept (GSocketListener *listener,
+ GObject **source_object,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_listener_accept_async (GSocketListener *listener,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection * g_socket_listener_accept_finish (GSocketListener *listener,
+ GAsyncResult *result,
+ GObject **source_object,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_socket_listener_close (GSocketListener *listener);
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_LISTENER_H__ */
diff --git a/include/glib/gio/gsocketservice.h b/include/glib/gio/gsocketservice.h
new file mode 100644
index 0000000000..f25a1b6b75
--- /dev/null
+++ b/include/glib/gio/gsocketservice.h
@@ -0,0 +1,93 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2009 Codethink Limited
+ * Copyright © 2009 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_SOCKET_SERVICE_H__
+#define __G_SOCKET_SERVICE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketlistener.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SOCKET_SERVICE (g_socket_service_get_type ())
+#define G_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_SOCKET_SERVICE, GSocketService))
+#define G_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
+#define G_IS_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_SOCKET_SERVICE))
+#define G_IS_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_SOCKET_SERVICE))
+#define G_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
+
+typedef struct _GSocketServicePrivate GSocketServicePrivate;
+typedef struct _GSocketServiceClass GSocketServiceClass;
+
+/**
+ * GSocketServiceClass:
+ * @incomming: signal emitted when new connections are accepted
+ *
+ * Class structure for #GSocketService.
+ */
+struct _GSocketServiceClass
+{
+ GSocketListenerClass parent_class;
+
+ gboolean (* incoming) (GSocketService *service,
+ GSocketConnection *connection,
+ GObject *source_object);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+struct _GSocketService
+{
+ GSocketListener parent_instance;
+ GSocketServicePrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_socket_service_get_type (void);
+
+GLIB_AVAILABLE_IN_ALL
+GSocketService *g_socket_service_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_service_start (GSocketService *service);
+GLIB_AVAILABLE_IN_ALL
+void g_socket_service_stop (GSocketService *service);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_socket_service_is_active (GSocketService *service);
+
+
+G_END_DECLS
+
+#endif /* __G_SOCKET_SERVICE_H__ */
diff --git a/include/glib/gio/gsrvtarget.h b/include/glib/gio/gsrvtarget.h
new file mode 100644
index 0000000000..3ef16f1398
--- /dev/null
+++ b/include/glib/gio/gsrvtarget.h
@@ -0,0 +1,59 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SRV_TARGET_H__
+#define __G_SRV_TARGET_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+GType g_srv_target_get_type (void) G_GNUC_CONST;
+#define G_TYPE_SRV_TARGET (g_srv_target_get_type ())
+
+GLIB_AVAILABLE_IN_ALL
+GSrvTarget *g_srv_target_new (const gchar *hostname,
+ guint16 port,
+ guint16 priority,
+ guint16 weight);
+GLIB_AVAILABLE_IN_ALL
+GSrvTarget *g_srv_target_copy (GSrvTarget *target);
+GLIB_AVAILABLE_IN_ALL
+void g_srv_target_free (GSrvTarget *target);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_srv_target_get_hostname (GSrvTarget *target);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_srv_target_get_port (GSrvTarget *target);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_srv_target_get_priority (GSrvTarget *target);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_srv_target_get_weight (GSrvTarget *target);
+
+GLIB_AVAILABLE_IN_ALL
+GList *g_srv_target_list_sort (GList *targets);
+
+G_END_DECLS
+
+#endif /* __G_SRV_TARGET_H__ */
+
diff --git a/include/glib/gio/gsubprocess.h b/include/glib/gio/gsubprocess.h
new file mode 100644
index 0000000000..68bb26aab5
--- /dev/null
+++ b/include/glib/gio/gsubprocess.h
@@ -0,0 +1,167 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2012 Colin Walters <walters@verbum.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Colin Walters <walters@verbum.org>
+ */
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#ifndef __G_SUBPROCESS_H__
+#define __G_SUBPROCESS_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SUBPROCESS (g_subprocess_get_type ())
+#define G_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS, GSubprocess))
+#define G_IS_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS))
+
+GLIB_AVAILABLE_IN_2_40
+GType g_subprocess_get_type (void) G_GNUC_CONST;
+
+/**** Core API ****/
+
+GLIB_AVAILABLE_IN_2_40
+GSubprocess * g_subprocess_new (GSubprocessFlags flags,
+ GError **error,
+ const gchar *argv0,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_2_40
+GSubprocess * g_subprocess_newv (const gchar * const *argv,
+ GSubprocessFlags flags,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+GOutputStream * g_subprocess_get_stdin_pipe (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+GInputStream * g_subprocess_get_stdout_pipe (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+GInputStream * g_subprocess_get_stderr_pipe (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+const gchar * g_subprocess_get_identifier (GSubprocess *subprocess);
+
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_send_signal (GSubprocess *subprocess,
+ gint signal_num);
+#endif
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_force_exit (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_wait (GSubprocess *subprocess,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_wait_async (GSubprocess *subprocess,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_wait_finish (GSubprocess *subprocess,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_wait_check (GSubprocess *subprocess,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_wait_check_async (GSubprocess *subprocess,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_wait_check_finish (GSubprocess *subprocess,
+ GAsyncResult *result,
+ GError **error);
+
+
+GLIB_AVAILABLE_IN_2_40
+gint g_subprocess_get_status (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_get_successful (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_get_if_exited (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gint g_subprocess_get_exit_status (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_get_if_signaled (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gint g_subprocess_get_term_sig (GSubprocess *subprocess);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate (GSubprocess *subprocess,
+ GBytes *stdin_buf,
+ GCancellable *cancellable,
+ GBytes **stdout_buf,
+ GBytes **stderr_buf,
+ GError **error);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_communicate_async (GSubprocess *subprocess,
+ GBytes *stdin_buf,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate_finish (GSubprocess *subprocess,
+ GAsyncResult *result,
+ GBytes **stdout_buf,
+ GBytes **stderr_buf,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate_utf8 (GSubprocess *subprocess,
+ const char *stdin_buf,
+ GCancellable *cancellable,
+ char **stdout_buf,
+ char **stderr_buf,
+ GError **error);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_communicate_utf8_async (GSubprocess *subprocess,
+ const char *stdin_buf,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate_utf8_finish (GSubprocess *subprocess,
+ GAsyncResult *result,
+ char **stdout_buf,
+ char **stderr_buf,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_SUBPROCESS_H__ */
diff --git a/include/glib/gio/gsubprocesslauncher.h b/include/glib/gio/gsubprocesslauncher.h
new file mode 100644
index 0000000000..05d83f131d
--- /dev/null
+++ b/include/glib/gio/gsubprocesslauncher.h
@@ -0,0 +1,116 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2012,2013 Colin Walters <walters@verbum.org>
+ * Copyright © 2012,2013 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ * Author: Colin Walters <walters@verbum.org>
+ */
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#ifndef __G_SUBPROCESS_LAUNCHER_H__
+#define __G_SUBPROCESS_LAUNCHER_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SUBPROCESS_LAUNCHER (g_subprocess_launcher_get_type ())
+#define G_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS_LAUNCHER, GSubprocessLauncher))
+#define G_IS_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS_LAUNCHER))
+
+GLIB_AVAILABLE_IN_2_40
+GType g_subprocess_launcher_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_40
+GSubprocessLauncher * g_subprocess_launcher_new (GSubprocessFlags flags);
+
+GLIB_AVAILABLE_IN_2_40
+GSubprocess * g_subprocess_launcher_spawn (GSubprocessLauncher *self,
+ GError **error,
+ const gchar *argv0,
+ ...) G_GNUC_NULL_TERMINATED;
+
+GLIB_AVAILABLE_IN_2_40
+GSubprocess * g_subprocess_launcher_spawnv (GSubprocessLauncher *self,
+ const gchar * const *argv,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_environ (GSubprocessLauncher *self,
+ gchar **env);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_setenv (GSubprocessLauncher *self,
+ const gchar *variable,
+ const gchar *value,
+ gboolean overwrite);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_unsetenv (GSubprocessLauncher *self,
+ const gchar *variable);
+
+GLIB_AVAILABLE_IN_2_40
+const gchar * g_subprocess_launcher_getenv (GSubprocessLauncher *self,
+ const gchar *variable);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_cwd (GSubprocessLauncher *self,
+ const gchar *cwd);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_flags (GSubprocessLauncher *self,
+ GSubprocessFlags flags);
+
+/* Extended I/O control, only available on UNIX */
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_stdin_file_path (GSubprocessLauncher *self,
+ const gchar *path);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_take_stdin_fd (GSubprocessLauncher *self,
+ gint fd);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_stdout_file_path (GSubprocessLauncher *self,
+ const gchar *path);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_take_stdout_fd (GSubprocessLauncher *self,
+ gint fd);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_stderr_file_path (GSubprocessLauncher *self,
+ const gchar *path);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_take_stderr_fd (GSubprocessLauncher *self,
+ gint fd);
+
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_take_fd (GSubprocessLauncher *self,
+ gint source_fd,
+ gint target_fd);
+
+/* Child setup, only available on UNIX */
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_launcher_set_child_setup (GSubprocessLauncher *self,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GDestroyNotify destroy_notify);
+#endif
+
+G_END_DECLS
+
+#endif /* __G_SUBPROCESS_H__ */
diff --git a/include/glib/gio/gtask.h b/include/glib/gio/gtask.h
new file mode 100644
index 0000000000..4fc1c859e3
--- /dev/null
+++ b/include/glib/gio/gtask.h
@@ -0,0 +1,165 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TASK_H__
+#define __G_TASK_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TASK (g_task_get_type ())
+#define G_TASK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TASK, GTask))
+#define G_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TASK, GTaskClass))
+#define G_IS_TASK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TASK))
+#define G_IS_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TASK))
+#define G_TASK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TASK, GTaskClass))
+
+typedef struct _GTaskClass GTaskClass;
+
+GLIB_AVAILABLE_IN_2_36
+GType g_task_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_36
+GTask *g_task_new (gpointer source_object,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer callback_data);
+
+GLIB_AVAILABLE_IN_2_36
+void g_task_report_error (gpointer source_object,
+ GAsyncReadyCallback callback,
+ gpointer callback_data,
+ gpointer source_tag,
+ GError *error);
+GLIB_AVAILABLE_IN_2_36
+void g_task_report_new_error (gpointer source_object,
+ GAsyncReadyCallback callback,
+ gpointer callback_data,
+ gpointer source_tag,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...) G_GNUC_PRINTF(7, 8);
+
+GLIB_AVAILABLE_IN_2_36
+void g_task_set_task_data (GTask *task,
+ gpointer task_data,
+ GDestroyNotify task_data_destroy);
+GLIB_AVAILABLE_IN_2_36
+void g_task_set_priority (GTask *task,
+ gint priority);
+GLIB_AVAILABLE_IN_2_36
+void g_task_set_check_cancellable (GTask *task,
+ gboolean check_cancellable);
+GLIB_AVAILABLE_IN_2_36
+void g_task_set_source_tag (GTask *task,
+ gpointer source_tag);
+GLIB_AVAILABLE_IN_2_60
+void g_task_set_name (GTask *task,
+ const gchar *name);
+
+GLIB_AVAILABLE_IN_2_36
+gpointer g_task_get_source_object (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+gpointer g_task_get_task_data (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+gint g_task_get_priority (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+GMainContext *g_task_get_context (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+GCancellable *g_task_get_cancellable (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_get_check_cancellable (GTask *task);
+GLIB_AVAILABLE_IN_2_36
+gpointer g_task_get_source_tag (GTask *task);
+GLIB_AVAILABLE_IN_2_60
+const gchar *g_task_get_name (GTask *task);
+
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_is_valid (gpointer result,
+ gpointer source_object);
+
+
+typedef void (*GTaskThreadFunc) (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable);
+GLIB_AVAILABLE_IN_2_36
+void g_task_run_in_thread (GTask *task,
+ GTaskThreadFunc task_func);
+GLIB_AVAILABLE_IN_2_36
+void g_task_run_in_thread_sync (GTask *task,
+ GTaskThreadFunc task_func);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_set_return_on_cancel (GTask *task,
+ gboolean return_on_cancel);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_get_return_on_cancel (GTask *task);
+
+GLIB_AVAILABLE_IN_2_36
+void g_task_attach_source (GTask *task,
+ GSource *source,
+ GSourceFunc callback);
+
+
+GLIB_AVAILABLE_IN_2_36
+void g_task_return_pointer (GTask *task,
+ gpointer result,
+ GDestroyNotify result_destroy);
+GLIB_AVAILABLE_IN_2_36
+void g_task_return_boolean (GTask *task,
+ gboolean result);
+GLIB_AVAILABLE_IN_2_36
+void g_task_return_int (GTask *task,
+ gssize result);
+
+GLIB_AVAILABLE_IN_2_36
+void g_task_return_error (GTask *task,
+ GError *error);
+GLIB_AVAILABLE_IN_2_36
+void g_task_return_new_error (GTask *task,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...) G_GNUC_PRINTF (4, 5);
+
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_return_error_if_cancelled (GTask *task);
+
+GLIB_AVAILABLE_IN_2_36
+gpointer g_task_propagate_pointer (GTask *task,
+ GError **error);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_propagate_boolean (GTask *task,
+ GError **error);
+GLIB_AVAILABLE_IN_2_36
+gssize g_task_propagate_int (GTask *task,
+ GError **error);
+GLIB_AVAILABLE_IN_2_36
+gboolean g_task_had_error (GTask *task);
+GLIB_AVAILABLE_IN_2_44
+gboolean g_task_get_completed (GTask *task);
+
+G_END_DECLS
+
+#endif /* __G_TASK_H__ */
diff --git a/include/glib/gio/gtcpconnection.h b/include/glib/gio/gtcpconnection.h
new file mode 100644
index 0000000000..39645f914b
--- /dev/null
+++ b/include/glib/gio/gtcpconnection.h
@@ -0,0 +1,69 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2008, 2009 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_TCP_CONNECTION_H__
+#define __G_TCP_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TCP_CONNECTION (g_tcp_connection_get_type ())
+#define G_TCP_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_TCP_CONNECTION, GTcpConnection))
+#define G_TCP_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_TCP_CONNECTION, GTcpConnectionClass))
+#define G_IS_TCP_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_TCP_CONNECTION))
+#define G_IS_TCP_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_TCP_CONNECTION))
+#define G_TCP_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_TCP_CONNECTION, GTcpConnectionClass))
+
+typedef struct _GTcpConnectionPrivate GTcpConnectionPrivate;
+typedef struct _GTcpConnectionClass GTcpConnectionClass;
+
+struct _GTcpConnectionClass
+{
+ GSocketConnectionClass parent_class;
+};
+
+struct _GTcpConnection
+{
+ GSocketConnection parent_instance;
+ GTcpConnectionPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tcp_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+void g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection,
+ gboolean graceful_disconnect);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection);
+
+G_END_DECLS
+
+#endif /* __G_TCP_CONNECTION_H__ */
diff --git a/include/glib/gio/gtcpwrapperconnection.h b/include/glib/gio/gtcpwrapperconnection.h
new file mode 100644
index 0000000000..a32acad79f
--- /dev/null
+++ b/include/glib/gio/gtcpwrapperconnection.h
@@ -0,0 +1,69 @@
+/* GIO - GLib Input, Output and Streaming Library
+ * Copyright © 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
+ *
+ */
+
+#ifndef __G_TCP_WRAPPER_CONNECTION_H__
+#define __G_TCP_WRAPPER_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gtcpconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TCP_WRAPPER_CONNECTION (g_tcp_wrapper_connection_get_type ())
+#define G_TCP_WRAPPER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnection))
+#define G_TCP_WRAPPER_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnectionClass))
+#define G_IS_TCP_WRAPPER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_TCP_WRAPPER_CONNECTION))
+#define G_IS_TCP_WRAPPER_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_TCP_WRAPPER_CONNECTION))
+#define G_TCP_WRAPPER_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnectionClass))
+
+typedef struct _GTcpWrapperConnectionPrivate GTcpWrapperConnectionPrivate;
+typedef struct _GTcpWrapperConnectionClass GTcpWrapperConnectionClass;
+
+struct _GTcpWrapperConnectionClass
+{
+ GTcpConnectionClass parent_class;
+};
+
+struct _GTcpWrapperConnection
+{
+ GTcpConnection parent_instance;
+ GTcpWrapperConnectionPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tcp_wrapper_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GSocketConnection *g_tcp_wrapper_connection_new (GIOStream *base_io_stream,
+ GSocket *socket);
+GLIB_AVAILABLE_IN_ALL
+GIOStream *g_tcp_wrapper_connection_get_base_io_stream (GTcpWrapperConnection *conn);
+
+G_END_DECLS
+
+#endif /* __G_TCP_WRAPPER_CONNECTION_H__ */
diff --git a/include/glib/gio/gtestdbus.h b/include/glib/gio/gtestdbus.h
new file mode 100644
index 0000000000..9467f59aec
--- /dev/null
+++ b/include/glib/gio/gtestdbus.h
@@ -0,0 +1,72 @@
+/* GIO testing utilities
+ *
+ * Copyright (C) 2008-2010 Red Hat, Inc.
+ * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: David Zeuthen <davidz@redhat.com>
+ * Xavier Claessens <xavier.claessens@collabora.co.uk>
+ */
+
+#ifndef __G_TEST_DBUS_H__
+#define __G_TEST_DBUS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TEST_DBUS \
+ (g_test_dbus_get_type ())
+#define G_TEST_DBUS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TEST_DBUS, \
+ GTestDBus))
+#define G_IS_TEST_DBUS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TEST_DBUS))
+
+GLIB_AVAILABLE_IN_2_34
+GType g_test_dbus_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_2_34
+GTestDBus * g_test_dbus_new (GTestDBusFlags flags);
+
+GLIB_AVAILABLE_IN_2_34
+GTestDBusFlags g_test_dbus_get_flags (GTestDBus *self);
+
+GLIB_AVAILABLE_IN_2_34
+const gchar * g_test_dbus_get_bus_address (GTestDBus *self);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_dbus_add_service_dir (GTestDBus *self,
+ const gchar *path);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_dbus_up (GTestDBus *self);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_dbus_stop (GTestDBus *self);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_dbus_down (GTestDBus *self);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_dbus_unset (void);
+
+G_END_DECLS
+
+#endif /* __G_TEST_DBUS_H__ */
diff --git a/include/glib/gio/gthemedicon.h b/include/glib/gio/gthemedicon.h
new file mode 100644
index 0000000000..3a145b5c3a
--- /dev/null
+++ b/include/glib/gio/gthemedicon.h
@@ -0,0 +1,68 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_THEMED_ICON_H__
+#define __G_THEMED_ICON_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_THEMED_ICON (g_themed_icon_get_type ())
+#define G_THEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_THEMED_ICON, GThemedIcon))
+#define G_THEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_THEMED_ICON, GThemedIconClass))
+#define G_IS_THEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_THEMED_ICON))
+#define G_IS_THEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_THEMED_ICON))
+#define G_THEMED_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_THEMED_ICON, GThemedIconClass))
+
+/**
+ * GThemedIcon:
+ *
+ * An implementation of #GIcon for themed icons.
+ **/
+typedef struct _GThemedIconClass GThemedIconClass;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_themed_icon_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_themed_icon_new (const char *iconname);
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_themed_icon_new_with_default_fallbacks (const char *iconname);
+GLIB_AVAILABLE_IN_ALL
+GIcon *g_themed_icon_new_from_names (char **iconnames,
+ int len);
+GLIB_AVAILABLE_IN_ALL
+void g_themed_icon_prepend_name (GThemedIcon *icon,
+ const char *iconname);
+GLIB_AVAILABLE_IN_ALL
+void g_themed_icon_append_name (GThemedIcon *icon,
+ const char *iconname);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar* const * g_themed_icon_get_names (GThemedIcon *icon);
+
+G_END_DECLS
+
+#endif /* __G_THEMED_ICON_H__ */
diff --git a/include/glib/gio/gthreadedsocketservice.h b/include/glib/gio/gthreadedsocketservice.h
new file mode 100644
index 0000000000..fa3204f953
--- /dev/null
+++ b/include/glib/gio/gthreadedsocketservice.h
@@ -0,0 +1,81 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2009 Codethink Limited
+ * Copyright © 2009 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ryan Lortie <desrt@desrt.ca>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_THREADED_SOCKET_SERVICE_H__
+#define __G_THREADED_SOCKET_SERVICE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gsocketservice.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_THREADED_SOCKET_SERVICE (g_threaded_socket_service_get_type ())
+#define G_THREADED_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_THREADED_SOCKET_SERVICE, \
+ GThreadedSocketService))
+#define G_THREADED_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_THREADED_SOCKET_SERVICE, \
+ GThreadedSocketServiceClass))
+#define G_IS_THREADED_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_THREADED_SOCKET_SERVICE))
+#define G_IS_THREADED_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_THREADED_SOCKET_SERVICE))
+#define G_THREADED_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_THREADED_SOCKET_SERVICE, \
+ GThreadedSocketServiceClass))
+
+typedef struct _GThreadedSocketServicePrivate GThreadedSocketServicePrivate;
+typedef struct _GThreadedSocketServiceClass GThreadedSocketServiceClass;
+
+struct _GThreadedSocketServiceClass
+{
+ GSocketServiceClass parent_class;
+
+ gboolean (* run) (GThreadedSocketService *service,
+ GSocketConnection *connection,
+ GObject *source_object);
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+};
+
+struct _GThreadedSocketService
+{
+ GSocketService parent_instance;
+ GThreadedSocketServicePrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_threaded_socket_service_get_type (void);
+GLIB_AVAILABLE_IN_ALL
+GSocketService * g_threaded_socket_service_new (int max_threads);
+
+G_END_DECLS
+
+#endif /* __G_THREADED_SOCKET_SERVICE_H__ */
diff --git a/include/glib/gio/gtlsbackend.h b/include/glib/gio/gtlsbackend.h
new file mode 100644
index 0000000000..f19ab7e3c9
--- /dev/null
+++ b/include/glib/gio/gtlsbackend.h
@@ -0,0 +1,113 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright © 2015 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TLS_BACKEND_H__
+#define __G_TLS_BACKEND_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_TLS_BACKEND_EXTENSION_POINT_NAME:
+ *
+ * Extension point for TLS functionality via #GTlsBackend.
+ * See [Extending GIO][extending-gio].
+ */
+#define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"
+
+#define G_TYPE_TLS_BACKEND (g_tls_backend_get_type ())
+#define G_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TLS_BACKEND, GTlsBackend))
+#define G_IS_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TLS_BACKEND))
+#define G_TLS_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_TLS_BACKEND, GTlsBackendInterface))
+
+typedef struct _GTlsBackend GTlsBackend;
+typedef struct _GTlsBackendInterface GTlsBackendInterface;
+
+/**
+ * GTlsBackendInterface:
+ * @g_iface: The parent interface.
+ * @supports_tls: returns whether the backend supports TLS.
+ * @supports_dtls: returns whether the backend supports DTLS
+ * @get_default_database: returns a default #GTlsDatabase instance.
+ * @get_certificate_type: returns the #GTlsCertificate implementation type
+ * @get_client_connection_type: returns the #GTlsClientConnection implementation type
+ * @get_server_connection_type: returns the #GTlsServerConnection implementation type
+ * @get_file_database_type: returns the #GTlsFileDatabase implementation type.
+ * @get_dtls_client_connection_type: returns the #GDtlsClientConnection implementation type
+ * @get_dtls_server_connection_type: returns the #GDtlsServerConnection implementation type
+ *
+ * Provides an interface for describing TLS-related types.
+ *
+ * Since: 2.28
+ */
+struct _GTlsBackendInterface
+{
+ GTypeInterface g_iface;
+
+ /* methods */
+ gboolean ( *supports_tls) (GTlsBackend *backend);
+ GType ( *get_certificate_type) (void);
+ GType ( *get_client_connection_type) (void);
+ GType ( *get_server_connection_type) (void);
+ GType ( *get_file_database_type) (void);
+ GTlsDatabase * ( *get_default_database) (GTlsBackend *backend);
+ gboolean ( *supports_dtls) (GTlsBackend *backend);
+ GType ( *get_dtls_client_connection_type) (void);
+ GType ( *get_dtls_server_connection_type) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_backend_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsBackend * g_tls_backend_get_default (void);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_2_60
+void g_tls_backend_set_default_database (GTlsBackend *backend,
+ GTlsDatabase *database);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tls_backend_supports_tls (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_tls_backend_supports_dtls (GTlsBackend *backend);
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_backend_get_certificate_type (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_backend_get_client_connection_type (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_backend_get_server_connection_type (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_backend_get_file_database_type (GTlsBackend *backend);
+
+GLIB_AVAILABLE_IN_2_48
+GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend);
+GLIB_AVAILABLE_IN_2_48
+GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend);
+
+G_END_DECLS
+
+#endif /* __G_TLS_BACKEND_H__ */
diff --git a/include/glib/gio/gtlscertificate.h b/include/glib/gio/gtlscertificate.h
new file mode 100644
index 0000000000..a064543c44
--- /dev/null
+++ b/include/glib/gio/gtlscertificate.h
@@ -0,0 +1,92 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TLS_CERTIFICATE_H__
+#define __G_TLS_CERTIFICATE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_CERTIFICATE (g_tls_certificate_get_type ())
+#define G_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificate))
+#define G_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
+#define G_IS_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CERTIFICATE))
+#define G_IS_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CERTIFICATE))
+#define G_TLS_CERTIFICATE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
+
+typedef struct _GTlsCertificateClass GTlsCertificateClass;
+typedef struct _GTlsCertificatePrivate GTlsCertificatePrivate;
+
+struct _GTlsCertificate {
+ GObject parent_instance;
+
+ GTlsCertificatePrivate *priv;
+};
+
+struct _GTlsCertificateClass
+{
+ GObjectClass parent_class;
+
+ GTlsCertificateFlags (* verify) (GTlsCertificate *cert,
+ GSocketConnectable *identity,
+ GTlsCertificate *trusted_ca);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_certificate_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_certificate_new_from_pem (const gchar *data,
+ gssize length,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_certificate_new_from_file (const gchar *file,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_certificate_new_from_files (const gchar *cert_file,
+ const gchar *key_file,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GList *g_tls_certificate_list_new_from_file (const gchar *file,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_certificate_get_issuer (GTlsCertificate *cert);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificateFlags g_tls_certificate_verify (GTlsCertificate *cert,
+ GSocketConnectable *identity,
+ GTlsCertificate *trusted_ca);
+
+GLIB_AVAILABLE_IN_2_34
+gboolean g_tls_certificate_is_same (GTlsCertificate *cert_one,
+ GTlsCertificate *cert_two);
+
+G_END_DECLS
+
+#endif /* __G_TLS_CERTIFICATE_H__ */
diff --git a/include/glib/gio/gtlsclientconnection.h b/include/glib/gio/gtlsclientconnection.h
new file mode 100644
index 0000000000..29dbafcf4a
--- /dev/null
+++ b/include/glib/gio/gtlsclientconnection.h
@@ -0,0 +1,86 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TLS_CLIENT_CONNECTION_H__
+#define __G_TLS_CLIENT_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gtlsconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_CLIENT_CONNECTION (g_tls_client_connection_get_type ())
+#define G_TLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CLIENT_CONNECTION, GTlsClientConnection))
+#define G_IS_TLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CLIENT_CONNECTION))
+#define G_TLS_CLIENT_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_CLIENT_CONNECTION, GTlsClientConnectionInterface))
+
+typedef struct _GTlsClientConnectionInterface GTlsClientConnectionInterface;
+
+/**
+ * GTlsClientConnectionInterface:
+ * @g_iface: The parent interface.
+ * @copy_session_state: Copies session state from one #GTlsClientConnection to another.
+ *
+ * vtable for a #GTlsClientConnection implementation.
+ *
+ * Since: 2.26
+ */
+struct _GTlsClientConnectionInterface
+{
+ GTypeInterface g_iface;
+
+ void ( *copy_session_state ) (GTlsClientConnection *conn,
+ GTlsClientConnection *source);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_client_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream * g_tls_client_connection_new (GIOStream *base_io_stream,
+ GSocketConnectable *server_identity,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificateFlags g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_client_connection_set_validation_flags (GTlsClientConnection *conn,
+ GTlsCertificateFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GSocketConnectable *g_tls_client_connection_get_server_identity (GTlsClientConnection *conn);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_client_connection_set_server_identity (GTlsClientConnection *conn,
+ GSocketConnectable *identity);
+GLIB_DEPRECATED_IN_2_56
+gboolean g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn);
+GLIB_DEPRECATED_IN_2_56
+void g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn,
+ gboolean use_ssl3);
+GLIB_AVAILABLE_IN_ALL
+GList * g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn);
+
+GLIB_AVAILABLE_IN_2_46
+void g_tls_client_connection_copy_session_state (GTlsClientConnection *conn,
+ GTlsClientConnection *source);
+
+G_END_DECLS
+
+#endif /* __G_TLS_CLIENT_CONNECTION_H__ */
diff --git a/include/glib/gio/gtlsconnection.h b/include/glib/gio/gtlsconnection.h
new file mode 100644
index 0000000000..be38dcf5c9
--- /dev/null
+++ b/include/glib/gio/gtlsconnection.h
@@ -0,0 +1,163 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TLS_CONNECTION_H__
+#define __G_TLS_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giostream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_CONNECTION (g_tls_connection_get_type ())
+#define G_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CONNECTION, GTlsConnection))
+#define G_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CONNECTION, GTlsConnectionClass))
+#define G_IS_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CONNECTION))
+#define G_IS_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CONNECTION))
+#define G_TLS_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CONNECTION, GTlsConnectionClass))
+
+typedef struct _GTlsConnectionClass GTlsConnectionClass;
+typedef struct _GTlsConnectionPrivate GTlsConnectionPrivate;
+
+struct _GTlsConnection {
+ GIOStream parent_instance;
+
+ GTlsConnectionPrivate *priv;
+};
+
+struct _GTlsConnectionClass
+{
+ GIOStreamClass parent_class;
+
+ /* signals */
+ gboolean ( *accept_certificate) (GTlsConnection *connection,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors);
+
+ /* methods */
+ gboolean ( *handshake ) (GTlsConnection *conn,
+ GCancellable *cancellable,
+ GError **error);
+
+ void ( *handshake_async ) (GTlsConnection *conn,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean ( *handshake_finish ) (GTlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_DEPRECATED
+void g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
+ gboolean use_system_certdb);
+GLIB_DEPRECATED
+gboolean g_tls_connection_get_use_system_certdb (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_connection_set_database (GTlsConnection *conn,
+ GTlsDatabase *database);
+GLIB_AVAILABLE_IN_ALL
+GTlsDatabase * g_tls_connection_get_database (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_connection_set_certificate (GTlsConnection *conn,
+ GTlsCertificate *certificate);
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_connection_get_certificate (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_connection_set_interaction (GTlsConnection *conn,
+ GTlsInteraction *interaction);
+GLIB_AVAILABLE_IN_ALL
+GTlsInteraction * g_tls_connection_get_interaction (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate *g_tls_connection_get_peer_certificate (GTlsConnection *conn);
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificateFlags g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_connection_set_require_close_notify (GTlsConnection *conn,
+ gboolean require_close_notify);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_60
+void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
+ GTlsRehandshakeMode mode);
+GLIB_DEPRECATED_IN_2_60
+GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_2_60
+void g_tls_connection_set_advertised_protocols (GTlsConnection *conn,
+ const gchar * const *protocols);
+
+GLIB_AVAILABLE_IN_2_60
+const gchar * g_tls_connection_get_negotiated_protocol (GTlsConnection *conn);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tls_connection_handshake (GTlsConnection *conn,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_connection_handshake_async (GTlsConnection *conn,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tls_connection_handshake_finish (GTlsConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+
+/**
+ * G_TLS_ERROR:
+ *
+ * Error domain for TLS. Errors in this domain will be from the
+ * #GTlsError enumeration. See #GError for more information on error
+ * domains.
+ */
+#define G_TLS_ERROR (g_tls_error_quark ())
+GLIB_AVAILABLE_IN_ALL
+GQuark g_tls_error_quark (void);
+
+
+/*< protected >*/
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors);
+
+G_END_DECLS
+
+#endif /* __G_TLS_CONNECTION_H__ */
diff --git a/include/glib/gio/gtlsdatabase.h b/include/glib/gio/gtlsdatabase.h
new file mode 100644
index 0000000000..5dafd7bc00
--- /dev/null
+++ b/include/glib/gio/gtlsdatabase.h
@@ -0,0 +1,247 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Stef Walter <stefw@collabora.co.uk>
+ */
+
+#ifndef __G_TLS_DATABASE_H__
+#define __G_TLS_DATABASE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
+#define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
+
+#define G_TYPE_TLS_DATABASE (g_tls_database_get_type ())
+#define G_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
+#define G_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
+#define G_IS_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
+#define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
+#define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
+
+typedef struct _GTlsDatabaseClass GTlsDatabaseClass;
+typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate;
+
+struct _GTlsDatabase
+{
+ GObject parent_instance;
+
+ GTlsDatabasePrivate *priv;
+};
+
+struct _GTlsDatabaseClass
+{
+ GObjectClass parent_class;
+
+ /* virtual methods */
+
+ GTlsCertificateFlags (*verify_chain) (GTlsDatabase *self,
+ GTlsCertificate *chain,
+ const gchar *purpose,
+ GSocketConnectable *identity,
+ GTlsInteraction *interaction,
+ GTlsDatabaseVerifyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*verify_chain_async) (GTlsDatabase *self,
+ GTlsCertificate *chain,
+ const gchar *purpose,
+ GSocketConnectable *identity,
+ GTlsInteraction *interaction,
+ GTlsDatabaseVerifyFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GTlsCertificateFlags (*verify_chain_finish) (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+ gchar* (*create_certificate_handle) (GTlsDatabase *self,
+ GTlsCertificate *certificate);
+
+ GTlsCertificate* (*lookup_certificate_for_handle) (GTlsDatabase *self,
+ const gchar *handle,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*lookup_certificate_for_handle_async) (GTlsDatabase *self,
+ const gchar *handle,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GTlsCertificate* (*lookup_certificate_for_handle_finish) (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+ GTlsCertificate* (*lookup_certificate_issuer) (GTlsDatabase *self,
+ GTlsCertificate *certificate,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*lookup_certificate_issuer_async) (GTlsDatabase *self,
+ GTlsCertificate *certificate,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GTlsCertificate* (*lookup_certificate_issuer_finish) (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+ GList* (*lookup_certificates_issued_by) (GTlsDatabase *self,
+ GByteArray *issuer_raw_dn,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (*lookup_certificates_issued_by_async) (GTlsDatabase *self,
+ GByteArray *issuer_raw_dn,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GList* (*lookup_certificates_issued_by_finish) (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[16];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_database_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificateFlags g_tls_database_verify_chain (GTlsDatabase *self,
+ GTlsCertificate *chain,
+ const gchar *purpose,
+ GSocketConnectable *identity,
+ GTlsInteraction *interaction,
+ GTlsDatabaseVerifyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_database_verify_chain_async (GTlsDatabase *self,
+ GTlsCertificate *chain,
+ const gchar *purpose,
+ GSocketConnectable *identity,
+ GTlsInteraction *interaction,
+ GTlsDatabaseVerifyFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificateFlags g_tls_database_verify_chain_finish (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_tls_database_create_certificate_handle (GTlsDatabase *self,
+ GTlsCertificate *certificate);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate* g_tls_database_lookup_certificate_for_handle (GTlsDatabase *self,
+ const gchar *handle,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase *self,
+ const gchar *handle,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate* g_tls_database_lookup_certificate_issuer (GTlsDatabase *self,
+ GTlsCertificate *certificate,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase *self,
+ GTlsCertificate *certificate,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsCertificate* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GList* g_tls_database_lookup_certificates_issued_by (GTlsDatabase *self,
+ GByteArray *issuer_raw_dn,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase *self,
+ GByteArray *issuer_raw_dn,
+ GTlsInteraction *interaction,
+ GTlsDatabaseLookupFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GList* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase *self,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_TLS_DATABASE_H__ */
diff --git a/include/glib/gio/gtlsfiledatabase.h b/include/glib/gio/gtlsfiledatabase.h
new file mode 100644
index 0000000000..1ee4631be9
--- /dev/null
+++ b/include/glib/gio/gtlsfiledatabase.h
@@ -0,0 +1,58 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2010 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * See the included COPYING file for more information.
+ *
+ * Author: Stef Walter <stefw@collabora.co.uk>
+ */
+
+#ifndef __G_TLS_FILE_DATABASE_H__
+#define __G_TLS_FILE_DATABASE_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_FILE_DATABASE (g_tls_file_database_get_type ())
+#define G_TLS_FILE_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_FILE_DATABASE, GTlsFileDatabase))
+#define G_IS_TLS_FILE_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_FILE_DATABASE))
+#define G_TLS_FILE_DATABASE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_FILE_DATABASE, GTlsFileDatabaseInterface))
+
+typedef struct _GTlsFileDatabaseInterface GTlsFileDatabaseInterface;
+
+/**
+ * GTlsFileDatabaseInterface:
+ * @g_iface: The parent interface.
+ *
+ * Provides an interface for #GTlsFileDatabase implementations.
+ *
+ */
+struct _GTlsFileDatabaseInterface
+{
+ GTypeInterface g_iface;
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[8];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_file_database_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsDatabase* g_tls_file_database_new (const gchar *anchors,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_TLS_FILE_DATABASE_H___ */
diff --git a/include/glib/gio/gtlsinteraction.h b/include/glib/gio/gtlsinteraction.h
new file mode 100644
index 0000000000..03552fb14a
--- /dev/null
+++ b/include/glib/gio/gtlsinteraction.h
@@ -0,0 +1,148 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2011 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Stef Walter <stefw@collabora.co.uk>
+ */
+
+#ifndef __G_TLS_INTERACTION_H__
+#define __G_TLS_INTERACTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_INTERACTION (g_tls_interaction_get_type ())
+#define G_TLS_INTERACTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TLS_INTERACTION, GTlsInteraction))
+#define G_TLS_INTERACTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TLS_INTERACTION, GTlsInteractionClass))
+#define G_IS_TLS_INTERACTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TLS_INTERACTION))
+#define G_IS_TLS_INTERACTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TLS_INTERACTION))
+#define G_TLS_INTERACTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TLS_INTERACTION, GTlsInteractionClass))
+
+typedef struct _GTlsInteractionClass GTlsInteractionClass;
+typedef struct _GTlsInteractionPrivate GTlsInteractionPrivate;
+
+struct _GTlsInteraction
+{
+ /*< private >*/
+ GObject parent_instance;
+ GTlsInteractionPrivate *priv;
+};
+
+struct _GTlsInteractionClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+ GTlsInteractionResult (* ask_password) (GTlsInteraction *interaction,
+ GTlsPassword *password,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* ask_password_async) (GTlsInteraction *interaction,
+ GTlsPassword *password,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GTlsInteractionResult (* ask_password_finish) (GTlsInteraction *interaction,
+ GAsyncResult *result,
+ GError **error);
+
+ GTlsInteractionResult (* request_certificate) (GTlsInteraction *interaction,
+ GTlsConnection *connection,
+ GTlsCertificateRequestFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+ void (* request_certificate_async) (GTlsInteraction *interaction,
+ GTlsConnection *connection,
+ GTlsCertificateRequestFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ GTlsInteractionResult (* request_certificate_finish) (GTlsInteraction *interaction,
+ GAsyncResult *result,
+ GError **error);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[21];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_interaction_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsInteractionResult g_tls_interaction_invoke_ask_password (GTlsInteraction *interaction,
+ GTlsPassword *password,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsInteractionResult g_tls_interaction_ask_password (GTlsInteraction *interaction,
+ GTlsPassword *password,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_tls_interaction_ask_password_async (GTlsInteraction *interaction,
+ GTlsPassword *password,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsInteractionResult g_tls_interaction_ask_password_finish (GTlsInteraction *interaction,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+GTlsInteractionResult g_tls_interaction_invoke_request_certificate (GTlsInteraction *interaction,
+ GTlsConnection *connection,
+ GTlsCertificateRequestFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+GTlsInteractionResult g_tls_interaction_request_certificate (GTlsInteraction *interaction,
+ GTlsConnection *connection,
+ GTlsCertificateRequestFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_40
+void g_tls_interaction_request_certificate_async (GTlsInteraction *interaction,
+ GTlsConnection *connection,
+ GTlsCertificateRequestFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+GTlsInteractionResult g_tls_interaction_request_certificate_finish (GTlsInteraction *interaction,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_TLS_INTERACTION_H__ */
diff --git a/include/glib/gio/gtlspassword.h b/include/glib/gio/gtlspassword.h
new file mode 100644
index 0000000000..befe706a84
--- /dev/null
+++ b/include/glib/gio/gtlspassword.h
@@ -0,0 +1,119 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2011 Collabora, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Stef Walter <stefw@collabora.co.uk>
+ */
+
+#ifndef __G_TLS_PASSWORD_H__
+#define __G_TLS_PASSWORD_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_PASSWORD (g_tls_password_get_type ())
+#define G_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TLS_PASSWORD, GTlsPassword))
+#define G_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TLS_PASSWORD, GTlsPasswordClass))
+#define G_IS_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TLS_PASSWORD))
+#define G_IS_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TLS_PASSWORD))
+#define G_TLS_PASSWORD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TLS_PASSWORD, GTlsPasswordClass))
+
+typedef struct _GTlsPasswordClass GTlsPasswordClass;
+typedef struct _GTlsPasswordPrivate GTlsPasswordPrivate;
+
+struct _GTlsPassword
+{
+ GObject parent_instance;
+
+ GTlsPasswordPrivate *priv;
+};
+
+/**
+ * GTlsPasswordClass:
+ * @get_value: virtual method for g_tls_password_get_value()
+ * @set_value: virtual method for g_tls_password_set_value()
+ * @get_default_warning: virtual method for g_tls_password_get_warning() if no
+ * value has been set using g_tls_password_set_warning()
+ *
+ * Class structure for #GTlsPassword.
+ */
+struct _GTlsPasswordClass
+{
+ GObjectClass parent_class;
+
+ /* methods */
+
+ const guchar * ( *get_value) (GTlsPassword *password,
+ gsize *length);
+
+ void ( *set_value) (GTlsPassword *password,
+ guchar *value,
+ gssize length,
+ GDestroyNotify destroy);
+
+ const gchar* ( *get_default_warning) (GTlsPassword *password);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ gpointer padding[4];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_password_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags,
+ const gchar *description);
+
+GLIB_AVAILABLE_IN_ALL
+const guchar * g_tls_password_get_value (GTlsPassword *password,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_password_set_value (GTlsPassword *password,
+ const guchar *value,
+ gssize length);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_password_set_value_full (GTlsPassword *password,
+ guchar *value,
+ gssize length,
+ GDestroyNotify destroy);
+
+GLIB_AVAILABLE_IN_ALL
+GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_password_set_flags (GTlsPassword *password,
+ GTlsPasswordFlags flags);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar* g_tls_password_get_description (GTlsPassword *password);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_password_set_description (GTlsPassword *password,
+ const gchar *description);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_tls_password_get_warning (GTlsPassword *password);
+GLIB_AVAILABLE_IN_ALL
+void g_tls_password_set_warning (GTlsPassword *password,
+ const gchar *warning);
+
+G_END_DECLS
+
+#endif /* __G_TLS_PASSWORD_H__ */
diff --git a/include/glib/gio/gtlsserverconnection.h b/include/glib/gio/gtlsserverconnection.h
new file mode 100644
index 0000000000..6926e7d122
--- /dev/null
+++ b/include/glib/gio/gtlsserverconnection.h
@@ -0,0 +1,69 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TLS_SERVER_CONNECTION_H__
+#define __G_TLS_SERVER_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gtlsconnection.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_TLS_SERVER_CONNECTION (g_tls_server_connection_get_type ())
+#define G_TLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_SERVER_CONNECTION, GTlsServerConnection))
+#define G_IS_TLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_SERVER_CONNECTION))
+#define G_TLS_SERVER_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_SERVER_CONNECTION, GTlsServerConnectionInterface))
+
+/**
+ * GTlsServerConnection:
+ *
+ * TLS server-side connection. This is the server-side implementation
+ * of a #GTlsConnection.
+ *
+ * Since: 2.28
+ */
+typedef struct _GTlsServerConnectionInterface GTlsServerConnectionInterface;
+
+/**
+ * GTlsServerConnectionInterface:
+ * @g_iface: The parent interface.
+ *
+ * vtable for a #GTlsServerConnection implementation.
+ *
+ * Since: 2.26
+ */
+struct _GTlsServerConnectionInterface
+{
+ GTypeInterface g_iface;
+
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_tls_server_connection_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GIOStream * g_tls_server_connection_new (GIOStream *base_io_stream,
+ GTlsCertificate *certificate,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_TLS_SERVER_CONNECTION_H__ */
diff --git a/include/glib/gio/gvfs.h b/include/glib/gio/gvfs.h
new file mode 100644
index 0000000000..72fe2dd323
--- /dev/null
+++ b/include/glib/gio/gvfs.h
@@ -0,0 +1,168 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_VFS_H__
+#define __G_VFS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_VFS (g_vfs_get_type ())
+#define G_VFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VFS, GVfs))
+#define G_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VFS, GVfsClass))
+#define G_VFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VFS, GVfsClass))
+#define G_IS_VFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VFS))
+#define G_IS_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VFS))
+
+/**
+ * GVfsFileLookupFunc:
+ * @vfs: a #GVfs
+ * @identifier: the identifier to look up a #GFile for. This can either
+ * be an URI or a parse name as returned by g_file_get_parse_name()
+ * @user_data: user data passed to the function
+ *
+ * This function type is used by g_vfs_register_uri_scheme() to make it
+ * possible for a client to associate an URI scheme to a different #GFile
+ * implementation.
+ *
+ * The client should return a reference to the new file that has been
+ * created for @uri, or %NULL to continue with the default implementation.
+ *
+ * Returns: (transfer full): a #GFile for @identifier.
+ *
+ * Since: 2.50
+ */
+typedef GFile * (* GVfsFileLookupFunc) (GVfs *vfs,
+ const char *identifier,
+ gpointer user_data);
+
+/**
+ * G_VFS_EXTENSION_POINT_NAME:
+ *
+ * Extension point for #GVfs functionality.
+ * See [Extending GIO][extending-gio].
+ */
+#define G_VFS_EXTENSION_POINT_NAME "gio-vfs"
+
+/**
+ * GVfs:
+ *
+ * Virtual File System object.
+ **/
+typedef struct _GVfsClass GVfsClass;
+
+struct _GVfs
+{
+ GObject parent_instance;
+};
+
+struct _GVfsClass
+{
+ GObjectClass parent_class;
+
+ /* Virtual Table */
+
+ gboolean (* is_active) (GVfs *vfs);
+ GFile * (* get_file_for_path) (GVfs *vfs,
+ const char *path);
+ GFile * (* get_file_for_uri) (GVfs *vfs,
+ const char *uri);
+ const gchar * const * (* get_supported_uri_schemes) (GVfs *vfs);
+ GFile * (* parse_name) (GVfs *vfs,
+ const char *parse_name);
+
+ /*< private >*/
+ void (* local_file_add_info) (GVfs *vfs,
+ const char *filename,
+ guint64 device,
+ GFileAttributeMatcher *attribute_matcher,
+ GFileInfo *info,
+ GCancellable *cancellable,
+ gpointer *extra_data,
+ GDestroyNotify *free_extra_data);
+ void (* add_writable_namespaces) (GVfs *vfs,
+ GFileAttributeInfoList *list);
+ gboolean (* local_file_set_attributes) (GVfs *vfs,
+ const char *filename,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+ void (* local_file_removed) (GVfs *vfs,
+ const char *filename);
+ void (* local_file_moved) (GVfs *vfs,
+ const char *source,
+ const char *dest);
+ GIcon * (* deserialize_icon) (GVfs *vfs,
+ GVariant *value);
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_vfs_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_vfs_is_active (GVfs *vfs);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_vfs_get_file_for_path (GVfs *vfs,
+ const char *path);
+GLIB_AVAILABLE_IN_ALL
+GFile * g_vfs_get_file_for_uri (GVfs *vfs,
+ const char *uri);
+GLIB_AVAILABLE_IN_ALL
+const gchar* const * g_vfs_get_supported_uri_schemes (GVfs *vfs);
+
+GLIB_AVAILABLE_IN_ALL
+GFile * g_vfs_parse_name (GVfs *vfs,
+ const char *parse_name);
+
+GLIB_AVAILABLE_IN_ALL
+GVfs * g_vfs_get_default (void);
+GLIB_AVAILABLE_IN_ALL
+GVfs * g_vfs_get_local (void);
+
+GLIB_AVAILABLE_IN_2_50
+gboolean g_vfs_register_uri_scheme (GVfs *vfs,
+ const char *scheme,
+ GVfsFileLookupFunc uri_func,
+ gpointer uri_data,
+ GDestroyNotify uri_destroy,
+ GVfsFileLookupFunc parse_name_func,
+ gpointer parse_name_data,
+ GDestroyNotify parse_name_destroy);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_vfs_unregister_uri_scheme (GVfs *vfs,
+ const char *scheme);
+
+
+G_END_DECLS
+
+#endif /* __G_VFS_H__ */
diff --git a/include/glib/gio/gvolume.h b/include/glib/gio/gvolume.h
new file mode 100644
index 0000000000..e153b7c38c
--- /dev/null
+++ b/include/glib/gio/gvolume.h
@@ -0,0 +1,253 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ * David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_VOLUME_H__
+#define __G_VOLUME_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_HAL_UDI:
+ *
+ * The string used to obtain a Hal UDI with g_volume_get_identifier().
+ *
+ * Deprecated: 2.58: Do not use, HAL is deprecated.
+ */
+#define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi" GLIB_DEPRECATED_MACRO_IN_2_58
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE:
+ *
+ * The string used to obtain a Unix device path with g_volume_get_identifier().
+ */
+#define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_LABEL:
+ *
+ * The string used to obtain a filesystem label with g_volume_get_identifier().
+ */
+#define G_VOLUME_IDENTIFIER_KIND_LABEL "label"
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_UUID:
+ *
+ * The string used to obtain a UUID with g_volume_get_identifier().
+ */
+#define G_VOLUME_IDENTIFIER_KIND_UUID "uuid"
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT:
+ *
+ * The string used to obtain a NFS mount with g_volume_get_identifier().
+ */
+#define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount"
+
+/**
+ * G_VOLUME_IDENTIFIER_KIND_CLASS:
+ *
+ * The string used to obtain the volume class with g_volume_get_identifier().
+ *
+ * Known volume classes include `device`, `network`, and `loop`. Other
+ * classes may be added in the future.
+ *
+ * This is intended to be used by applications to classify #GVolume
+ * instances into different sections - for example a file manager or
+ * file chooser can use this information to show `network` volumes under
+ * a "Network" heading and `device` volumes under a "Devices" heading.
+ */
+#define G_VOLUME_IDENTIFIER_KIND_CLASS "class"
+
+
+#define G_TYPE_VOLUME (g_volume_get_type ())
+#define G_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
+#define G_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
+#define G_VOLUME_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
+
+/**
+ * GVolumeIface:
+ * @g_iface: The parent interface.
+ * @changed: Changed signal that is emitted when the volume's state has changed.
+ * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
+ * @get_name: Gets a string containing the name of the #GVolume.
+ * @get_icon: Gets a #GIcon for the #GVolume.
+ * @get_uuid: Gets the UUID for the #GVolume. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
+ * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
+ * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
+ * @can_mount: Returns %TRUE if the #GVolume can be mounted.
+ * @can_eject: Checks if a #GVolume can be ejected.
+ * @mount_fn: Mounts a given #GVolume.
+ * #GVolume implementations must emit the #GMountOperation::aborted
+ * signal before completing a mount operation that is aborted while
+ * awaiting input from the user through a #GMountOperation instance.
+ * @mount_finish: Finishes a mount operation.
+ * @eject: Ejects a given #GVolume.
+ * @eject_finish: Finishes an eject operation.
+ * @get_identifier: Returns the [identifier][volume-identifier] of the given kind, or %NULL if
+ * the #GVolume doesn't have one.
+ * @enumerate_identifiers: Returns an array strings listing the kinds
+ * of [identifiers][volume-identifier] which the #GVolume has.
+ * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted.
+ * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if
+ * it is not known.
+ * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
+ * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
+ * @get_sort_key: Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.
+ * @get_symbolic_icon: Gets a symbolic #GIcon for the #GVolume. Since 2.34.
+ *
+ * Interface for implementing operations for mountable volumes.
+ **/
+typedef struct _GVolumeIface GVolumeIface;
+
+struct _GVolumeIface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+
+ void (* changed) (GVolume *volume);
+ void (* removed) (GVolume *volume);
+
+ /* Virtual Table */
+
+ char * (* get_name) (GVolume *volume);
+ GIcon * (* get_icon) (GVolume *volume);
+ char * (* get_uuid) (GVolume *volume);
+ GDrive * (* get_drive) (GVolume *volume);
+ GMount * (* get_mount) (GVolume *volume);
+ gboolean (* can_mount) (GVolume *volume);
+ gboolean (* can_eject) (GVolume *volume);
+ void (* mount_fn) (GVolume *volume,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* mount_finish) (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+ void (* eject) (GVolume *volume,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_finish) (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+
+ char * (* get_identifier) (GVolume *volume,
+ const char *kind);
+ char ** (* enumerate_identifiers) (GVolume *volume);
+
+ gboolean (* should_automount) (GVolume *volume);
+
+ GFile * (* get_activation_root) (GVolume *volume);
+
+ void (* eject_with_operation) (GVolume *volume,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* eject_with_operation_finish) (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+
+ const gchar * (* get_sort_key) (GVolume *volume);
+ GIcon * (* get_symbolic_icon) (GVolume *volume);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_volume_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+char * g_volume_get_name (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_volume_get_icon (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+GIcon * g_volume_get_symbolic_icon (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+char * g_volume_get_uuid (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+GDrive * g_volume_get_drive (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+GMount * g_volume_get_mount (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_volume_can_mount (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_volume_can_eject (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_volume_should_automount (GVolume *volume);
+GLIB_AVAILABLE_IN_ALL
+void g_volume_mount (GVolume *volume,
+ GMountMountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_volume_mount_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+GLIB_DEPRECATED_FOR(g_volume_eject_with_operation)
+void g_volume_eject (GVolume *volume,
+ GMountUnmountFlags flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_DEPRECATED_FOR(g_volume_eject_with_operation_finish)
+gboolean g_volume_eject_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+char * g_volume_get_identifier (GVolume *volume,
+ const char *kind);
+GLIB_AVAILABLE_IN_ALL
+char ** g_volume_enumerate_identifiers (GVolume *volume);
+
+GLIB_AVAILABLE_IN_ALL
+GFile * g_volume_get_activation_root (GVolume *volume);
+
+GLIB_AVAILABLE_IN_ALL
+void g_volume_eject_with_operation (GVolume *volume,
+ GMountUnmountFlags flags,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_volume_eject_with_operation_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_32
+const gchar *g_volume_get_sort_key (GVolume *volume);
+
+G_END_DECLS
+
+#endif /* __G_VOLUME_H__ */
diff --git a/include/glib/gio/gvolumemonitor.h b/include/glib/gio/gvolumemonitor.h
new file mode 100644
index 0000000000..899942f6cb
--- /dev/null
+++ b/include/glib/gio/gvolumemonitor.h
@@ -0,0 +1,154 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ * David Zeuthen <davidz@redhat.com>
+ */
+
+#ifndef __G_VOLUME_MONITOR_H__
+#define __G_VOLUME_MONITOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_VOLUME_MONITOR (g_volume_monitor_get_type ())
+#define G_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
+#define G_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
+#define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
+#define G_IS_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
+#define G_IS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
+
+/**
+ * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
+ *
+ * Extension point for volume monitor functionality.
+ * See [Extending GIO][extending-gio].
+ */
+#define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
+
+/**
+ * GVolumeMonitor:
+ *
+ * A Volume Monitor that watches for volume events.
+ **/
+typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
+
+struct _GVolumeMonitor
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ gpointer priv;
+};
+
+struct _GVolumeMonitorClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* signals */
+ void (* volume_added) (GVolumeMonitor *volume_monitor,
+ GVolume *volume);
+ void (* volume_removed) (GVolumeMonitor *volume_monitor,
+ GVolume *volume);
+ void (* volume_changed) (GVolumeMonitor *volume_monitor,
+ GVolume *volume);
+
+ void (* mount_added) (GVolumeMonitor *volume_monitor,
+ GMount *mount);
+ void (* mount_removed) (GVolumeMonitor *volume_monitor,
+ GMount *mount);
+ void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
+ GMount *mount);
+ void (* mount_changed) (GVolumeMonitor *volume_monitor,
+ GMount *mount);
+
+ void (* drive_connected) (GVolumeMonitor *volume_monitor,
+ GDrive *drive);
+ void (* drive_disconnected) (GVolumeMonitor *volume_monitor,
+ GDrive *drive);
+ void (* drive_changed) (GVolumeMonitor *volume_monitor,
+ GDrive *drive);
+
+ /* Vtable */
+
+ gboolean (* is_supported) (void);
+
+ GList * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
+ GList * (* get_volumes) (GVolumeMonitor *volume_monitor);
+ GList * (* get_mounts) (GVolumeMonitor *volume_monitor);
+
+ GVolume * (* get_volume_for_uuid) (GVolumeMonitor *volume_monitor,
+ const char *uuid);
+
+ GMount * (* get_mount_for_uuid) (GVolumeMonitor *volume_monitor,
+ const char *uuid);
+
+
+ /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
+ GVolume * (* adopt_orphan_mount) (GMount *mount,
+ GVolumeMonitor *volume_monitor);
+
+ /* signal added in 2.17 */
+ void (* drive_eject_button) (GVolumeMonitor *volume_monitor,
+ GDrive *drive);
+
+ /* signal added in 2.21 */
+ void (* drive_stop_button) (GVolumeMonitor *volume_monitor,
+ GDrive *drive);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_volume_monitor_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GVolumeMonitor *g_volume_monitor_get (void);
+GLIB_AVAILABLE_IN_ALL
+GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
+GLIB_AVAILABLE_IN_ALL
+GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor);
+GLIB_AVAILABLE_IN_ALL
+GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor);
+GLIB_AVAILABLE_IN_ALL
+GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
+ const char *uuid);
+GLIB_AVAILABLE_IN_ALL
+GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
+ const char *uuid);
+
+GLIB_DEPRECATED
+GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount);
+
+G_END_DECLS
+
+#endif /* __G_VOLUME_MONITOR_H__ */
diff --git a/include/glib/gio/gzlibcompressor.h b/include/glib/gio/gzlibcompressor.h
new file mode 100644
index 0000000000..f89b30f204
--- /dev/null
+++ b/include/glib/gio/gzlibcompressor.h
@@ -0,0 +1,62 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_ZLIB_COMPRESSOR_H__
+#define __G_ZLIB_COMPRESSOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gconverter.h>
+#include <gio/gfileinfo.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ZLIB_COMPRESSOR (g_zlib_compressor_get_type ())
+#define G_ZLIB_COMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressor))
+#define G_ZLIB_COMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressorClass))
+#define G_IS_ZLIB_COMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_ZLIB_COMPRESSOR))
+#define G_IS_ZLIB_COMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_ZLIB_COMPRESSOR))
+#define G_ZLIB_COMPRESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressorClass))
+
+typedef struct _GZlibCompressorClass GZlibCompressorClass;
+
+struct _GZlibCompressorClass
+{
+ GObjectClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_zlib_compressor_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GZlibCompressor *g_zlib_compressor_new (GZlibCompressorFormat format,
+ int level);
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_zlib_compressor_get_file_info (GZlibCompressor *compressor);
+GLIB_AVAILABLE_IN_ALL
+void g_zlib_compressor_set_file_info (GZlibCompressor *compressor,
+ GFileInfo *file_info);
+
+G_END_DECLS
+
+#endif /* __G_ZLIB_COMPRESSOR_H__ */
diff --git a/include/glib/gio/gzlibdecompressor.h b/include/glib/gio/gzlibdecompressor.h
new file mode 100644
index 0000000000..373ac67d18
--- /dev/null
+++ b/include/glib/gio/gzlibdecompressor.h
@@ -0,0 +1,58 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_ZLIB_DECOMPRESSOR_H__
+#define __G_ZLIB_DECOMPRESSOR_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/gconverter.h>
+#include <gio/gfileinfo.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_ZLIB_DECOMPRESSOR (g_zlib_decompressor_get_type ())
+#define G_ZLIB_DECOMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressor))
+#define G_ZLIB_DECOMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressorClass))
+#define G_IS_ZLIB_DECOMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_ZLIB_DECOMPRESSOR))
+#define G_IS_ZLIB_DECOMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_ZLIB_DECOMPRESSOR))
+#define G_ZLIB_DECOMPRESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressorClass))
+
+typedef struct _GZlibDecompressorClass GZlibDecompressorClass;
+
+struct _GZlibDecompressorClass
+{
+ GObjectClass parent_class;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_zlib_decompressor_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GZlibDecompressor *g_zlib_decompressor_new (GZlibCompressorFormat format);
+
+GLIB_AVAILABLE_IN_ALL
+GFileInfo *g_zlib_decompressor_get_file_info (GZlibDecompressor *decompressor);
+
+G_END_DECLS
+
+#endif /* __G_ZLIB_DECOMPRESSOR_H__ */
diff --git a/include/glib/glib-object.h b/include/glib/glib-object.h
new file mode 100644
index 0000000000..9561a65289
--- /dev/null
+++ b/include/glib/glib-object.h
@@ -0,0 +1,43 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __GLIB_GOBJECT_H__
+#define __GLIB_GOBJECT_H__
+
+#define __GLIB_GOBJECT_H_INSIDE__
+
+/* topmost include file for GObject header files */
+#include <gobject/gbinding.h>
+#include <gobject/gboxed.h>
+#include <gobject/genums.h>
+#include <gobject/gobject.h>
+#include <gobject/gparam.h>
+#include <gobject/gparamspecs.h>
+#include <gobject/gsignal.h>
+#include <gobject/gsourceclosure.h>
+#include <gobject/gtype.h>
+#include <gobject/gtypemodule.h>
+#include <gobject/gtypeplugin.h>
+#include <gobject/gvalue.h>
+#include <gobject/gvaluearray.h>
+#include <gobject/gvaluetypes.h>
+#include <gobject/glib-enumtypes.h>
+
+#include <gobject/gobject-autocleanups.h>
+
+#undef __GLIB_GOBJECT_H_INSIDE__
+
+#endif /* __GLIB_GOBJECT_H__ */
diff --git a/include/glib/glib-unix.h b/include/glib/glib-unix.h
new file mode 100644
index 0000000000..ef8702d798
--- /dev/null
+++ b/include/glib/glib-unix.h
@@ -0,0 +1,119 @@
+/* glib-unix.h - Unix specific integration
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_UNIX_H__
+#define __G_UNIX_H__
+
+/* We need to include the UNIX headers needed to use the APIs below,
+ * but we also take this opportunity to include a wide selection of
+ * other UNIX headers. If one of the headers below is broken on some
+ * system, work around it here (or better, fix the system or tell
+ * people to use a better one).
+ */
+#include <unistd.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+#include <glib.h>
+
+#ifndef G_OS_UNIX
+#error "This header may only be used on UNIX"
+#endif
+
+G_BEGIN_DECLS
+
+/**
+ * G_UNIX_ERROR:
+ *
+ * Error domain for API in the g_unix_ namespace. Note that there is no
+ * exported enumeration mapping %errno. Instead, all functions ensure that
+ * %errno is relevant. The code for all #G_UNIX_ERROR is always 0, and the
+ * error message is always generated via g_strerror().
+ *
+ * It is expected that most code will not look at %errno from these APIs.
+ * Important cases where one would want to differentiate between errors are
+ * already covered by existing cross-platform GLib API, such as e.g. #GFile
+ * wrapping `ENOENT`. However, it is provided for completeness, at least.
+ */
+#define G_UNIX_ERROR (g_unix_error_quark())
+
+GLIB_AVAILABLE_IN_2_30
+GQuark g_unix_error_quark (void);
+
+GLIB_AVAILABLE_IN_2_30
+gboolean g_unix_open_pipe (gint *fds,
+ gint flags,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_30
+gboolean g_unix_set_fd_nonblocking (gint fd,
+ gboolean nonblock,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_30
+GSource *g_unix_signal_source_new (gint signum);
+
+GLIB_AVAILABLE_IN_2_30
+guint g_unix_signal_add_full (gint priority,
+ gint signum,
+ GSourceFunc handler,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GLIB_AVAILABLE_IN_2_30
+guint g_unix_signal_add (gint signum,
+ GSourceFunc handler,
+ gpointer user_data);
+
+/**
+ * GUnixFDSourceFunc:
+ * @fd: the fd that triggered the event
+ * @condition: the IO conditions reported on @fd
+ * @user_data: user data passed to g_unix_fd_add()
+ *
+ * The type of functions to be called when a UNIX fd watch source
+ * triggers.
+ *
+ * Returns: %FALSE if the source should be removed
+ **/
+typedef gboolean (*GUnixFDSourceFunc) (gint fd,
+ GIOCondition condition,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_36
+GSource *g_unix_fd_source_new (gint fd,
+ GIOCondition condition);
+
+GLIB_AVAILABLE_IN_2_36
+guint g_unix_fd_add_full (gint priority,
+ gint fd,
+ GIOCondition condition,
+ GUnixFDSourceFunc function,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GLIB_AVAILABLE_IN_2_36
+guint g_unix_fd_add (gint fd,
+ GIOCondition condition,
+ GUnixFDSourceFunc function,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_UNIX_H__ */
diff --git a/include/glib/glib.h b/include/glib/glib.h
new file mode 100644
index 0000000000..5c21b6bf65
--- /dev/null
+++ b/include/glib/glib.h
@@ -0,0 +1,116 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_LIB_H__
+#define __G_LIB_H__
+
+#define __GLIB_H_INSIDE__
+
+#include <glib/galloca.h>
+#include <glib/garray.h>
+#include <glib/gasyncqueue.h>
+#include <glib/gatomic.h>
+#include <glib/gbacktrace.h>
+#include <glib/gbase64.h>
+#include <glib/gbitlock.h>
+#include <glib/gbookmarkfile.h>
+#include <glib/gbytes.h>
+#include <glib/gcharset.h>
+#include <glib/gchecksum.h>
+#include <glib/gconvert.h>
+#include <glib/gdataset.h>
+#include <glib/gdate.h>
+#include <glib/gdatetime.h>
+#include <glib/gdir.h>
+#include <glib/genviron.h>
+#include <glib/gerror.h>
+#include <glib/gfileutils.h>
+#include <glib/ggettext.h>
+#include <glib/ghash.h>
+#include <glib/ghmac.h>
+#include <glib/ghook.h>
+#include <glib/ghostutils.h>
+#include <glib/giochannel.h>
+#include <glib/gkeyfile.h>
+#include <glib/glist.h>
+#include <glib/gmacros.h>
+#include <glib/gmain.h>
+#include <glib/gmappedfile.h>
+#include <glib/gmarkup.h>
+#include <glib/gmem.h>
+#include <glib/gmessages.h>
+#include <glib/gnode.h>
+#include <glib/goption.h>
+#include <glib/gpattern.h>
+#include <glib/gpoll.h>
+#include <glib/gprimes.h>
+#include <glib/gqsort.h>
+#include <glib/gquark.h>
+#include <glib/gqueue.h>
+#include <glib/grand.h>
+#include <glib/grcbox.h>
+#include <glib/grefcount.h>
+#include <glib/grefstring.h>
+#include <glib/gregex.h>
+#include <glib/gscanner.h>
+#include <glib/gsequence.h>
+#include <glib/gshell.h>
+#include <glib/gslice.h>
+#include <glib/gslist.h>
+#include <glib/gspawn.h>
+#include <glib/gstrfuncs.h>
+#include <glib/gstring.h>
+#include <glib/gstringchunk.h>
+#include <glib/gtestutils.h>
+#include <glib/gthread.h>
+#include <glib/gthreadpool.h>
+#include <glib/gtimer.h>
+#include <glib/gtimezone.h>
+#include <glib/gtrashstack.h>
+#include <glib/gtree.h>
+#include <glib/gtypes.h>
+#include <glib/gunicode.h>
+#include <glib/gurifuncs.h>
+#include <glib/gutils.h>
+#include <glib/guuid.h>
+#include <glib/gvarianttype.h>
+#include <glib/gvariant.h>
+#include <glib/gversion.h>
+#include <glib/gversionmacros.h>
+#ifdef G_PLATFORM_WIN32
+#include <glib/gwin32.h>
+#endif
+
+#include <glib/deprecated/gallocator.h>
+#include <glib/deprecated/gcache.h>
+#include <glib/deprecated/gcompletion.h>
+#include <glib/deprecated/gmain.h>
+#include <glib/deprecated/grel.h>
+#include <glib/deprecated/gthread.h>
+
+#include <glib/glib-autocleanups.h>
+
+#undef __GLIB_H_INSIDE__
+
+#endif /* __G_LIB_H__ */
diff --git a/include/glib/glib/deprecated/gallocator.h b/include/glib/glib/deprecated/gallocator.h
new file mode 100644
index 0000000000..005e92b6eb
--- /dev/null
+++ b/include/glib/glib/deprecated/gallocator.h
@@ -0,0 +1,88 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_ALLOCATOR_H__
+#define __G_ALLOCATOR_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GAllocator GAllocator;
+typedef struct _GMemChunk GMemChunk;
+
+#define G_ALLOC_ONLY 1
+#define G_ALLOC_AND_FREE 2
+#define G_ALLOCATOR_LIST 1
+#define G_ALLOCATOR_SLIST 2
+#define G_ALLOCATOR_NODE 3
+
+#define g_chunk_new(type, chunk) ((type *) g_mem_chunk_alloc (chunk))
+#define g_chunk_new0(type, chunk) ((type *) g_mem_chunk_alloc0 (chunk))
+#define g_chunk_free(mem, mem_chunk) (g_mem_chunk_free (mem_chunk, mem))
+#define g_mem_chunk_create(type, x, y) (g_mem_chunk_new (NULL, sizeof (type), 0, 0))
+
+
+GLIB_DEPRECATED
+GMemChunk * g_mem_chunk_new (const gchar *name,
+ gint atom_size,
+ gsize area_size,
+ gint type);
+GLIB_DEPRECATED
+void g_mem_chunk_destroy (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+void g_mem_chunk_free (GMemChunk *mem_chunk,
+ gpointer mem);
+GLIB_DEPRECATED
+void g_mem_chunk_clean (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+void g_mem_chunk_reset (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+void g_mem_chunk_print (GMemChunk *mem_chunk);
+GLIB_DEPRECATED
+void g_mem_chunk_info (void);
+GLIB_DEPRECATED
+void g_blow_chunks (void);
+
+
+GLIB_DEPRECATED
+GAllocator * g_allocator_new (const gchar *name,
+ guint n_preallocs);
+GLIB_DEPRECATED
+void g_allocator_free (GAllocator *allocator);
+GLIB_DEPRECATED
+void g_list_push_allocator (GAllocator *allocator);
+GLIB_DEPRECATED
+void g_list_pop_allocator (void);
+GLIB_DEPRECATED
+void g_slist_push_allocator (GAllocator *allocator);
+GLIB_DEPRECATED
+void g_slist_pop_allocator (void);
+GLIB_DEPRECATED
+void g_node_push_allocator (GAllocator *allocator);
+GLIB_DEPRECATED
+void g_node_pop_allocator (void);
+
+G_END_DECLS
+
+#endif /* __G_ALLOCATOR_H__ */
diff --git a/include/glib/glib/deprecated/gcache.h b/include/glib/glib/deprecated/gcache.h
new file mode 100644
index 0000000000..e1c1f2cde6
--- /dev/null
+++ b/include/glib/glib/deprecated/gcache.h
@@ -0,0 +1,75 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CACHE_H__
+#define __G_CACHE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GCache GCache GLIB_DEPRECATED_TYPE_IN_2_26_FOR(GHashTable);
+
+typedef gpointer (*GCacheNewFunc) (gpointer key) GLIB_DEPRECATED_TYPE_IN_2_26;
+typedef gpointer (*GCacheDupFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26;
+typedef void (*GCacheDestroyFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26;
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+/* Caches
+ */
+GLIB_DEPRECATED
+GCache* g_cache_new (GCacheNewFunc value_new_func,
+ GCacheDestroyFunc value_destroy_func,
+ GCacheDupFunc key_dup_func,
+ GCacheDestroyFunc key_destroy_func,
+ GHashFunc hash_key_func,
+ GHashFunc hash_value_func,
+ GEqualFunc key_equal_func);
+GLIB_DEPRECATED
+void g_cache_destroy (GCache *cache);
+GLIB_DEPRECATED
+gpointer g_cache_insert (GCache *cache,
+ gpointer key);
+GLIB_DEPRECATED
+void g_cache_remove (GCache *cache,
+ gconstpointer value);
+GLIB_DEPRECATED
+void g_cache_key_foreach (GCache *cache,
+ GHFunc func,
+ gpointer user_data);
+GLIB_DEPRECATED
+void g_cache_value_foreach (GCache *cache,
+ GHFunc func,
+ gpointer user_data);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+G_END_DECLS
+
+#endif /* __G_CACHE_H__ */
diff --git a/include/glib/glib/deprecated/gcompletion.h b/include/glib/glib/deprecated/gcompletion.h
new file mode 100644
index 0000000000..2fd1f0393f
--- /dev/null
+++ b/include/glib/glib/deprecated/gcompletion.h
@@ -0,0 +1,83 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_COMPLETION_H__
+#define __G_COMPLETION_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GCompletion GCompletion;
+
+typedef gchar* (*GCompletionFunc) (gpointer);
+
+/* GCompletion
+ */
+
+typedef gint (*GCompletionStrncmpFunc) (const gchar *s1,
+ const gchar *s2,
+ gsize n);
+
+struct _GCompletion
+{
+ GList* items;
+ GCompletionFunc func;
+
+ gchar* prefix;
+ GList* cache;
+ GCompletionStrncmpFunc strncmp_func;
+};
+
+GLIB_DEPRECATED_IN_2_26
+GCompletion* g_completion_new (GCompletionFunc func);
+GLIB_DEPRECATED_IN_2_26
+void g_completion_add_items (GCompletion* cmp,
+ GList* items);
+GLIB_DEPRECATED_IN_2_26
+void g_completion_remove_items (GCompletion* cmp,
+ GList* items);
+GLIB_DEPRECATED_IN_2_26
+void g_completion_clear_items (GCompletion* cmp);
+GLIB_DEPRECATED_IN_2_26
+GList* g_completion_complete (GCompletion* cmp,
+ const gchar* prefix,
+ gchar** new_prefix);
+GLIB_DEPRECATED_IN_2_26
+GList* g_completion_complete_utf8 (GCompletion *cmp,
+ const gchar* prefix,
+ gchar** new_prefix);
+GLIB_DEPRECATED_IN_2_26
+void g_completion_set_compare (GCompletion *cmp,
+ GCompletionStrncmpFunc strncmp_func);
+GLIB_DEPRECATED_IN_2_26
+void g_completion_free (GCompletion* cmp);
+
+G_END_DECLS
+
+#endif /* __G_COMPLETION_H__ */
diff --git a/include/glib/glib/deprecated/gmain.h b/include/glib/glib/deprecated/gmain.h
new file mode 100644
index 0000000000..2199328fd2
--- /dev/null
+++ b/include/glib/glib/deprecated/gmain.h
@@ -0,0 +1,135 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_DEPRECATED_MAIN_H__
+#define __G_DEPRECATED_MAIN_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmain.h>
+
+G_BEGIN_DECLS
+
+/* ============== Compat main loop stuff ================== */
+
+/**
+ * g_main_new:
+ * @is_running: set to %TRUE to indicate that the loop is running. This
+ * is not very important since calling g_main_run() will set this
+ * to %TRUE anyway.
+ *
+ * Creates a new #GMainLoop for th default main context.
+ *
+ * Returns: a new #GMainLoop
+ *
+ * Deprecated: 2.2: Use g_main_loop_new() instead
+ */
+#define g_main_new(is_running) g_main_loop_new (NULL, is_running) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_new)
+
+/**
+ * g_main_run:
+ * @loop: a #GMainLoop
+ *
+ * Runs a main loop until it stops running.
+ *
+ * Deprecated: 2.2: Use g_main_loop_run() instead
+ */
+#define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run)
+
+/**
+ * g_main_quit:
+ * @loop: a #GMainLoop
+ *
+ * Stops the #GMainLoop.
+ * If g_main_run() was called to run the #GMainLoop, it will now return.
+ *
+ * Deprecated: 2.2: Use g_main_loop_quit() instead
+ */
+#define g_main_quit(loop) g_main_loop_quit(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_quit)
+
+/**
+ * g_main_destroy:
+ * @loop: a #GMainLoop
+ *
+ * Frees the memory allocated for the #GMainLoop.
+ *
+ * Deprecated: 2.2: Use g_main_loop_unref() instead
+ */
+#define g_main_destroy(loop) g_main_loop_unref(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_unref)
+
+/**
+ * g_main_is_running:
+ * @loop: a #GMainLoop
+ *
+ * Checks if the main loop is running.
+ *
+ * Returns: %TRUE if the main loop is running
+ *
+ * Deprecated: 2.2: Use g_main_loop_is_running() instead
+ */
+#define g_main_is_running(loop) g_main_loop_is_running(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_is_running)
+
+/**
+ * g_main_iteration:
+ * @may_block: set to %TRUE if it should block (i.e. wait) until an event
+ * source becomes ready. It will return after an event source has been
+ * processed. If set to %FALSE it will return immediately if no event
+ * source is ready to be processed.
+ *
+ * Runs a single iteration for the default #GMainContext.
+ *
+ * Returns: %TRUE if more events are pending.
+ *
+ * Deprecated: 2.2: Use g_main_context_iteration() instead.
+ */
+#define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_iteration)
+
+/**
+ * g_main_pending:
+ *
+ * Checks if any events are pending for the default #GMainContext
+ * (i.e. ready to be processed).
+ *
+ * Returns: %TRUE if any events are pending.
+ *
+ * Deprected: 2.2: Use g_main_context_pending() instead.
+ */
+#define g_main_pending() g_main_context_pending (NULL) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_pending)
+
+/**
+ * g_main_set_poll_func:
+ * @func: the function to call to poll all file descriptors
+ *
+ * Sets the function to use for the handle polling of file descriptors
+ * for the default main context.
+ *
+ * Deprecated: 2.2: Use g_main_context_set_poll_func() again
+ */
+#define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_set_poll_func)
+
+G_END_DECLS
+
+#endif /* __G_DEPRECATED_MAIN_H__ */
diff --git a/include/glib/glib/deprecated/grel.h b/include/glib/glib/deprecated/grel.h
new file mode 100644
index 0000000000..3a65240c1f
--- /dev/null
+++ b/include/glib/glib/deprecated/grel.h
@@ -0,0 +1,105 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_REL_H__
+#define __G_REL_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GRelation GRelation;
+typedef struct _GTuples GTuples;
+
+struct _GTuples
+{
+ guint len;
+};
+
+/* GRelation
+ *
+ * Indexed Relations. Imagine a really simple table in a
+ * database. Relations are not ordered. This data type is meant for
+ * maintaining a N-way mapping.
+ *
+ * g_relation_new() creates a relation with FIELDS fields
+ *
+ * g_relation_destroy() frees all resources
+ * g_tuples_destroy() frees the result of g_relation_select()
+ *
+ * g_relation_index() indexes relation FIELD with the provided
+ * equality and hash functions. this must be done before any
+ * calls to insert are made.
+ *
+ * g_relation_insert() inserts a new tuple. you are expected to
+ * provide the right number of fields.
+ *
+ * g_relation_delete() deletes all relations with KEY in FIELD
+ * g_relation_select() returns ...
+ * g_relation_count() counts ...
+ */
+
+GLIB_DEPRECATED_IN_2_26
+GRelation* g_relation_new (gint fields);
+GLIB_DEPRECATED_IN_2_26
+void g_relation_destroy (GRelation *relation);
+GLIB_DEPRECATED_IN_2_26
+void g_relation_index (GRelation *relation,
+ gint field,
+ GHashFunc hash_func,
+ GEqualFunc key_equal_func);
+GLIB_DEPRECATED_IN_2_26
+void g_relation_insert (GRelation *relation,
+ ...);
+GLIB_DEPRECATED_IN_2_26
+gint g_relation_delete (GRelation *relation,
+ gconstpointer key,
+ gint field);
+GLIB_DEPRECATED_IN_2_26
+GTuples* g_relation_select (GRelation *relation,
+ gconstpointer key,
+ gint field);
+GLIB_DEPRECATED_IN_2_26
+gint g_relation_count (GRelation *relation,
+ gconstpointer key,
+ gint field);
+GLIB_DEPRECATED_IN_2_26
+gboolean g_relation_exists (GRelation *relation,
+ ...);
+GLIB_DEPRECATED_IN_2_26
+void g_relation_print (GRelation *relation);
+GLIB_DEPRECATED_IN_2_26
+void g_tuples_destroy (GTuples *tuples);
+GLIB_DEPRECATED_IN_2_26
+gpointer g_tuples_index (GTuples *tuples,
+ gint index_,
+ gint field);
+
+G_END_DECLS
+
+#endif /* __G_REL_H__ */
diff --git a/include/glib/glib/deprecated/gthread.h b/include/glib/glib/deprecated/gthread.h
new file mode 100644
index 0000000000..33b422240d
--- /dev/null
+++ b/include/glib/glib/deprecated/gthread.h
@@ -0,0 +1,289 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_DEPRECATED_THREAD_H__
+#define __G_DEPRECATED_THREAD_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+typedef enum
+{
+ G_THREAD_PRIORITY_LOW,
+ G_THREAD_PRIORITY_NORMAL,
+ G_THREAD_PRIORITY_HIGH,
+ G_THREAD_PRIORITY_URGENT
+} GThreadPriority GLIB_DEPRECATED_TYPE_IN_2_32;
+
+struct _GThread
+{
+ /*< private >*/
+ GThreadFunc func;
+ gpointer data;
+ gboolean joinable;
+ GThreadPriority priority;
+};
+
+typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32;
+struct _GThreadFunctions
+{
+ GMutex* (*mutex_new) (void);
+ void (*mutex_lock) (GMutex *mutex);
+ gboolean (*mutex_trylock) (GMutex *mutex);
+ void (*mutex_unlock) (GMutex *mutex);
+ void (*mutex_free) (GMutex *mutex);
+ GCond* (*cond_new) (void);
+ void (*cond_signal) (GCond *cond);
+ void (*cond_broadcast) (GCond *cond);
+ void (*cond_wait) (GCond *cond,
+ GMutex *mutex);
+ gboolean (*cond_timed_wait) (GCond *cond,
+ GMutex *mutex,
+ GTimeVal *end_time);
+ void (*cond_free) (GCond *cond);
+ GPrivate* (*private_new) (GDestroyNotify destructor);
+ gpointer (*private_get) (GPrivate *private_key);
+ void (*private_set) (GPrivate *private_key,
+ gpointer data);
+ void (*thread_create) (GThreadFunc func,
+ gpointer data,
+ gulong stack_size,
+ gboolean joinable,
+ gboolean bound,
+ GThreadPriority priority,
+ gpointer thread,
+ GError **error);
+ void (*thread_yield) (void);
+ void (*thread_join) (gpointer thread);
+ void (*thread_exit) (void);
+ void (*thread_set_priority)(gpointer thread,
+ GThreadPriority priority);
+ void (*thread_self) (gpointer thread);
+ gboolean (*thread_equal) (gpointer thread1,
+ gpointer thread2);
+} GLIB_DEPRECATED_TYPE_IN_2_32;
+
+GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
+GLIB_VAR gboolean g_thread_use_default_impl;
+
+GLIB_VAR guint64 (*g_thread_gettime) (void);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
+GThread *g_thread_create (GThreadFunc func,
+ gpointer data,
+ gboolean joinable,
+ GError **error);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new)
+GThread *g_thread_create_full (GThreadFunc func,
+ gpointer data,
+ gulong stack_size,
+ gboolean joinable,
+ gboolean bound,
+ GThreadPriority priority,
+ GError **error);
+
+GLIB_DEPRECATED_IN_2_32
+void g_thread_set_priority (GThread *thread,
+ GThreadPriority priority);
+
+GLIB_DEPRECATED_IN_2_32
+void g_thread_foreach (GFunc thread_func,
+ gpointer user_data);
+
+#ifndef G_OS_WIN32
+#include <sys/types.h>
+#include <pthread.h>
+#endif
+
+#define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl GLIB_DEPRECATED_MACRO_IN_2_32
+#define G_STATIC_MUTEX_INIT { NULL } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_init)
+typedef struct
+{
+ GMutex *mutex;
+#ifndef G_OS_WIN32
+ /* only for ABI compatibility reasons */
+ pthread_mutex_t unused;
+#endif
+} GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
+
+#define g_static_mutex_lock(mutex) \
+ g_mutex_lock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_lock)
+#define g_static_mutex_trylock(mutex) \
+ g_mutex_trylock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_trylock)
+#define g_static_mutex_unlock(mutex) \
+ g_mutex_unlock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_unlock)
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init)
+void g_static_mutex_init (GStaticMutex *mutex);
+GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear)
+void g_static_mutex_free (GStaticMutex *mutex);
+GLIB_DEPRECATED_IN_2_32_FOR(GMutex)
+GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex);
+
+typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
+struct _GStaticRecMutex
+{
+ /*< private >*/
+ GStaticMutex mutex;
+ guint depth;
+
+ /* ABI compat only */
+ union {
+#ifdef G_OS_WIN32
+ void *owner;
+#else
+ pthread_t owner;
+#endif
+ gdouble dummy;
+ } unused;
+} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
+
+#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init)
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init)
+void g_static_rec_mutex_init (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock)
+void g_static_rec_mutex_lock (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock)
+gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock)
+void g_static_rec_mutex_unlock (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32
+void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
+ guint depth);
+
+GLIB_DEPRECATED_IN_2_32
+guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free)
+void g_static_rec_mutex_free (GStaticRecMutex *mutex);
+
+typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
+struct _GStaticRWLock
+{
+ /*< private >*/
+ GStaticMutex mutex;
+ GCond *read_cond;
+ GCond *write_cond;
+ guint read_counter;
+ gboolean have_writer;
+ guint want_to_read;
+ guint want_to_write;
+} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
+
+#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rw_lock_init)
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init)
+void g_static_rw_lock_init (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock)
+void g_static_rw_lock_reader_lock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock)
+gboolean g_static_rw_lock_reader_trylock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock)
+void g_static_rw_lock_reader_unlock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock)
+void g_static_rw_lock_writer_lock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock)
+gboolean g_static_rw_lock_writer_trylock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock)
+void g_static_rw_lock_writer_unlock (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free)
+void g_static_rw_lock_free (GStaticRWLock *lock);
+
+GLIB_DEPRECATED_IN_2_32
+GPrivate * g_private_new (GDestroyNotify notify);
+
+typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
+struct _GStaticPrivate
+{
+ /*< private >*/
+ guint index;
+} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
+
+#define G_STATIC_PRIVATE_INIT { 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_PRIVATE_INIT)
+GLIB_DEPRECATED_IN_2_32
+void g_static_private_init (GStaticPrivate *private_key);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_private_get)
+gpointer g_static_private_get (GStaticPrivate *private_key);
+
+GLIB_DEPRECATED_IN_2_32_FOR(g_private_set)
+void g_static_private_set (GStaticPrivate *private_key,
+ gpointer data,
+ GDestroyNotify notify);
+
+GLIB_DEPRECATED_IN_2_32
+void g_static_private_free (GStaticPrivate *private_key);
+
+GLIB_DEPRECATED_IN_2_32
+gboolean g_once_init_enter_impl (volatile gsize *location);
+
+GLIB_DEPRECATED_IN_2_32
+void g_thread_init (gpointer vtable);
+GLIB_DEPRECATED_IN_2_32
+void g_thread_init_with_errorcheck_mutexes (gpointer vtable);
+
+GLIB_DEPRECATED_IN_2_32
+gboolean g_thread_get_initialized (void);
+
+GLIB_VAR gboolean g_threads_got_initialized;
+
+#define g_thread_supported() (1) GLIB_DEPRECATED_MACRO_IN_2_32
+
+GLIB_DEPRECATED_IN_2_32
+GMutex * g_mutex_new (void);
+GLIB_DEPRECATED_IN_2_32
+void g_mutex_free (GMutex *mutex);
+GLIB_DEPRECATED_IN_2_32
+GCond * g_cond_new (void);
+GLIB_DEPRECATED_IN_2_32
+void g_cond_free (GCond *cond);
+GLIB_DEPRECATED_IN_2_32
+gboolean g_cond_timed_wait (GCond *cond,
+ GMutex *mutex,
+ GTimeVal *timeval);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+G_END_DECLS
+
+#endif /* __G_DEPRECATED_THREAD_H__ */
diff --git a/include/glib/glib/galloca.h b/include/glib/glib/galloca.h
new file mode 100644
index 0000000000..47151ee8b6
--- /dev/null
+++ b/include/glib/glib/galloca.h
@@ -0,0 +1,103 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_ALLOCA_H__
+#define __G_ALLOCA_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+#if defined(__BIONIC__) && defined (GLIB_HAVE_ALLOCA_H)
+# include <alloca.h>
+#elif defined(__GNUC__)
+/* GCC does the right thing */
+# undef alloca
+# define alloca(size) __builtin_alloca (size)
+#elif defined (GLIB_HAVE_ALLOCA_H)
+/* a native and working alloca.h is there */
+# include <alloca.h>
+#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */
+# if defined(_MSC_VER) || defined(__DMC__)
+# include <malloc.h>
+# define alloca _alloca
+# else /* !_MSC_VER && !__DMC__ */
+# ifdef _AIX
+# pragma alloca
+# else /* !_AIX */
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+G_BEGIN_DECLS
+char *alloca ();
+G_END_DECLS
+# endif /* !alloca */
+# endif /* !_AIX */
+# endif /* !_MSC_VER && !__DMC__ */
+#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */
+
+/**
+ * g_alloca:
+ * @size: number of bytes to allocate.
+ *
+ * Allocates @size bytes on the stack; these bytes will be freed when the current
+ * stack frame is cleaned up. This macro essentially just wraps the alloca()
+ * function present on most UNIX variants.
+ * Thus it provides the same advantages and pitfalls as alloca():
+ *
+ * - alloca() is very fast, as on most systems it's implemented by just adjusting
+ * the stack pointer register.
+ *
+ * - It doesn't cause any memory fragmentation, within its scope, separate alloca()
+ * blocks just build up and are released together at function end.
+ *
+ * - Allocation sizes have to fit into the current stack frame. For instance in a
+ * threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes,
+ * so be sparse with alloca() uses.
+ *
+ * - Allocation failure due to insufficient stack space is not indicated with a %NULL
+ * return like e.g. with malloc(). Instead, most systems probably handle it the same
+ * way as out of stack space situations from infinite function recursion, i.e.
+ * with a segmentation fault.
+ *
+ * - Special care has to be taken when mixing alloca() with GNU C variable sized arrays.
+ * Stack space allocated with alloca() in the same scope as a variable sized array
+ * will be freed together with the variable sized array upon exit of that scope, and
+ * not upon exit of the enclosing function scope.
+ *
+ * Returns: space for @size bytes, allocated on the stack
+ */
+#define g_alloca(size) alloca (size)
+/**
+ * g_newa:
+ * @struct_type: Type of memory chunks to be allocated
+ * @n_structs: Number of chunks to be allocated
+ *
+ * Wraps g_alloca() in a more typesafe manner.
+ *
+ * Returns: Pointer to stack space for @n_structs chunks of type @struct_type
+ */
+#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs)))
+
+#endif /* __G_ALLOCA_H__ */
diff --git a/include/glib/glib/garray.h b/include/glib/glib/garray.h
new file mode 100644
index 0000000000..3e7ce77321
--- /dev/null
+++ b/include/glib/glib/garray.h
@@ -0,0 +1,272 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_ARRAY_H__
+#define __G_ARRAY_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GBytes GBytes;
+typedef struct _GArray GArray;
+typedef struct _GByteArray GByteArray;
+typedef struct _GPtrArray GPtrArray;
+
+struct _GArray
+{
+ gchar *data;
+ guint len;
+};
+
+struct _GByteArray
+{
+ guint8 *data;
+ guint len;
+};
+
+struct _GPtrArray
+{
+ gpointer *pdata;
+ guint len;
+};
+
+/* Resizable arrays. remove fills any cleared spot and shortens the
+ * array, while preserving the order. remove_fast will distort the
+ * order by moving the last element to the position of the removed.
+ */
+
+#define g_array_append_val(a,v) g_array_append_vals (a, &(v), 1)
+#define g_array_prepend_val(a,v) g_array_prepend_vals (a, &(v), 1)
+#define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &(v), 1)
+#define g_array_index(a,t,i) (((t*) (void *) (a)->data) [(i)])
+
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_sized_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size,
+ guint reserved_size);
+GLIB_AVAILABLE_IN_2_62
+GArray* g_array_copy (GArray *array);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_array_free (GArray *array,
+ gboolean free_segment);
+GLIB_AVAILABLE_IN_ALL
+GArray *g_array_ref (GArray *array);
+GLIB_AVAILABLE_IN_ALL
+void g_array_unref (GArray *array);
+GLIB_AVAILABLE_IN_ALL
+guint g_array_get_element_size (GArray *array);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_append_vals (GArray *array,
+ gconstpointer data,
+ guint len);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_prepend_vals (GArray *array,
+ gconstpointer data,
+ guint len);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_insert_vals (GArray *array,
+ guint index_,
+ gconstpointer data,
+ guint len);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_set_size (GArray *array,
+ guint length);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_remove_index (GArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_remove_index_fast (GArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+GArray* g_array_remove_range (GArray *array,
+ guint index_,
+ guint length);
+GLIB_AVAILABLE_IN_ALL
+void g_array_sort (GArray *array,
+ GCompareFunc compare_func);
+GLIB_AVAILABLE_IN_ALL
+void g_array_sort_with_data (GArray *array,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_62
+gboolean g_array_binary_search (GArray *array,
+ gconstpointer target,
+ GCompareFunc compare_func,
+ guint *out_match_index);
+GLIB_AVAILABLE_IN_ALL
+void g_array_set_clear_func (GArray *array,
+ GDestroyNotify clear_func);
+
+/* Resizable pointer array. This interface is much less complicated
+ * than the above. Add appends a pointer. Remove fills any cleared
+ * spot and shortens the array. remove_fast will again distort order.
+ */
+#define g_ptr_array_index(array,index_) ((array)->pdata)[index_]
+GLIB_AVAILABLE_IN_ALL
+GPtrArray* g_ptr_array_new (void);
+GLIB_AVAILABLE_IN_ALL
+GPtrArray* g_ptr_array_new_with_free_func (GDestroyNotify element_free_func);
+GLIB_AVAILABLE_IN_2_62
+GPtrArray *g_ptr_array_copy (GPtrArray *array,
+ GCopyFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GPtrArray* g_ptr_array_sized_new (guint reserved_size);
+GLIB_AVAILABLE_IN_ALL
+GPtrArray* g_ptr_array_new_full (guint reserved_size,
+ GDestroyNotify element_free_func);
+GLIB_AVAILABLE_IN_ALL
+gpointer* g_ptr_array_free (GPtrArray *array,
+ gboolean free_seg);
+GLIB_AVAILABLE_IN_ALL
+GPtrArray* g_ptr_array_ref (GPtrArray *array);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_unref (GPtrArray *array);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_set_free_func (GPtrArray *array,
+ GDestroyNotify element_free_func);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_set_size (GPtrArray *array,
+ gint length);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_ptr_array_remove_index (GPtrArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_ptr_array_remove_index_fast (GPtrArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_ptr_array_steal_index (GPtrArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_ptr_array_steal_index_fast (GPtrArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_ptr_array_remove (GPtrArray *array,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_ptr_array_remove_fast (GPtrArray *array,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GPtrArray *g_ptr_array_remove_range (GPtrArray *array,
+ guint index_,
+ guint length);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_add (GPtrArray *array,
+ gpointer data);
+GLIB_AVAILABLE_IN_2_62
+void g_ptr_array_extend (GPtrArray *array_to_extend,
+ GPtrArray *array,
+ GCopyFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_62
+void g_ptr_array_extend_and_steal (GPtrArray *array_to_extend,
+ GPtrArray *array);
+GLIB_AVAILABLE_IN_2_40
+void g_ptr_array_insert (GPtrArray *array,
+ gint index_,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_sort (GPtrArray *array,
+ GCompareFunc compare_func);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_sort_with_data (GPtrArray *array,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_ptr_array_foreach (GPtrArray *array,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_54
+gboolean g_ptr_array_find (GPtrArray *haystack,
+ gconstpointer needle,
+ guint *index_);
+GLIB_AVAILABLE_IN_2_54
+gboolean g_ptr_array_find_with_equal_func (GPtrArray *haystack,
+ gconstpointer needle,
+ GEqualFunc equal_func,
+ guint *index_);
+
+
+/* Byte arrays, an array of guint8. Implemented as a GArray,
+ * but type-safe.
+ */
+
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_new (void);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_new_take (guint8 *data,
+ gsize len);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_sized_new (guint reserved_size);
+GLIB_AVAILABLE_IN_ALL
+guint8* g_byte_array_free (GByteArray *array,
+ gboolean free_segment);
+GLIB_AVAILABLE_IN_ALL
+GBytes* g_byte_array_free_to_bytes (GByteArray *array);
+GLIB_AVAILABLE_IN_ALL
+GByteArray *g_byte_array_ref (GByteArray *array);
+GLIB_AVAILABLE_IN_ALL
+void g_byte_array_unref (GByteArray *array);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_append (GByteArray *array,
+ const guint8 *data,
+ guint len);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_prepend (GByteArray *array,
+ const guint8 *data,
+ guint len);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_set_size (GByteArray *array,
+ guint length);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_remove_index (GByteArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_remove_index_fast (GByteArray *array,
+ guint index_);
+GLIB_AVAILABLE_IN_ALL
+GByteArray* g_byte_array_remove_range (GByteArray *array,
+ guint index_,
+ guint length);
+GLIB_AVAILABLE_IN_ALL
+void g_byte_array_sort (GByteArray *array,
+ GCompareFunc compare_func);
+GLIB_AVAILABLE_IN_ALL
+void g_byte_array_sort_with_data (GByteArray *array,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_ARRAY_H__ */
diff --git a/include/glib/glib/gasyncqueue.h b/include/glib/glib/gasyncqueue.h
new file mode 100644
index 0000000000..73e537b079
--- /dev/null
+++ b/include/glib/glib/gasyncqueue.h
@@ -0,0 +1,124 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_ASYNCQUEUE_H__
+#define __G_ASYNCQUEUE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GAsyncQueue GAsyncQueue;
+
+GLIB_AVAILABLE_IN_ALL
+GAsyncQueue *g_async_queue_new (void);
+GLIB_AVAILABLE_IN_ALL
+GAsyncQueue *g_async_queue_new_full (GDestroyNotify item_free_func);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_lock (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_unlock (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GAsyncQueue *g_async_queue_ref (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_unref (GAsyncQueue *queue);
+
+GLIB_DEPRECATED_FOR(g_async_queue_ref)
+void g_async_queue_ref_unlocked (GAsyncQueue *queue);
+
+GLIB_DEPRECATED_FOR(g_async_queue_unref)
+void g_async_queue_unref_and_unlock (GAsyncQueue *queue);
+
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_push (GAsyncQueue *queue,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_push_unlocked (GAsyncQueue *queue,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_push_sorted (GAsyncQueue *queue,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_pop (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_try_pop (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_timeout_pop (GAsyncQueue *queue,
+ guint64 timeout);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_async_queue_timeout_pop_unlocked (GAsyncQueue *queue,
+ guint64 timeout);
+GLIB_AVAILABLE_IN_ALL
+gint g_async_queue_length (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gint g_async_queue_length_unlocked (GAsyncQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_sort (GAsyncQueue *queue,
+ GCompareDataFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_async_queue_sort_unlocked (GAsyncQueue *queue,
+ GCompareDataFunc func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_46
+gboolean g_async_queue_remove (GAsyncQueue *queue,
+ gpointer item);
+GLIB_AVAILABLE_IN_2_46
+gboolean g_async_queue_remove_unlocked (GAsyncQueue *queue,
+ gpointer item);
+GLIB_AVAILABLE_IN_2_46
+void g_async_queue_push_front (GAsyncQueue *queue,
+ gpointer item);
+GLIB_AVAILABLE_IN_2_46
+void g_async_queue_push_front_unlocked (GAsyncQueue *queue,
+ gpointer item);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop)
+gpointer g_async_queue_timed_pop (GAsyncQueue *queue,
+ GTimeVal *end_time);
+GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop_unlocked)
+gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue,
+ GTimeVal *end_time);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+G_END_DECLS
+
+#endif /* __G_ASYNCQUEUE_H__ */
diff --git a/include/glib/glib/gatomic.h b/include/glib/glib/gatomic.h
new file mode 100644
index 0000000000..971176eb99
--- /dev/null
+++ b/include/glib/glib/gatomic.h
@@ -0,0 +1,291 @@
+/*
+ * Copyright © 2011 Ryan Lortie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_ATOMIC_H__
+#define __G_ATOMIC_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gint g_atomic_int_get (const volatile gint *atomic);
+GLIB_AVAILABLE_IN_ALL
+void g_atomic_int_set (volatile gint *atomic,
+ gint newval);
+GLIB_AVAILABLE_IN_ALL
+void g_atomic_int_inc (volatile gint *atomic);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_atomic_int_dec_and_test (volatile gint *atomic);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval);
+GLIB_AVAILABLE_IN_ALL
+gint g_atomic_int_add (volatile gint *atomic,
+ gint val);
+GLIB_AVAILABLE_IN_2_30
+guint g_atomic_int_and (volatile guint *atomic,
+ guint val);
+GLIB_AVAILABLE_IN_2_30
+guint g_atomic_int_or (volatile guint *atomic,
+ guint val);
+GLIB_AVAILABLE_IN_ALL
+guint g_atomic_int_xor (volatile guint *atomic,
+ guint val);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_atomic_pointer_get (const volatile void *atomic);
+GLIB_AVAILABLE_IN_ALL
+void g_atomic_pointer_set (volatile void *atomic,
+ gpointer newval);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_atomic_pointer_compare_and_exchange (volatile void *atomic,
+ gpointer oldval,
+ gpointer newval);
+GLIB_AVAILABLE_IN_ALL
+gssize g_atomic_pointer_add (volatile void *atomic,
+ gssize val);
+GLIB_AVAILABLE_IN_2_30
+gsize g_atomic_pointer_and (volatile void *atomic,
+ gsize val);
+GLIB_AVAILABLE_IN_2_30
+gsize g_atomic_pointer_or (volatile void *atomic,
+ gsize val);
+GLIB_AVAILABLE_IN_ALL
+gsize g_atomic_pointer_xor (volatile void *atomic,
+ gsize val);
+
+GLIB_DEPRECATED_IN_2_30_FOR(g_atomic_int_add)
+gint g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val);
+
+G_END_DECLS
+
+#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+
+/* We prefer the new C11-style atomic extension of GCC if available */
+#if defined(__ATOMIC_SEQ_CST) && !defined(__clang__)
+
+/* This assumes sizeof(int) is 4: gatomic.c statically
+ * asserts that (using G_STATIC_ASSERT at top-level in a header was
+ * problematic, see #730932) */
+
+#define g_atomic_int_get(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ *(atomic) : 1); \
+ (gint) __atomic_load_4 ((atomic), __ATOMIC_SEQ_CST); \
+ }))
+#define g_atomic_int_set(atomic, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (newval) : 1); \
+ __atomic_store_4 ((atomic), (newval), __ATOMIC_SEQ_CST); \
+ }))
+
+#if GLIB_SIZEOF_VOID_P == 8
+
+#define g_atomic_pointer_get(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ guint64 gapg_temp = __atomic_load_8 ((atomic), __ATOMIC_SEQ_CST); \
+ (gpointer) gapg_temp; \
+ }))
+#define g_atomic_pointer_set(atomic, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ __atomic_store_8 ((atomic), (gsize) (newval), __ATOMIC_SEQ_CST); \
+ }))
+
+#else /* GLIB_SIZEOF_VOID_P == 8 */
+
+/* This assumes that if sizeof(void *) is not 8, then it is 4:
+ * gatomic.c statically asserts that (using G_STATIC_ASSERT
+ * at top-level in a header was problematic, see #730932) */
+
+#define g_atomic_pointer_get(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ guint32 gapg_temp = __atomic_load_4 ((atomic), __ATOMIC_SEQ_CST); \
+ (gpointer) gapg_temp; \
+ }))
+#define g_atomic_pointer_set(atomic, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ __atomic_store_4 ((atomic), (gsize) (newval), __ATOMIC_SEQ_CST); \
+ }))
+
+#endif /* GLIB_SIZEOF_VOID_P == 8 */
+
+#else /* defined(__ATOMIC_SEQ_CST) */
+
+#define g_atomic_int_get(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ *(atomic) : 1); \
+ __sync_synchronize (); \
+ (gint) *(atomic); \
+ }))
+#define g_atomic_int_set(atomic, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (newval) : 1); \
+ *(atomic) = (newval); \
+ __sync_synchronize (); \
+ }))
+#define g_atomic_pointer_get(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ __sync_synchronize (); \
+ (gpointer) *(atomic); \
+ }))
+#define g_atomic_pointer_set(atomic, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ *(atomic) = (__typeof__ (*(atomic))) (gsize) (newval); \
+ __sync_synchronize (); \
+ }))
+
+#endif /* !defined(__ATOMIC_SEQ_CST) */
+
+#define g_atomic_int_inc(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ *(atomic) : 1); \
+ (void) __sync_fetch_and_add ((atomic), 1); \
+ }))
+#define g_atomic_int_dec_and_test(atomic) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ *(atomic) : 1); \
+ __sync_fetch_and_sub ((atomic), 1) == 1; \
+ }))
+#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 1); \
+ __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \
+ }))
+#define g_atomic_int_add(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (val) : 1); \
+ (gint) __sync_fetch_and_add ((atomic), (val)); \
+ }))
+#define g_atomic_int_and(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (val) : 1); \
+ (guint) __sync_fetch_and_and ((atomic), (val)); \
+ }))
+#define g_atomic_int_or(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (val) : 1); \
+ (guint) __sync_fetch_and_or ((atomic), (val)); \
+ }))
+#define g_atomic_int_xor(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
+ (void) (0 ? *(atomic) ^ (val) : 1); \
+ (guint) __sync_fetch_and_xor ((atomic), (val)); \
+ }))
+
+#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \
+ }))
+#define g_atomic_pointer_add(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ (void) (0 ? (val) ^ (val) : 1); \
+ (gssize) __sync_fetch_and_add ((atomic), (val)); \
+ }))
+#define g_atomic_pointer_and(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ (void) (0 ? (val) ^ (val) : 1); \
+ (gsize) __sync_fetch_and_and ((atomic), (val)); \
+ }))
+#define g_atomic_pointer_or(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ (void) (0 ? (val) ^ (val) : 1); \
+ (gsize) __sync_fetch_and_or ((atomic), (val)); \
+ }))
+#define g_atomic_pointer_xor(atomic, val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(atomic) : NULL); \
+ (void) (0 ? (val) ^ (val) : 1); \
+ (gsize) __sync_fetch_and_xor ((atomic), (val)); \
+ }))
+
+#else /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */
+
+#define g_atomic_int_get(atomic) \
+ (g_atomic_int_get ((gint *) (atomic)))
+#define g_atomic_int_set(atomic, newval) \
+ (g_atomic_int_set ((gint *) (atomic), (gint) (newval)))
+#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \
+ (g_atomic_int_compare_and_exchange ((gint *) (atomic), (oldval), (newval)))
+#define g_atomic_int_add(atomic, val) \
+ (g_atomic_int_add ((gint *) (atomic), (val)))
+#define g_atomic_int_and(atomic, val) \
+ (g_atomic_int_and ((guint *) (atomic), (val)))
+#define g_atomic_int_or(atomic, val) \
+ (g_atomic_int_or ((guint *) (atomic), (val)))
+#define g_atomic_int_xor(atomic, val) \
+ (g_atomic_int_xor ((guint *) (atomic), (val)))
+#define g_atomic_int_inc(atomic) \
+ (g_atomic_int_inc ((gint *) (atomic)))
+#define g_atomic_int_dec_and_test(atomic) \
+ (g_atomic_int_dec_and_test ((gint *) (atomic)))
+
+#define g_atomic_pointer_get(atomic) \
+ (g_atomic_pointer_get (atomic))
+#define g_atomic_pointer_set(atomic, newval) \
+ (g_atomic_pointer_set ((atomic), (gpointer) (newval)))
+#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \
+ (g_atomic_pointer_compare_and_exchange ((atomic), (gpointer) (oldval), (gpointer) (newval)))
+#define g_atomic_pointer_add(atomic, val) \
+ (g_atomic_pointer_add ((atomic), (gssize) (val)))
+#define g_atomic_pointer_and(atomic, val) \
+ (g_atomic_pointer_and ((atomic), (gsize) (val)))
+#define g_atomic_pointer_or(atomic, val) \
+ (g_atomic_pointer_or ((atomic), (gsize) (val)))
+#define g_atomic_pointer_xor(atomic, val) \
+ (g_atomic_pointer_xor ((atomic), (gsize) (val)))
+
+#endif /* defined(__GNUC__) && defined(G_ATOMIC_OP_USE_GCC_BUILTINS) */
+
+#endif /* __G_ATOMIC_H__ */
diff --git a/include/glib/glib/gbacktrace.h b/include/glib/glib/gbacktrace.h
new file mode 100644
index 0000000000..9e9cba151c
--- /dev/null
+++ b/include/glib/glib/gbacktrace.h
@@ -0,0 +1,72 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_BACKTRACE_H__
+#define __G_BACKTRACE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#ifdef __sun__
+#include <sys/select.h>
+#endif
+#include <signal.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+void g_on_error_query (const gchar *prg_name);
+GLIB_AVAILABLE_IN_ALL
+void g_on_error_stack_trace (const gchar *prg_name);
+
+/**
+ * G_BREAKPOINT:
+ *
+ * Inserts a breakpoint instruction into the code.
+ *
+ * On architectures which support it, this is implemented as a soft interrupt
+ * and on other architectures it raises a `SIGTRAP` signal.
+ *
+ * `SIGTRAP` is used rather than abort() to allow breakpoints to be skipped past
+ * in a debugger if they are not the desired target of debugging.
+ */
+#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2
+# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
+#elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86)
+# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END
+#elif defined (_MSC_VER)
+# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END
+#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2
+# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
+#elif defined (__APPLE__)
+# define G_BREAKPOINT() G_STMT_START{ __builtin_trap(); }G_STMT_END
+#else /* !__i386__ && !__alpha__ */
+# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END
+#endif /* __i386__ */
+
+G_END_DECLS
+
+#endif /* __G_BACKTRACE_H__ */
diff --git a/include/glib/glib/gbase64.h b/include/glib/glib/gbase64.h
new file mode 100644
index 0000000000..662c597ff9
--- /dev/null
+++ b/include/glib/glib/gbase64.h
@@ -0,0 +1,61 @@
+/* gbase64.h - Base64 coding functions
+ *
+ * Copyright (C) 2005 Alexander Larsson <alexl@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_BASE64_H__
+#define __G_BASE64_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_base64_encode_step (const guchar *in,
+ gsize len,
+ gboolean break_lines,
+ gchar *out,
+ gint *state,
+ gint *save);
+GLIB_AVAILABLE_IN_ALL
+gsize g_base64_encode_close (gboolean break_lines,
+ gchar *out,
+ gint *state,
+ gint *save);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_base64_encode (const guchar *data,
+ gsize len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gsize g_base64_decode_step (const gchar *in,
+ gsize len,
+ guchar *out,
+ gint *state,
+ guint *save);
+GLIB_AVAILABLE_IN_ALL
+guchar *g_base64_decode (const gchar *text,
+ gsize *out_len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+guchar *g_base64_decode_inplace (gchar *text,
+ gsize *out_len);
+
+
+G_END_DECLS
+
+#endif /* __G_BASE64_H__ */
diff --git a/include/glib/glib/gbitlock.h b/include/glib/glib/gbitlock.h
new file mode 100644
index 0000000000..8054bc8ae5
--- /dev/null
+++ b/include/glib/glib/gbitlock.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2008 Ryan Lortie
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_BITLOCK_H__
+#define __G_BITLOCK_H__
+
+#include <glib/gtypes.h>
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+void g_bit_lock (volatile gint *address,
+ gint lock_bit);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bit_trylock (volatile gint *address,
+ gint lock_bit);
+GLIB_AVAILABLE_IN_ALL
+void g_bit_unlock (volatile gint *address,
+ gint lock_bit);
+
+GLIB_AVAILABLE_IN_ALL
+void g_pointer_bit_lock (volatile void *address,
+ gint lock_bit);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pointer_bit_trylock (volatile void *address,
+ gint lock_bit);
+GLIB_AVAILABLE_IN_ALL
+void g_pointer_bit_unlock (volatile void *address,
+ gint lock_bit);
+
+#ifdef __GNUC__
+
+#define g_pointer_bit_lock(address, lock_bit) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
+ g_pointer_bit_lock ((address), (lock_bit)); \
+ }))
+
+#define g_pointer_bit_trylock(address, lock_bit) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
+ g_pointer_bit_trylock ((address), (lock_bit)); \
+ }))
+
+#define g_pointer_bit_unlock(address, lock_bit) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
+ g_pointer_bit_unlock ((address), (lock_bit)); \
+ }))
+
+#endif
+
+G_END_DECLS
+
+#endif /* __G_BITLOCK_H_ */
diff --git a/include/glib/glib/gbookmarkfile.h b/include/glib/glib/gbookmarkfile.h
new file mode 100644
index 0000000000..8dd93a1dcc
--- /dev/null
+++ b/include/glib/glib/gbookmarkfile.h
@@ -0,0 +1,254 @@
+/* gbookmarkfile.h: parsing and building desktop bookmarks
+ *
+ * Copyright (C) 2005-2006 Emmanuele Bassi
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_BOOKMARK_FILE_H__
+#define __G_BOOKMARK_FILE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+#include <time.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_BOOKMARK_FILE_ERROR:
+ *
+ * Error domain for bookmark file parsing.
+ * Errors in this domain will be from the #GBookmarkFileError
+ * enumeration. See #GError for information on error domains.
+ */
+#define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ())
+
+
+/**
+ * GBookmarkFileError:
+ * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed
+ * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found
+ * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did
+ * not register a bookmark
+ * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found
+ * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed
+ * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was
+ * in an unknown encoding
+ * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing
+ * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found
+ *
+ * Error codes returned by bookmark file parsing.
+ */
+typedef enum
+{
+ G_BOOKMARK_FILE_ERROR_INVALID_URI,
+ G_BOOKMARK_FILE_ERROR_INVALID_VALUE,
+ G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,
+ G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,
+ G_BOOKMARK_FILE_ERROR_READ,
+ G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,
+ G_BOOKMARK_FILE_ERROR_WRITE,
+ G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND
+} GBookmarkFileError;
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_bookmark_file_error_quark (void);
+
+/**
+ * GBookmarkFile:
+ *
+ * The `GBookmarkFile` structure contains only
+ * private data and should not be directly accessed.
+ */
+typedef struct _GBookmarkFile GBookmarkFile;
+
+GLIB_AVAILABLE_IN_ALL
+GBookmarkFile *g_bookmark_file_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_free (GBookmarkFile *bookmark);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark,
+ const gchar *filename,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark,
+ const gchar *data,
+ gsize length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark,
+ const gchar *file,
+ gchar **full_path,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark,
+ const gchar *filename,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_title (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *title);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_description (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *description);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *mime_type);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_groups (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar **groups,
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_add_group (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *group);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *group,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark,
+ const gchar *uri,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_add_application (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *name,
+ const gchar *exec);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *name,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark,
+ const gchar *uri,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *name,
+ const gchar *exec,
+ gint count,
+ time_t stamp,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *name,
+ gchar **exec,
+ guint *count,
+ time_t *stamp,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_is_private (GBookmarkFile *bookmark,
+ const gchar *uri,
+ gboolean is_private);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_icon (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *href,
+ const gchar *mime_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark,
+ const gchar *uri,
+ gchar **href,
+ gchar **mime_type,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_added (GBookmarkFile *bookmark,
+ const gchar *uri,
+ time_t added);
+GLIB_AVAILABLE_IN_ALL
+time_t g_bookmark_file_get_added (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_modified (GBookmarkFile *bookmark,
+ const gchar *uri,
+ time_t modified);
+GLIB_AVAILABLE_IN_ALL
+time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_bookmark_file_set_visited (GBookmarkFile *bookmark,
+ const gchar *uri,
+ time_t visited);
+GLIB_AVAILABLE_IN_ALL
+time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark,
+ const gchar *uri);
+GLIB_AVAILABLE_IN_ALL
+gint g_bookmark_file_get_size (GBookmarkFile *bookmark);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *group,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark,
+ const gchar *uri,
+ const gchar *name,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark,
+ const gchar *uri,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark,
+ const gchar *old_uri,
+ const gchar *new_uri,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_BOOKMARK_FILE_H__ */
diff --git a/include/glib/glib/gbytes.h b/include/glib/glib/gbytes.h
new file mode 100644
index 0000000000..0bb1517b91
--- /dev/null
+++ b/include/glib/glib/gbytes.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2009, 2010 Codethink Limited
+ * Copyright © 2011 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ * Stef Walter <stefw@collabora.co.uk>
+ */
+
+#ifndef __G_BYTES_H__
+#define __G_BYTES_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include <glib/garray.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_new (gconstpointer data,
+ gsize size);
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_new_take (gpointer data,
+ gsize size);
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_new_static (gconstpointer data,
+ gsize size);
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_new_with_free_func (gconstpointer data,
+ gsize size,
+ GDestroyNotify free_func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_new_from_bytes (GBytes *bytes,
+ gsize offset,
+ gsize length);
+
+GLIB_AVAILABLE_IN_ALL
+gconstpointer g_bytes_get_data (GBytes *bytes,
+ gsize *size);
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_bytes_get_size (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_ALL
+GBytes * g_bytes_ref (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_ALL
+void g_bytes_unref (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_bytes_unref_to_data (GBytes *bytes,
+ gsize *size);
+
+GLIB_AVAILABLE_IN_ALL
+GByteArray * g_bytes_unref_to_array (GBytes *bytes);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_bytes_hash (gconstpointer bytes);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_bytes_equal (gconstpointer bytes1,
+ gconstpointer bytes2);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_bytes_compare (gconstpointer bytes1,
+ gconstpointer bytes2);
+
+G_END_DECLS
+
+#endif /* __G_BYTES_H__ */
diff --git a/include/glib/glib/gcharset.h b/include/glib/glib/gcharset.h
new file mode 100644
index 0000000000..82020f6047
--- /dev/null
+++ b/include/glib/glib/gcharset.h
@@ -0,0 +1,47 @@
+/* gcharset.h - Charset functions
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_CHARSET_H__
+#define __G_CHARSET_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_get_charset (const char **charset);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_get_codeset (void);
+GLIB_AVAILABLE_IN_2_62
+gboolean g_get_console_charset (const char **charset);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * const * g_get_language_names (void);
+GLIB_AVAILABLE_IN_2_58
+const gchar * const * g_get_language_names_with_category
+ (const gchar *category_name);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_get_locale_variants (const gchar *locale);
+
+G_END_DECLS
+
+#endif /* __G_CHARSET_H__ */
diff --git a/include/glib/glib/gchecksum.h b/include/glib/glib/gchecksum.h
new file mode 100644
index 0000000000..599f439c1e
--- /dev/null
+++ b/include/glib/glib/gchecksum.h
@@ -0,0 +1,103 @@
+/* gchecksum.h - data hashing functions
+ *
+ * Copyright (C) 2007 Emmanuele Bassi <ebassi@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_CHECKSUM_H__
+#define __G_CHECKSUM_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include <glib/gbytes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GChecksumType:
+ * @G_CHECKSUM_MD5: Use the MD5 hashing algorithm
+ * @G_CHECKSUM_SHA1: Use the SHA-1 hashing algorithm
+ * @G_CHECKSUM_SHA256: Use the SHA-256 hashing algorithm
+ * @G_CHECKSUM_SHA384: Use the SHA-384 hashing algorithm (Since: 2.51)
+ * @G_CHECKSUM_SHA512: Use the SHA-512 hashing algorithm (Since: 2.36)
+ *
+ * The hashing algorithm to be used by #GChecksum when performing the
+ * digest of some data.
+ *
+ * Note that the #GChecksumType enumeration may be extended at a later
+ * date to include new hashing algorithm types.
+ *
+ * Since: 2.16
+ */
+typedef enum {
+ G_CHECKSUM_MD5,
+ G_CHECKSUM_SHA1,
+ G_CHECKSUM_SHA256,
+ G_CHECKSUM_SHA512,
+ G_CHECKSUM_SHA384
+} GChecksumType;
+
+/**
+ * GChecksum:
+ *
+ * An opaque structure representing a checksumming operation.
+ * To create a new GChecksum, use g_checksum_new(). To free
+ * a GChecksum, use g_checksum_free().
+ *
+ * Since: 2.16
+ */
+typedef struct _GChecksum GChecksum;
+
+GLIB_AVAILABLE_IN_ALL
+gssize g_checksum_type_get_length (GChecksumType checksum_type);
+
+GLIB_AVAILABLE_IN_ALL
+GChecksum * g_checksum_new (GChecksumType checksum_type);
+GLIB_AVAILABLE_IN_ALL
+void g_checksum_reset (GChecksum *checksum);
+GLIB_AVAILABLE_IN_ALL
+GChecksum * g_checksum_copy (const GChecksum *checksum);
+GLIB_AVAILABLE_IN_ALL
+void g_checksum_free (GChecksum *checksum);
+GLIB_AVAILABLE_IN_ALL
+void g_checksum_update (GChecksum *checksum,
+ const guchar *data,
+ gssize length);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_checksum_get_string (GChecksum *checksum);
+GLIB_AVAILABLE_IN_ALL
+void g_checksum_get_digest (GChecksum *checksum,
+ guint8 *buffer,
+ gsize *digest_len);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_compute_checksum_for_data (GChecksumType checksum_type,
+ const guchar *data,
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_compute_checksum_for_string (GChecksumType checksum_type,
+ const gchar *str,
+ gssize length);
+
+GLIB_AVAILABLE_IN_2_34
+gchar *g_compute_checksum_for_bytes (GChecksumType checksum_type,
+ GBytes *data);
+
+G_END_DECLS
+
+#endif /* __G_CHECKSUM_H__ */
diff --git a/include/glib/glib/gconvert.h b/include/glib/glib/gconvert.h
new file mode 100644
index 0000000000..be58ecfbe1
--- /dev/null
+++ b/include/glib/glib/gconvert.h
@@ -0,0 +1,177 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_CONVERT_H__
+#define __G_CONVERT_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GConvertError:
+ * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character
+ * sets is not supported.
+ * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input;
+ * or the character sequence could not be represented in the target
+ * character set.
+ * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason.
+ * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input.
+ * @G_CONVERT_ERROR_BAD_URI: URI is invalid.
+ * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path.
+ * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40
+ * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in
+ * conversion output where a NUL-terminated string is expected.
+ * Since: 2.56
+ *
+ * Error codes returned by character set conversion routines.
+ */
+typedef enum
+{
+ G_CONVERT_ERROR_NO_CONVERSION,
+ G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ G_CONVERT_ERROR_FAILED,
+ G_CONVERT_ERROR_PARTIAL_INPUT,
+ G_CONVERT_ERROR_BAD_URI,
+ G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
+ G_CONVERT_ERROR_NO_MEMORY,
+ G_CONVERT_ERROR_EMBEDDED_NUL
+} GConvertError;
+
+/**
+ * G_CONVERT_ERROR:
+ *
+ * Error domain for character set conversions. Errors in this domain will
+ * be from the #GConvertError enumeration. See #GError for information on
+ * error domains.
+ */
+#define G_CONVERT_ERROR g_convert_error_quark()
+GLIB_AVAILABLE_IN_ALL
+GQuark g_convert_error_quark (void);
+
+/**
+ * GIConv: (skip)
+ *
+ * The GIConv struct wraps an iconv() conversion descriptor. It contains
+ * private data and should only be accessed using the following functions.
+ */
+typedef struct _GIConv *GIConv;
+
+GLIB_AVAILABLE_IN_ALL
+GIConv g_iconv_open (const gchar *to_codeset,
+ const gchar *from_codeset);
+GLIB_AVAILABLE_IN_ALL
+gsize g_iconv (GIConv converter,
+ gchar **inbuf,
+ gsize *inbytes_left,
+ gchar **outbuf,
+ gsize *outbytes_left);
+GLIB_AVAILABLE_IN_ALL
+gint g_iconv_close (GIConv converter);
+
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_convert (const gchar *str,
+ gssize len,
+ const gchar *to_codeset,
+ const gchar *from_codeset,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_convert_with_iconv (const gchar *str,
+ gssize len,
+ GIConv converter,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_convert_with_fallback (const gchar *str,
+ gssize len,
+ const gchar *to_codeset,
+ const gchar *from_codeset,
+ const gchar *fallback,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+
+
+/* Convert between libc's idea of strings and UTF-8.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_locale_to_utf8 (const gchar *opsysstring,
+ gssize len,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_locale_from_utf8 (const gchar *utf8string,
+ gssize len,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+
+/* Convert between the operating system (or C runtime)
+ * representation of file names and UTF-8.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_filename_to_utf8 (const gchar *opsysstring,
+ gssize len,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_filename_from_utf8 (const gchar *utf8string,
+ gssize len,
+ gsize *bytes_read,
+ gsize *bytes_written,
+ GError **error) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_filename_from_uri (const gchar *uri,
+ gchar **hostname,
+ GError **error) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_filename_to_uri (const gchar *filename,
+ const gchar *hostname,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_get_filename_charsets (const gchar ***filename_charsets);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gchar **g_uri_list_extract_uris (const gchar *uri_list);
+
+G_END_DECLS
+
+#endif /* __G_CONVERT_H__ */
diff --git a/include/glib/glib/gdataset.h b/include/glib/glib/gdataset.h
new file mode 100644
index 0000000000..89a34c71af
--- /dev/null
+++ b/include/glib/glib/gdataset.h
@@ -0,0 +1,150 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_DATASET_H__
+#define __G_DATASET_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gquark.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GData GData;
+
+typedef void (*GDataForeachFunc) (GQuark key_id,
+ gpointer data,
+ gpointer user_data);
+
+/* Keyed Data List
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_init (GData **datalist);
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_clear (GData **datalist);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_datalist_id_get_data (GData **datalist,
+ GQuark key_id);
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_id_set_data_full (GData **datalist,
+ GQuark key_id,
+ gpointer data,
+ GDestroyNotify destroy_func);
+
+typedef gpointer (*GDuplicateFunc) (gpointer data, gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_34
+gpointer g_datalist_id_dup_data (GData **datalist,
+ GQuark key_id,
+ GDuplicateFunc dup_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_datalist_id_replace_data (GData **datalist,
+ GQuark key_id,
+ gpointer oldval,
+ gpointer newval,
+ GDestroyNotify destroy,
+ GDestroyNotify *old_destroy);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_datalist_id_remove_no_notify (GData **datalist,
+ GQuark key_id);
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_foreach (GData **datalist,
+ GDataForeachFunc func,
+ gpointer user_data);
+
+/**
+ * G_DATALIST_FLAGS_MASK:
+ *
+ * A bitmask that restricts the possible flags passed to
+ * g_datalist_set_flags(). Passing a flags value where
+ * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.
+ */
+#define G_DATALIST_FLAGS_MASK 0x3
+
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_set_flags (GData **datalist,
+ guint flags);
+GLIB_AVAILABLE_IN_ALL
+void g_datalist_unset_flags (GData **datalist,
+ guint flags);
+GLIB_AVAILABLE_IN_ALL
+guint g_datalist_get_flags (GData **datalist);
+
+#define g_datalist_id_set_data(dl, q, d) \
+ g_datalist_id_set_data_full ((dl), (q), (d), NULL)
+#define g_datalist_id_remove_data(dl, q) \
+ g_datalist_id_set_data ((dl), (q), NULL)
+#define g_datalist_set_data_full(dl, k, d, f) \
+ g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f))
+#define g_datalist_remove_no_notify(dl, k) \
+ g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k))
+#define g_datalist_set_data(dl, k, d) \
+ g_datalist_set_data_full ((dl), (k), (d), NULL)
+#define g_datalist_remove_data(dl, k) \
+ g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL)
+
+/* Location Associated Keyed Data
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_dataset_destroy (gconstpointer dataset_location);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_dataset_id_get_data (gconstpointer dataset_location,
+ GQuark key_id);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_datalist_get_data (GData **datalist,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+void g_dataset_id_set_data_full (gconstpointer dataset_location,
+ GQuark key_id,
+ gpointer data,
+ GDestroyNotify destroy_func);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location,
+ GQuark key_id);
+GLIB_AVAILABLE_IN_ALL
+void g_dataset_foreach (gconstpointer dataset_location,
+ GDataForeachFunc func,
+ gpointer user_data);
+#define g_dataset_id_set_data(l, k, d) \
+ g_dataset_id_set_data_full ((l), (k), (d), NULL)
+#define g_dataset_id_remove_data(l, k) \
+ g_dataset_id_set_data ((l), (k), NULL)
+#define g_dataset_get_data(l, k) \
+ (g_dataset_id_get_data ((l), g_quark_try_string (k)))
+#define g_dataset_set_data_full(l, k, d, f) \
+ g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f))
+#define g_dataset_remove_no_notify(l, k) \
+ g_dataset_id_remove_no_notify ((l), g_quark_try_string (k))
+#define g_dataset_set_data(l, k, d) \
+ g_dataset_set_data_full ((l), (k), (d), NULL)
+#define g_dataset_remove_data(l, k) \
+ g_dataset_id_set_data ((l), g_quark_try_string (k), NULL)
+
+G_END_DECLS
+
+#endif /* __G_DATASET_H__ */
diff --git a/include/glib/glib/gdate.h b/include/glib/glib/gdate.h
new file mode 100644
index 0000000000..3bc07bf5c3
--- /dev/null
+++ b/include/glib/glib/gdate.h
@@ -0,0 +1,307 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_DATE_H__
+#define __G_DATE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <time.h>
+
+#include <glib/gtypes.h>
+#include <glib/gquark.h>
+
+G_BEGIN_DECLS
+
+/* GDate
+ *
+ * Date calculations (not time for now, to be resolved). These are a
+ * mutant combination of Steffen Beyer's DateCalc routines
+ * (http://www.perl.com/CPAN/authors/id/STBEY/) and Jon Trowbridge's
+ * date routines (written for in-house software). Written by Havoc
+ * Pennington <hp@pobox.com>
+ */
+
+typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
+typedef guint16 GDateYear;
+typedef guint8 GDateDay; /* day of the month */
+typedef struct _GDate GDate;
+
+/* enum used to specify order of appearance in parsed date strings */
+typedef enum
+{
+ G_DATE_DAY = 0,
+ G_DATE_MONTH = 1,
+ G_DATE_YEAR = 2
+} GDateDMY;
+
+/* actual week and month values */
+typedef enum
+{
+ G_DATE_BAD_WEEKDAY = 0,
+ G_DATE_MONDAY = 1,
+ G_DATE_TUESDAY = 2,
+ G_DATE_WEDNESDAY = 3,
+ G_DATE_THURSDAY = 4,
+ G_DATE_FRIDAY = 5,
+ G_DATE_SATURDAY = 6,
+ G_DATE_SUNDAY = 7
+} GDateWeekday;
+typedef enum
+{
+ G_DATE_BAD_MONTH = 0,
+ G_DATE_JANUARY = 1,
+ G_DATE_FEBRUARY = 2,
+ G_DATE_MARCH = 3,
+ G_DATE_APRIL = 4,
+ G_DATE_MAY = 5,
+ G_DATE_JUNE = 6,
+ G_DATE_JULY = 7,
+ G_DATE_AUGUST = 8,
+ G_DATE_SEPTEMBER = 9,
+ G_DATE_OCTOBER = 10,
+ G_DATE_NOVEMBER = 11,
+ G_DATE_DECEMBER = 12
+} GDateMonth;
+
+#define G_DATE_BAD_JULIAN 0U
+#define G_DATE_BAD_DAY 0U
+#define G_DATE_BAD_YEAR 0U
+
+/* Note: directly manipulating structs is generally a bad idea, but
+ * in this case it's an *incredibly* bad idea, because all or part
+ * of this struct can be invalid at any given time. Use the functions,
+ * or you will get hosed, I promise.
+ */
+struct _GDate
+{
+ guint julian_days : 32; /* julian days representation - we use a
+ * bitfield hoping that 64 bit platforms
+ * will pack this whole struct in one big
+ * int
+ */
+
+ guint julian : 1; /* julian is valid */
+ guint dmy : 1; /* dmy is valid */
+
+ /* DMY representation */
+ guint day : 6;
+ guint month : 4;
+ guint year : 16;
+};
+
+/* g_date_new() returns an invalid date, you then have to _set() stuff
+ * to get a usable object. You can also allocate a GDate statically,
+ * then call g_date_clear() to initialize.
+ */
+GLIB_AVAILABLE_IN_ALL
+GDate* g_date_new (void);
+GLIB_AVAILABLE_IN_ALL
+GDate* g_date_new_dmy (GDateDay day,
+ GDateMonth month,
+ GDateYear year);
+GLIB_AVAILABLE_IN_ALL
+GDate* g_date_new_julian (guint32 julian_day);
+GLIB_AVAILABLE_IN_ALL
+void g_date_free (GDate *date);
+GLIB_AVAILABLE_IN_2_56
+GDate* g_date_copy (const GDate *date);
+
+/* check g_date_valid() after doing an operation that might fail, like
+ * _parse. Almost all g_date operations are undefined on invalid
+ * dates (the exceptions are the mutators, since you need those to
+ * return to validity).
+ */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_day (GDateDay day) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_month (GDateMonth month) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_year (GDateYear year) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_weekday (GDateWeekday weekday) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_julian (guint32 julian_date) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_valid_dmy (GDateDay day,
+ GDateMonth month,
+ GDateYear year) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GDateWeekday g_date_get_weekday (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+GDateMonth g_date_get_month (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+GDateYear g_date_get_year (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+GDateDay g_date_get_day (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+guint32 g_date_get_julian (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+guint g_date_get_day_of_year (const GDate *date);
+/* First monday/sunday is the start of week 1; if we haven't reached
+ * that day, return 0. These are not ISO weeks of the year; that
+ * routine needs to be added.
+ * these functions return the number of weeks, starting on the
+ * corrsponding day
+ */
+GLIB_AVAILABLE_IN_ALL
+guint g_date_get_monday_week_of_year (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+guint g_date_get_sunday_week_of_year (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+guint g_date_get_iso8601_week_of_year (const GDate *date);
+
+/* If you create a static date struct you need to clear it to get it
+ * in a sane state before use. You can clear a whole array at
+ * once with the ndates argument.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_date_clear (GDate *date,
+ guint n_dates);
+
+/* The parse routine is meant for dates typed in by a user, so it
+ * permits many formats but tries to catch common typos. If your data
+ * needs to be strictly validated, it is not an appropriate function.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_parse (GDate *date,
+ const gchar *str);
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_time_t (GDate *date,
+ time_t timet);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_set_time_t)
+void g_date_set_time_val (GDate *date,
+ GTimeVal *timeval);
+GLIB_DEPRECATED_FOR(g_date_set_time_t)
+void g_date_set_time (GDate *date,
+ GTime time_);
+G_GNUC_END_IGNORE_DEPRECATIONS
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_month (GDate *date,
+ GDateMonth month);
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_day (GDate *date,
+ GDateDay day);
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_year (GDate *date,
+ GDateYear year);
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_dmy (GDate *date,
+ GDateDay day,
+ GDateMonth month,
+ GDateYear y);
+GLIB_AVAILABLE_IN_ALL
+void g_date_set_julian (GDate *date,
+ guint32 julian_date);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_is_first_of_month (const GDate *date);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_is_last_of_month (const GDate *date);
+
+/* To go forward by some number of weeks just go forward weeks*7 days */
+GLIB_AVAILABLE_IN_ALL
+void g_date_add_days (GDate *date,
+ guint n_days);
+GLIB_AVAILABLE_IN_ALL
+void g_date_subtract_days (GDate *date,
+ guint n_days);
+
+/* If you add/sub months while day > 28, the day might change */
+GLIB_AVAILABLE_IN_ALL
+void g_date_add_months (GDate *date,
+ guint n_months);
+GLIB_AVAILABLE_IN_ALL
+void g_date_subtract_months (GDate *date,
+ guint n_months);
+
+/* If it's feb 29, changing years can move you to the 28th */
+GLIB_AVAILABLE_IN_ALL
+void g_date_add_years (GDate *date,
+ guint n_years);
+GLIB_AVAILABLE_IN_ALL
+void g_date_subtract_years (GDate *date,
+ guint n_years);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_is_leap_year (GDateYear year) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+guint8 g_date_get_days_in_month (GDateMonth month,
+ GDateYear year) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+guint8 g_date_get_monday_weeks_in_year (GDateYear year) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+guint8 g_date_get_sunday_weeks_in_year (GDateYear year) G_GNUC_CONST;
+
+/* Returns the number of days between the two dates. If date2 comes
+ before date1, a negative value is return. */
+GLIB_AVAILABLE_IN_ALL
+gint g_date_days_between (const GDate *date1,
+ const GDate *date2);
+
+/* qsort-friendly (with a cast...) */
+GLIB_AVAILABLE_IN_ALL
+gint g_date_compare (const GDate *lhs,
+ const GDate *rhs);
+GLIB_AVAILABLE_IN_ALL
+void g_date_to_struct_tm (const GDate *date,
+ struct tm *tm);
+
+GLIB_AVAILABLE_IN_ALL
+void g_date_clamp (GDate *date,
+ const GDate *min_date,
+ const GDate *max_date);
+
+/* Swap date1 and date2's values if date1 > date2. */
+GLIB_AVAILABLE_IN_ALL
+void g_date_order (GDate *date1, GDate *date2);
+
+/* Just like strftime() except you can only use date-related formats.
+ * Using a time format is undefined.
+ */
+GLIB_AVAILABLE_IN_ALL
+gsize g_date_strftime (gchar *s,
+ gsize slen,
+ const gchar *format,
+ const GDate *date);
+
+#define g_date_weekday g_date_get_weekday GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_weekday)
+#define g_date_month g_date_get_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_month)
+#define g_date_year g_date_get_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_year)
+#define g_date_day g_date_get_day GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day)
+#define g_date_julian g_date_get_julian GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_julian)
+#define g_date_day_of_year g_date_get_day_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day_of_year)
+#define g_date_monday_week_of_year g_date_get_monday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_week_of_year)
+#define g_date_sunday_week_of_year g_date_get_sunday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_week_of_year)
+#define g_date_days_in_month g_date_get_days_in_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_days_in_month)
+#define g_date_monday_weeks_in_year g_date_get_monday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_weeks_in_year)
+#define g_date_sunday_weeks_in_year g_date_get_sunday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_weeks_in_year)
+
+G_END_DECLS
+
+#endif /* __G_DATE_H__ */
diff --git a/include/glib/glib/gdatetime.h b/include/glib/glib/gdatetime.h
new file mode 100644
index 0000000000..fa43d85314
--- /dev/null
+++ b/include/glib/glib/gdatetime.h
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2009-2010 Christian Hergert <chris@dronelabs.com>
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * licence, or (at your option) any later version.
+ *
+ * This 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Christian Hergert <chris@dronelabs.com>
+ * Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+ * Emmanuele Bassi <ebassi@linux.intel.com>
+ * Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_DATE_TIME_H__
+#define __G_DATE_TIME_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtimezone.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_TIME_SPAN_DAY:
+ *
+ * Evaluates to a time span of one day.
+ *
+ * Since: 2.26
+ */
+#define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000))
+
+/**
+ * G_TIME_SPAN_HOUR:
+ *
+ * Evaluates to a time span of one hour.
+ *
+ * Since: 2.26
+ */
+#define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000))
+
+/**
+ * G_TIME_SPAN_MINUTE:
+ *
+ * Evaluates to a time span of one minute.
+ *
+ * Since: 2.26
+ */
+#define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000))
+
+/**
+ * G_TIME_SPAN_SECOND:
+ *
+ * Evaluates to a time span of one second.
+ *
+ * Since: 2.26
+ */
+#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000))
+
+/**
+ * G_TIME_SPAN_MILLISECOND:
+ *
+ * Evaluates to a time span of one millisecond.
+ *
+ * Since: 2.26
+ */
+#define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000))
+
+/**
+ * GTimeSpan:
+ *
+ * A value representing an interval of time, in microseconds.
+ *
+ * Since: 2.26
+ */
+typedef gint64 GTimeSpan;
+
+/**
+ * GDateTime:
+ *
+ * `GDateTime` is an opaque structure whose members
+ * cannot be accessed directly.
+ *
+ * Since: 2.26
+ */
+typedef struct _GDateTime GDateTime;
+
+GLIB_AVAILABLE_IN_ALL
+void g_date_time_unref (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_ref (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_now (GTimeZone *tz);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_now_local (void);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_now_utc (void);
+
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_from_unix_local (gint64 t);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_from_unix_utc (gint64 t);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_local)
+GDateTime * g_date_time_new_from_timeval_local (const GTimeVal *tv);
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_utc)
+GDateTime * g_date_time_new_from_timeval_utc (const GTimeVal *tv);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_2_56
+GDateTime * g_date_time_new_from_iso8601 (const gchar *text,
+ GTimeZone *default_tz);
+
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new (GTimeZone *tz,
+ gint year,
+ gint month,
+ gint day,
+ gint hour,
+ gint minute,
+ gdouble seconds);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_local (gint year,
+ gint month,
+ gint day,
+ gint hour,
+ gint minute,
+ gdouble seconds);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_new_utc (gint year,
+ gint month,
+ gint day,
+ gint hour,
+ gint minute,
+ gdouble seconds);
+
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add (GDateTime *datetime,
+ GTimeSpan timespan);
+
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_years (GDateTime *datetime,
+ gint years);
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_months (GDateTime *datetime,
+ gint months);
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_weeks (GDateTime *datetime,
+ gint weeks);
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_days (GDateTime *datetime,
+ gint days);
+
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_hours (GDateTime *datetime,
+ gint hours);
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_minutes (GDateTime *datetime,
+ gint minutes);
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_seconds (GDateTime *datetime,
+ gdouble seconds);
+
+GLIB_AVAILABLE_IN_ALL
+G_GNUC_WARN_UNUSED_RESULT
+GDateTime * g_date_time_add_full (GDateTime *datetime,
+ gint years,
+ gint months,
+ gint days,
+ gint hours,
+ gint minutes,
+ gdouble seconds);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_compare (gconstpointer dt1,
+ gconstpointer dt2);
+GLIB_AVAILABLE_IN_ALL
+GTimeSpan g_date_time_difference (GDateTime *end,
+ GDateTime *begin);
+GLIB_AVAILABLE_IN_ALL
+guint g_date_time_hash (gconstpointer datetime);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_time_equal (gconstpointer dt1,
+ gconstpointer dt2);
+
+GLIB_AVAILABLE_IN_ALL
+void g_date_time_get_ymd (GDateTime *datetime,
+ gint *year,
+ gint *month,
+ gint *day);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_year (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_month (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_day_of_month (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_week_numbering_year (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_week_of_year (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_day_of_week (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_day_of_year (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_hour (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_minute (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_second (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gint g_date_time_get_microsecond (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_date_time_get_seconds (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+gint64 g_date_time_to_unix (GDateTime *datetime);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_to_unix)
+gboolean g_date_time_to_timeval (GDateTime *datetime,
+ GTimeVal *tv);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime);
+GLIB_AVAILABLE_IN_2_58
+GTimeZone * g_date_time_get_timezone (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_date_time_is_daylight_savings (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_to_timezone (GDateTime *datetime,
+ GTimeZone *tz);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_to_local (GDateTime *datetime);
+GLIB_AVAILABLE_IN_ALL
+GDateTime * g_date_time_to_utc (GDateTime *datetime);
+
+GLIB_AVAILABLE_IN_ALL
+gchar * g_date_time_format (GDateTime *datetime,
+ const gchar *format) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_2_62
+gchar * g_date_time_format_iso8601 (GDateTime *datetime) G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* __G_DATE_TIME_H__ */
diff --git a/include/glib/glib/gdir.h b/include/glib/glib/gdir.h
new file mode 100644
index 0000000000..8f9d6bd7cc
--- /dev/null
+++ b/include/glib/glib/gdir.h
@@ -0,0 +1,52 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * gdir.c: Simplified wrapper around the DIRENT functions.
+ *
+ * Copyright 2001 Hans Breuer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_DIR_H__
+#define __G_DIR_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+
+#ifdef G_OS_UNIX
+#include <dirent.h>
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _GDir GDir;
+
+GLIB_AVAILABLE_IN_ALL
+GDir * g_dir_open (const gchar *path,
+ guint flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_dir_read_name (GDir *dir);
+GLIB_AVAILABLE_IN_ALL
+void g_dir_rewind (GDir *dir);
+GLIB_AVAILABLE_IN_ALL
+void g_dir_close (GDir *dir);
+
+G_END_DECLS
+
+#endif /* __G_DIR_H__ */
diff --git a/include/glib/glib/genviron.h b/include/glib/glib/genviron.h
new file mode 100644
index 0000000000..c4bf01a5ab
--- /dev/null
+++ b/include/glib/glib/genviron.h
@@ -0,0 +1,63 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_ENVIRON_H__
+#define __G_ENVIRON_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_getenv (const gchar *variable);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_setenv (const gchar *variable,
+ const gchar *value,
+ gboolean overwrite);
+GLIB_AVAILABLE_IN_ALL
+void g_unsetenv (const gchar *variable);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_listenv (void);
+
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_get_environ (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_environ_getenv (gchar **envp,
+ const gchar *variable);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_environ_setenv (gchar **envp,
+ const gchar *variable,
+ const gchar *value,
+ gboolean overwrite) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_environ_unsetenv (gchar **envp,
+ const gchar *variable) G_GNUC_WARN_UNUSED_RESULT;
+
+G_END_DECLS
+
+#endif /* __G_ENVIRON_H__ */
diff --git a/include/glib/glib/gerror.h b/include/glib/glib/gerror.h
new file mode 100644
index 0000000000..8ecff04e16
--- /dev/null
+++ b/include/glib/glib/gerror.h
@@ -0,0 +1,117 @@
+/* gerror.h - Error reporting system
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_ERROR_H__
+#define __G_ERROR_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <stdarg.h>
+
+#include <glib/gquark.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GError:
+ * @domain: error domain, e.g. #G_FILE_ERROR
+ * @code: error code, e.g. %G_FILE_ERROR_NOENT
+ * @message: human-readable informative error message
+ *
+ * The `GError` structure contains information about
+ * an error that has occurred.
+ */
+typedef struct _GError GError;
+
+struct _GError
+{
+ GQuark domain;
+ gint code;
+ gchar *message;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GError* g_error_new (GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
+GLIB_AVAILABLE_IN_ALL
+GError* g_error_new_literal (GQuark domain,
+ gint code,
+ const gchar *message);
+GLIB_AVAILABLE_IN_ALL
+GError* g_error_new_valist (GQuark domain,
+ gint code,
+ const gchar *format,
+ va_list args) G_GNUC_PRINTF(3, 0);
+
+GLIB_AVAILABLE_IN_ALL
+void g_error_free (GError *error);
+GLIB_AVAILABLE_IN_ALL
+GError* g_error_copy (const GError *error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_error_matches (const GError *error,
+ GQuark domain,
+ gint code);
+
+/* if (err) *err = g_error_new(domain, code, format, ...), also has
+ * some sanity checks.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_set_error (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (4, 5);
+
+GLIB_AVAILABLE_IN_ALL
+void g_set_error_literal (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *message);
+
+/* if (dest) *dest = src; also has some sanity checks.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_propagate_error (GError **dest,
+ GError *src);
+
+/* if (err && *err) { g_error_free(*err); *err = NULL; } */
+GLIB_AVAILABLE_IN_ALL
+void g_clear_error (GError **err);
+
+/* if (err) prefix the formatted string to the ->message */
+GLIB_AVAILABLE_IN_ALL
+void g_prefix_error (GError **err,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+/* g_propagate_error then g_error_prefix on dest */
+GLIB_AVAILABLE_IN_ALL
+void g_propagate_prefixed_error (GError **dest,
+ GError *src,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
+G_END_DECLS
+
+#endif /* __G_ERROR_H__ */
diff --git a/include/glib/glib/gfileutils.h b/include/glib/glib/gfileutils.h
new file mode 100644
index 0000000000..f60fad8584
--- /dev/null
+++ b/include/glib/glib/gfileutils.h
@@ -0,0 +1,179 @@
+/* gfileutils.h - File utility functions
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_FILEUTILS_H__
+#define __G_FILEUTILS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glibconfig.h>
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+#define G_FILE_ERROR g_file_error_quark ()
+
+typedef enum
+{
+ G_FILE_ERROR_EXIST,
+ G_FILE_ERROR_ISDIR,
+ G_FILE_ERROR_ACCES,
+ G_FILE_ERROR_NAMETOOLONG,
+ G_FILE_ERROR_NOENT,
+ G_FILE_ERROR_NOTDIR,
+ G_FILE_ERROR_NXIO,
+ G_FILE_ERROR_NODEV,
+ G_FILE_ERROR_ROFS,
+ G_FILE_ERROR_TXTBSY,
+ G_FILE_ERROR_FAULT,
+ G_FILE_ERROR_LOOP,
+ G_FILE_ERROR_NOSPC,
+ G_FILE_ERROR_NOMEM,
+ G_FILE_ERROR_MFILE,
+ G_FILE_ERROR_NFILE,
+ G_FILE_ERROR_BADF,
+ G_FILE_ERROR_INVAL,
+ G_FILE_ERROR_PIPE,
+ G_FILE_ERROR_AGAIN,
+ G_FILE_ERROR_INTR,
+ G_FILE_ERROR_IO,
+ G_FILE_ERROR_PERM,
+ G_FILE_ERROR_NOSYS,
+ G_FILE_ERROR_FAILED
+} GFileError;
+
+/* For backward-compat reasons, these are synced to an old
+ * anonymous enum in libgnome. But don't use that enum
+ * in new code.
+ */
+typedef enum
+{
+ G_FILE_TEST_IS_REGULAR = 1 << 0,
+ G_FILE_TEST_IS_SYMLINK = 1 << 1,
+ G_FILE_TEST_IS_DIR = 1 << 2,
+ G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
+ G_FILE_TEST_EXISTS = 1 << 4
+} GFileTest;
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_file_error_quark (void);
+/* So other code can generate a GFileError */
+GLIB_AVAILABLE_IN_ALL
+GFileError g_file_error_from_errno (gint err_no);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_test (const gchar *filename,
+ GFileTest test);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_get_contents (const gchar *filename,
+ gchar **contents,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_file_set_contents (const gchar *filename,
+ const gchar *contents,
+ gssize length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_file_read_link (const gchar *filename,
+ GError **error);
+
+/* Wrapper / workalike for mkdtemp() */
+GLIB_AVAILABLE_IN_2_30
+gchar *g_mkdtemp (gchar *tmpl);
+GLIB_AVAILABLE_IN_2_30
+gchar *g_mkdtemp_full (gchar *tmpl,
+ gint mode);
+
+/* Wrapper / workalike for mkstemp() */
+GLIB_AVAILABLE_IN_ALL
+gint g_mkstemp (gchar *tmpl);
+GLIB_AVAILABLE_IN_ALL
+gint g_mkstemp_full (gchar *tmpl,
+ gint flags,
+ gint mode);
+
+/* Wrappers for g_mkstemp and g_mkdtemp() */
+GLIB_AVAILABLE_IN_ALL
+gint g_file_open_tmp (const gchar *tmpl,
+ gchar **name_used,
+ GError **error);
+GLIB_AVAILABLE_IN_2_30
+gchar *g_dir_make_tmp (const gchar *tmpl,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_build_path (const gchar *separator,
+ const gchar *first_element,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_build_pathv (const gchar *separator,
+ gchar **args) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_build_filename (const gchar *first_element,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_2_56
+gchar *g_build_filename_valist (const gchar *first_element,
+ va_list *args) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gint g_mkdir_with_parents (const gchar *pathname,
+ gint mode);
+
+#ifdef G_OS_WIN32
+
+/* On Win32, the canonical directory separator is the backslash, and
+ * the search path separator is the semicolon. Note that also the
+ * (forward) slash works as directory separator.
+ */
+#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
+
+#else /* !G_OS_WIN32 */
+
+#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR)
+
+#endif /* !G_OS_WIN32 */
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_path_is_absolute (const gchar *file_name);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_path_skip_root (const gchar *file_name);
+
+GLIB_DEPRECATED_FOR(g_path_get_basename)
+const gchar *g_basename (const gchar *file_name);
+#define g_dirname g_path_get_dirname GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_path_get_dirname)
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_get_current_dir (void);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_2_58
+gchar *g_canonicalize_filename (const gchar *filename,
+ const gchar *relative_to) G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* __G_FILEUTILS_H__ */
diff --git a/include/glib/glib/ggettext.h b/include/glib/glib/ggettext.h
new file mode 100644
index 0000000000..036f9d5348
--- /dev/null
+++ b/include/glib/glib/ggettext.h
@@ -0,0 +1,63 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_GETTEXT_H__
+#define __G_GETTEXT_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_strip_context (const gchar *msgid,
+ const gchar *msgval) G_GNUC_FORMAT(1);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dgettext (const gchar *domain,
+ const gchar *msgid) G_GNUC_FORMAT(2);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dcgettext (const gchar *domain,
+ const gchar *msgid,
+ gint category) G_GNUC_FORMAT(2);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dngettext (const gchar *domain,
+ const gchar *msgid,
+ const gchar *msgid_plural,
+ gulong n) G_GNUC_FORMAT(3);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dpgettext (const gchar *domain,
+ const gchar *msgctxtid,
+ gsize msgidoffset) G_GNUC_FORMAT(2);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_dpgettext2 (const gchar *domain,
+ const gchar *context,
+ const gchar *msgid) G_GNUC_FORMAT(3);
+
+G_END_DECLS
+
+#endif /* __G_GETTEXT_H__ */
diff --git a/include/glib/glib/ghash.h b/include/glib/glib/ghash.h
new file mode 100644
index 0000000000..e9ce64505f
--- /dev/null
+++ b/include/glib/glib/ghash.h
@@ -0,0 +1,188 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_HASH_H__
+#define __G_HASH_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GHashTable GHashTable;
+
+typedef gboolean (*GHRFunc) (gpointer key,
+ gpointer value,
+ gpointer user_data);
+
+typedef struct _GHashTableIter GHashTableIter;
+
+struct _GHashTableIter
+{
+ /*< private >*/
+ gpointer dummy1;
+ gpointer dummy2;
+ gpointer dummy3;
+ int dummy4;
+ gboolean dummy5;
+ gpointer dummy6;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GHashTable* g_hash_table_new (GHashFunc hash_func,
+ GEqualFunc key_equal_func);
+GLIB_AVAILABLE_IN_ALL
+GHashTable* g_hash_table_new_full (GHashFunc hash_func,
+ GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_destroy (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_insert (GHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_replace (GHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_add (GHashTable *hash_table,
+ gpointer key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_remove (GHashTable *hash_table,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_remove_all (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_steal (GHashTable *hash_table,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_hash_table_steal_extended (GHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *stolen_key,
+ gpointer *stolen_value);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_steal_all (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_hash_table_lookup (GHashTable *hash_table,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_contains (GHashTable *hash_table,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_foreach (GHashTable *hash_table,
+ GHFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_hash_table_find (GHashTable *hash_table,
+ GHRFunc predicate,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+guint g_hash_table_foreach_remove (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+guint g_hash_table_foreach_steal (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+guint g_hash_table_size (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+GList * g_hash_table_get_keys (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+GList * g_hash_table_get_values (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_2_40
+gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table,
+ guint *length);
+
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_iter_init (GHashTableIter *iter,
+ GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hash_table_iter_next (GHashTableIter *iter,
+ gpointer *key,
+ gpointer *value);
+GLIB_AVAILABLE_IN_ALL
+GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_iter_remove (GHashTableIter *iter);
+GLIB_AVAILABLE_IN_2_30
+void g_hash_table_iter_replace (GHashTableIter *iter,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_iter_steal (GHashTableIter *iter);
+
+GLIB_AVAILABLE_IN_ALL
+GHashTable* g_hash_table_ref (GHashTable *hash_table);
+GLIB_AVAILABLE_IN_ALL
+void g_hash_table_unref (GHashTable *hash_table);
+
+#define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26
+#define g_hash_table_thaw(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26
+
+/* Hash Functions
+ */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_str_equal (gconstpointer v1,
+ gconstpointer v2);
+GLIB_AVAILABLE_IN_ALL
+guint g_str_hash (gconstpointer v);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_int_equal (gconstpointer v1,
+ gconstpointer v2);
+GLIB_AVAILABLE_IN_ALL
+guint g_int_hash (gconstpointer v);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_int64_equal (gconstpointer v1,
+ gconstpointer v2);
+GLIB_AVAILABLE_IN_ALL
+guint g_int64_hash (gconstpointer v);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_double_equal (gconstpointer v1,
+ gconstpointer v2);
+GLIB_AVAILABLE_IN_ALL
+guint g_double_hash (gconstpointer v);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_direct_equal (gconstpointer v1,
+ gconstpointer v2) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_HASH_H__ */
diff --git a/include/glib/glib/ghmac.h b/include/glib/glib/ghmac.h
new file mode 100644
index 0000000000..36e24eb29b
--- /dev/null
+++ b/include/glib/glib/ghmac.h
@@ -0,0 +1,83 @@
+/* ghmac.h - secure data hashing
+ *
+ * Copyright (C) 2011 Stef Walter <stefw@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_HMAC_H__
+#define __G_HMAC_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include "gchecksum.h"
+
+G_BEGIN_DECLS
+
+/**
+ * GHmac:
+ *
+ * An opaque structure representing a HMAC operation.
+ * To create a new GHmac, use g_hmac_new(). To free
+ * a GHmac, use g_hmac_unref().
+ *
+ * Since: 2.30
+ */
+typedef struct _GHmac GHmac;
+
+GLIB_AVAILABLE_IN_2_30
+GHmac * g_hmac_new (GChecksumType digest_type,
+ const guchar *key,
+ gsize key_len);
+GLIB_AVAILABLE_IN_2_30
+GHmac * g_hmac_copy (const GHmac *hmac);
+GLIB_AVAILABLE_IN_2_30
+GHmac * g_hmac_ref (GHmac *hmac);
+GLIB_AVAILABLE_IN_2_30
+void g_hmac_unref (GHmac *hmac);
+GLIB_AVAILABLE_IN_2_30
+void g_hmac_update (GHmac *hmac,
+ const guchar *data,
+ gssize length);
+GLIB_AVAILABLE_IN_2_30
+const gchar * g_hmac_get_string (GHmac *hmac);
+GLIB_AVAILABLE_IN_2_30
+void g_hmac_get_digest (GHmac *hmac,
+ guint8 *buffer,
+ gsize *digest_len);
+
+GLIB_AVAILABLE_IN_2_30
+gchar *g_compute_hmac_for_data (GChecksumType digest_type,
+ const guchar *key,
+ gsize key_len,
+ const guchar *data,
+ gsize length);
+GLIB_AVAILABLE_IN_2_30
+gchar *g_compute_hmac_for_string (GChecksumType digest_type,
+ const guchar *key,
+ gsize key_len,
+ const gchar *str,
+ gssize length);
+GLIB_AVAILABLE_IN_2_50
+gchar *g_compute_hmac_for_bytes (GChecksumType digest_type,
+ GBytes *key,
+ GBytes *data);
+
+
+G_END_DECLS
+
+#endif /* __G_CHECKSUM_H__ */
diff --git a/include/glib/glib/ghook.h b/include/glib/glib/ghook.h
new file mode 100644
index 0000000000..83ad1bdefc
--- /dev/null
+++ b/include/glib/glib/ghook.h
@@ -0,0 +1,202 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_HOOK_H__
+#define __G_HOOK_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmem.h>
+
+G_BEGIN_DECLS
+
+
+/* --- typedefs --- */
+typedef struct _GHook GHook;
+typedef struct _GHookList GHookList;
+
+typedef gint (*GHookCompareFunc) (GHook *new_hook,
+ GHook *sibling);
+typedef gboolean (*GHookFindFunc) (GHook *hook,
+ gpointer data);
+typedef void (*GHookMarshaller) (GHook *hook,
+ gpointer marshal_data);
+typedef gboolean (*GHookCheckMarshaller) (GHook *hook,
+ gpointer marshal_data);
+typedef void (*GHookFunc) (gpointer data);
+typedef gboolean (*GHookCheckFunc) (gpointer data);
+typedef void (*GHookFinalizeFunc) (GHookList *hook_list,
+ GHook *hook);
+typedef enum
+{
+ G_HOOK_FLAG_ACTIVE = 1 << 0,
+ G_HOOK_FLAG_IN_CALL = 1 << 1,
+ G_HOOK_FLAG_MASK = 0x0f
+} GHookFlagMask;
+#define G_HOOK_FLAG_USER_SHIFT (4)
+
+
+/* --- structures --- */
+struct _GHookList
+{
+ gulong seq_id;
+ guint hook_size : 16;
+ guint is_setup : 1;
+ GHook *hooks;
+ gpointer dummy3;
+ GHookFinalizeFunc finalize_hook;
+ gpointer dummy[2];
+};
+struct _GHook
+{
+ gpointer data;
+ GHook *next;
+ GHook *prev;
+ guint ref_count;
+ gulong hook_id;
+ guint flags;
+ gpointer func;
+ GDestroyNotify destroy;
+};
+
+
+/* --- macros --- */
+#define G_HOOK(hook) ((GHook*) (hook))
+#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags)
+#define G_HOOK_ACTIVE(hook) ((G_HOOK_FLAGS (hook) & \
+ G_HOOK_FLAG_ACTIVE) != 0)
+#define G_HOOK_IN_CALL(hook) ((G_HOOK_FLAGS (hook) & \
+ G_HOOK_FLAG_IN_CALL) != 0)
+#define G_HOOK_IS_VALID(hook) (G_HOOK (hook)->hook_id != 0 && \
+ (G_HOOK_FLAGS (hook) & \
+ G_HOOK_FLAG_ACTIVE))
+#define G_HOOK_IS_UNLINKED(hook) (G_HOOK (hook)->next == NULL && \
+ G_HOOK (hook)->prev == NULL && \
+ G_HOOK (hook)->hook_id == 0 && \
+ G_HOOK (hook)->ref_count == 0)
+
+
+/* --- prototypes --- */
+/* callback maintenance functions */
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_init (GHookList *hook_list,
+ guint hook_size);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_clear (GHookList *hook_list);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_alloc (GHookList *hook_list);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_free (GHookList *hook_list,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+GHook * g_hook_ref (GHookList *hook_list,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_unref (GHookList *hook_list,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hook_destroy (GHookList *hook_list,
+ gulong hook_id);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_destroy_link (GHookList *hook_list,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_prepend (GHookList *hook_list,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_insert_before (GHookList *hook_list,
+ GHook *sibling,
+ GHook *hook);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_insert_sorted (GHookList *hook_list,
+ GHook *hook,
+ GHookCompareFunc func);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_get (GHookList *hook_list,
+ gulong hook_id);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_find (GHookList *hook_list,
+ gboolean need_valids,
+ GHookFindFunc func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_find_data (GHookList *hook_list,
+ gboolean need_valids,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_find_func (GHookList *hook_list,
+ gboolean need_valids,
+ gpointer func);
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_find_func_data (GHookList *hook_list,
+ gboolean need_valids,
+ gpointer func,
+ gpointer data);
+/* return the first valid hook, and increment its reference count */
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_first_valid (GHookList *hook_list,
+ gboolean may_be_in_call);
+/* return the next valid hook with incremented reference count, and
+ * decrement the reference count of the original hook
+ */
+GLIB_AVAILABLE_IN_ALL
+GHook* g_hook_next_valid (GHookList *hook_list,
+ GHook *hook,
+ gboolean may_be_in_call);
+/* GHookCompareFunc implementation to insert hooks sorted by their id */
+GLIB_AVAILABLE_IN_ALL
+gint g_hook_compare_ids (GHook *new_hook,
+ GHook *sibling);
+/* convenience macros */
+#define g_hook_append( hook_list, hook ) \
+ g_hook_insert_before ((hook_list), NULL, (hook))
+/* invoke all valid hooks with the (*GHookFunc) signature.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_invoke (GHookList *hook_list,
+ gboolean may_recurse);
+/* invoke all valid hooks with the (*GHookCheckFunc) signature,
+ * and destroy the hook if FALSE is returned.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_invoke_check (GHookList *hook_list,
+ gboolean may_recurse);
+/* invoke a marshaller on all valid hooks.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_marshal (GHookList *hook_list,
+ gboolean may_recurse,
+ GHookMarshaller marshaller,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_hook_list_marshal_check (GHookList *hook_list,
+ gboolean may_recurse,
+ GHookCheckMarshaller marshaller,
+ gpointer marshal_data);
+
+G_END_DECLS
+
+#endif /* __G_HOOK_H__ */
diff --git a/include/glib/glib/ghostutils.h b/include/glib/glib/ghostutils.h
new file mode 100644
index 0000000000..59d2d41edc
--- /dev/null
+++ b/include/glib/glib/ghostutils.h
@@ -0,0 +1,43 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_HOST_UTILS_H__
+#define __G_HOST_UTILS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hostname_is_non_ascii (const gchar *hostname);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hostname_is_ascii_encoded (const gchar *hostname);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_hostname_is_ip_address (const gchar *hostname);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_hostname_to_ascii (const gchar *hostname);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_hostname_to_unicode (const gchar *hostname);
+
+G_END_DECLS
+
+#endif /* __G_HOST_UTILS_H__ */
diff --git a/include/glib/glib/gi18n-lib.h b/include/glib/glib/gi18n-lib.h
new file mode 100644
index 0000000000..74e50a3a8c
--- /dev/null
+++ b/include/glib/glib/gi18n-lib.h
@@ -0,0 +1,36 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_I18N_LIB_H__
+#define __G_I18N_LIB_H__
+
+#include <glib.h>
+
+#include <libintl.h>
+#include <string.h>
+
+#ifndef GETTEXT_PACKAGE
+#error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h?
+#endif
+
+#define _(String) ((char *) g_dgettext (GETTEXT_PACKAGE, String))
+#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0)
+#define N_(String) (String)
+#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1)
+#define NC_(Context, String) (String)
+
+#endif /* __G_I18N_LIB_H__ */
diff --git a/include/glib/glib/gi18n.h b/include/glib/glib/gi18n.h
new file mode 100644
index 0000000000..5f996d24e8
--- /dev/null
+++ b/include/glib/glib/gi18n.h
@@ -0,0 +1,32 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_I18N_H__
+#define __G_I18N_H__
+
+#include <glib.h>
+
+#include <libintl.h>
+#include <string.h>
+
+#define _(String) gettext (String)
+#define Q_(String) g_dpgettext (NULL, String, 0)
+#define N_(String) (String)
+#define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
+#define NC_(Context, String) (String)
+
+#endif /* __G_I18N_H__ */
diff --git a/include/glib/glib/giochannel.h b/include/glib/glib/giochannel.h
new file mode 100644
index 0000000000..82743602a7
--- /dev/null
+++ b/include/glib/glib/giochannel.h
@@ -0,0 +1,404 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_IOCHANNEL_H__
+#define __G_IOCHANNEL_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gconvert.h>
+#include <glib/gmain.h>
+#include <glib/gstring.h>
+
+G_BEGIN_DECLS
+
+/* GIOChannel
+ */
+
+typedef struct _GIOChannel GIOChannel;
+typedef struct _GIOFuncs GIOFuncs;
+
+typedef enum
+{
+ G_IO_ERROR_NONE,
+ G_IO_ERROR_AGAIN,
+ G_IO_ERROR_INVAL,
+ G_IO_ERROR_UNKNOWN
+} GIOError;
+
+#define G_IO_CHANNEL_ERROR g_io_channel_error_quark()
+
+typedef enum
+{
+ /* Derived from errno */
+ G_IO_CHANNEL_ERROR_FBIG,
+ G_IO_CHANNEL_ERROR_INVAL,
+ G_IO_CHANNEL_ERROR_IO,
+ G_IO_CHANNEL_ERROR_ISDIR,
+ G_IO_CHANNEL_ERROR_NOSPC,
+ G_IO_CHANNEL_ERROR_NXIO,
+ G_IO_CHANNEL_ERROR_OVERFLOW,
+ G_IO_CHANNEL_ERROR_PIPE,
+ /* Other */
+ G_IO_CHANNEL_ERROR_FAILED
+} GIOChannelError;
+
+typedef enum
+{
+ G_IO_STATUS_ERROR,
+ G_IO_STATUS_NORMAL,
+ G_IO_STATUS_EOF,
+ G_IO_STATUS_AGAIN
+} GIOStatus;
+
+typedef enum
+{
+ G_SEEK_CUR,
+ G_SEEK_SET,
+ G_SEEK_END
+} GSeekType;
+
+typedef enum
+{
+ G_IO_FLAG_APPEND = 1 << 0,
+ G_IO_FLAG_NONBLOCK = 1 << 1,
+ G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */
+ G_IO_FLAG_IS_WRITABLE = 1 << 3, /* Read only flag */
+ G_IO_FLAG_IS_WRITEABLE = 1 << 3, /* Misspelling in 2.29.10 and earlier */
+ G_IO_FLAG_IS_SEEKABLE = 1 << 4, /* Read only flag */
+ G_IO_FLAG_MASK = (1 << 5) - 1,
+ G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK,
+ G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK
+} GIOFlags;
+
+struct _GIOChannel
+{
+ /*< private >*/
+ gint ref_count;
+ GIOFuncs *funcs;
+
+ gchar *encoding;
+ GIConv read_cd;
+ GIConv write_cd;
+ gchar *line_term; /* String which indicates the end of a line of text */
+ guint line_term_len; /* So we can have null in the line term */
+
+ gsize buf_size;
+ GString *read_buf; /* Raw data from the channel */
+ GString *encoded_read_buf; /* Channel data converted to UTF-8 */
+ GString *write_buf; /* Data ready to be written to the file */
+ gchar partial_write_buf[6]; /* UTF-8 partial characters, null terminated */
+
+ /* Group the flags together, immediately after partial_write_buf, to save memory */
+
+ guint use_buffer : 1; /* The encoding uses the buffers */
+ guint do_encode : 1; /* The encoding uses the GIConv coverters */
+ guint close_on_unref : 1; /* Close the channel on final unref */
+ guint is_readable : 1; /* Cached GIOFlag */
+ guint is_writeable : 1; /* ditto */
+ guint is_seekable : 1; /* ditto */
+
+ gpointer reserved1;
+ gpointer reserved2;
+};
+
+typedef gboolean (*GIOFunc) (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data);
+struct _GIOFuncs
+{
+ GIOStatus (*io_read) (GIOChannel *channel,
+ gchar *buf,
+ gsize count,
+ gsize *bytes_read,
+ GError **err);
+ GIOStatus (*io_write) (GIOChannel *channel,
+ const gchar *buf,
+ gsize count,
+ gsize *bytes_written,
+ GError **err);
+ GIOStatus (*io_seek) (GIOChannel *channel,
+ gint64 offset,
+ GSeekType type,
+ GError **err);
+ GIOStatus (*io_close) (GIOChannel *channel,
+ GError **err);
+ GSource* (*io_create_watch) (GIOChannel *channel,
+ GIOCondition condition);
+ void (*io_free) (GIOChannel *channel);
+ GIOStatus (*io_set_flags) (GIOChannel *channel,
+ GIOFlags flags,
+ GError **err);
+ GIOFlags (*io_get_flags) (GIOChannel *channel);
+};
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_init (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+GIOChannel *g_io_channel_ref (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_unref (GIOChannel *channel);
+
+GLIB_DEPRECATED_FOR(g_io_channel_read_chars)
+GIOError g_io_channel_read (GIOChannel *channel,
+ gchar *buf,
+ gsize count,
+ gsize *bytes_read);
+
+GLIB_DEPRECATED_FOR(g_io_channel_write_chars)
+GIOError g_io_channel_write (GIOChannel *channel,
+ const gchar *buf,
+ gsize count,
+ gsize *bytes_written);
+
+GLIB_DEPRECATED_FOR(g_io_channel_seek_position)
+GIOError g_io_channel_seek (GIOChannel *channel,
+ gint64 offset,
+ GSeekType type);
+
+GLIB_DEPRECATED_FOR(g_io_channel_shutdown)
+void g_io_channel_close (GIOChannel *channel);
+
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_shutdown (GIOChannel *channel,
+ gboolean flush,
+ GError **err);
+GLIB_AVAILABLE_IN_ALL
+guint g_io_add_watch_full (GIOChannel *channel,
+ gint priority,
+ GIOCondition condition,
+ GIOFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+GSource * g_io_create_watch (GIOChannel *channel,
+ GIOCondition condition);
+GLIB_AVAILABLE_IN_ALL
+guint g_io_add_watch (GIOChannel *channel,
+ GIOCondition condition,
+ GIOFunc func,
+ gpointer user_data);
+
+/* character encoding conversion involved functions.
+ */
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_set_buffer_size (GIOChannel *channel,
+ gsize size);
+GLIB_AVAILABLE_IN_ALL
+gsize g_io_channel_get_buffer_size (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_set_flags (GIOChannel *channel,
+ GIOFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOFlags g_io_channel_get_flags (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_set_line_term (GIOChannel *channel,
+ const gchar *line_term,
+ gint length);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_io_channel_get_line_term (GIOChannel *channel,
+ gint *length);
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_set_buffered (GIOChannel *channel,
+ gboolean buffered);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_channel_get_buffered (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_set_encoding (GIOChannel *channel,
+ const gchar *encoding,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_io_channel_get_encoding (GIOChannel *channel);
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_set_close_on_unref (GIOChannel *channel,
+ gboolean do_close);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_io_channel_get_close_on_unref (GIOChannel *channel);
+
+
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_flush (GIOChannel *channel,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_read_line (GIOChannel *channel,
+ gchar **str_return,
+ gsize *length,
+ gsize *terminator_pos,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_read_line_string (GIOChannel *channel,
+ GString *buffer,
+ gsize *terminator_pos,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_read_to_end (GIOChannel *channel,
+ gchar **str_return,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_read_chars (GIOChannel *channel,
+ gchar *buf,
+ gsize count,
+ gsize *bytes_read,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_read_unichar (GIOChannel *channel,
+ gunichar *thechar,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_write_chars (GIOChannel *channel,
+ const gchar *buf,
+ gssize count,
+ gsize *bytes_written,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_write_unichar (GIOChannel *channel,
+ gunichar thechar,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOStatus g_io_channel_seek_position (GIOChannel *channel,
+ gint64 offset,
+ GSeekType type,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GIOChannel* g_io_channel_new_file (const gchar *filename,
+ const gchar *mode,
+ GError **error);
+
+/* Error handling */
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_io_channel_error_quark (void);
+GLIB_AVAILABLE_IN_ALL
+GIOChannelError g_io_channel_error_from_errno (gint en);
+
+/* On Unix, IO channels created with this function for any file
+ * descriptor or socket.
+ *
+ * On Win32, this can be used either for files opened with the MSVCRT
+ * (the Microsoft run-time C library) _open() or _pipe, including file
+ * descriptors 0, 1 and 2 (corresponding to stdin, stdout and stderr),
+ * or for Winsock SOCKETs. If the parameter is a legal file
+ * descriptor, it is assumed to be such, otherwise it should be a
+ * SOCKET. This relies on SOCKETs and file descriptors not
+ * overlapping. If you want to be certain, call either
+ * g_io_channel_win32_new_fd() or g_io_channel_win32_new_socket()
+ * instead as appropriate.
+ *
+ * The term file descriptor as used in the context of Win32 refers to
+ * the emulated Unix-like file descriptors MSVCRT provides. The native
+ * corresponding concept is file HANDLE. There isn't as of yet a way to
+ * get GIOChannels for Win32 file HANDLEs.
+ */
+GLIB_AVAILABLE_IN_ALL
+GIOChannel* g_io_channel_unix_new (int fd);
+GLIB_AVAILABLE_IN_ALL
+gint g_io_channel_unix_get_fd (GIOChannel *channel);
+
+
+/* Hook for GClosure / GSource integration. Don't touch */
+GLIB_VAR GSourceFuncs g_io_watch_funcs;
+
+#ifdef G_OS_WIN32
+
+/* You can use this "pseudo file descriptor" in a GPollFD to add
+ * polling for Windows messages. GTK applications should not do that.
+ */
+
+#define G_WIN32_MSG_HANDLE 19981206
+
+/* Use this to get a GPollFD from a GIOChannel, so that you can call
+ * g_io_channel_win32_poll(). After calling this you should only use
+ * g_io_channel_read() to read from the GIOChannel, i.e. never read()
+ * from the underlying file descriptor. For SOCKETs, it is possible to call
+ * recv().
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_win32_make_pollfd (GIOChannel *channel,
+ GIOCondition condition,
+ GPollFD *fd);
+
+/* This can be used to wait until at least one of the channels is readable.
+ * On Unix you would do a select() on the file descriptors of the channels.
+ */
+GLIB_AVAILABLE_IN_ALL
+gint g_io_channel_win32_poll (GPollFD *fds,
+ gint n_fds,
+ gint timeout_);
+
+/* Create an IO channel for Windows messages for window handle hwnd. */
+#if GLIB_SIZEOF_VOID_P == 8
+/* We use gsize here so that it is still an integer type and not a
+ * pointer, like the guint in the traditional prototype. We can't use
+ * intptr_t as that is not portable enough.
+ */
+GLIB_AVAILABLE_IN_ALL
+GIOChannel *g_io_channel_win32_new_messages (gsize hwnd);
+#else
+GLIB_AVAILABLE_IN_ALL
+GIOChannel *g_io_channel_win32_new_messages (guint hwnd);
+#endif
+
+/* Create an IO channel for C runtime (emulated Unix-like) file
+ * descriptors. After calling g_io_add_watch() on a IO channel
+ * returned by this function, you shouldn't call read() on the file
+ * descriptor. This is because adding polling for a file descriptor is
+ * implemented on Win32 by starting a thread that sits blocked in a
+ * read() from the file descriptor most of the time. All reads from
+ * the file descriptor should be done by this internal GLib
+ * thread. Your code should call only g_io_channel_read_chars().
+ */
+GLIB_AVAILABLE_IN_ALL
+GIOChannel* g_io_channel_win32_new_fd (gint fd);
+
+/* Get the C runtime file descriptor of a channel. */
+GLIB_AVAILABLE_IN_ALL
+gint g_io_channel_win32_get_fd (GIOChannel *channel);
+
+/* Create an IO channel for a winsock socket. The parameter should be
+ * a SOCKET. Contrary to IO channels for file descriptors (on *Win32),
+ * you can use normal recv() or recvfrom() on sockets even if GLib
+ * is polling them.
+ */
+GLIB_AVAILABLE_IN_ALL
+GIOChannel *g_io_channel_win32_new_socket (gint socket);
+
+GLIB_DEPRECATED_FOR(g_io_channel_win32_new_socket)
+GIOChannel *g_io_channel_win32_new_stream_socket (gint socket);
+
+GLIB_AVAILABLE_IN_ALL
+void g_io_channel_win32_set_debug (GIOChannel *channel,
+ gboolean flag);
+
+#endif
+
+G_END_DECLS
+
+#endif /* __G_IOCHANNEL_H__ */
diff --git a/include/glib/glib/gkeyfile.h b/include/glib/glib/gkeyfile.h
new file mode 100644
index 0000000000..7a1004841a
--- /dev/null
+++ b/include/glib/glib/gkeyfile.h
@@ -0,0 +1,330 @@
+/* gkeyfile.h - desktop entry file parser
+ *
+ * Copyright 2004 Red Hat, Inc.
+ *
+ * Ray Strode <halfline@hawaii.rr.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_KEY_FILE_H__
+#define __G_KEY_FILE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gbytes.h>
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
+ G_KEY_FILE_ERROR_PARSE,
+ G_KEY_FILE_ERROR_NOT_FOUND,
+ G_KEY_FILE_ERROR_KEY_NOT_FOUND,
+ G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
+ G_KEY_FILE_ERROR_INVALID_VALUE
+} GKeyFileError;
+
+#define G_KEY_FILE_ERROR g_key_file_error_quark()
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_key_file_error_quark (void);
+
+typedef struct _GKeyFile GKeyFile;
+
+typedef enum
+{
+ G_KEY_FILE_NONE = 0,
+ G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
+ G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
+} GKeyFileFlags;
+
+GLIB_AVAILABLE_IN_ALL
+GKeyFile *g_key_file_new (void);
+GLIB_AVAILABLE_IN_ALL
+GKeyFile *g_key_file_ref (GKeyFile *key_file);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_unref (GKeyFile *key_file);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_free (GKeyFile *key_file);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_list_separator (GKeyFile *key_file,
+ gchar separator);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_load_from_file (GKeyFile *key_file,
+ const gchar *file,
+ GKeyFileFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_load_from_data (GKeyFile *key_file,
+ const gchar *data,
+ gsize length,
+ GKeyFileFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_key_file_load_from_bytes (GKeyFile *key_file,
+ GBytes *bytes,
+ GKeyFileFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_load_from_dirs (GKeyFile *key_file,
+ const gchar *file,
+ const gchar **search_dirs,
+ gchar **full_path,
+ GKeyFileFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
+ const gchar *file,
+ gchar **full_path,
+ GKeyFileFlags flags,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_to_data (GKeyFile *key_file,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_2_40
+gboolean g_key_file_save_to_file (GKeyFile *key_file,
+ const gchar *filename,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar **g_key_file_get_groups (GKeyFile *key_file,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_key_file_get_keys (GKeyFile *key_file,
+ const gchar *group_name,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_has_group (GKeyFile *key_file,
+ const gchar *group_name);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_has_key (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_get_value (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_value (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *value);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_get_string (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_string (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_get_locale_string (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *locale,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_2_56
+gchar *g_key_file_get_locale_for_key (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *locale) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_locale_string (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *locale,
+ const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_get_boolean (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_boolean (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gboolean value);
+GLIB_AVAILABLE_IN_ALL
+gint g_key_file_get_integer (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_integer (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gint value);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_key_file_get_int64 (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_int64 (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gint64 value);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_key_file_get_uint64 (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_uint64 (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ guint64 value);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_key_file_get_double (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_double (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gdouble value);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_key_file_get_string_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_string_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar * const list[],
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *locale,
+ gsize *length,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_locale_string_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *locale,
+ const gchar * const list[],
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_boolean_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gboolean list[],
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gint *g_key_file_get_integer_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_double_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gdouble list[],
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gdouble *g_key_file_get_double_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gsize *length,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_key_file_set_integer_list (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ gint list[],
+ gsize length);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_set_comment (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ const gchar *comment,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_key_file_get_comment (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_remove_comment (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_remove_key (GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_key_file_remove_group (GKeyFile *key_file,
+ const gchar *group_name,
+ GError **error);
+
+/* Defines for handling freedesktop.org Desktop files */
+#define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
+
+#define G_KEY_FILE_DESKTOP_KEY_TYPE "Type"
+#define G_KEY_FILE_DESKTOP_KEY_VERSION "Version"
+#define G_KEY_FILE_DESKTOP_KEY_NAME "Name"
+#define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName"
+#define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay"
+#define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment"
+#define G_KEY_FILE_DESKTOP_KEY_ICON "Icon"
+#define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden"
+#define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn"
+#define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn"
+#define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec"
+#define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec"
+#define G_KEY_FILE_DESKTOP_KEY_PATH "Path"
+#define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal"
+#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType"
+#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories"
+#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
+#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
+#define G_KEY_FILE_DESKTOP_KEY_URL "URL"
+#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
+#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions"
+
+#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
+#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
+#define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory"
+
+G_END_DECLS
+
+#endif /* __G_KEY_FILE_H__ */
diff --git a/include/glib/glib/glib-autocleanups.h b/include/glib/glib/glib-autocleanups.h
new file mode 100644
index 0000000000..efa4a99ab6
--- /dev/null
+++ b/include/glib/glib/glib-autocleanups.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2015 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+static inline void
+g_autoptr_cleanup_generic_gfree (void *p)
+{
+ void **pp = (void**)p;
+ g_free (*pp);
+}
+
+static inline void
+g_autoptr_cleanup_gstring_free (GString *string)
+{
+ if (string)
+ g_string_free (string, TRUE);
+}
+
+/* If adding a cleanup here, please also add a test case to
+ * glib/tests/autoptr.c
+ */
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GRefString, g_ref_string_release)
diff --git a/include/glib/glib/glist.h b/include/glib/glib/glist.h
new file mode 100644
index 0000000000..8b4703e171
--- /dev/null
+++ b/include/glib/glib/glist.h
@@ -0,0 +1,156 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_LIST_H__
+#define __G_LIST_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmem.h>
+#include <glib/gnode.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GList GList;
+
+struct _GList
+{
+ gpointer data;
+ GList *next;
+ GList *prev;
+};
+
+/* Doubly linked lists
+ */
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+void g_list_free (GList *list);
+GLIB_AVAILABLE_IN_ALL
+void g_list_free_1 (GList *list);
+#define g_list_free1 g_list_free_1
+GLIB_AVAILABLE_IN_ALL
+void g_list_free_full (GList *list,
+ GDestroyNotify free_func);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_append (GList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_prepend (GList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_insert (GList *list,
+ gpointer data,
+ gint position) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_insert_sorted (GList *list,
+ gpointer data,
+ GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_insert_sorted_with_data (GList *list,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_insert_before (GList *list,
+ GList *sibling,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_2_62
+GList* g_list_insert_before_link (GList *list,
+ GList *sibling,
+ GList *link_) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_concat (GList *list1,
+ GList *list2) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_remove (GList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_remove_all (GList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_remove_link (GList *list,
+ GList *llink) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_delete_link (GList *list,
+ GList *link_) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT;
+
+GLIB_AVAILABLE_IN_2_34
+GList* g_list_copy_deep (GList *list,
+ GCopyFunc func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_nth (GList *list,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_nth_prev (GList *list,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_find (GList *list,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_find_custom (GList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GLIB_AVAILABLE_IN_ALL
+gint g_list_position (GList *list,
+ GList *llink);
+GLIB_AVAILABLE_IN_ALL
+gint g_list_index (GList *list,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_last (GList *list);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_first (GList *list);
+GLIB_AVAILABLE_IN_ALL
+guint g_list_length (GList *list);
+GLIB_AVAILABLE_IN_ALL
+void g_list_foreach (GList *list,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_sort (GList *list,
+ GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GList* g_list_sort_with_data (GList *list,
+ GCompareDataFunc compare_func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_list_nth_data (GList *list,
+ guint n);
+
+
+#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
+#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
+
+G_END_DECLS
+
+#endif /* __G_LIST_H__ */
diff --git a/include/glib/glib/gmacros.h b/include/glib/glib/gmacros.h
new file mode 100644
index 0000000000..79077e23bd
--- /dev/null
+++ b/include/glib/glib/gmacros.h
@@ -0,0 +1,1099 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/* This file must not include any other glib header file and must thus
+ * not refer to variables from glibconfig.h
+ */
+
+#ifndef __G_MACROS_H__
+#define __G_MACROS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+/* We include stddef.h to get the system's definition of NULL
+ */
+#include <stddef.h>
+
+#ifdef __GNUC__
+#define G_GNUC_CHECK_VERSION(major, minor) \
+ ((__GNUC__ > (major)) || \
+ ((__GNUC__ == (major)) && \
+ (__GNUC_MINOR__ >= (minor))))
+#else
+#define G_GNUC_CHECK_VERSION(major, minor) 0
+#endif
+
+/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
+ * where this is valid. This allows for warningless compilation of
+ * "long long" types even in the presence of '-ansi -pedantic'.
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+#define G_GNUC_EXTENSION __extension__
+#else
+#define G_GNUC_EXTENSION
+#endif
+
+/* Every compiler that we target supports inlining, but some of them may
+ * complain about it if we don't say "__inline". If we have C99, or if
+ * we are using C++, then we can use "inline" directly. Unfortunately
+ * Visual Studio does not support __STDC_VERSION__, so we need to check
+ * whether we are on Visual Studio 2013 or earlier to see that we need to
+ * say "__inline" in C mode.
+ * Otherwise, we say "__inline" to avoid the warning.
+ */
+#define G_CAN_INLINE
+#ifndef __cplusplus
+# ifdef _MSC_VER
+# if (_MSC_VER < 1900)
+# define G_INLINE_DEFINE_NEEDED
+# endif
+# elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900)
+# define G_INLINE_DEFINE_NEEDED
+# endif
+#endif
+
+#ifdef G_INLINE_DEFINE_NEEDED
+# undef inline
+# define inline __inline
+#endif
+
+#undef G_INLINE_DEFINE_NEEDED
+
+/**
+ * G_INLINE_FUNC:
+ *
+ * This macro used to be used to conditionally define inline functions
+ * in a compatible way before this feature was supported in all
+ * compilers. These days, GLib requires inlining support from the
+ * compiler, so your GLib-using programs can safely assume that the
+ * "inline" keywork works properly.
+ *
+ * Never use this macro anymore. Just say "static inline".
+ *
+ * Deprecated: 2.48: Use "static inline" instead
+ */
+
+/* For historical reasons we need to continue to support those who
+ * define G_IMPLEMENT_INLINES to mean "don't implement this here".
+ */
+#ifdef G_IMPLEMENT_INLINES
+# define G_INLINE_FUNC extern GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline)
+# undef G_CAN_INLINE
+#else
+# define G_INLINE_FUNC static inline GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline)
+#endif /* G_IMPLEMENT_INLINES */
+
+/* Provide macros to feature the GCC function attribute.
+ */
+
+/**
+ * G_GNUC_PURE:
+ *
+ * Expands to the GNU C `pure` function attribute if the compiler is gcc.
+ * Declaring a function as `pure` enables better optimization of calls to
+ * the function. A `pure` function has no effects except its return value
+ * and the return value depends only on the parameters and/or global
+ * variables.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gboolean g_type_check_value (const GValue *value) G_GNUC_PURE;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute) for more details.
+ */
+
+/**
+ * G_GNUC_MALLOC:
+ *
+ * Expands to the
+ * [GNU C `malloc` function attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc)
+ * if the compiler is gcc.
+ * Declaring a function as `malloc` enables better optimization of the function,
+ * but must only be done if the allocation behaviour of the function is fully
+ * understood, otherwise miscompilation can result.
+ *
+ * A function can have the `malloc` attribute if it returns a pointer which is
+ * guaranteed to not alias with any other pointer valid when the function
+ * returns, and moreover no pointers to valid objects occur in any storage
+ * addressed by the returned pointer.
+ *
+ * In practice, this means that `G_GNUC_MALLOC` can be used with any function
+ * which returns unallocated or zeroed-out memory, but not with functions which
+ * return initialised structures containing other pointers, or with functions
+ * that reallocate memory. This definition changed in GLib 2.58 to match the
+ * stricter definition introduced around GCC 5.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+ * ]|
+ *
+ * See the
+ * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc)
+ * for more details.
+ *
+ * Since: 2.6
+ */
+
+/**
+ * G_GNUC_NO_INLINE:
+ *
+ * Expands to the GNU C `noinline` function attribute if the compiler is gcc.
+ * If the compiler is not gcc, this macro expands to nothing.
+ *
+ * Declaring a function as `noinline` prevents the function from being
+ * considered for inlining.
+ *
+ * The attribute may be placed before the declaration or definition,
+ * right before the `static` keyword.
+ *
+ * |[<!-- language="C" -->
+ * G_GNUC_NO_INLINE
+ * static int
+ * do_not_inline_this (void)
+ * {
+ * ...
+ * }
+ * ]|
+ *
+ * See the
+ * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute)
+ * for more details.
+ *
+ * Since: 2.58
+ */
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#define G_GNUC_PURE __attribute__((__pure__))
+#define G_GNUC_MALLOC __attribute__((__malloc__))
+#define G_GNUC_NO_INLINE __attribute__((noinline))
+#else
+#define G_GNUC_PURE
+#define G_GNUC_MALLOC
+#define G_GNUC_NO_INLINE
+#endif
+
+/**
+ * G_GNUC_NULL_TERMINATED:
+ *
+ * Expands to the GNU C `sentinel` function attribute if the compiler is gcc.
+ * This function attribute only applies to variadic functions and instructs
+ * the compiler to check that the argument list is terminated with an
+ * explicit %NULL.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gchar *g_strconcat (const gchar *string1,
+ * ...) G_GNUC_NULL_TERMINATED;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-sentinel-function-attribute) for more details.
+ *
+ * Since: 2.8
+ */
+#if __GNUC__ >= 4
+#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define G_GNUC_NULL_TERMINATED
+#endif
+
+/*
+ * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since
+ * __typeof__ is used in a few places in GLib, provide a pre-processor symbol
+ * to factor the check out from callers.
+ *
+ * This symbol is private.
+ */
+#undef g_has_typeof
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus)
+#define g_has_typeof
+#endif
+
+/*
+ * Clang feature detection: http://clang.llvm.org/docs/LanguageExtensions.html
+ * These are not available on GCC, but since the pre-processor doesn't do
+ * operator short-circuiting, we can't use it in a statement or we'll get:
+ *
+ * error: missing binary operator before token "("
+ *
+ * So we define it to 0 to satisfy the pre-processor.
+ */
+
+#ifdef __has_attribute
+#define g_macro__has_attribute __has_attribute
+#else
+#define g_macro__has_attribute(x) 0
+#endif
+
+#ifdef __has_feature
+#define g_macro__has_feature __has_feature
+#else
+#define g_macro__has_feature(x) 0
+#endif
+
+#ifdef __has_builtin
+#define g_macro__has_builtin __has_builtin
+#else
+#define g_macro__has_builtin(x) 0
+#endif
+
+/**
+ * G_GNUC_ALLOC_SIZE:
+ * @x: the index of the argument specifying the allocation size
+ *
+ * Expands to the GNU C `alloc_size` function attribute if the compiler
+ * is a new enough gcc. This attribute tells the compiler that the
+ * function returns a pointer to memory of a size that is specified
+ * by the @xth function parameter.
+ *
+ * Place the attribute after the function declaration, just before the
+ * semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details.
+ *
+ * Since: 2.18
+ */
+
+/**
+ * G_GNUC_ALLOC_SIZE2:
+ * @x: the index of the argument specifying one factor of the allocation size
+ * @y: the index of the argument specifying the second factor of the allocation size
+ *
+ * Expands to the GNU C `alloc_size` function attribute if the compiler is a
+ * new enough gcc. This attribute tells the compiler that the function returns
+ * a pointer to memory of a size that is specified by the product of two
+ * function parameters.
+ *
+ * Place the attribute after the function declaration, just before the
+ * semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gpointer g_malloc_n (gsize n_blocks,
+ * gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1, 2);
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details.
+ *
+ * Since: 2.18
+ */
+#if (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
+ (defined(__clang__) && g_macro__has_attribute(__alloc_size__))
+#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
+#else
+#define G_GNUC_ALLOC_SIZE(x)
+#define G_GNUC_ALLOC_SIZE2(x,y)
+#endif
+
+/**
+ * G_GNUC_PRINTF:
+ * @format_idx: the index of the argument corresponding to the
+ * format string (the arguments are numbered from 1)
+ * @arg_idx: the index of the first of the format arguments, or 0 if
+ * there are no format arguments
+ *
+ * Expands to the GNU C `format` function attribute if the compiler is gcc.
+ * This is used for declaring functions which take a variable number of
+ * arguments, with the same syntax as `printf()`. It allows the compiler
+ * to type-check the arguments passed to the function.
+ *
+ * Place the attribute after the function declaration, just before the
+ * semicolon.
+ *
+ * See the
+ * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
+ * for more details.
+ *
+ * |[<!-- language="C" -->
+ * gint g_snprintf (gchar *string,
+ * gulong n,
+ * gchar const *format,
+ * ...) G_GNUC_PRINTF (3, 4);
+ * ]|
+ */
+
+/**
+ * G_GNUC_SCANF:
+ * @format_idx: the index of the argument corresponding to
+ * the format string (the arguments are numbered from 1)
+ * @arg_idx: the index of the first of the format arguments, or 0 if
+ * there are no format arguments
+ *
+ * Expands to the GNU C `format` function attribute if the compiler is gcc.
+ * This is used for declaring functions which take a variable number of
+ * arguments, with the same syntax as `scanf()`. It allows the compiler
+ * to type-check the arguments passed to the function.
+ *
+ * |[<!-- language="C" -->
+ * int my_scanf (MyStream *stream,
+ * const char *format,
+ * ...) G_GNUC_SCANF (2, 3);
+ * int my_vscanf (MyStream *stream,
+ * const char *format,
+ * va_list ap) G_GNUC_SCANF (2, 0);
+ * ]|
+ *
+ * See the
+ * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
+ * for details.
+ */
+
+/**
+ * G_GNUC_STRFTIME:
+ * @format_idx: the index of the argument corresponding to
+ * the format string (the arguments are numbered from 1)
+ *
+ * Expands to the GNU C `strftime` format function attribute if the compiler
+ * is gcc. This is used for declaring functions which take a format argument
+ * which is passed to `strftime()` or an API implementing its formats. It allows
+ * the compiler check the format passed to the function.
+ *
+ * |[<!-- language="C" -->
+ * gsize my_strftime (MyBuffer *buffer,
+ * const char *format,
+ * const struct tm *tm) G_GNUC_STRFTIME (2);
+ * ]|
+ *
+ * See the
+ * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
+ * for details.
+ *
+ * Since: 2.60
+ */
+
+/**
+ * G_GNUC_FORMAT:
+ * @arg_idx: the index of the argument
+ *
+ * Expands to the GNU C `format_arg` function attribute if the compiler
+ * is gcc. This function attribute specifies that a function takes a
+ * format string for a `printf()`, `scanf()`, `strftime()` or `strfmon()` style
+ * function and modifies it, so that the result can be passed to a `printf()`,
+ * `scanf()`, `strftime()` or `strfmon()` style function (with the remaining
+ * arguments to the format function the same as they would have been
+ * for the unmodified string).
+ *
+ * Place the attribute after the function declaration, just before the
+ * semicolon.
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-nonliteral-1) for more details.
+ *
+ * |[<!-- language="C" -->
+ * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
+ * ]|
+ */
+
+/**
+ * G_GNUC_NORETURN:
+ *
+ * Expands to the GNU C `noreturn` function attribute if the compiler is gcc.
+ * It is used for declaring functions which never return. It enables
+ * optimization of the function, and avoids possible compiler warnings.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * void g_abort (void) G_GNUC_NORETURN;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute) for more details.
+ */
+
+/**
+ * G_GNUC_CONST:
+ *
+ * Expands to the GNU C `const` function attribute if the compiler is gcc.
+ * Declaring a function as `const` enables better optimization of calls to
+ * the function. A `const` function doesn't examine any values except its
+ * parameters, and has no effects except its return value.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * gchar g_ascii_tolower (gchar c) G_GNUC_CONST;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute) for more details.
+ *
+ * A function that has pointer arguments and examines the data pointed to
+ * must not be declared `const`. Likewise, a function that calls a non-`const`
+ * function usually must not be `const`. It doesn't make sense for a `const`
+ * function to return `void`.
+ */
+
+/**
+ * G_GNUC_UNUSED:
+ *
+ * Expands to the GNU C `unused` function attribute if the compiler is gcc.
+ * It is used for declaring functions and arguments which may never be used.
+ * It avoids possible compiler warnings.
+ *
+ * For functions, place the attribute after the declaration, just before the
+ * semicolon. For arguments, place the attribute at the beginning of the
+ * argument declaration.
+ *
+ * |[<!-- language="C" -->
+ * void my_unused_function (G_GNUC_UNUSED gint unused_argument,
+ * gint other_argument) G_GNUC_UNUSED;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute) for more details.
+ */
+
+/**
+ * G_GNUC_NO_INSTRUMENT:
+ *
+ * Expands to the GNU C `no_instrument_function` function attribute if the
+ * compiler is gcc. Functions with this attribute will not be instrumented
+ * for profiling, when the compiler is called with the
+ * `-finstrument-functions` option.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * int do_uninteresting_things (void) G_GNUC_NO_INSTRUMENT;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005finstrument_005ffunction-function-attribute) for more details.
+ */
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#if !defined (__clang__) && G_GNUC_CHECK_VERSION (4, 4)
+#define G_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (gnu_printf, format_idx, arg_idx)))
+#define G_GNUC_SCANF( format_idx, arg_idx ) \
+ __attribute__((__format__ (gnu_scanf, format_idx, arg_idx)))
+#define G_GNUC_STRFTIME( format_idx ) \
+ __attribute__((__format__ (gnu_strftime, format_idx, 0)))
+#else
+#define G_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#define G_GNUC_SCANF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
+#define G_GNUC_STRFTIME( format_idx ) \
+ __attribute__((__format__ (__strftime__, format_idx, 0)))
+#endif
+#define G_GNUC_FORMAT( arg_idx ) \
+ __attribute__((__format_arg__ (arg_idx)))
+#define G_GNUC_NORETURN \
+ __attribute__((__noreturn__))
+#define G_GNUC_CONST \
+ __attribute__((__const__))
+#define G_GNUC_UNUSED \
+ __attribute__((__unused__))
+#define G_GNUC_NO_INSTRUMENT \
+ __attribute__((__no_instrument_function__))
+#else /* !__GNUC__ */
+#define G_GNUC_PRINTF( format_idx, arg_idx )
+#define G_GNUC_SCANF( format_idx, arg_idx )
+#define G_GNUC_STRFTIME( format_idx )
+#define G_GNUC_FORMAT( arg_idx )
+/* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__,
+ * __declspec can only be placed at the start of the function prototype
+ * and not at the end, so we can't use it without breaking API.
+ */
+#define G_GNUC_NORETURN
+#define G_GNUC_CONST
+#define G_GNUC_UNUSED
+#define G_GNUC_NO_INSTRUMENT
+#endif /* !__GNUC__ */
+
+/**
+ * G_GNUC_FALLTHROUGH:
+ *
+ * Expands to the GNU C `fallthrough` statement attribute if the compiler is gcc.
+ * This allows declaring case statement to explicitly fall through in switch
+ * statements. To enable this feature, use `-Wimplicit-fallthrough` during
+ * compilation.
+ *
+ * Put the attribute right before the case statement you want to fall through
+ * to.
+ *
+ * |[<!-- language="C" -->
+ * switch (foo)
+ * {
+ * case 1:
+ * g_message ("it's 1");
+ * G_GNUC_FALLTHROUGH;
+ * case 2:
+ * g_message ("it's either 1 or 2");
+ * break;
+ * }
+ * ]|
+ *
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#index-fallthrough-statement-attribute) for more details.
+ *
+ * Since: 2.60
+ */
+#if __GNUC__ > 6
+#define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
+#else
+#define G_GNUC_FALLTHROUGH
+#endif /* __GNUC__ */
+
+/**
+ * G_GNUC_DEPRECATED:
+ *
+ * Expands to the GNU C `deprecated` attribute if the compiler is gcc.
+ * It can be used to mark `typedef`s, variables and functions as deprecated.
+ * When called with the `-Wdeprecated-declarations` option,
+ * gcc will generate warnings when deprecated interfaces are used.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * int my_mistake (void) G_GNUC_DEPRECATED;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details.
+ *
+ * Since: 2.2
+ */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__)
+#define G_GNUC_DEPRECATED __attribute__((__deprecated__))
+#else
+#define G_GNUC_DEPRECATED
+#endif /* __GNUC__ */
+
+/**
+ * G_GNUC_DEPRECATED_FOR:
+ * @f: the intended replacement for the deprecated symbol,
+ * such as the name of a function
+ *
+ * Like %G_GNUC_DEPRECATED, but names the intended replacement for the
+ * deprecated symbol if the version of gcc in use is new enough to support
+ * custom deprecation messages.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * int my_mistake (void) G_GNUC_DEPRECATED_FOR(my_replacement);
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details.
+ *
+ * Note that if @f is a macro, it will be expanded in the warning message.
+ * You can enclose it in quotes to prevent this. (The quotes will show up
+ * in the warning, but it's better than showing the macro expansion.)
+ *
+ * Since: 2.26
+ */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__)
+#define G_GNUC_DEPRECATED_FOR(f) \
+ __attribute__((deprecated("Use " #f " instead")))
+#else
+#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
+#endif /* __GNUC__ */
+
+#ifdef __ICC
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ _Pragma ("warning (push)") \
+ _Pragma ("warning (disable:1478)")
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+ _Pragma ("warning (pop)")
+#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+ _Pragma ("GCC diagnostic pop")
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500) && !defined (__clang__)
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ __pragma (warning (push)) \
+ __pragma (warning (disable : 4996))
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+ __pragma (warning (pop))
+#elif defined (__clang__)
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+ _Pragma("clang diagnostic pop")
+#else
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+#define G_GNUC_END_IGNORE_DEPRECATIONS
+#endif
+
+/**
+ * G_GNUC_MAY_ALIAS:
+ *
+ * Expands to the GNU C `may_alias` type attribute if the compiler is gcc.
+ * Types with this attribute will not be subjected to type-based alias
+ * analysis, but are assumed to alias with any other type, just like `char`.
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-may_005falias-type-attribute) for details.
+ *
+ * Since: 2.14
+ */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+#define G_GNUC_MAY_ALIAS __attribute__((may_alias))
+#else
+#define G_GNUC_MAY_ALIAS
+#endif
+
+/**
+ * G_GNUC_WARN_UNUSED_RESULT:
+ *
+ * Expands to the GNU C `warn_unused_result` function attribute if the compiler
+ * is gcc. This function attribute makes the compiler emit a warning if the
+ * result of a function call is ignored.
+ *
+ * Place the attribute after the declaration, just before the semicolon.
+ *
+ * |[<!-- language="C" -->
+ * GList *g_list_append (GList *list,
+ * gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+ * ]|
+ *
+ * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warn_005funused_005fresult-function-attribute) for more details.
+ *
+ * Since: 2.10
+ */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define G_GNUC_WARN_UNUSED_RESULT
+#endif /* __GNUC__ */
+
+/**
+ * G_GNUC_FUNCTION:
+ *
+ * Expands to "" on all modern compilers, and to __FUNCTION__ on gcc
+ * version 2.x. Don't use it.
+ *
+ * Deprecated: 2.16: Use G_STRFUNC() instead
+ */
+
+/**
+ * G_GNUC_PRETTY_FUNCTION:
+ *
+ * Expands to "" on all modern compilers, and to __PRETTY_FUNCTION__
+ * on gcc version 2.x. Don't use it.
+ *
+ * Deprecated: 2.16: Use G_STRFUNC() instead
+ */
+
+/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
+ * macros, so we can refer to them as strings unconditionally.
+ * usage not-recommended since gcc-3.0
+ *
+ * Mark them as deprecated since 2.26, since that’s when version macros were
+ * introduced.
+ */
+#if defined (__GNUC__) && (__GNUC__ < 3)
+#define G_GNUC_FUNCTION __FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC)
+#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC)
+#else /* !__GNUC__ */
+#define G_GNUC_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC)
+#define G_GNUC_PRETTY_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC)
+#endif /* !__GNUC__ */
+
+#if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__)
+#define G_ANALYZER_ANALYZING 1
+#define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
+#else
+#define G_ANALYZER_ANALYZING 0
+#define G_ANALYZER_NORETURN
+#endif
+
+#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
+#define G_STRINGIFY_ARG(contents) #contents
+
+#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
+#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
+#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2)
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
+#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
+ (defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \
+ (defined (_MSC_VER) && (_MSC_VER >= 1800))
+#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false")
+#else
+#ifdef __COUNTER__
+#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
+#else
+#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED
+#endif
+#endif /* __STDC_VERSION__ */
+#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
+#endif /* !__GI_SCANNER__ */
+
+/* Provide a string identifying the current code position */
+#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
+#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
+#else
+#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
+#endif
+
+/* Provide a string identifying the current function, non-concatenatable */
+#if defined (__GNUC__) && defined (__cplusplus)
+#define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define G_STRFUNC ((const char*) (__func__))
+#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300))
+#define G_STRFUNC ((const char*) (__FUNCTION__))
+#else
+#define G_STRFUNC ((const char*) ("???"))
+#endif
+
+/* Guard C code in headers, while including them from C++ */
+#ifdef __cplusplus
+#define G_BEGIN_DECLS extern "C" {
+#define G_END_DECLS }
+#else
+#define G_BEGIN_DECLS
+#define G_END_DECLS
+#endif
+
+/* Provide definitions for some commonly used macros.
+ * Some of them are only provided if they haven't already
+ * been defined. It is assumed that if they are already
+ * defined then the current definition is correct.
+ */
+#ifndef NULL
+# ifdef __cplusplus
+# define NULL (0L)
+# else /* !__cplusplus */
+# define NULL ((void*) 0)
+# endif /* !__cplusplus */
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+#undef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#undef ABS
+#define ABS(a) (((a) < 0) ? -(a) : (a))
+
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+#define G_APPROX_VALUE(a, b, epsilon) \
+ (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon))
+
+/* Count the number of elements in an array. The array must be defined
+ * as such; using this with a dynamically allocated array will give
+ * incorrect results.
+ */
+#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
+/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT
+ */
+#define GPOINTER_TO_SIZE(p) ((gsize) (p))
+#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s))
+
+/* Provide convenience macros for handling structure
+ * fields through their offsets.
+ */
+
+#if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER)
+#define G_STRUCT_OFFSET(struct_type, member) \
+ ((glong) offsetof (struct_type, member))
+#else
+#define G_STRUCT_OFFSET(struct_type, member) \
+ ((glong) ((guint8*) &((struct_type*) 0)->member))
+#endif
+
+#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \
+ ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))
+#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \
+ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset)))
+
+/* Provide simple macro statement wrappers:
+ * G_STMT_START { statements; } G_STMT_END;
+ * This can be used as a single statement, like:
+ * if (x) G_STMT_START { ... } G_STMT_END; else ...
+ * This intentionally does not use compiler extensions like GCC's '({...})' to
+ * avoid portability issue or side effects when compiled with different compilers.
+ * MSVC complains about "while(0)": C4127: "Conditional expression is constant",
+ * so we use __pragma to avoid the warning since the use here is intentional.
+ */
+#if !(defined (G_STMT_START) && defined (G_STMT_END))
+#define G_STMT_START do
+#if defined (_MSC_VER) && (_MSC_VER >= 1500)
+#define G_STMT_END \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4127)) \
+ while(0) \
+ __pragma(warning(pop))
+#else
+#define G_STMT_END while (0)
+#endif
+#endif
+
+/* Provide G_ALIGNOF alignment macro.
+ *
+ * Note we cannot use the gcc __alignof__ operator here, as that returns the
+ * preferred alignment rather than the minimal alignment. See
+ * https://gitlab.gnome.org/GNOME/glib/merge_requests/538/diffs#note_390790.
+ */
+
+/**
+ * G_ALIGNOF
+ * @type: a type-name
+ *
+ * Return the minimal alignment required by the platform ABI for values of the given
+ * type. The address of a variable or struct member of the given type must always be
+ * a multiple of this alignment. For example, most platforms require int variables
+ * to be aligned at a 4-byte boundary, so `G_ALIGNOF (int)` is 4 on most platforms.
+ *
+ * Note this is not necessarily the same as the value returned by GCC’s
+ * `__alignof__` operator, which returns the preferred alignment for a type.
+ * The preferred alignment may be a stricter alignment than the minimal
+ * alignment.
+ *
+ * Since: 2.60
+ */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+#define G_ALIGNOF(type) _Alignof (type)
+#else
+#define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b))
+#endif
+
+/**
+ * G_CONST_RETURN:
+ *
+ * If %G_DISABLE_CONST_RETURNS is defined, this macro expands
+ * to nothing. By default, the macro expands to const. The macro
+ * can be used in place of const for functions that return a value
+ * that should not be modified. The purpose of this macro is to allow
+ * us to turn on const for returned constant strings by default, while
+ * allowing programmers who find that annoying to turn it off. This macro
+ * should only be used for return values and for "out" parameters, it
+ * doesn't make sense for "in" parameters.
+ *
+ * Deprecated: 2.30: API providers should replace all existing uses with
+ * const and API consumers should adjust their code accordingly
+ */
+#ifdef G_DISABLE_CONST_RETURNS
+#define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const)
+#else
+#define G_CONST_RETURN const GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const)
+#endif
+
+/*
+ * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to
+ * the compiler about the expected result of an expression. Some compilers
+ * can use this information for optimizations.
+ *
+ * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
+ * putting assignments in g_return_if_fail ().
+ */
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define _G_BOOLEAN_EXPR(expr) \
+ G_GNUC_EXTENSION ({ \
+ int _g_boolean_var_; \
+ if (expr) \
+ _g_boolean_var_ = 1; \
+ else \
+ _g_boolean_var_ = 0; \
+ _g_boolean_var_; \
+})
+#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
+#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0))
+#else
+#define G_LIKELY(expr) (expr)
+#define G_UNLIKELY(expr) (expr)
+#endif
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__)
+#define G_DEPRECATED __attribute__((__deprecated__))
+#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+#define G_DEPRECATED __declspec(deprecated)
+#else
+#define G_DEPRECATED
+#endif
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__)
+#define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
+#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
+#define G_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
+#else
+#define G_DEPRECATED_FOR(f) G_DEPRECATED
+#endif
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__)
+#define G_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min)))
+#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
+#define G_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min))
+#else
+#define G_UNAVAILABLE(maj,min) G_DEPRECATED
+#endif
+
+#ifndef _GLIB_EXTERN
+#define _GLIB_EXTERN extern
+#endif
+
+/* These macros are used to mark deprecated symbols in GLib headers,
+ * and thus have to be exposed in installed headers. But please
+ * do *not* use them in other projects. Instead, use G_DEPRECATED
+ * or define your own wrappers around it.
+ */
+
+#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS
+#define GLIB_DEPRECATED _GLIB_EXTERN
+#define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN
+#define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN
+#else
+#define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN
+#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN
+#define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN
+#endif
+
+#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \
+ __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
+#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
+#define GLIB_DEPRECATED_MACRO _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol")
+#define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning #f)
+#define GLIB_UNAVAILABLE_MACRO(maj,min) _GLIB_GNUC_DO_PRAGMA(GCC warning "Not available before " #maj "." #min)
+#else
+#define GLIB_DEPRECATED_MACRO
+#define GLIB_DEPRECATED_MACRO_FOR(f)
+#define GLIB_UNAVAILABLE_MACRO(maj,min)
+#endif
+
+#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \
+ ((defined (__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1))) || \
+ (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
+#define GLIB_DEPRECATED_ENUMERATOR G_DEPRECATED
+#define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
+#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min)
+#else
+#define GLIB_DEPRECATED_ENUMERATOR
+#define GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min)
+#endif
+
+#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \
+ ((defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || \
+ (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
+#define GLIB_DEPRECATED_TYPE G_DEPRECATED
+#define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
+#define GLIB_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min)
+#else
+#define GLIB_DEPRECATED_TYPE
+#define GLIB_DEPRECATED_TYPE_FOR(f)
+#define GLIB_UNAVAILABLE_TYPE(maj,min)
+#endif
+
+#ifndef __GI_SCANNER__
+
+#if defined (__GNUC__) || defined (__clang__)
+
+/* these macros are private */
+#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
+#define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName
+#define _GLIB_AUTOPTR_TYPENAME(TypeName) TypeName##_autoptr
+#define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) glib_listautoptr_cleanup_##TypeName
+#define _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) TypeName##_listautoptr
+#define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) glib_slistautoptr_cleanup_##TypeName
+#define _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) TypeName##_slistautoptr
+#define _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) glib_queueautoptr_cleanup_##TypeName
+#define _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) TypeName##_queueautoptr
+#define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName
+#define _GLIB_CLEANUP(func) __attribute__((cleanup(func)))
+#define _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, ParentName, cleanup) \
+ typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName); \
+ typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \
+ typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \
+ typedef GQueue *_GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName); \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \
+ { if (_ptr) (cleanup) ((ParentName *) _ptr); } \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) \
+ { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (*_ptr); } \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) \
+ { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) \
+ { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) (GQueue **_q) \
+ { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) cleanup); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \
+ _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName))
+
+
+/* these macros are API */
+#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \
+ _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func)
+#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName)
+#define g_autolist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_LIST_TYPENAME(TypeName)
+#define g_autoslist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName)
+#define g_autoqueue(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName)
+#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName
+#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree)
+
+#else /* not GNU C */
+/* this (dummy) macro is private */
+#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName)
+
+/* these (dummy) macros are API */
+#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)
+#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func)
+#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none)
+
+/* no declaration of g_auto() or g_autoptr() here */
+#endif /* __GNUC__ */
+
+#else
+
+#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName)
+
+#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)
+#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func)
+#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none)
+
+#endif /* __GI_SCANNER__ */
+
+#endif /* __G_MACROS_H__ */
diff --git a/include/glib/glib/gmain.h b/include/glib/glib/gmain.h
new file mode 100644
index 0000000000..6325ecbe3f
--- /dev/null
+++ b/include/glib/glib/gmain.h
@@ -0,0 +1,689 @@
+/* gmain.h - the GLib Main loop
+ * Copyright (C) 1998-2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_MAIN_H__
+#define __G_MAIN_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gpoll.h>
+#include <glib/gslist.h>
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+typedef enum /*< flags >*/
+{
+ G_IO_IN GLIB_SYSDEF_POLLIN,
+ G_IO_OUT GLIB_SYSDEF_POLLOUT,
+ G_IO_PRI GLIB_SYSDEF_POLLPRI,
+ G_IO_ERR GLIB_SYSDEF_POLLERR,
+ G_IO_HUP GLIB_SYSDEF_POLLHUP,
+ G_IO_NVAL GLIB_SYSDEF_POLLNVAL
+} GIOCondition;
+
+
+/**
+ * GMainContext:
+ *
+ * The `GMainContext` struct is an opaque data
+ * type representing a set of sources to be handled in a main loop.
+ */
+typedef struct _GMainContext GMainContext;
+
+/**
+ * GMainLoop:
+ *
+ * The `GMainLoop` struct is an opaque data type
+ * representing the main event loop of a GLib or GTK+ application.
+ */
+typedef struct _GMainLoop GMainLoop;
+
+/**
+ * GSource:
+ *
+ * The `GSource` struct is an opaque data type
+ * representing an event source.
+ */
+typedef struct _GSource GSource;
+typedef struct _GSourcePrivate GSourcePrivate;
+
+/**
+ * GSourceCallbackFuncs:
+ * @ref: Called when a reference is added to the callback object
+ * @unref: Called when a reference to the callback object is dropped
+ * @get: Called to extract the callback function and data from the
+ * callback object.
+ *
+ * The `GSourceCallbackFuncs` struct contains
+ * functions for managing callback objects.
+ */
+typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs;
+
+/**
+ * GSourceFuncs:
+ * @prepare: Called before all the file descriptors are polled. If the
+ * source can determine that it is ready here (without waiting for the
+ * results of the poll() call) it should return %TRUE. It can also return
+ * a @timeout_ value which should be the maximum timeout (in milliseconds)
+ * which should be passed to the poll() call. The actual timeout used will
+ * be -1 if all sources returned -1, or it will be the minimum of all
+ * the @timeout_ values returned which were >= 0. Since 2.36 this may
+ * be %NULL, in which case the effect is as if the function always returns
+ * %FALSE with a timeout of -1. If @prepare returns a
+ * timeout and the source also has a ready time set, then the
+ * lower of the two will be used.
+ * @check: Called after all the file descriptors are polled. The source
+ * should return %TRUE if it is ready to be dispatched. Note that some
+ * time may have passed since the previous prepare function was called,
+ * so the source should be checked again here. Since 2.36 this may
+ * be %NULL, in which case the effect is as if the function always returns
+ * %FALSE.
+ * @dispatch: Called to dispatch the event source, after it has returned
+ * %TRUE in either its @prepare or its @check function, or if a ready time
+ * has been reached. The @dispatch function receives a callback function and
+ * user data. The callback function may be %NULL if the source was never
+ * connected to a callback using g_source_set_callback(). The @dispatch
+ * function should call the callback function with @user_data and whatever
+ * additional parameters are needed for this type of event source. The
+ * return value of the @dispatch function should be #G_SOURCE_REMOVE if the
+ * source should be removed or #G_SOURCE_CONTINUE to keep it.
+ * @finalize: Called when the source is finalized. At this point, the source
+ * will have been destroyed, had its callback cleared, and have been removed
+ * from its #GMainContext, but it will still have its final reference count,
+ * so methods can be called on it from within this function.
+ *
+ * The `GSourceFuncs` struct contains a table of
+ * functions used to handle event sources in a generic manner.
+ *
+ * For idle sources, the prepare and check functions always return %TRUE
+ * to indicate that the source is always ready to be processed. The prepare
+ * function also returns a timeout value of 0 to ensure that the poll() call
+ * doesn't block (since that would be time wasted which could have been spent
+ * running the idle function).
+ *
+ * For timeout sources, the prepare and check functions both return %TRUE
+ * if the timeout interval has expired. The prepare function also returns
+ * a timeout value to ensure that the poll() call doesn't block too long
+ * and miss the next timeout.
+ *
+ * For file descriptor sources, the prepare function typically returns %FALSE,
+ * since it must wait until poll() has been called before it knows whether
+ * any events need to be processed. It sets the returned timeout to -1 to
+ * indicate that it doesn't mind how long the poll() call blocks. In the
+ * check function, it tests the results of the poll() call to see if the
+ * required condition has been met, and returns %TRUE if so.
+ */
+typedef struct _GSourceFuncs GSourceFuncs;
+
+/**
+ * GPid:
+ *
+ * A type which is used to hold a process identification.
+ *
+ * On UNIX, processes are identified by a process id (an integer),
+ * while Windows uses process handles (which are pointers).
+ *
+ * GPid is used in GLib only for descendant processes spawned with
+ * the g_spawn functions.
+ */
+/* defined in glibconfig.h */
+
+/**
+ * G_PID_FORMAT:
+ *
+ * A format specifier that can be used in printf()-style format strings
+ * when printing a #GPid.
+ *
+ * Since: 2.50
+ */
+/* defined in glibconfig.h */
+
+/**
+ * GSourceFunc:
+ * @user_data: data passed to the function, set when the source was
+ * created with one of the above functions
+ *
+ * Specifies the type of function passed to g_timeout_add(),
+ * g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
+ *
+ * When calling g_source_set_callback(), you may need to cast a function of a
+ * different type to this type. Use G_SOURCE_FUNC() to avoid warnings about
+ * incompatible function types.
+ *
+ * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and
+ * #G_SOURCE_REMOVE are more memorable names for the return value.
+ */
+typedef gboolean (*GSourceFunc) (gpointer user_data);
+
+/**
+ * G_SOURCE_FUNC:
+ * @f: a function pointer.
+ *
+ * Cast a function pointer to a #GSourceFunc, suppressing warnings from GCC 8
+ * onwards with `-Wextra` or `-Wcast-function-type` enabled about the function
+ * types being incompatible.
+ *
+ * For example, the correct type of callback for a source created by
+ * g_child_watch_source_new() is #GChildWatchFunc, which accepts more arguments
+ * than #GSourceFunc. Casting the function with `(GSourceFunc)` to call
+ * g_source_set_callback() will trigger a warning, even though it will be cast
+ * back to the correct type before it is called by the source.
+ *
+ * Since: 2.58
+ */
+#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
+
+/**
+ * GChildWatchFunc:
+ * @pid: the process id of the child process
+ * @status: Status information about the child process, encoded
+ * in a platform-specific manner
+ * @user_data: user data passed to g_child_watch_add()
+ *
+ * Prototype of a #GChildWatchSource callback, called when a child
+ * process has exited. To interpret @status, see the documentation
+ * for g_spawn_check_exit_status().
+ */
+typedef void (*GChildWatchFunc) (GPid pid,
+ gint status,
+ gpointer user_data);
+struct _GSource
+{
+ /*< private >*/
+ gpointer callback_data;
+ GSourceCallbackFuncs *callback_funcs;
+
+ const GSourceFuncs *source_funcs;
+ guint ref_count;
+
+ GMainContext *context;
+
+ gint priority;
+ guint flags;
+ guint source_id;
+
+ GSList *poll_fds;
+
+ GSource *prev;
+ GSource *next;
+
+ char *name;
+
+ GSourcePrivate *priv;
+};
+
+struct _GSourceCallbackFuncs
+{
+ void (*ref) (gpointer cb_data);
+ void (*unref) (gpointer cb_data);
+ void (*get) (gpointer cb_data,
+ GSource *source,
+ GSourceFunc *func,
+ gpointer *data);
+};
+
+/**
+ * GSourceDummyMarshal:
+ *
+ * This is just a placeholder for #GClosureMarshal,
+ * which cannot be used here for dependency reasons.
+ */
+typedef void (*GSourceDummyMarshal) (void);
+
+struct _GSourceFuncs
+{
+ gboolean (*prepare) (GSource *source,
+ gint *timeout_);
+ gboolean (*check) (GSource *source);
+ gboolean (*dispatch) (GSource *source,
+ GSourceFunc callback,
+ gpointer user_data);
+ void (*finalize) (GSource *source); /* Can be NULL */
+
+ /*< private >*/
+ /* For use by g_source_set_closure */
+ GSourceFunc closure_callback;
+ GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
+};
+
+/* Standard priorities */
+
+/**
+ * G_PRIORITY_HIGH:
+ *
+ * Use this for high priority event sources.
+ *
+ * It is not used within GLib or GTK+.
+ */
+#define G_PRIORITY_HIGH -100
+
+/**
+ * G_PRIORITY_DEFAULT:
+ *
+ * Use this for default priority event sources.
+ *
+ * In GLib this priority is used when adding timeout functions
+ * with g_timeout_add(). In GDK this priority is used for events
+ * from the X server.
+ */
+#define G_PRIORITY_DEFAULT 0
+
+/**
+ * G_PRIORITY_HIGH_IDLE:
+ *
+ * Use this for high priority idle functions.
+ *
+ * GTK+ uses #G_PRIORITY_HIGH_IDLE + 10 for resizing operations,
+ * and #G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is
+ * done to ensure that any pending resizes are processed before any
+ * pending redraws, so that widgets are not redrawn twice unnecessarily.)
+ */
+#define G_PRIORITY_HIGH_IDLE 100
+
+/**
+ * G_PRIORITY_DEFAULT_IDLE:
+ *
+ * Use this for default priority idle functions.
+ *
+ * In GLib this priority is used when adding idle functions with
+ * g_idle_add().
+ */
+#define G_PRIORITY_DEFAULT_IDLE 200
+
+/**
+ * G_PRIORITY_LOW:
+ *
+ * Use this for very low priority background tasks.
+ *
+ * It is not used within GLib or GTK+.
+ */
+#define G_PRIORITY_LOW 300
+
+/**
+ * G_SOURCE_REMOVE:
+ *
+ * Use this macro as the return value of a #GSourceFunc to remove
+ * the #GSource from the main loop.
+ *
+ * Since: 2.32
+ */
+#define G_SOURCE_REMOVE FALSE
+
+/**
+ * G_SOURCE_CONTINUE:
+ *
+ * Use this macro as the return value of a #GSourceFunc to leave
+ * the #GSource in the main loop.
+ *
+ * Since: 2.32
+ */
+#define G_SOURCE_CONTINUE TRUE
+
+/* GMainContext: */
+
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_context_new (void);
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_context_ref (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_unref (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_context_default (void);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_iteration (GMainContext *context,
+ gboolean may_block);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_pending (GMainContext *context);
+
+/* For implementation of legacy interfaces
+ */
+GLIB_AVAILABLE_IN_ALL
+GSource *g_main_context_find_source_by_id (GMainContext *context,
+ guint source_id);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_main_context_find_source_by_user_data (GMainContext *context,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context,
+ GSourceFuncs *funcs,
+ gpointer user_data);
+
+/* Low level functions for implementing custom main loops.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_wakeup (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_acquire (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_release (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_is_owner (GMainContext *context);
+GLIB_DEPRECATED_IN_2_58_FOR(g_main_context_is_owner)
+gboolean g_main_context_wait (GMainContext *context,
+ GCond *cond,
+ GMutex *mutex);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_prepare (GMainContext *context,
+ gint *priority);
+GLIB_AVAILABLE_IN_ALL
+gint g_main_context_query (GMainContext *context,
+ gint max_priority,
+ gint *timeout_,
+ GPollFD *fds,
+ gint n_fds);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_context_check (GMainContext *context,
+ gint max_priority,
+ GPollFD *fds,
+ gint n_fds);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_dispatch (GMainContext *context);
+
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_set_poll_func (GMainContext *context,
+ GPollFunc func);
+GLIB_AVAILABLE_IN_ALL
+GPollFunc g_main_context_get_poll_func (GMainContext *context);
+
+/* Low level functions for use by source implementations
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_add_poll (GMainContext *context,
+ GPollFD *fd,
+ gint priority);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_remove_poll (GMainContext *context,
+ GPollFD *fd);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_main_depth (void);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_main_current_source (void);
+
+/* GMainContexts for other threads
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_push_thread_default (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_pop_thread_default (GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_context_get_thread_default (void);
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_context_ref_thread_default (void);
+
+/* GMainLoop: */
+
+GLIB_AVAILABLE_IN_ALL
+GMainLoop *g_main_loop_new (GMainContext *context,
+ gboolean is_running);
+GLIB_AVAILABLE_IN_ALL
+void g_main_loop_run (GMainLoop *loop);
+GLIB_AVAILABLE_IN_ALL
+void g_main_loop_quit (GMainLoop *loop);
+GLIB_AVAILABLE_IN_ALL
+GMainLoop *g_main_loop_ref (GMainLoop *loop);
+GLIB_AVAILABLE_IN_ALL
+void g_main_loop_unref (GMainLoop *loop);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_main_loop_is_running (GMainLoop *loop);
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_main_loop_get_context (GMainLoop *loop);
+
+/* GSource: */
+
+GLIB_AVAILABLE_IN_ALL
+GSource *g_source_new (GSourceFuncs *source_funcs,
+ guint struct_size);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_source_ref (GSource *source);
+GLIB_AVAILABLE_IN_ALL
+void g_source_unref (GSource *source);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_source_attach (GSource *source,
+ GMainContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_source_destroy (GSource *source);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_priority (GSource *source,
+ gint priority);
+GLIB_AVAILABLE_IN_ALL
+gint g_source_get_priority (GSource *source);
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_can_recurse (GSource *source,
+ gboolean can_recurse);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_source_get_can_recurse (GSource *source);
+GLIB_AVAILABLE_IN_ALL
+guint g_source_get_id (GSource *source);
+
+GLIB_AVAILABLE_IN_ALL
+GMainContext *g_source_get_context (GSource *source);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_callback (GSource *source,
+ GSourceFunc func,
+ gpointer data,
+ GDestroyNotify notify);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_funcs (GSource *source,
+ GSourceFuncs *funcs);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_source_is_destroyed (GSource *source);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_name (GSource *source,
+ const char *name);
+GLIB_AVAILABLE_IN_ALL
+const char * g_source_get_name (GSource *source);
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_name_by_id (guint tag,
+ const char *name);
+
+GLIB_AVAILABLE_IN_2_36
+void g_source_set_ready_time (GSource *source,
+ gint64 ready_time);
+GLIB_AVAILABLE_IN_2_36
+gint64 g_source_get_ready_time (GSource *source);
+
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_36
+gpointer g_source_add_unix_fd (GSource *source,
+ gint fd,
+ GIOCondition events);
+GLIB_AVAILABLE_IN_2_36
+void g_source_modify_unix_fd (GSource *source,
+ gpointer tag,
+ GIOCondition new_events);
+GLIB_AVAILABLE_IN_2_36
+void g_source_remove_unix_fd (GSource *source,
+ gpointer tag);
+GLIB_AVAILABLE_IN_2_36
+GIOCondition g_source_query_unix_fd (GSource *source,
+ gpointer tag);
+#endif
+
+/* Used to implement g_source_connect_closure and internally*/
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_callback_indirect (GSource *source,
+ gpointer callback_data,
+ GSourceCallbackFuncs *callback_funcs);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_add_poll (GSource *source,
+ GPollFD *fd);
+GLIB_AVAILABLE_IN_ALL
+void g_source_remove_poll (GSource *source,
+ GPollFD *fd);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_add_child_source (GSource *source,
+ GSource *child_source);
+GLIB_AVAILABLE_IN_ALL
+void g_source_remove_child_source (GSource *source,
+ GSource *child_source);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time)
+void g_source_get_current_time (GSource *source,
+ GTimeVal *timeval);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+gint64 g_source_get_time (GSource *source);
+
+ /* void g_source_connect_closure (GSource *source,
+ GClosure *closure);
+ */
+
+/* Specific source types
+ */
+GLIB_AVAILABLE_IN_ALL
+GSource *g_idle_source_new (void);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_child_watch_source_new (GPid pid);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_timeout_source_new (guint interval);
+GLIB_AVAILABLE_IN_ALL
+GSource *g_timeout_source_new_seconds (guint interval);
+
+/* Miscellaneous functions
+ */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time)
+void g_get_current_time (GTimeVal *result);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+gint64 g_get_monotonic_time (void);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_get_real_time (void);
+
+
+/* Source manipulation by ID */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_source_remove (guint tag);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_source_remove_by_user_data (gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs,
+ gpointer user_data);
+
+/**
+ * GClearHandleFunc:
+ * @handle_id: the handle ID to clear
+ *
+ * Specifies the type of function passed to g_clear_handle_id().
+ * The implementation is expected to free the resource identified
+ * by @handle_id; for instance, if @handle_id is a #GSource ID,
+ * g_source_remove() can be used.
+ *
+ * Since: 2.56
+ */
+typedef void (* GClearHandleFunc) (guint handle_id);
+
+GLIB_AVAILABLE_IN_2_56
+void g_clear_handle_id (guint *tag_ptr,
+ GClearHandleFunc clear_func);
+
+#define g_clear_handle_id(tag_ptr, clear_func) \
+ G_STMT_START { \
+ G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \
+ guint *_tag_ptr = (guint *) (tag_ptr); \
+ guint _handle_id; \
+ \
+ _handle_id = *_tag_ptr; \
+ if (_handle_id > 0) \
+ { \
+ *_tag_ptr = 0; \
+ clear_func (_handle_id); \
+ } \
+ } G_STMT_END \
+ GLIB_AVAILABLE_MACRO_IN_2_56
+
+/* Idles, child watchers and timeouts */
+GLIB_AVAILABLE_IN_ALL
+guint g_timeout_add_full (gint priority,
+ guint interval,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+guint g_timeout_add (guint interval,
+ GSourceFunc function,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_timeout_add_seconds_full (gint priority,
+ guint interval,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+guint g_timeout_add_seconds (guint interval,
+ GSourceFunc function,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_child_watch_add_full (gint priority,
+ GPid pid,
+ GChildWatchFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+guint g_child_watch_add (GPid pid,
+ GChildWatchFunc function,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_idle_add (GSourceFunc function,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_idle_add_full (gint priority,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_idle_remove_by_data (gpointer data);
+
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_invoke_full (GMainContext *context,
+ gint priority,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+void g_main_context_invoke (GMainContext *context,
+ GSourceFunc function,
+ gpointer data);
+
+/* Hook for GClosure / GSource integration. Don't touch */
+GLIB_VAR GSourceFuncs g_timeout_funcs;
+GLIB_VAR GSourceFuncs g_child_watch_funcs;
+GLIB_VAR GSourceFuncs g_idle_funcs;
+#ifdef G_OS_UNIX
+GLIB_VAR GSourceFuncs g_unix_signal_funcs;
+GLIB_VAR GSourceFuncs g_unix_fd_source_funcs;
+#endif
+
+G_END_DECLS
+
+#endif /* __G_MAIN_H__ */
diff --git a/include/glib/glib/gmappedfile.h b/include/glib/glib/gmappedfile.h
new file mode 100644
index 0000000000..8256811e6c
--- /dev/null
+++ b/include/glib/glib/gmappedfile.h
@@ -0,0 +1,58 @@
+/* GLIB - Library of useful routines for C programming
+ * gmappedfile.h: Simplified wrapper around the mmap function
+ *
+ * Copyright 2005 Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_MAPPED_FILE_H__
+#define __G_MAPPED_FILE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gbytes.h>
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GMappedFile GMappedFile;
+
+GLIB_AVAILABLE_IN_ALL
+GMappedFile *g_mapped_file_new (const gchar *filename,
+ gboolean writable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GMappedFile *g_mapped_file_new_from_fd (gint fd,
+ gboolean writable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gsize g_mapped_file_get_length (GMappedFile *file);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_mapped_file_get_contents (GMappedFile *file);
+GLIB_AVAILABLE_IN_2_34
+GBytes * g_mapped_file_get_bytes (GMappedFile *file);
+GLIB_AVAILABLE_IN_ALL
+GMappedFile *g_mapped_file_ref (GMappedFile *file);
+GLIB_AVAILABLE_IN_ALL
+void g_mapped_file_unref (GMappedFile *file);
+
+GLIB_DEPRECATED_FOR(g_mapped_file_unref)
+void g_mapped_file_free (GMappedFile *file);
+
+G_END_DECLS
+
+#endif /* __G_MAPPED_FILE_H__ */
diff --git a/include/glib/glib/gmarkup.h b/include/glib/glib/gmarkup.h
new file mode 100644
index 0000000000..96375b55a1
--- /dev/null
+++ b/include/glib/glib/gmarkup.h
@@ -0,0 +1,261 @@
+/* gmarkup.h - Simple XML-like string parser/writer
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_MARKUP_H__
+#define __G_MARKUP_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <stdarg.h>
+
+#include <glib/gerror.h>
+#include <glib/gslist.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GMarkupError:
+ * @G_MARKUP_ERROR_BAD_UTF8: text being parsed was not valid UTF-8
+ * @G_MARKUP_ERROR_EMPTY: document contained nothing, or only whitespace
+ * @G_MARKUP_ERROR_PARSE: document was ill-formed
+ * @G_MARKUP_ERROR_UNKNOWN_ELEMENT: error should be set by #GMarkupParser
+ * functions; element wasn't known
+ * @G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE: error should be set by #GMarkupParser
+ * functions; attribute wasn't known
+ * @G_MARKUP_ERROR_INVALID_CONTENT: error should be set by #GMarkupParser
+ * functions; content was invalid
+ * @G_MARKUP_ERROR_MISSING_ATTRIBUTE: error should be set by #GMarkupParser
+ * functions; a required attribute was missing
+ *
+ * Error codes returned by markup parsing.
+ */
+typedef enum
+{
+ G_MARKUP_ERROR_BAD_UTF8,
+ G_MARKUP_ERROR_EMPTY,
+ G_MARKUP_ERROR_PARSE,
+ /* The following are primarily intended for specific GMarkupParser
+ * implementations to set.
+ */
+ G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ G_MARKUP_ERROR_MISSING_ATTRIBUTE
+} GMarkupError;
+
+/**
+ * G_MARKUP_ERROR:
+ *
+ * Error domain for markup parsing.
+ * Errors in this domain will be from the #GMarkupError enumeration.
+ * See #GError for information on error domains.
+ */
+#define G_MARKUP_ERROR g_markup_error_quark ()
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_markup_error_quark (void);
+
+/**
+ * GMarkupParseFlags:
+ * @G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG: flag you should not use
+ * @G_MARKUP_TREAT_CDATA_AS_TEXT: When this flag is set, CDATA marked
+ * sections are not passed literally to the @passthrough function of
+ * the parser. Instead, the content of the section (without the
+ * `<![CDATA[` and `]]>`) is
+ * passed to the @text function. This flag was added in GLib 2.12
+ * @G_MARKUP_PREFIX_ERROR_POSITION: Normally errors caught by GMarkup
+ * itself have line/column information prefixed to them to let the
+ * caller know the location of the error. When this flag is set the
+ * location information is also prefixed to errors generated by the
+ * #GMarkupParser implementation functions
+ * @G_MARKUP_IGNORE_QUALIFIED: Ignore (don't report) qualified
+ * attributes and tags, along with their contents. A qualified
+ * attribute or tag is one that contains ':' in its name (ie: is in
+ * another namespace). Since: 2.40.
+ *
+ * Flags that affect the behaviour of the parser.
+ */
+typedef enum
+{
+ G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
+ G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1,
+ G_MARKUP_PREFIX_ERROR_POSITION = 1 << 2,
+ G_MARKUP_IGNORE_QUALIFIED = 1 << 3
+} GMarkupParseFlags;
+
+/**
+ * GMarkupParseContext:
+ *
+ * A parse context is used to parse a stream of bytes that
+ * you expect to contain marked-up text.
+ *
+ * See g_markup_parse_context_new(), #GMarkupParser, and so
+ * on for more details.
+ */
+typedef struct _GMarkupParseContext GMarkupParseContext;
+typedef struct _GMarkupParser GMarkupParser;
+
+/**
+ * GMarkupParser:
+ * @start_element: Callback to invoke when the opening tag of an element
+ * is seen. The callback's @attribute_names and @attribute_values parameters
+ * are %NULL-terminated.
+ * @end_element: Callback to invoke when the closing tag of an element
+ * is seen. Note that this is also called for empty tags like
+ * `<empty/>`.
+ * @text: Callback to invoke when some text is seen (text is always
+ * inside an element). Note that the text of an element may be spread
+ * over multiple calls of this function. If the
+ * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is set, this function is also
+ * called for the content of CDATA marked sections.
+ * @passthrough: Callback to invoke for comments, processing instructions
+ * and doctype declarations; if you're re-writing the parsed document,
+ * write the passthrough text back out in the same position. If the
+ * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is not set, this function is also
+ * called for CDATA marked sections.
+ * @error: Callback to invoke when an error occurs.
+ *
+ * Any of the fields in #GMarkupParser can be %NULL, in which case they
+ * will be ignored. Except for the @error function, any of these callbacks
+ * can set an error; in particular the %G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ * %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and %G_MARKUP_ERROR_INVALID_CONTENT
+ * errors are intended to be set from these callbacks. If you set an error
+ * from a callback, g_markup_parse_context_parse() will report that error
+ * back to its caller.
+ */
+struct _GMarkupParser
+{
+ /* Called for open tags <foo bar="baz"> */
+ void (*start_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+
+ /* Called for close tags </foo> */
+ void (*end_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+
+ /* Called for character data */
+ /* text is not nul-terminated */
+ void (*text) (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+
+ /* Called for strings that should be re-saved verbatim in this same
+ * position, but are not otherwise interpretable. At the moment
+ * this includes comments and processing instructions.
+ */
+ /* text is not nul-terminated. */
+ void (*passthrough) (GMarkupParseContext *context,
+ const gchar *passthrough_text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+
+ /* Called on error, including one set by other
+ * methods in the vtable. The GError should not be freed.
+ */
+ void (*error) (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data);
+};
+
+GLIB_AVAILABLE_IN_ALL
+GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
+ GMarkupParseFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_dnotify);
+GLIB_AVAILABLE_IN_2_36
+GMarkupParseContext *g_markup_parse_context_ref (GMarkupParseContext *context);
+GLIB_AVAILABLE_IN_2_36
+void g_markup_parse_context_unref (GMarkupParseContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_markup_parse_context_free (GMarkupParseContext *context);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
+ const gchar *text,
+ gssize text_len,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_markup_parse_context_push (GMarkupParseContext *context,
+ const GMarkupParser *parser,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_markup_parse_context_pop (GMarkupParseContext *context);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_markup_parse_context_get_element (GMarkupParseContext *context);
+GLIB_AVAILABLE_IN_ALL
+const GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context);
+
+/* For user-constructed error messages, has no precise semantics */
+GLIB_AVAILABLE_IN_ALL
+void g_markup_parse_context_get_position (GMarkupParseContext *context,
+ gint *line_number,
+ gint *char_number);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_markup_parse_context_get_user_data (GMarkupParseContext *context);
+
+/* useful when saving */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_markup_escape_text (const gchar *text,
+ gssize length);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_markup_printf_escaped (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_markup_vprintf_escaped (const char *format,
+ va_list args) G_GNUC_PRINTF(1, 0);
+
+typedef enum
+{
+ G_MARKUP_COLLECT_INVALID,
+ G_MARKUP_COLLECT_STRING,
+ G_MARKUP_COLLECT_STRDUP,
+ G_MARKUP_COLLECT_BOOLEAN,
+ G_MARKUP_COLLECT_TRISTATE,
+
+ G_MARKUP_COLLECT_OPTIONAL = (1 << 16)
+} GMarkupCollectType;
+
+
+/* useful from start_element */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_markup_collect_attributes (const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ GError **error,
+ GMarkupCollectType first_type,
+ const gchar *first_attr,
+ ...);
+
+G_END_DECLS
+
+#endif /* __G_MARKUP_H__ */
diff --git a/include/glib/glib/gmem.h b/include/glib/glib/gmem.h
new file mode 100644
index 0000000000..953a0182d5
--- /dev/null
+++ b/include/glib/glib/gmem.h
@@ -0,0 +1,392 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_MEM_H__
+#define __G_MEM_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gutils.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GMemVTable:
+ * @malloc: function to use for allocating memory.
+ * @realloc: function to use for reallocating memory.
+ * @free: function to use to free memory.
+ * @calloc: function to use for allocating zero-filled memory.
+ * @try_malloc: function to use for allocating memory without a default error handler.
+ * @try_realloc: function to use for reallocating memory without a default error handler.
+ *
+ * A set of functions used to perform memory allocation. The same #GMemVTable must
+ * be used for all allocations in the same program; a call to g_mem_set_vtable(),
+ * if it exists, should be prior to any use of GLib.
+ *
+ * This functions related to this has been deprecated in 2.46, and no longer work.
+ */
+typedef struct _GMemVTable GMemVTable;
+
+
+#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG
+/**
+ * G_MEM_ALIGN:
+ *
+ * Indicates the number of bytes to which memory will be aligned on the
+ * current platform.
+ */
+# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P
+#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
+# define G_MEM_ALIGN GLIB_SIZEOF_LONG
+#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
+
+
+/* Memory allocation functions
+ */
+
+GLIB_AVAILABLE_IN_ALL
+void g_free (gpointer mem);
+
+GLIB_AVAILABLE_IN_2_34
+void g_clear_pointer (gpointer *pp,
+ GDestroyNotify destroy);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_realloc (gpointer mem,
+ gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_realloc (gpointer mem,
+ gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT;
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_malloc_n (gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_malloc0_n (gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_realloc_n (gpointer mem,
+ gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_malloc_n (gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_malloc0_n (gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_try_realloc_n (gpointer mem,
+ gsize n_blocks,
+ gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT;
+
+#if defined(g_has_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58
+#define g_clear_pointer(pp, destroy) \
+ G_STMT_START { \
+ G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
+ __typeof__((pp)) _pp = (pp); \
+ __typeof__(*(pp)) _ptr = *_pp; \
+ *_pp = NULL; \
+ if (_ptr) \
+ (destroy) (_ptr); \
+ } G_STMT_END \
+ GLIB_AVAILABLE_MACRO_IN_2_34
+#else /* __GNUC__ */
+#define g_clear_pointer(pp, destroy) \
+ G_STMT_START { \
+ G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
+ /* Only one access, please; work around type aliasing */ \
+ union { char *in; gpointer *out; } _pp; \
+ gpointer _p; \
+ /* This assignment is needed to avoid a gcc warning */ \
+ GDestroyNotify _destroy = (GDestroyNotify) (destroy); \
+ \
+ _pp.in = (char *) (pp); \
+ _p = *_pp.out; \
+ if (_p) \
+ { \
+ *_pp.out = NULL; \
+ _destroy (_p); \
+ } \
+ } G_STMT_END \
+ GLIB_AVAILABLE_MACRO_IN_2_34
+#endif /* __GNUC__ */
+
+/**
+ * g_steal_pointer:
+ * @pp: (not nullable): a pointer to a pointer
+ *
+ * Sets @pp to %NULL, returning the value that was there before.
+ *
+ * Conceptually, this transfers the ownership of the pointer from the
+ * referenced variable to the "caller" of the macro (ie: "steals" the
+ * reference).
+ *
+ * The return value will be properly typed, according to the type of
+ * @pp.
+ *
+ * This can be very useful when combined with g_autoptr() to prevent the
+ * return value of a function from being automatically freed. Consider
+ * the following example (which only works on GCC and clang):
+ *
+ * |[
+ * GObject *
+ * create_object (void)
+ * {
+ * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL);
+ *
+ * if (early_error_case)
+ * return NULL;
+ *
+ * return g_steal_pointer (&obj);
+ * }
+ * ]|
+ *
+ * It can also be used in similar ways for 'out' parameters and is
+ * particularly useful for dealing with optional out parameters:
+ *
+ * |[
+ * gboolean
+ * get_object (GObject **obj_out)
+ * {
+ * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL);
+ *
+ * if (early_error_case)
+ * return FALSE;
+ *
+ * if (obj_out)
+ * *obj_out = g_steal_pointer (&obj);
+ *
+ * return TRUE;
+ * }
+ * ]|
+ *
+ * In the above example, the object will be automatically freed in the
+ * early error case and also in the case that %NULL was given for
+ * @obj_out.
+ *
+ * Since: 2.44
+ */
+static inline gpointer
+g_steal_pointer (gpointer pp)
+{
+ gpointer *ptr = (gpointer *) pp;
+ gpointer ref;
+
+ ref = *ptr;
+ *ptr = NULL;
+
+ return ref;
+}
+
+/* type safety */
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58
+#define g_steal_pointer(pp) ((__typeof__(*pp)) (g_steal_pointer) (pp))
+#else /* __GNUC__ */
+/* This version does not depend on gcc extensions, but gcc does not warn
+ * about incompatible-pointer-types: */
+#define g_steal_pointer(pp) \
+ (0 ? (*(pp)) : (g_steal_pointer) (pp))
+#endif /* __GNUC__ */
+
+/* Optimise: avoid the call to the (slower) _n function if we can
+ * determine at compile-time that no overflow happens.
+ */
+#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
+# define _G_NEW(struct_type, n_structs, func) \
+ (struct_type *) (G_GNUC_EXTENSION ({ \
+ gsize __n = (gsize) (n_structs); \
+ gsize __s = sizeof (struct_type); \
+ gpointer __p; \
+ if (__s == 1) \
+ __p = g_##func (__n); \
+ else if (__builtin_constant_p (__n) && \
+ (__s == 0 || __n <= G_MAXSIZE / __s)) \
+ __p = g_##func (__n * __s); \
+ else \
+ __p = g_##func##_n (__n, __s); \
+ __p; \
+ }))
+# define _G_RENEW(struct_type, mem, n_structs, func) \
+ (struct_type *) (G_GNUC_EXTENSION ({ \
+ gsize __n = (gsize) (n_structs); \
+ gsize __s = sizeof (struct_type); \
+ gpointer __p = (gpointer) (mem); \
+ if (__s == 1) \
+ __p = g_##func (__p, __n); \
+ else if (__builtin_constant_p (__n) && \
+ (__s == 0 || __n <= G_MAXSIZE / __s)) \
+ __p = g_##func (__p, __n * __s); \
+ else \
+ __p = g_##func##_n (__p, __n, __s); \
+ __p; \
+ }))
+
+#else
+
+/* Unoptimised version: always call the _n() function. */
+
+#define _G_NEW(struct_type, n_structs, func) \
+ ((struct_type *) g_##func##_n ((n_structs), sizeof (struct_type)))
+#define _G_RENEW(struct_type, mem, n_structs, func) \
+ ((struct_type *) g_##func##_n (mem, (n_structs), sizeof (struct_type)))
+
+#endif
+
+/**
+ * g_new:
+ * @struct_type: the type of the elements to allocate
+ * @n_structs: the number of elements to allocate
+ *
+ * Allocates @n_structs elements of type @struct_type.
+ * The returned pointer is cast to a pointer to the given type.
+ * If @n_structs is 0 it returns %NULL.
+ * Care is taken to avoid overflow when calculating the size of the allocated block.
+ *
+ * Since the returned pointer is already casted to the right type,
+ * it is normally unnecessary to cast it explicitly, and doing
+ * so might hide memory allocation errors.
+ *
+ * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type
+ */
+#define g_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc)
+/**
+ * g_new0:
+ * @struct_type: the type of the elements to allocate.
+ * @n_structs: the number of elements to allocate.
+ *
+ * Allocates @n_structs elements of type @struct_type, initialized to 0's.
+ * The returned pointer is cast to a pointer to the given type.
+ * If @n_structs is 0 it returns %NULL.
+ * Care is taken to avoid overflow when calculating the size of the allocated block.
+ *
+ * Since the returned pointer is already casted to the right type,
+ * it is normally unnecessary to cast it explicitly, and doing
+ * so might hide memory allocation errors.
+ *
+ * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type.
+ */
+#define g_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc0)
+/**
+ * g_renew:
+ * @struct_type: the type of the elements to allocate
+ * @mem: the currently allocated memory
+ * @n_structs: the number of elements to allocate
+ *
+ * Reallocates the memory pointed to by @mem, so that it now has space for
+ * @n_structs elements of type @struct_type. It returns the new address of
+ * the memory, which may have been moved.
+ * Care is taken to avoid overflow when calculating the size of the allocated block.
+ *
+ * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type
+ */
+#define g_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, realloc)
+/**
+ * g_try_new:
+ * @struct_type: the type of the elements to allocate
+ * @n_structs: the number of elements to allocate
+ *
+ * Attempts to allocate @n_structs elements of type @struct_type, and returns
+ * %NULL on failure. Contrast with g_new(), which aborts the program on failure.
+ * The returned pointer is cast to a pointer to the given type.
+ * The function returns %NULL when @n_structs is 0 of if an overflow occurs.
+ *
+ * Since: 2.8
+ * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type
+ */
+#define g_try_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc)
+/**
+ * g_try_new0:
+ * @struct_type: the type of the elements to allocate
+ * @n_structs: the number of elements to allocate
+ *
+ * Attempts to allocate @n_structs elements of type @struct_type, initialized
+ * to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts
+ * the program on failure.
+ * The returned pointer is cast to a pointer to the given type.
+ * The function returns %NULL when @n_structs is 0 or if an overflow occurs.
+ *
+ * Since: 2.8
+ * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type
+ */
+#define g_try_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc0)
+/**
+ * g_try_renew:
+ * @struct_type: the type of the elements to allocate
+ * @mem: the currently allocated memory
+ * @n_structs: the number of elements to allocate
+ *
+ * Attempts to reallocate the memory pointed to by @mem, so that it now has
+ * space for @n_structs elements of type @struct_type, and returns %NULL on
+ * failure. Contrast with g_renew(), which aborts the program on failure.
+ * It returns the new address of the memory, which may have been moved.
+ * The function returns %NULL if an overflow occurs.
+ *
+ * Since: 2.8
+ * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type
+ */
+#define g_try_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, try_realloc)
+
+
+/* Memory allocation virtualization for debugging purposes
+ * g_mem_set_vtable() has to be the very first GLib function called
+ * if being used
+ */
+struct _GMemVTable {
+ gpointer (*malloc) (gsize n_bytes);
+ gpointer (*realloc) (gpointer mem,
+ gsize n_bytes);
+ void (*free) (gpointer mem);
+ /* optional; set to NULL if not used ! */
+ gpointer (*calloc) (gsize n_blocks,
+ gsize n_block_bytes);
+ gpointer (*try_malloc) (gsize n_bytes);
+ gpointer (*try_realloc) (gpointer mem,
+ gsize n_bytes);
+};
+GLIB_DEPRECATED_IN_2_46
+void g_mem_set_vtable (GMemVTable *vtable);
+GLIB_DEPRECATED_IN_2_46
+gboolean g_mem_is_system_malloc (void);
+
+GLIB_VAR gboolean g_mem_gc_friendly;
+
+/* Memory profiler and checker, has to be enabled via g_mem_set_vtable()
+ */
+GLIB_VAR GMemVTable *glib_mem_profiler_table;
+GLIB_DEPRECATED_IN_2_46
+void g_mem_profile (void);
+
+G_END_DECLS
+
+#endif /* __G_MEM_H__ */
diff --git a/include/glib/glib/gmessages.h b/include/glib/glib/gmessages.h
new file mode 100644
index 0000000000..95d60c5bee
--- /dev/null
+++ b/include/glib/glib/gmessages.h
@@ -0,0 +1,636 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_MESSAGES_H__
+#define __G_MESSAGES_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <stdarg.h>
+#include <glib/gtypes.h>
+#include <glib/gmacros.h>
+#include <glib/gvariant.h>
+
+G_BEGIN_DECLS
+
+/* calculate a string size, guaranteed to fit format + args.
+ */
+GLIB_AVAILABLE_IN_ALL
+gsize g_printf_string_upper_bound (const gchar* format,
+ va_list args) G_GNUC_PRINTF(1, 0);
+
+/* Log level shift offset for user defined
+ * log levels (0-7 are used by GLib).
+ */
+#define G_LOG_LEVEL_USER_SHIFT (8)
+
+/* Glib log levels and flags.
+ */
+typedef enum
+{
+ /* log flags */
+ G_LOG_FLAG_RECURSION = 1 << 0,
+ G_LOG_FLAG_FATAL = 1 << 1,
+
+ /* GLib log levels */
+ G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */
+ G_LOG_LEVEL_CRITICAL = 1 << 3,
+ G_LOG_LEVEL_WARNING = 1 << 4,
+ G_LOG_LEVEL_MESSAGE = 1 << 5,
+ G_LOG_LEVEL_INFO = 1 << 6,
+ G_LOG_LEVEL_DEBUG = 1 << 7,
+
+ G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
+} GLogLevelFlags;
+
+/* GLib log levels that are considered fatal by default */
+#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR)
+
+typedef void (*GLogFunc) (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+
+/* Logging mechanism
+ */
+GLIB_AVAILABLE_IN_ALL
+guint g_log_set_handler (const gchar *log_domain,
+ GLogLevelFlags log_levels,
+ GLogFunc log_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_46
+guint g_log_set_handler_full (const gchar *log_domain,
+ GLogLevelFlags log_levels,
+ GLogFunc log_func,
+ gpointer user_data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+void g_log_remove_handler (const gchar *log_domain,
+ guint handler_id);
+GLIB_AVAILABLE_IN_ALL
+void g_log_default_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data);
+GLIB_AVAILABLE_IN_ALL
+GLogFunc g_log_set_default_handler (GLogFunc log_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_log (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+GLIB_AVAILABLE_IN_ALL
+void g_logv (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ va_list args) G_GNUC_PRINTF(3, 0);
+GLIB_AVAILABLE_IN_ALL
+GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain,
+ GLogLevelFlags fatal_mask);
+GLIB_AVAILABLE_IN_ALL
+GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
+
+/* Structured logging mechanism. */
+
+/**
+ * GLogWriterOutput:
+ * @G_LOG_WRITER_HANDLED: Log writer has handled the log entry.
+ * @G_LOG_WRITER_UNHANDLED: Log writer could not handle the log entry.
+ *
+ * Return values from #GLogWriterFuncs to indicate whether the given log entry
+ * was successfully handled by the writer, or whether there was an error in
+ * handling it (and hence a fallback writer should be used).
+ *
+ * If a #GLogWriterFunc ignores a log entry, it should return
+ * %G_LOG_WRITER_HANDLED.
+ *
+ * Since: 2.50
+ */
+typedef enum
+{
+ G_LOG_WRITER_HANDLED = 1,
+ G_LOG_WRITER_UNHANDLED = 0,
+} GLogWriterOutput;
+
+/**
+ * GLogField:
+ * @key: field name (UTF-8 string)
+ * @value: field value (arbitrary bytes)
+ * @length: length of @value, in bytes, or -1 if it is nul-terminated
+ *
+ * Structure representing a single field in a structured log entry. See
+ * g_log_structured() for details.
+ *
+ * Log fields may contain arbitrary values, including binary with embedded nul
+ * bytes. If the field contains a string, the string must be UTF-8 encoded and
+ * have a trailing nul byte. Otherwise, @length must be set to a non-negative
+ * value.
+ *
+ * Since: 2.50
+ */
+typedef struct _GLogField GLogField;
+struct _GLogField
+{
+ const gchar *key;
+ gconstpointer value;
+ gssize length;
+};
+
+/**
+ * GLogWriterFunc:
+ * @log_level: log level of the message
+ * @fields: (array length=n_fields): fields forming the message
+ * @n_fields: number of @fields
+ * @user_data: user data passed to g_log_set_writer_func()
+ *
+ * Writer function for log entries. A log entry is a collection of one or more
+ * #GLogFields, using the standard [field names from journal
+ * specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
+ * See g_log_structured() for more information.
+ *
+ * Writer functions must ignore fields which they do not recognise, unless they
+ * can write arbitrary binary output, as field values may be arbitrary binary.
+ *
+ * @log_level is guaranteed to be included in @fields as the `PRIORITY` field,
+ * but is provided separately for convenience of deciding whether or where to
+ * output the log entry.
+ *
+ * Writer functions should return %G_LOG_WRITER_HANDLED if they handled the log
+ * message successfully or if they deliberately ignored it. If there was an
+ * error handling the message (for example, if the writer function is meant to
+ * send messages to a remote logging server and there is a network error), it
+ * should return %G_LOG_WRITER_UNHANDLED. This allows writer functions to be
+ * chained and fall back to simpler handlers in case of failure.
+ *
+ * Returns: %G_LOG_WRITER_HANDLED if the log entry was handled successfully;
+ * %G_LOG_WRITER_UNHANDLED otherwise
+ * Since: 2.50
+ */
+typedef GLogWriterOutput (*GLogWriterFunc) (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_50
+void g_log_structured (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ ...);
+GLIB_AVAILABLE_IN_2_50
+void g_log_structured_array (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields);
+
+GLIB_AVAILABLE_IN_2_50
+void g_log_variant (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ GVariant *fields);
+
+GLIB_AVAILABLE_IN_2_50
+void g_log_set_writer_func (GLogWriterFunc func,
+ gpointer user_data,
+ GDestroyNotify user_data_free);
+
+GLIB_AVAILABLE_IN_2_50
+gboolean g_log_writer_supports_color (gint output_fd);
+GLIB_AVAILABLE_IN_2_50
+gboolean g_log_writer_is_journald (gint output_fd);
+
+GLIB_AVAILABLE_IN_2_50
+gchar *g_log_writer_format_fields (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gboolean use_color);
+
+GLIB_AVAILABLE_IN_2_50
+GLogWriterOutput g_log_writer_journald (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_50
+GLogWriterOutput g_log_writer_standard_streams (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_50
+GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data);
+
+/**
+ * G_DEBUG_HERE:
+ *
+ * A convenience form of g_log_structured(), recommended to be added to
+ * functions when debugging. It prints the current monotonic time and the code
+ * location using %G_STRLOC.
+ *
+ * Since: 2.50
+ */
+#define G_DEBUG_HERE() \
+ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ "CODE_FILE", __FILE__, \
+ "CODE_LINE", G_STRINGIFY (__LINE__), \
+ "CODE_FUNC", G_STRFUNC, \
+ "MESSAGE", "%" G_GINT64_FORMAT ": %s", \
+ g_get_monotonic_time (), G_STRLOC)
+
+/* internal */
+void _g_log_fallback_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data);
+
+/* Internal functions, used to implement the following macros */
+GLIB_AVAILABLE_IN_ALL
+void g_return_if_fail_warning (const char *log_domain,
+ const char *pretty_function,
+ const char *expression) G_ANALYZER_NORETURN;
+GLIB_AVAILABLE_IN_ALL
+void g_warn_message (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *warnexpr) G_ANALYZER_NORETURN;
+GLIB_DEPRECATED
+void g_assert_warning (const char *log_domain,
+ const char *file,
+ const int line,
+ const char *pretty_function,
+ const char *expression) G_GNUC_NORETURN;
+
+GLIB_AVAILABLE_IN_2_56
+void g_log_structured_standard (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *file,
+ const gchar *line,
+ const gchar *func,
+ const gchar *message_format,
+ ...) G_GNUC_PRINTF (6, 7);
+
+#ifndef G_LOG_DOMAIN
+#define G_LOG_DOMAIN ((gchar*) 0)
+#endif /* G_LOG_DOMAIN */
+
+#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING
+#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
+#define g_error(...) G_STMT_START { \
+ g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__); \
+ for (;;) ; \
+ } G_STMT_END
+#define g_message(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__)
+#define g_critical(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__)
+#define g_warning(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__)
+#define g_info(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__)
+#define g_debug(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, __VA_ARGS__)
+#else
+/* for(;;) ; so that GCC knows that control doesn't go past g_error().
+ * Put space before ending semicolon to avoid C++ build warnings.
+ */
+#define g_error(...) G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ __VA_ARGS__); \
+ for (;;) ; \
+ } G_STMT_END
+#define g_message(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ __VA_ARGS__)
+#define g_critical(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ __VA_ARGS__)
+#define g_warning(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ __VA_ARGS__)
+#define g_info(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_INFO, \
+ __VA_ARGS__)
+#define g_debug(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_DEBUG, \
+ __VA_ARGS__)
+#endif
+#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING
+#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
+#define g_error(format...) G_STMT_START { \
+ g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format); \
+ for (;;) ; \
+ } G_STMT_END
+#define g_message(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format)
+#define g_critical(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format)
+#define g_warning(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format)
+#define g_info(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format)
+#define g_debug(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ __FILE__, G_STRINGIFY (__LINE__), \
+ G_STRFUNC, format)
+#else
+#define g_error(format...) G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ format); \
+ for (;;) ; \
+ } G_STMT_END
+
+#define g_message(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ format)
+#define g_critical(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ format)
+#define g_warning(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ format)
+#define g_info(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_INFO, \
+ format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_DEBUG, \
+ format)
+#endif
+#else /* no varargs macros */
+static void g_error (const gchar *format, ...) G_GNUC_NORETURN G_ANALYZER_NORETURN;
+static void g_critical (const gchar *format, ...) G_ANALYZER_NORETURN;
+
+static inline void
+g_error (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+ va_end (args);
+
+ for(;;) ;
+}
+static inline void
+g_message (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args);
+ va_end (args);
+}
+static inline void
+g_critical (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args);
+ va_end (args);
+}
+static inline void
+g_warning (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args);
+ va_end (args);
+}
+static inline void
+g_info (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args);
+ va_end (args);
+}
+static inline void
+g_debug (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
+ va_end (args);
+}
+#endif /* !__GNUC__ */
+
+/**
+ * GPrintFunc:
+ * @string: the message to output
+ *
+ * Specifies the type of the print handler functions.
+ * These are called with the complete formatted string to output.
+ */
+typedef void (*GPrintFunc) (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+void g_print (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+GPrintFunc g_set_print_handler (GPrintFunc func);
+GLIB_AVAILABLE_IN_ALL
+void g_printerr (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+GPrintFunc g_set_printerr_handler (GPrintFunc func);
+
+/**
+ * g_warn_if_reached:
+ *
+ * Logs a warning.
+ *
+ * Since: 2.16
+ */
+#define g_warn_if_reached() \
+ do { \
+ g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); \
+ } while (0)
+
+/**
+ * g_warn_if_fail:
+ * @expr: the expression to check
+ *
+ * Logs a warning if the expression is not true.
+ *
+ * Since: 2.16
+ */
+#define g_warn_if_fail(expr) \
+ do { \
+ if G_LIKELY (expr) ; \
+ else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); \
+ } while (0)
+
+#ifdef G_DISABLE_CHECKS
+
+/**
+ * g_return_if_fail:
+ * @expr: the expression to check
+ *
+ * Verifies that the expression @expr, usually representing a precondition,
+ * evaluates to %TRUE. If the function returns a value, use
+ * g_return_val_if_fail() instead.
+ *
+ * If @expr evaluates to %FALSE, the current function should be considered to
+ * have undefined behaviour (a programmer error). The only correct solution
+ * to such an error is to change the module that is calling the current
+ * function, so that it avoids this incorrect call.
+ *
+ * To make this undefined behaviour visible, if @expr evaluates to %FALSE,
+ * the result is usually that a critical message is logged and the current
+ * function returns.
+ *
+ * If `G_DISABLE_CHECKS` is defined then the check is not performed. You
+ * should therefore not depend on any side effects of @expr.
+ *
+ * To debug failure of a g_return_if_fail() check, run the code under a debugger
+ * with `G_DEBUG=fatal-criticals` or `G_DEBUG=fatal-warnings` defined in the
+ * environment (see [Running GLib Applications](glib-running.html)):
+ *
+ * |[
+ * G_DEBUG=fatal-warnings gdb ./my-program
+ * ]|
+ *
+ * Any unrelated failures can be skipped over in
+ * [gdb](https://www.gnu.org/software/gdb/) using the `continue` command.
+ */
+#define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
+
+/**
+ * g_return_val_if_fail:
+ * @expr: the expression to check
+ * @val: the value to return from the current function
+ * if the expression is not true
+ *
+ * Verifies that the expression @expr, usually representing a precondition,
+ * evaluates to %TRUE. If the function does not return a value, use
+ * g_return_if_fail() instead.
+ *
+ * If @expr evaluates to %FALSE, the current function should be considered to
+ * have undefined behaviour (a programmer error). The only correct solution
+ * to such an error is to change the module that is calling the current
+ * function, so that it avoids this incorrect call.
+ *
+ * To make this undefined behaviour visible, if @expr evaluates to %FALSE,
+ * the result is usually that a critical message is logged and @val is
+ * returned from the current function.
+ *
+ * If `G_DISABLE_CHECKS` is defined then the check is not performed. You
+ * should therefore not depend on any side effects of @expr.
+ *
+ * See g_return_if_fail() for guidance on how to debug failure of this check.
+ */
+#define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
+
+/**
+ * g_return_if_reached:
+ *
+ * Logs a critical message and returns from the current function.
+ * This can only be used in functions which do not return a value.
+ *
+ * See g_return_if_fail() for guidance on how to debug failure of this check.
+ */
+#define g_return_if_reached() G_STMT_START{ return; }G_STMT_END
+
+/**
+ * g_return_val_if_reached:
+ * @val: the value to return from the current function
+ *
+ * Logs a critical message and returns @val.
+ *
+ * See g_return_if_fail() for guidance on how to debug failure of this check.
+ */
+#define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END
+
+#else /* !G_DISABLE_CHECKS */
+
+#define g_return_if_fail(expr) \
+ G_STMT_START { \
+ if (G_LIKELY (expr)) \
+ { } \
+ else \
+ { \
+ g_return_if_fail_warning (G_LOG_DOMAIN, \
+ G_STRFUNC, \
+ #expr); \
+ return; \
+ } \
+ } G_STMT_END
+
+#define g_return_val_if_fail(expr, val) \
+ G_STMT_START { \
+ if (G_LIKELY (expr)) \
+ { } \
+ else \
+ { \
+ g_return_if_fail_warning (G_LOG_DOMAIN, \
+ G_STRFUNC, \
+ #expr); \
+ return (val); \
+ } \
+ } G_STMT_END
+
+#define g_return_if_reached() \
+ G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d (%s): should not be reached", \
+ __FILE__, \
+ __LINE__, \
+ G_STRFUNC); \
+ return; \
+ } G_STMT_END
+
+#define g_return_val_if_reached(val) \
+ G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d (%s): should not be reached", \
+ __FILE__, \
+ __LINE__, \
+ G_STRFUNC); \
+ return (val); \
+ } G_STMT_END
+
+#endif /* !G_DISABLE_CHECKS */
+
+G_END_DECLS
+
+#endif /* __G_MESSAGES_H__ */
diff --git a/include/glib/glib/gnode.h b/include/glib/glib/gnode.h
new file mode 100644
index 0000000000..693e6154da
--- /dev/null
+++ b/include/glib/glib/gnode.h
@@ -0,0 +1,307 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_NODE_H__
+#define __G_NODE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmem.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GNode GNode;
+
+/* Tree traverse flags */
+typedef enum
+{
+ G_TRAVERSE_LEAVES = 1 << 0,
+ G_TRAVERSE_NON_LEAVES = 1 << 1,
+ G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES,
+ G_TRAVERSE_MASK = 0x03,
+ G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES,
+ G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES
+} GTraverseFlags;
+
+/* Tree traverse orders */
+typedef enum
+{
+ G_IN_ORDER,
+ G_PRE_ORDER,
+ G_POST_ORDER,
+ G_LEVEL_ORDER
+} GTraverseType;
+
+typedef gboolean (*GNodeTraverseFunc) (GNode *node,
+ gpointer data);
+typedef void (*GNodeForeachFunc) (GNode *node,
+ gpointer data);
+
+/* N-way tree implementation
+ */
+struct _GNode
+{
+ gpointer data;
+ GNode *next;
+ GNode *prev;
+ GNode *parent;
+ GNode *children;
+};
+
+/**
+ * G_NODE_IS_ROOT:
+ * @node: a #GNode
+ *
+ * Returns %TRUE if a #GNode is the root of a tree.
+ *
+ * Returns: %TRUE if the #GNode is the root of a tree
+ * (i.e. it has no parent or siblings)
+ */
+#define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \
+ ((GNode*) (node))->prev == NULL && \
+ ((GNode*) (node))->next == NULL)
+
+/**
+ * G_NODE_IS_LEAF:
+ * @node: a #GNode
+ *
+ * Returns %TRUE if a #GNode is a leaf node.
+ *
+ * Returns: %TRUE if the #GNode is a leaf node
+ * (i.e. it has no children)
+ */
+#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)
+
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_new (gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_node_destroy (GNode *root);
+GLIB_AVAILABLE_IN_ALL
+void g_node_unlink (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_copy_deep (GNode *node,
+ GCopyFunc copy_func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_copy (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_insert (GNode *parent,
+ gint position,
+ GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_insert_before (GNode *parent,
+ GNode *sibling,
+ GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_insert_after (GNode *parent,
+ GNode *sibling,
+ GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_prepend (GNode *parent,
+ GNode *node);
+GLIB_AVAILABLE_IN_ALL
+guint g_node_n_nodes (GNode *root,
+ GTraverseFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_get_root (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_node_is_ancestor (GNode *node,
+ GNode *descendant);
+GLIB_AVAILABLE_IN_ALL
+guint g_node_depth (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_find (GNode *root,
+ GTraverseType order,
+ GTraverseFlags flags,
+ gpointer data);
+
+/* convenience macros */
+/**
+ * g_node_append:
+ * @parent: the #GNode to place the new #GNode under
+ * @node: the #GNode to insert
+ *
+ * Inserts a #GNode as the last child of the given parent.
+ *
+ * Returns: the inserted #GNode
+ */
+#define g_node_append(parent, node) \
+ g_node_insert_before ((parent), NULL, (node))
+
+/**
+ * g_node_insert_data:
+ * @parent: the #GNode to place the new #GNode under
+ * @position: the position to place the new #GNode at. If position is -1,
+ * the new #GNode is inserted as the last child of @parent
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode at the given position.
+ *
+ * Returns: the new #GNode
+ */
+#define g_node_insert_data(parent, position, data) \
+ g_node_insert ((parent), (position), g_node_new (data))
+
+/**
+ * g_node_insert_data_after:
+ * @parent: the #GNode to place the new #GNode under
+ * @sibling: the sibling #GNode to place the new #GNode after
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode after the given sibling.
+ *
+ * Returns: the new #GNode
+ */
+
+#define g_node_insert_data_after(parent, sibling, data) \
+ g_node_insert_after ((parent), (sibling), g_node_new (data))
+/**
+ * g_node_insert_data_before:
+ * @parent: the #GNode to place the new #GNode under
+ * @sibling: the sibling #GNode to place the new #GNode before
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode before the given sibling.
+ *
+ * Returns: the new #GNode
+ */
+#define g_node_insert_data_before(parent, sibling, data) \
+ g_node_insert_before ((parent), (sibling), g_node_new (data))
+
+/**
+ * g_node_prepend_data:
+ * @parent: the #GNode to place the new #GNode under
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode as the first child of the given parent.
+ *
+ * Returns: the new #GNode
+ */
+#define g_node_prepend_data(parent, data) \
+ g_node_prepend ((parent), g_node_new (data))
+
+/**
+ * g_node_append_data:
+ * @parent: the #GNode to place the new #GNode under
+ * @data: the data for the new #GNode
+ *
+ * Inserts a new #GNode as the last child of the given parent.
+ *
+ * Returns: the new #GNode
+ */
+#define g_node_append_data(parent, data) \
+ g_node_insert_before ((parent), NULL, g_node_new (data))
+
+/* traversal function, assumes that 'node' is root
+ * (only traverses 'node' and its subtree).
+ * this function is just a high level interface to
+ * low level traversal functions, optimized for speed.
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_node_traverse (GNode *root,
+ GTraverseType order,
+ GTraverseFlags flags,
+ gint max_depth,
+ GNodeTraverseFunc func,
+ gpointer data);
+
+/* return the maximum tree height starting with 'node', this is an expensive
+ * operation, since we need to visit all nodes. this could be shortened by
+ * adding 'guint height' to struct _GNode, but then again, this is not very
+ * often needed, and would make g_node_insert() more time consuming.
+ */
+GLIB_AVAILABLE_IN_ALL
+guint g_node_max_height (GNode *root);
+
+GLIB_AVAILABLE_IN_ALL
+void g_node_children_foreach (GNode *node,
+ GTraverseFlags flags,
+ GNodeForeachFunc func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_node_reverse_children (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+guint g_node_n_children (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_nth_child (GNode *node,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_last_child (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_find_child (GNode *node,
+ GTraverseFlags flags,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+gint g_node_child_position (GNode *node,
+ GNode *child);
+GLIB_AVAILABLE_IN_ALL
+gint g_node_child_index (GNode *node,
+ gpointer data);
+
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_first_sibling (GNode *node);
+GLIB_AVAILABLE_IN_ALL
+GNode* g_node_last_sibling (GNode *node);
+
+/**
+ * g_node_prev_sibling:
+ * @node: a #GNode
+ *
+ * Gets the previous sibling of a #GNode.
+ *
+ * Returns: the previous sibling of @node, or %NULL if @node is the first
+ * node or %NULL
+ */
+#define g_node_prev_sibling(node) ((node) ? \
+ ((GNode*) (node))->prev : NULL)
+
+/**
+ * g_node_next_sibling:
+ * @node: a #GNode
+ *
+ * Gets the next sibling of a #GNode.
+ *
+ * Returns: the next sibling of @node, or %NULL if @node is the last node
+ * or %NULL
+ */
+#define g_node_next_sibling(node) ((node) ? \
+ ((GNode*) (node))->next : NULL)
+
+/**
+ * g_node_first_child:
+ * @node: a #GNode
+ *
+ * Gets the first child of a #GNode.
+ *
+ * Returns: the first child of @node, or %NULL if @node is %NULL
+ * or has no children
+ */
+#define g_node_first_child(node) ((node) ? \
+ ((GNode*) (node))->children : NULL)
+
+G_END_DECLS
+
+#endif /* __G_NODE_H__ */
diff --git a/include/glib/glib/goption.h b/include/glib/glib/goption.h
new file mode 100644
index 0000000000..63552fb0d5
--- /dev/null
+++ b/include/glib/glib/goption.h
@@ -0,0 +1,388 @@
+/* goption.h - Option parser
+ *
+ * Copyright (C) 2004 Anders Carlsson <andersca@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_OPTION_H__
+#define __G_OPTION_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+#include <glib/gquark.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GOptionContext:
+ *
+ * A `GOptionContext` struct defines which options
+ * are accepted by the commandline option parser. The struct has only private
+ * fields and should not be directly accessed.
+ */
+typedef struct _GOptionContext GOptionContext;
+
+/**
+ * GOptionGroup:
+ *
+ * A `GOptionGroup` struct defines the options in a single
+ * group. The struct has only private fields and should not be directly accessed.
+ *
+ * All options in a group share the same translation function. Libraries which
+ * need to parse commandline options are expected to provide a function for
+ * getting a `GOptionGroup` holding their options, which
+ * the application can then add to its #GOptionContext.
+ */
+typedef struct _GOptionGroup GOptionGroup;
+typedef struct _GOptionEntry GOptionEntry;
+
+/**
+ * GOptionFlags:
+ * @G_OPTION_FLAG_NONE: No flags. Since: 2.42.
+ * @G_OPTION_FLAG_HIDDEN: The option doesn't appear in `--help` output.
+ * @G_OPTION_FLAG_IN_MAIN: The option appears in the main section of the
+ * `--help` output, even if it is defined in a group.
+ * @G_OPTION_FLAG_REVERSE: For options of the %G_OPTION_ARG_NONE kind, this
+ * flag indicates that the sense of the option is reversed.
+ * @G_OPTION_FLAG_NO_ARG: For options of the %G_OPTION_ARG_CALLBACK kind,
+ * this flag indicates that the callback does not take any argument
+ * (like a %G_OPTION_ARG_NONE option). Since 2.8
+ * @G_OPTION_FLAG_FILENAME: For options of the %G_OPTION_ARG_CALLBACK
+ * kind, this flag indicates that the argument should be passed to the
+ * callback in the GLib filename encoding rather than UTF-8. Since 2.8
+ * @G_OPTION_FLAG_OPTIONAL_ARG: For options of the %G_OPTION_ARG_CALLBACK
+ * kind, this flag indicates that the argument supply is optional.
+ * If no argument is given then data of %GOptionParseFunc will be
+ * set to NULL. Since 2.8
+ * @G_OPTION_FLAG_NOALIAS: This flag turns off the automatic conflict
+ * resolution which prefixes long option names with `groupname-` if
+ * there is a conflict. This option should only be used in situations
+ * where aliasing is necessary to model some legacy commandline interface.
+ * It is not safe to use this option, unless all option groups are under
+ * your direct control. Since 2.8.
+ *
+ * Flags which modify individual options.
+ */
+typedef enum
+{
+ G_OPTION_FLAG_NONE = 0,
+ G_OPTION_FLAG_HIDDEN = 1 << 0,
+ G_OPTION_FLAG_IN_MAIN = 1 << 1,
+ G_OPTION_FLAG_REVERSE = 1 << 2,
+ G_OPTION_FLAG_NO_ARG = 1 << 3,
+ G_OPTION_FLAG_FILENAME = 1 << 4,
+ G_OPTION_FLAG_OPTIONAL_ARG = 1 << 5,
+ G_OPTION_FLAG_NOALIAS = 1 << 6
+} GOptionFlags;
+
+/**
+ * GOptionArg:
+ * @G_OPTION_ARG_NONE: No extra argument. This is useful for simple flags.
+ * @G_OPTION_ARG_STRING: The option takes a UTF-8 string argument.
+ * @G_OPTION_ARG_INT: The option takes an integer argument.
+ * @G_OPTION_ARG_CALLBACK: The option provides a callback (of type
+ * #GOptionArgFunc) to parse the extra argument.
+ * @G_OPTION_ARG_FILENAME: The option takes a filename as argument, which will
+ be in the GLib filename encoding rather than UTF-8.
+ * @G_OPTION_ARG_STRING_ARRAY: The option takes a string argument, multiple
+ * uses of the option are collected into an array of strings.
+ * @G_OPTION_ARG_FILENAME_ARRAY: The option takes a filename as argument,
+ * multiple uses of the option are collected into an array of strings.
+ * @G_OPTION_ARG_DOUBLE: The option takes a double argument. The argument
+ * can be formatted either for the user's locale or for the "C" locale.
+ * Since 2.12
+ * @G_OPTION_ARG_INT64: The option takes a 64-bit integer. Like
+ * %G_OPTION_ARG_INT but for larger numbers. The number can be in
+ * decimal base, or in hexadecimal (when prefixed with `0x`, for
+ * example, `0xffffffff`). Since 2.12
+ *
+ * The #GOptionArg enum values determine which type of extra argument the
+ * options expect to find. If an option expects an extra argument, it can
+ * be specified in several ways; with a short option: `-x arg`, with a long
+ * option: `--name arg` or combined in a single argument: `--name=arg`.
+ */
+typedef enum
+{
+ G_OPTION_ARG_NONE,
+ G_OPTION_ARG_STRING,
+ G_OPTION_ARG_INT,
+ G_OPTION_ARG_CALLBACK,
+ G_OPTION_ARG_FILENAME,
+ G_OPTION_ARG_STRING_ARRAY,
+ G_OPTION_ARG_FILENAME_ARRAY,
+ G_OPTION_ARG_DOUBLE,
+ G_OPTION_ARG_INT64
+} GOptionArg;
+
+/**
+ * GOptionArgFunc:
+ * @option_name: The name of the option being parsed. This will be either a
+ * single dash followed by a single letter (for a short name) or two dashes
+ * followed by a long option name.
+ * @value: The value to be parsed.
+ * @data: User data added to the #GOptionGroup containing the option when it
+ * was created with g_option_group_new()
+ * @error: A return location for errors. The error code %G_OPTION_ERROR_FAILED
+ * is intended to be used for errors in #GOptionArgFunc callbacks.
+ *
+ * The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK
+ * options.
+ *
+ * Returns: %TRUE if the option was successfully parsed, %FALSE if an error
+ * occurred, in which case @error should be set with g_set_error()
+ */
+typedef gboolean (*GOptionArgFunc) (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error);
+
+/**
+ * GOptionParseFunc:
+ * @context: The active #GOptionContext
+ * @group: The group to which the function belongs
+ * @data: User data added to the #GOptionGroup containing the option when it
+ * was created with g_option_group_new()
+ * @error: A return location for error details
+ *
+ * The type of function that can be called before and after parsing.
+ *
+ * Returns: %TRUE if the function completed successfully, %FALSE if an error
+ * occurred, in which case @error should be set with g_set_error()
+ */
+typedef gboolean (*GOptionParseFunc) (GOptionContext *context,
+ GOptionGroup *group,
+ gpointer data,
+ GError **error);
+
+/**
+ * GOptionErrorFunc:
+ * @context: The active #GOptionContext
+ * @group: The group to which the function belongs
+ * @data: User data added to the #GOptionGroup containing the option when it
+ * was created with g_option_group_new()
+ * @error: The #GError containing details about the parse error
+ *
+ * The type of function to be used as callback when a parse error occurs.
+ */
+typedef void (*GOptionErrorFunc) (GOptionContext *context,
+ GOptionGroup *group,
+ gpointer data,
+ GError **error);
+
+/**
+ * G_OPTION_ERROR:
+ *
+ * Error domain for option parsing. Errors in this domain will
+ * be from the #GOptionError enumeration. See #GError for information on
+ * error domains.
+ */
+#define G_OPTION_ERROR (g_option_error_quark ())
+
+/**
+ * GOptionError:
+ * @G_OPTION_ERROR_UNKNOWN_OPTION: An option was not known to the parser.
+ * This error will only be reported, if the parser hasn't been instructed
+ * to ignore unknown options, see g_option_context_set_ignore_unknown_options().
+ * @G_OPTION_ERROR_BAD_VALUE: A value couldn't be parsed.
+ * @G_OPTION_ERROR_FAILED: A #GOptionArgFunc callback failed.
+ *
+ * Error codes returned by option parsing.
+ */
+typedef enum
+{
+ G_OPTION_ERROR_UNKNOWN_OPTION,
+ G_OPTION_ERROR_BAD_VALUE,
+ G_OPTION_ERROR_FAILED
+} GOptionError;
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_option_error_quark (void);
+
+/**
+ * GOptionEntry:
+ * @long_name: The long name of an option can be used to specify it
+ * in a commandline as `--long_name`. Every option must have a
+ * long name. To resolve conflicts if multiple option groups contain
+ * the same long name, it is also possible to specify the option as
+ * `--groupname-long_name`.
+ * @short_name: If an option has a short name, it can be specified
+ * `-short_name` in a commandline. @short_name must be a printable
+ * ASCII character different from '-', or zero if the option has no
+ * short name.
+ * @flags: Flags from #GOptionFlags
+ * @arg: The type of the option, as a #GOptionArg
+ * @arg_data: If the @arg type is %G_OPTION_ARG_CALLBACK, then @arg_data
+ * must point to a #GOptionArgFunc callback function, which will be
+ * called to handle the extra argument. Otherwise, @arg_data is a
+ * pointer to a location to store the value, the required type of
+ * the location depends on the @arg type:
+ * - %G_OPTION_ARG_NONE: %gboolean
+ * - %G_OPTION_ARG_STRING: %gchar*
+ * - %G_OPTION_ARG_INT: %gint
+ * - %G_OPTION_ARG_FILENAME: %gchar*
+ * - %G_OPTION_ARG_STRING_ARRAY: %gchar**
+ * - %G_OPTION_ARG_FILENAME_ARRAY: %gchar**
+ * - %G_OPTION_ARG_DOUBLE: %gdouble
+ * If @arg type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME,
+ * the location will contain a newly allocated string if the option
+ * was given. That string needs to be freed by the callee using g_free().
+ * Likewise if @arg type is %G_OPTION_ARG_STRING_ARRAY or
+ * %G_OPTION_ARG_FILENAME_ARRAY, the data should be freed using g_strfreev().
+ * @description: the description for the option in `--help`
+ * output. The @description is translated using the @translate_func
+ * of the group, see g_option_group_set_translation_domain().
+ * @arg_description: The placeholder to use for the extra argument parsed
+ * by the option in `--help` output. The @arg_description is translated
+ * using the @translate_func of the group, see
+ * g_option_group_set_translation_domain().
+ *
+ * A GOptionEntry struct defines a single option. To have an effect, they
+ * must be added to a #GOptionGroup with g_option_context_add_main_entries()
+ * or g_option_group_add_entries().
+ */
+struct _GOptionEntry
+{
+ const gchar *long_name;
+ gchar short_name;
+ gint flags;
+
+ GOptionArg arg;
+ gpointer arg_data;
+
+ const gchar *description;
+ const gchar *arg_description;
+};
+
+/**
+ * G_OPTION_REMAINING:
+ *
+ * If a long option in the main group has this name, it is not treated as a
+ * regular option. Instead it collects all non-option arguments which would
+ * otherwise be left in `argv`. The option must be of type
+ * %G_OPTION_ARG_CALLBACK, %G_OPTION_ARG_STRING_ARRAY
+ * or %G_OPTION_ARG_FILENAME_ARRAY.
+ *
+ *
+ * Using #G_OPTION_REMAINING instead of simply scanning `argv`
+ * for leftover arguments has the advantage that GOption takes care of
+ * necessary encoding conversions for strings or filenames.
+ *
+ * Since: 2.6
+ */
+#define G_OPTION_REMAINING ""
+
+GLIB_AVAILABLE_IN_ALL
+GOptionContext *g_option_context_new (const gchar *parameter_string);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_summary (GOptionContext *context,
+ const gchar *summary);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_option_context_get_summary (GOptionContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_description (GOptionContext *context,
+ const gchar *description);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_option_context_get_description (GOptionContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_free (GOptionContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_help_enabled (GOptionContext *context,
+ gboolean help_enabled);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_option_context_get_help_enabled (GOptionContext *context);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_ignore_unknown_options (GOptionContext *context,
+ gboolean ignore_unknown);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_option_context_get_ignore_unknown_options (GOptionContext *context);
+
+GLIB_AVAILABLE_IN_2_44
+void g_option_context_set_strict_posix (GOptionContext *context,
+ gboolean strict_posix);
+GLIB_AVAILABLE_IN_2_44
+gboolean g_option_context_get_strict_posix (GOptionContext *context);
+
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_add_main_entries (GOptionContext *context,
+ const GOptionEntry *entries,
+ const gchar *translation_domain);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_option_context_parse (GOptionContext *context,
+ gint *argc,
+ gchar ***argv,
+ GError **error);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_option_context_parse_strv (GOptionContext *context,
+ gchar ***arguments,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_translate_func (GOptionContext *context,
+ GTranslateFunc func,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_translation_domain (GOptionContext *context,
+ const gchar *domain);
+
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_add_group (GOptionContext *context,
+ GOptionGroup *group);
+GLIB_AVAILABLE_IN_ALL
+void g_option_context_set_main_group (GOptionContext *context,
+ GOptionGroup *group);
+GLIB_AVAILABLE_IN_ALL
+GOptionGroup *g_option_context_get_main_group (GOptionContext *context);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_option_context_get_help (GOptionContext *context,
+ gboolean main_help,
+ GOptionGroup *group);
+
+GLIB_AVAILABLE_IN_ALL
+GOptionGroup *g_option_group_new (const gchar *name,
+ const gchar *description,
+ const gchar *help_description,
+ gpointer user_data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+void g_option_group_set_parse_hooks (GOptionGroup *group,
+ GOptionParseFunc pre_parse_func,
+ GOptionParseFunc post_parse_func);
+GLIB_AVAILABLE_IN_ALL
+void g_option_group_set_error_hook (GOptionGroup *group,
+ GOptionErrorFunc error_func);
+GLIB_DEPRECATED_IN_2_44
+void g_option_group_free (GOptionGroup *group);
+GLIB_AVAILABLE_IN_2_44
+GOptionGroup *g_option_group_ref (GOptionGroup *group);
+GLIB_AVAILABLE_IN_2_44
+void g_option_group_unref (GOptionGroup *group);
+GLIB_AVAILABLE_IN_ALL
+void g_option_group_add_entries (GOptionGroup *group,
+ const GOptionEntry *entries);
+GLIB_AVAILABLE_IN_ALL
+void g_option_group_set_translate_func (GOptionGroup *group,
+ GTranslateFunc func,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+GLIB_AVAILABLE_IN_ALL
+void g_option_group_set_translation_domain (GOptionGroup *group,
+ const gchar *domain);
+
+G_END_DECLS
+
+#endif /* __G_OPTION_H__ */
diff --git a/include/glib/glib/gpattern.h b/include/glib/glib/gpattern.h
new file mode 100644
index 0000000000..bd9e4a7afe
--- /dev/null
+++ b/include/glib/glib/gpattern.h
@@ -0,0 +1,53 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 1999 Peter Mattis, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_PATTERN_H__
+#define __G_PATTERN_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+
+typedef struct _GPatternSpec GPatternSpec;
+
+GLIB_AVAILABLE_IN_ALL
+GPatternSpec* g_pattern_spec_new (const gchar *pattern);
+GLIB_AVAILABLE_IN_ALL
+void g_pattern_spec_free (GPatternSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pattern_spec_equal (GPatternSpec *pspec1,
+ GPatternSpec *pspec2);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pattern_match (GPatternSpec *pspec,
+ guint string_length,
+ const gchar *string,
+ const gchar *string_reversed);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pattern_match_string (GPatternSpec *pspec,
+ const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_pattern_match_simple (const gchar *pattern,
+ const gchar *string);
+
+G_END_DECLS
+
+#endif /* __G_PATTERN_H__ */
diff --git a/include/glib/glib/gpoll.h b/include/glib/glib/gpoll.h
new file mode 100644
index 0000000000..2cbd697298
--- /dev/null
+++ b/include/glib/glib/gpoll.h
@@ -0,0 +1,120 @@
+/* gpoll.h - poll(2) support
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_POLL_H__
+#define __G_POLL_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (__G_MAIN_H__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glibconfig.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* Any definitions using GPollFD or GPollFunc are primarily
+ * for Unix and not guaranteed to be the compatible on all
+ * operating systems on which GLib runs. Right now, the
+ * GLib does use these functions on Win32 as well, but interprets
+ * them in a fairly different way than on Unix. If you use
+ * these definitions, you are should be prepared to recode
+ * for different operating systems.
+ *
+ * Note that on systems with a working poll(2), that function is used
+ * in place of g_poll(). Thus g_poll() must have the same signature as
+ * poll(), meaning GPollFD must have the same layout as struct pollfd.
+ *
+ * On Win32, the fd in a GPollFD should be Win32 HANDLE (*not* a file
+ * descriptor as provided by the C runtime) that can be used by
+ * MsgWaitForMultipleObjects. This does *not* include file handles
+ * from CreateFile, SOCKETs, nor pipe handles. (But you can use
+ * WSAEventSelect to signal events when a SOCKET is readable).
+ *
+ * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to
+ * indicate polling for messages.
+ *
+ * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK
+ * (GTK) programs, as GDK itself wants to read messages and convert them
+ * to GDK events.
+ *
+ * So, unless you really know what you are doing, it's best not to try
+ * to use the main loop polling stuff for your own needs on
+ * Windows.
+ */
+typedef struct _GPollFD GPollFD;
+
+/**
+ * GPollFunc:
+ * @ufds: an array of #GPollFD elements
+ * @nfsd: the number of elements in @ufds
+ * @timeout_: the maximum time to wait for an event of the file descriptors.
+ * A negative value indicates an infinite timeout.
+ *
+ * Specifies the type of function passed to g_main_context_set_poll_func().
+ * The semantics of the function should match those of the poll() system call.
+ *
+ * Returns: the number of #GPollFD elements which have events or errors
+ * reported, or -1 if an error occurred.
+ */
+typedef gint (*GPollFunc) (GPollFD *ufds,
+ guint nfsd,
+ gint timeout_);
+
+/**
+ * GPollFD:
+ * @fd: the file descriptor to poll (or a HANDLE on Win32)
+ * @events: a bitwise combination from #GIOCondition, specifying which
+ * events should be polled for. Typically for reading from a file
+ * descriptor you would use %G_IO_IN | %G_IO_HUP | %G_IO_ERR, and
+ * for writing you would use %G_IO_OUT | %G_IO_ERR.
+ * @revents: a bitwise combination of flags from #GIOCondition, returned
+ * from the poll() function to indicate which events occurred.
+ *
+ * Represents a file descriptor, which events to poll for, and which events
+ * occurred.
+ */
+struct _GPollFD
+{
+#if defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8
+#ifndef __GTK_DOC_IGNORE__
+ gint64 fd;
+#endif
+#else
+ gint fd;
+#endif
+ gushort events;
+ gushort revents;
+};
+
+/**
+ * G_POLLFD_FORMAT:
+ *
+ * A format specifier that can be used in printf()-style format strings
+ * when printing the @fd member of a #GPollFD.
+ */
+/* defined in glibconfig.h */
+
+GLIB_AVAILABLE_IN_ALL
+gint
+g_poll (GPollFD *fds,
+ guint nfds,
+ gint timeout);
+
+G_END_DECLS
+
+#endif /* __G_POLL_H__ */
diff --git a/include/glib/glib/gprimes.h b/include/glib/glib/gprimes.h
new file mode 100644
index 0000000000..0b6ea850db
--- /dev/null
+++ b/include/glib/glib/gprimes.h
@@ -0,0 +1,50 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_PRIMES_H__
+#define __G_PRIMES_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* Prime numbers.
+ */
+
+/* This function returns prime numbers spaced by approximately 1.5-2.0
+ * and is for use in resizing data structures which prefer
+ * prime-valued sizes. The closest spaced prime function returns the
+ * next largest prime, or the highest it knows about which is about
+ * MAXINT/4.
+ */
+GLIB_AVAILABLE_IN_ALL
+guint g_spaced_primes_closest (guint num) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_PRIMES_H__ */
diff --git a/include/glib/glib/gprintf.h b/include/glib/glib/gprintf.h
new file mode 100644
index 0000000000..429de7a24e
--- /dev/null
+++ b/include/glib/glib/gprintf.h
@@ -0,0 +1,57 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_PRINTF_H__
+#define __G_PRINTF_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+gint g_printf (gchar const *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+gint g_fprintf (FILE *file,
+ gchar const *format,
+ ...) G_GNUC_PRINTF (2, 3);
+GLIB_AVAILABLE_IN_ALL
+gint g_sprintf (gchar *string,
+ gchar const *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_vprintf (gchar const *format,
+ va_list args) G_GNUC_PRINTF(1, 0);
+GLIB_AVAILABLE_IN_ALL
+gint g_vfprintf (FILE *file,
+ gchar const *format,
+ va_list args) G_GNUC_PRINTF(2, 0);
+GLIB_AVAILABLE_IN_ALL
+gint g_vsprintf (gchar *string,
+ gchar const *format,
+ va_list args) G_GNUC_PRINTF(2, 0);
+GLIB_AVAILABLE_IN_ALL
+gint g_vasprintf (gchar **string,
+ gchar const *format,
+ va_list args) G_GNUC_PRINTF(2, 0);
+
+G_END_DECLS
+
+#endif /* __G_PRINTF_H__ */
diff --git a/include/glib/glib/gqsort.h b/include/glib/glib/gqsort.h
new file mode 100644
index 0000000000..2ecd75fae0
--- /dev/null
+++ b/include/glib/glib/gqsort.h
@@ -0,0 +1,45 @@
+ /* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_QSORT_H__
+#define __G_QSORT_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+void g_qsort_with_data (gconstpointer pbase,
+ gint total_elems,
+ gsize size,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __G_QSORT_H__ */
diff --git a/include/glib/glib/gquark.h b/include/glib/glib/gquark.h
new file mode 100644
index 0000000000..1822c4bf7b
--- /dev/null
+++ b/include/glib/glib/gquark.h
@@ -0,0 +1,68 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_QUARK_H__
+#define __G_QUARK_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef guint32 GQuark;
+
+/* Quarks (string<->id association)
+ */
+GLIB_AVAILABLE_IN_ALL
+GQuark g_quark_try_string (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+GQuark g_quark_from_static_string (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+GQuark g_quark_from_string (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_quark_to_string (GQuark quark) G_GNUC_CONST;
+
+#define G_DEFINE_QUARK(QN, q_n) \
+GQuark \
+q_n##_quark (void) \
+{ \
+ static GQuark q; \
+ \
+ if G_UNLIKELY (q == 0) \
+ q = g_quark_from_static_string (#QN); \
+ \
+ return q; \
+}
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_intern_string (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_intern_static_string (const gchar *string);
+
+G_END_DECLS
+
+#endif /* __G_QUARK_H__ */
diff --git a/include/glib/glib/gqueue.h b/include/glib/glib/gqueue.h
new file mode 100644
index 0000000000..65d609f1ae
--- /dev/null
+++ b/include/glib/glib/gqueue.h
@@ -0,0 +1,203 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_QUEUE_H__
+#define __G_QUEUE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GQueue GQueue;
+
+/**
+ * GQueue:
+ * @head: a pointer to the first element of the queue
+ * @tail: a pointer to the last element of the queue
+ * @length: the number of elements in the queue
+ *
+ * Contains the public fields of a
+ * [Queue][glib-Double-ended-Queues].
+ */
+struct _GQueue
+{
+ GList *head;
+ GList *tail;
+ guint length;
+};
+
+/**
+ * G_QUEUE_INIT:
+ *
+ * A statically-allocated #GQueue must be initialized with this
+ * macro before it can be used. This macro can be used to initialize
+ * a variable, but it cannot be assigned to a variable. In that case
+ * you have to use g_queue_init().
+ *
+ * |[
+ * GQueue my_queue = G_QUEUE_INIT;
+ * ]|
+ *
+ * Since: 2.14
+ */
+#define G_QUEUE_INIT { NULL, NULL, 0 }
+
+/* Queues
+ */
+GLIB_AVAILABLE_IN_ALL
+GQueue* g_queue_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_free (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_free_full (GQueue *queue,
+ GDestroyNotify free_func);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_init (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_clear (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_queue_is_empty (GQueue *queue);
+GLIB_AVAILABLE_IN_2_60
+void g_queue_clear_full (GQueue *queue,
+ GDestroyNotify free_func);
+GLIB_AVAILABLE_IN_ALL
+guint g_queue_get_length (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_reverse (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GQueue * g_queue_copy (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_foreach (GQueue *queue,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GList * g_queue_find (GQueue *queue,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+GList * g_queue_find_custom (GQueue *queue,
+ gconstpointer data,
+ GCompareFunc func);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_sort (GQueue *queue,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_head (GQueue *queue,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_tail (GQueue *queue,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_nth (GQueue *queue,
+ gpointer data,
+ gint n);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_pop_head (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_pop_tail (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_pop_nth (GQueue *queue,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_peek_head (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_peek_tail (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_queue_peek_nth (GQueue *queue,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+gint g_queue_index (GQueue *queue,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_queue_remove (GQueue *queue,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_queue_remove_all (GQueue *queue,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_insert_before (GQueue *queue,
+ GList *sibling,
+ gpointer data);
+GLIB_AVAILABLE_IN_2_62
+void g_queue_insert_before_link
+ (GQueue *queue,
+ GList *sibling,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_insert_after (GQueue *queue,
+ GList *sibling,
+ gpointer data);
+GLIB_AVAILABLE_IN_2_62
+void g_queue_insert_after_link
+ (GQueue *queue,
+ GList *sibling,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_insert_sorted (GQueue *queue,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_head_link (GQueue *queue,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_tail_link (GQueue *queue,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_push_nth_link (GQueue *queue,
+ gint n,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_pop_head_link (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_pop_tail_link (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_pop_nth_link (GQueue *queue,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_peek_head_link (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_peek_tail_link (GQueue *queue);
+GLIB_AVAILABLE_IN_ALL
+GList* g_queue_peek_nth_link (GQueue *queue,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+gint g_queue_link_index (GQueue *queue,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_unlink (GQueue *queue,
+ GList *link_);
+GLIB_AVAILABLE_IN_ALL
+void g_queue_delete_link (GQueue *queue,
+ GList *link_);
+
+G_END_DECLS
+
+#endif /* __G_QUEUE_H__ */
diff --git a/include/glib/glib/grand.h b/include/glib/glib/grand.h
new file mode 100644
index 0000000000..82528c77b5
--- /dev/null
+++ b/include/glib/glib/grand.h
@@ -0,0 +1,99 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_RAND_H__
+#define __G_RAND_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GRand GRand;
+
+/* GRand - a good and fast random number generator: Mersenne Twister
+ * see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for more info.
+ * The range functions return a value in the intervall [begin, end).
+ * int -> [0..2^32-1]
+ * int_range -> [begin..end-1]
+ * double -> [0..1)
+ * double_range -> [begin..end)
+ */
+
+GLIB_AVAILABLE_IN_ALL
+GRand* g_rand_new_with_seed (guint32 seed);
+GLIB_AVAILABLE_IN_ALL
+GRand* g_rand_new_with_seed_array (const guint32 *seed,
+ guint seed_length);
+GLIB_AVAILABLE_IN_ALL
+GRand* g_rand_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_rand_free (GRand *rand_);
+GLIB_AVAILABLE_IN_ALL
+GRand* g_rand_copy (GRand *rand_);
+GLIB_AVAILABLE_IN_ALL
+void g_rand_set_seed (GRand *rand_,
+ guint32 seed);
+GLIB_AVAILABLE_IN_ALL
+void g_rand_set_seed_array (GRand *rand_,
+ const guint32 *seed,
+ guint seed_length);
+
+#define g_rand_boolean(rand_) ((g_rand_int (rand_) & (1 << 15)) != 0)
+
+GLIB_AVAILABLE_IN_ALL
+guint32 g_rand_int (GRand *rand_);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_rand_int_range (GRand *rand_,
+ gint32 begin,
+ gint32 end);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_rand_double (GRand *rand_);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_rand_double_range (GRand *rand_,
+ gdouble begin,
+ gdouble end);
+GLIB_AVAILABLE_IN_ALL
+void g_random_set_seed (guint32 seed);
+
+#define g_random_boolean() ((g_random_int () & (1 << 15)) != 0)
+
+GLIB_AVAILABLE_IN_ALL
+guint32 g_random_int (void);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_random_int_range (gint32 begin,
+ gint32 end);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_random_double (void);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_random_double_range (gdouble begin,
+ gdouble end);
+
+
+G_END_DECLS
+
+#endif /* __G_RAND_H__ */
diff --git a/include/glib/glib/grcbox.h b/include/glib/glib/grcbox.h
new file mode 100644
index 0000000000..c92791260a
--- /dev/null
+++ b/include/glib/glib/grcbox.h
@@ -0,0 +1,88 @@
+/* grcbox.h: Reference counted data
+ *
+ * Copyright 2018 Emmanuele Bassi
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmem.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_58
+gpointer g_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_rc_box_dup (gsize block_size,
+ gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_rc_box_acquire (gpointer mem_block);
+GLIB_AVAILABLE_IN_2_58
+void g_rc_box_release (gpointer mem_block);
+GLIB_AVAILABLE_IN_2_58
+void g_rc_box_release_full (gpointer mem_block,
+ GDestroyNotify clear_func);
+
+GLIB_AVAILABLE_IN_2_58
+gsize g_rc_box_get_size (gpointer mem_block);
+
+GLIB_AVAILABLE_IN_2_58
+gpointer g_atomic_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_atomic_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_atomic_rc_box_dup (gsize block_size,
+ gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_2_58
+gpointer g_atomic_rc_box_acquire (gpointer mem_block);
+GLIB_AVAILABLE_IN_2_58
+void g_atomic_rc_box_release (gpointer mem_block);
+GLIB_AVAILABLE_IN_2_58
+void g_atomic_rc_box_release_full (gpointer mem_block,
+ GDestroyNotify clear_func);
+
+GLIB_AVAILABLE_IN_2_58
+gsize g_atomic_rc_box_get_size (gpointer mem_block);
+
+#define g_rc_box_new(type) \
+ ((type *) g_rc_box_alloc (sizeof (type)))
+#define g_rc_box_new0(type) \
+ ((type *) g_rc_box_alloc0 (sizeof (type)))
+#define g_atomic_rc_box_new(type) \
+ ((type *) g_atomic_rc_box_alloc (sizeof (type)))
+#define g_atomic_rc_box_new0(type) \
+ ((type *) g_atomic_rc_box_alloc0 (sizeof (type)))
+
+#ifdef g_has_typeof
+/* Type check to avoid assigning references to different types */
+# define g_rc_box_acquire(mem_block) \
+ ((__typeof__(mem_block)) (g_rc_box_acquire) (mem_block))
+# define g_atomic_rc_box_acquire(mem_block) \
+ ((__typeof__(mem_block)) (g_atomic_rc_box_acquire) (mem_block))
+
+/* Type check to avoid duplicating data to different types */
+# define g_rc_box_dup(block_size,mem_block) \
+ ((__typeof__(mem_block)) (g_rc_box_dup) (block_size,mem_block))
+# define g_atomic_rc_box_dup(block_size,mem_block) \
+ ((__typeof__(mem_block)) (g_atomic_rc_box_dup) (block_size,mem_block))
+#endif
+
+G_END_DECLS
diff --git a/include/glib/glib/grefcount.h b/include/glib/glib/grefcount.h
new file mode 100644
index 0000000000..599dac978e
--- /dev/null
+++ b/include/glib/glib/grefcount.h
@@ -0,0 +1,123 @@
+/* grefcount.h: Reference counting
+ *
+ * Copyright 2018 Emmanuele Bassi
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GREFCOUNT_H__
+#define __GREFCOUNT_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gatomic.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_58
+void g_ref_count_init (grefcount *rc);
+GLIB_AVAILABLE_IN_2_58
+void g_ref_count_inc (grefcount *rc);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_ref_count_dec (grefcount *rc);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_ref_count_compare (grefcount *rc,
+ gint val);
+
+GLIB_AVAILABLE_IN_2_58
+void g_atomic_ref_count_init (gatomicrefcount *arc);
+GLIB_AVAILABLE_IN_2_58
+void g_atomic_ref_count_inc (gatomicrefcount *arc);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_atomic_ref_count_dec (gatomicrefcount *arc);
+GLIB_AVAILABLE_IN_2_58
+gboolean g_atomic_ref_count_compare (gatomicrefcount *arc,
+ gint val);
+
+/* On GCC we can use __extension__ to inline the API without using
+ * ancillary functions; we only do this when disabling checks, as
+ * it disables warnings when saturating the reference counters
+ */
+#if defined(__GNUC__) && defined(G_DISABLE_CHECKS)
+
+# define g_ref_count_init(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \
+ (void) (0 ? *(rc) ^ *(rc) : 1); \
+ *(rc) = -1; \
+ }))
+
+# define g_ref_count_inc(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \
+ (void) (0 ? *(rc) ^ *(rc) : 1); \
+ if (*(rc) == G_MININT) ; else { \
+ *(rc) -= 1; \
+ } \
+ }))
+
+# define g_ref_count_dec(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \
+ grefcount __rc = *(rc); \
+ __rc += 1; \
+ if (__rc == 0) ; else { \
+ *(rc) = __rc; \
+ } \
+ (gboolean) (__rc == 0); \
+ }))
+
+# define g_ref_count_compare(rc,val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \
+ (void) (0 ? *(rc) ^ (val) : 1); \
+ (gboolean) (*(rc) == -(val)); \
+ }))
+
+# define g_atomic_ref_count_init(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \
+ (void) (0 ? *(rc) ^ *(rc) : 1); \
+ *(rc) = 1; \
+ }))
+
+# define g_atomic_ref_count_inc(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \
+ (void) (0 ? *(rc) ^ *(rc) : 1); \
+ (void) (g_atomic_int_get (rc) == G_MAXINT ? 0 : g_atomic_int_inc ((rc))); \
+ }))
+
+# define g_atomic_ref_count_dec(rc) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \
+ (void) (0 ? *(rc) ^ *(rc) : 1); \
+ g_atomic_int_dec_and_test ((rc)); \
+ }))
+
+# define g_atomic_ref_count_compare(rc,val) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \
+ (void) (0 ? *(rc) ^ (val) : 1); \
+ (gboolean) (g_atomic_int_get (rc) == (val)); \
+ }))
+
+#endif /* __GNUC__ && G_DISABLE_CHECKS */
+
+G_END_DECLS
+
+#endif /* __GREFCOUNT_H__ */
diff --git a/include/glib/glib/grefstring.h b/include/glib/glib/grefstring.h
new file mode 100644
index 0000000000..c27767c71c
--- /dev/null
+++ b/include/glib/glib/grefstring.h
@@ -0,0 +1,57 @@
+/* grefstring.h: Reference counted strings
+ *
+ * Copyright 2018 Emmanuele Bassi
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "gmem.h"
+#include "gmacros.h"
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_58
+char * g_ref_string_new (const char *str);
+GLIB_AVAILABLE_IN_2_58
+char * g_ref_string_new_len (const char *str,
+ gssize len);
+GLIB_AVAILABLE_IN_2_58
+char * g_ref_string_new_intern (const char *str);
+
+GLIB_AVAILABLE_IN_2_58
+char * g_ref_string_acquire (char *str);
+GLIB_AVAILABLE_IN_2_58
+void g_ref_string_release (char *str);
+
+GLIB_AVAILABLE_IN_2_58
+gsize g_ref_string_length (char *str);
+
+/**
+ * GRefString:
+ *
+ * A typedef for a reference-counted string. A pointer to a #GRefString can be
+ * treated like a standard `char*` array by all code, but can additionally have
+ * `g_ref_string_*()` methods called on it. `g_ref_string_*()` methods cannot be
+ * called on `char*` arrays not allocated using g_ref_string_new().
+ *
+ * If using #GRefString with autocleanups, g_autoptr() must be used rather than
+ * g_autofree(), so that the reference counting metadata is also freed.
+ *
+ * Since: 2.58
+ */
+typedef char GRefString;
+
+G_END_DECLS
diff --git a/include/glib/glib/gregex.h b/include/glib/glib/gregex.h
new file mode 100644
index 0000000000..45e198df69
--- /dev/null
+++ b/include/glib/glib/gregex.h
@@ -0,0 +1,609 @@
+/* GRegex -- regular expression API wrapper around PCRE.
+ *
+ * Copyright (C) 1999, 2000 Scott Wimer
+ * Copyright (C) 2004, Matthias Clasen <mclasen@redhat.com>
+ * Copyright (C) 2005 - 2007, Marco Barisione <marco@barisione.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_REGEX_H__
+#define __G_REGEX_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+#include <glib/gstring.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GRegexError:
+ * @G_REGEX_ERROR_COMPILE: Compilation of the regular expression failed.
+ * @G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression failed.
+ * @G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement
+ * string.
+ * @G_REGEX_ERROR_MATCH: The match process failed.
+ * @G_REGEX_ERROR_INTERNAL: Internal error of the regular expression engine.
+ * Since 2.16
+ * @G_REGEX_ERROR_STRAY_BACKSLASH: "\\" at end of pattern. Since 2.16
+ * @G_REGEX_ERROR_MISSING_CONTROL_CHAR: "\\c" at end of pattern. Since 2.16
+ * @G_REGEX_ERROR_UNRECOGNIZED_ESCAPE: Unrecognized character follows "\\".
+ * Since 2.16
+ * @G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER: Numbers out of order in "{}"
+ * quantifier. Since 2.16
+ * @G_REGEX_ERROR_QUANTIFIER_TOO_BIG: Number too big in "{}" quantifier.
+ * Since 2.16
+ * @G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS: Missing terminating "]" for
+ * character class. Since 2.16
+ * @G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS: Invalid escape sequence
+ * in character class. Since 2.16
+ * @G_REGEX_ERROR_RANGE_OUT_OF_ORDER: Range out of order in character class.
+ * Since 2.16
+ * @G_REGEX_ERROR_NOTHING_TO_REPEAT: Nothing to repeat. Since 2.16
+ * @G_REGEX_ERROR_UNRECOGNIZED_CHARACTER: Unrecognized character after "(?",
+ * "(?<" or "(?P". Since 2.16
+ * @G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS: POSIX named classes are
+ * supported only within a class. Since 2.16
+ * @G_REGEX_ERROR_UNMATCHED_PARENTHESIS: Missing terminating ")" or ")"
+ * without opening "(". Since 2.16
+ * @G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE: Reference to non-existent
+ * subpattern. Since 2.16
+ * @G_REGEX_ERROR_UNTERMINATED_COMMENT: Missing terminating ")" after comment.
+ * Since 2.16
+ * @G_REGEX_ERROR_EXPRESSION_TOO_LARGE: Regular expression too large.
+ * Since 2.16
+ * @G_REGEX_ERROR_MEMORY_ERROR: Failed to get memory. Since 2.16
+ * @G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND: Lookbehind assertion is not
+ * fixed length. Since 2.16
+ * @G_REGEX_ERROR_MALFORMED_CONDITION: Malformed number or name after "(?(".
+ * Since 2.16
+ * @G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES: Conditional group contains
+ * more than two branches. Since 2.16
+ * @G_REGEX_ERROR_ASSERTION_EXPECTED: Assertion expected after "(?(".
+ * Since 2.16
+ * @G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME: Unknown POSIX class name.
+ * Since 2.16
+ * @G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED: POSIX collating
+ * elements are not supported. Since 2.16
+ * @G_REGEX_ERROR_HEX_CODE_TOO_LARGE: Character value in "\\x{...}" sequence
+ * is too large. Since 2.16
+ * @G_REGEX_ERROR_INVALID_CONDITION: Invalid condition "(?(0)". Since 2.16
+ * @G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND: \\C not allowed in
+ * lookbehind assertion. Since 2.16
+ * @G_REGEX_ERROR_INFINITE_LOOP: Recursive call could loop indefinitely.
+ * Since 2.16
+ * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR: Missing terminator
+ * in subpattern name. Since 2.16
+ * @G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME: Two named subpatterns have
+ * the same name. Since 2.16
+ * @G_REGEX_ERROR_MALFORMED_PROPERTY: Malformed "\\P" or "\\p" sequence.
+ * Since 2.16
+ * @G_REGEX_ERROR_UNKNOWN_PROPERTY: Unknown property name after "\\P" or
+ * "\\p". Since 2.16
+ * @G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG: Subpattern name is too long
+ * (maximum 32 characters). Since 2.16
+ * @G_REGEX_ERROR_TOO_MANY_SUBPATTERNS: Too many named subpatterns (maximum
+ * 10,000). Since 2.16
+ * @G_REGEX_ERROR_INVALID_OCTAL_VALUE: Octal value is greater than "\\377".
+ * Since 2.16
+ * @G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE: "DEFINE" group contains more
+ * than one branch. Since 2.16
+ * @G_REGEX_ERROR_DEFINE_REPETION: Repeating a "DEFINE" group is not allowed.
+ * This error is never raised. Since: 2.16 Deprecated: 2.34
+ * @G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS: Inconsistent newline options.
+ * Since 2.16
+ * @G_REGEX_ERROR_MISSING_BACK_REFERENCE: "\\g" is not followed by a braced,
+ * angle-bracketed, or quoted name or number, or by a plain number. Since: 2.16
+ * @G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE: relative reference must not be zero. Since: 2.34
+ * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN: the backtracing
+ * control verb used does not allow an argument. Since: 2.34
+ * @G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB: unknown backtracing
+ * control verb. Since: 2.34
+ * @G_REGEX_ERROR_NUMBER_TOO_BIG: number is too big in escape sequence. Since: 2.34
+ * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME: Missing subpattern name. Since: 2.34
+ * @G_REGEX_ERROR_MISSING_DIGIT: Missing digit. Since 2.34
+ * @G_REGEX_ERROR_INVALID_DATA_CHARACTER: In JavaScript compatibility mode,
+ * "[" is an invalid data character. Since: 2.34
+ * @G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME: different names for subpatterns of the
+ * same number are not allowed. Since: 2.34
+ * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED: the backtracing control
+ * verb requires an argument. Since: 2.34
+ * @G_REGEX_ERROR_INVALID_CONTROL_CHAR: "\\c" must be followed by an ASCII
+ * character. Since: 2.34
+ * @G_REGEX_ERROR_MISSING_NAME: "\\k" is not followed by a braced, angle-bracketed, or
+ * quoted name. Since: 2.34
+ * @G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS: "\\N" is not supported in a class. Since: 2.34
+ * @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34
+ * @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)",
+ * "(*SKIP)", or "(*THEN)". Since: 2.34
+ * @G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE: the character value in the \\u sequence is
+ * too large. Since: 2.34
+ *
+ * Error codes returned by regular expressions functions.
+ *
+ * Since: 2.14
+ */
+typedef enum
+{
+ G_REGEX_ERROR_COMPILE,
+ G_REGEX_ERROR_OPTIMIZE,
+ G_REGEX_ERROR_REPLACE,
+ G_REGEX_ERROR_MATCH,
+ G_REGEX_ERROR_INTERNAL,
+
+ /* These are the error codes from PCRE + 100 */
+ G_REGEX_ERROR_STRAY_BACKSLASH = 101,
+ G_REGEX_ERROR_MISSING_CONTROL_CHAR = 102,
+ G_REGEX_ERROR_UNRECOGNIZED_ESCAPE = 103,
+ G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER = 104,
+ G_REGEX_ERROR_QUANTIFIER_TOO_BIG = 105,
+ G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS = 106,
+ G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS = 107,
+ G_REGEX_ERROR_RANGE_OUT_OF_ORDER = 108,
+ G_REGEX_ERROR_NOTHING_TO_REPEAT = 109,
+ G_REGEX_ERROR_UNRECOGNIZED_CHARACTER = 112,
+ G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113,
+ G_REGEX_ERROR_UNMATCHED_PARENTHESIS = 114,
+ G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE = 115,
+ G_REGEX_ERROR_UNTERMINATED_COMMENT = 118,
+ G_REGEX_ERROR_EXPRESSION_TOO_LARGE = 120,
+ G_REGEX_ERROR_MEMORY_ERROR = 121,
+ G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND = 125,
+ G_REGEX_ERROR_MALFORMED_CONDITION = 126,
+ G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES = 127,
+ G_REGEX_ERROR_ASSERTION_EXPECTED = 128,
+ G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME = 130,
+ G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131,
+ G_REGEX_ERROR_HEX_CODE_TOO_LARGE = 134,
+ G_REGEX_ERROR_INVALID_CONDITION = 135,
+ G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136,
+ G_REGEX_ERROR_INFINITE_LOOP = 140,
+ G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR = 142,
+ G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME = 143,
+ G_REGEX_ERROR_MALFORMED_PROPERTY = 146,
+ G_REGEX_ERROR_UNKNOWN_PROPERTY = 147,
+ G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG = 148,
+ G_REGEX_ERROR_TOO_MANY_SUBPATTERNS = 149,
+ G_REGEX_ERROR_INVALID_OCTAL_VALUE = 151,
+ G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE = 154,
+ G_REGEX_ERROR_DEFINE_REPETION = 155,
+ G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS = 156,
+ G_REGEX_ERROR_MISSING_BACK_REFERENCE = 157,
+ G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE = 158,
+ G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN = 159,
+ G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB = 160,
+ G_REGEX_ERROR_NUMBER_TOO_BIG = 161,
+ G_REGEX_ERROR_MISSING_SUBPATTERN_NAME = 162,
+ G_REGEX_ERROR_MISSING_DIGIT = 163,
+ G_REGEX_ERROR_INVALID_DATA_CHARACTER = 164,
+ G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME = 165,
+ G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED = 166,
+ G_REGEX_ERROR_INVALID_CONTROL_CHAR = 168,
+ G_REGEX_ERROR_MISSING_NAME = 169,
+ G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171,
+ G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172,
+ G_REGEX_ERROR_NAME_TOO_LONG = 175,
+ G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176
+} GRegexError;
+
+/**
+ * G_REGEX_ERROR:
+ *
+ * Error domain for regular expressions. Errors in this domain will be
+ * from the #GRegexError enumeration. See #GError for information on
+ * error domains.
+ *
+ * Since: 2.14
+ */
+#define G_REGEX_ERROR g_regex_error_quark ()
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_regex_error_quark (void);
+
+/**
+ * GRegexCompileFlags:
+ * @G_REGEX_CASELESS: Letters in the pattern match both upper- and
+ * lowercase letters. This option can be changed within a pattern
+ * by a "(?i)" option setting.
+ * @G_REGEX_MULTILINE: By default, GRegex treats the strings as consisting
+ * of a single line of characters (even if it actually contains
+ * newlines). The "start of line" metacharacter ("^") matches only
+ * at the start of the string, while the "end of line" metacharacter
+ * ("$") matches only at the end of the string, or before a terminating
+ * newline (unless #G_REGEX_DOLLAR_ENDONLY is set). When
+ * #G_REGEX_MULTILINE is set, the "start of line" and "end of line"
+ * constructs match immediately following or immediately before any
+ * newline in the string, respectively, as well as at the very start
+ * and end. This can be changed within a pattern by a "(?m)" option
+ * setting.
+ * @G_REGEX_DOTALL: A dot metacharacter (".") in the pattern matches all
+ * characters, including newlines. Without it, newlines are excluded.
+ * This option can be changed within a pattern by a ("?s") option setting.
+ * @G_REGEX_EXTENDED: Whitespace data characters in the pattern are
+ * totally ignored except when escaped or inside a character class.
+ * Whitespace does not include the VT character (code 11). In addition,
+ * characters between an unescaped "#" outside a character class and
+ * the next newline character, inclusive, are also ignored. This can
+ * be changed within a pattern by a "(?x)" option setting.
+ * @G_REGEX_ANCHORED: The pattern is forced to be "anchored", that is,
+ * it is constrained to match only at the first matching point in the
+ * string that is being searched. This effect can also be achieved by
+ * appropriate constructs in the pattern itself such as the "^"
+ * metacharacter.
+ * @G_REGEX_DOLLAR_ENDONLY: A dollar metacharacter ("$") in the pattern
+ * matches only at the end of the string. Without this option, a
+ * dollar also matches immediately before the final character if
+ * it is a newline (but not before any other newlines). This option
+ * is ignored if #G_REGEX_MULTILINE is set.
+ * @G_REGEX_UNGREEDY: Inverts the "greediness" of the quantifiers so that
+ * they are not greedy by default, but become greedy if followed by "?".
+ * It can also be set by a "(?U)" option setting within the pattern.
+ * @G_REGEX_RAW: Usually strings must be valid UTF-8 strings, using this
+ * flag they are considered as a raw sequence of bytes.
+ * @G_REGEX_NO_AUTO_CAPTURE: Disables the use of numbered capturing
+ * parentheses in the pattern. Any opening parenthesis that is not
+ * followed by "?" behaves as if it were followed by "?:" but named
+ * parentheses can still be used for capturing (and they acquire numbers
+ * in the usual way).
+ * @G_REGEX_OPTIMIZE: Optimize the regular expression. If the pattern will
+ * be used many times, then it may be worth the effort to optimize it
+ * to improve the speed of matches.
+ * @G_REGEX_FIRSTLINE: Limits an unanchored pattern to match before (or at) the
+ * first newline. Since: 2.34
+ * @G_REGEX_DUPNAMES: Names used to identify capturing subpatterns need not
+ * be unique. This can be helpful for certain types of pattern when it
+ * is known that only one instance of the named subpattern can ever be
+ * matched.
+ * @G_REGEX_NEWLINE_CR: Usually any newline character or character sequence is
+ * recognized. If this option is set, the only recognized newline character
+ * is '\r'.
+ * @G_REGEX_NEWLINE_LF: Usually any newline character or character sequence is
+ * recognized. If this option is set, the only recognized newline character
+ * is '\n'.
+ * @G_REGEX_NEWLINE_CRLF: Usually any newline character or character sequence is
+ * recognized. If this option is set, the only recognized newline character
+ * sequence is '\r\n'.
+ * @G_REGEX_NEWLINE_ANYCRLF: Usually any newline character or character sequence
+ * is recognized. If this option is set, the only recognized newline character
+ * sequences are '\r', '\n', and '\r\n'. Since: 2.34
+ * @G_REGEX_BSR_ANYCRLF: Usually any newline character or character sequence
+ * is recognised. If this option is set, then "\R" only recognizes the newline
+ * characters '\r', '\n' and '\r\n'. Since: 2.34
+ * @G_REGEX_JAVASCRIPT_COMPAT: Changes behaviour so that it is compatible with
+ * JavaScript rather than PCRE. Since: 2.34
+ *
+ * Flags specifying compile-time options.
+ *
+ * Since: 2.14
+ */
+/* Remember to update G_REGEX_COMPILE_MASK in gregex.c after
+ * adding a new flag.
+ */
+typedef enum
+{
+ G_REGEX_CASELESS = 1 << 0,
+ G_REGEX_MULTILINE = 1 << 1,
+ G_REGEX_DOTALL = 1 << 2,
+ G_REGEX_EXTENDED = 1 << 3,
+ G_REGEX_ANCHORED = 1 << 4,
+ G_REGEX_DOLLAR_ENDONLY = 1 << 5,
+ G_REGEX_UNGREEDY = 1 << 9,
+ G_REGEX_RAW = 1 << 11,
+ G_REGEX_NO_AUTO_CAPTURE = 1 << 12,
+ G_REGEX_OPTIMIZE = 1 << 13,
+ G_REGEX_FIRSTLINE = 1 << 18,
+ G_REGEX_DUPNAMES = 1 << 19,
+ G_REGEX_NEWLINE_CR = 1 << 20,
+ G_REGEX_NEWLINE_LF = 1 << 21,
+ G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF,
+ G_REGEX_NEWLINE_ANYCRLF = G_REGEX_NEWLINE_CR | 1 << 22,
+ G_REGEX_BSR_ANYCRLF = 1 << 23,
+ G_REGEX_JAVASCRIPT_COMPAT = 1 << 25
+} GRegexCompileFlags;
+
+/**
+ * GRegexMatchFlags:
+ * @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is,
+ * it is constrained to match only at the first matching point in the
+ * string that is being searched. This effect can also be achieved by
+ * appropriate constructs in the pattern itself such as the "^"
+ * metacharacter.
+ * @G_REGEX_MATCH_NOTBOL: Specifies that first character of the string is
+ * not the beginning of a line, so the circumflex metacharacter should
+ * not match before it. Setting this without #G_REGEX_MULTILINE (at
+ * compile time) causes circumflex never to match. This option affects
+ * only the behaviour of the circumflex metacharacter, it does not
+ * affect "\A".
+ * @G_REGEX_MATCH_NOTEOL: Specifies that the end of the subject string is
+ * not the end of a line, so the dollar metacharacter should not match
+ * it nor (except in multiline mode) a newline immediately before it.
+ * Setting this without #G_REGEX_MULTILINE (at compile time) causes
+ * dollar never to match. This option affects only the behaviour of
+ * the dollar metacharacter, it does not affect "\Z" or "\z".
+ * @G_REGEX_MATCH_NOTEMPTY: An empty string is not considered to be a valid
+ * match if this option is set. If there are alternatives in the pattern,
+ * they are tried. If all the alternatives match the empty string, the
+ * entire match fails. For example, if the pattern "a?b?" is applied to
+ * a string not beginning with "a" or "b", it matches the empty string
+ * at the start of the string. With this flag set, this match is not
+ * valid, so GRegex searches further into the string for occurrences
+ * of "a" or "b".
+ * @G_REGEX_MATCH_PARTIAL: Turns on the partial matching feature, for more
+ * documentation on partial matching see g_match_info_is_partial_match().
+ * @G_REGEX_MATCH_NEWLINE_CR: Overrides the newline definition set when
+ * creating a new #GRegex, setting the '\r' character as line terminator.
+ * @G_REGEX_MATCH_NEWLINE_LF: Overrides the newline definition set when
+ * creating a new #GRegex, setting the '\n' character as line terminator.
+ * @G_REGEX_MATCH_NEWLINE_CRLF: Overrides the newline definition set when
+ * creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
+ * @G_REGEX_MATCH_NEWLINE_ANY: Overrides the newline definition set when
+ * creating a new #GRegex, any Unicode newline sequence
+ * is recognised as a newline. These are '\r', '\n' and '\rn', and the
+ * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
+ * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
+ * U+2029 PARAGRAPH SEPARATOR.
+ * @G_REGEX_MATCH_NEWLINE_ANYCRLF: Overrides the newline definition set when
+ * creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence
+ * is recognized as a newline. Since: 2.34
+ * @G_REGEX_MATCH_BSR_ANYCRLF: Overrides the newline definition for "\R" set when
+ * creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences
+ * are recognized as a newline by "\R". Since: 2.34
+ * @G_REGEX_MATCH_BSR_ANY: Overrides the newline definition for "\R" set when
+ * creating a new #GRegex; any Unicode newline character or character sequence
+ * are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the
+ * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
+ * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
+ * U+2029 PARAGRAPH SEPARATOR. Since: 2.34
+ * @G_REGEX_MATCH_PARTIAL_SOFT: An alias for #G_REGEX_MATCH_PARTIAL. Since: 2.34
+ * @G_REGEX_MATCH_PARTIAL_HARD: Turns on the partial matching feature. In contrast to
+ * to #G_REGEX_MATCH_PARTIAL_SOFT, this stops matching as soon as a partial match
+ * is found, without continuing to search for a possible complete match. See
+ * g_match_info_is_partial_match() for more information. Since: 2.34
+ * @G_REGEX_MATCH_NOTEMPTY_ATSTART: Like #G_REGEX_MATCH_NOTEMPTY, but only applied to
+ * the start of the matched string. For anchored
+ * patterns this can only happen for pattern containing "\K". Since: 2.34
+ *
+ * Flags specifying match-time options.
+ *
+ * Since: 2.14
+ */
+/* Remember to update G_REGEX_MATCH_MASK in gregex.c after
+ * adding a new flag. */
+typedef enum
+{
+ G_REGEX_MATCH_ANCHORED = 1 << 4,
+ G_REGEX_MATCH_NOTBOL = 1 << 7,
+ G_REGEX_MATCH_NOTEOL = 1 << 8,
+ G_REGEX_MATCH_NOTEMPTY = 1 << 10,
+ G_REGEX_MATCH_PARTIAL = 1 << 15,
+ G_REGEX_MATCH_NEWLINE_CR = 1 << 20,
+ G_REGEX_MATCH_NEWLINE_LF = 1 << 21,
+ G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF,
+ G_REGEX_MATCH_NEWLINE_ANY = 1 << 22,
+ G_REGEX_MATCH_NEWLINE_ANYCRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_ANY,
+ G_REGEX_MATCH_BSR_ANYCRLF = 1 << 23,
+ G_REGEX_MATCH_BSR_ANY = 1 << 24,
+ G_REGEX_MATCH_PARTIAL_SOFT = G_REGEX_MATCH_PARTIAL,
+ G_REGEX_MATCH_PARTIAL_HARD = 1 << 27,
+ G_REGEX_MATCH_NOTEMPTY_ATSTART = 1 << 28
+} GRegexMatchFlags;
+
+/**
+ * GRegex:
+ *
+ * A GRegex is the "compiled" form of a regular expression pattern.
+ * This structure is opaque and its fields cannot be accessed directly.
+ *
+ * Since: 2.14
+ */
+typedef struct _GRegex GRegex;
+
+
+/**
+ * GMatchInfo:
+ *
+ * A GMatchInfo is an opaque struct used to return information about
+ * matches.
+ */
+typedef struct _GMatchInfo GMatchInfo;
+
+/**
+ * GRegexEvalCallback:
+ * @match_info: the #GMatchInfo generated by the match.
+ * Use g_match_info_get_regex() and g_match_info_get_string() if you
+ * need the #GRegex or the matched string.
+ * @result: a #GString containing the new string
+ * @user_data: user data passed to g_regex_replace_eval()
+ *
+ * Specifies the type of the function passed to g_regex_replace_eval().
+ * It is called for each occurrence of the pattern in the string passed
+ * to g_regex_replace_eval(), and it should append the replacement to
+ * @result.
+ *
+ * Returns: %FALSE to continue the replacement process, %TRUE to stop it
+ *
+ * Since: 2.14
+ */
+typedef gboolean (*GRegexEvalCallback) (const GMatchInfo *match_info,
+ GString *result,
+ gpointer user_data);
+
+
+GLIB_AVAILABLE_IN_ALL
+GRegex *g_regex_new (const gchar *pattern,
+ GRegexCompileFlags compile_options,
+ GRegexMatchFlags match_options,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GRegex *g_regex_ref (GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+void g_regex_unref (GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_regex_get_pattern (const GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+gint g_regex_get_max_backref (const GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+gint g_regex_get_capture_count (const GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_get_has_cr_or_lf (const GRegex *regex);
+GLIB_AVAILABLE_IN_2_38
+gint g_regex_get_max_lookbehind (const GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+gint g_regex_get_string_number (const GRegex *regex,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_regex_escape_string (const gchar *string,
+ gint length);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_regex_escape_nul (const gchar *string,
+ gint length);
+
+GLIB_AVAILABLE_IN_ALL
+GRegexCompileFlags g_regex_get_compile_flags (const GRegex *regex);
+GLIB_AVAILABLE_IN_ALL
+GRegexMatchFlags g_regex_get_match_flags (const GRegex *regex);
+
+/* Matching. */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_match_simple (const gchar *pattern,
+ const gchar *string,
+ GRegexCompileFlags compile_options,
+ GRegexMatchFlags match_options);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_match (const GRegex *regex,
+ const gchar *string,
+ GRegexMatchFlags match_options,
+ GMatchInfo **match_info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_match_full (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ GRegexMatchFlags match_options,
+ GMatchInfo **match_info,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_match_all (const GRegex *regex,
+ const gchar *string,
+ GRegexMatchFlags match_options,
+ GMatchInfo **match_info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_match_all_full (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ GRegexMatchFlags match_options,
+ GMatchInfo **match_info,
+ GError **error);
+
+/* String splitting. */
+GLIB_AVAILABLE_IN_ALL
+gchar **g_regex_split_simple (const gchar *pattern,
+ const gchar *string,
+ GRegexCompileFlags compile_options,
+ GRegexMatchFlags match_options);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_regex_split (const GRegex *regex,
+ const gchar *string,
+ GRegexMatchFlags match_options);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_regex_split_full (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ GRegexMatchFlags match_options,
+ gint max_tokens,
+ GError **error);
+
+/* String replacement. */
+GLIB_AVAILABLE_IN_ALL
+gchar *g_regex_replace (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ const gchar *replacement,
+ GRegexMatchFlags match_options,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_regex_replace_literal (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ const gchar *replacement,
+ GRegexMatchFlags match_options,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_regex_replace_eval (const GRegex *regex,
+ const gchar *string,
+ gssize string_len,
+ gint start_position,
+ GRegexMatchFlags match_options,
+ GRegexEvalCallback eval,
+ gpointer user_data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_regex_check_replacement (const gchar *replacement,
+ gboolean *has_references,
+ GError **error);
+
+/* Match info */
+GLIB_AVAILABLE_IN_ALL
+GRegex *g_match_info_get_regex (const GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+const gchar *g_match_info_get_string (const GMatchInfo *match_info);
+
+GLIB_AVAILABLE_IN_ALL
+GMatchInfo *g_match_info_ref (GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+void g_match_info_unref (GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+void g_match_info_free (GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_match_info_next (GMatchInfo *match_info,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_match_info_matches (const GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+gint g_match_info_get_match_count (const GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_match_info_is_partial_match (const GMatchInfo *match_info);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_match_info_expand_references(const GMatchInfo *match_info,
+ const gchar *string_to_expand,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_match_info_fetch (const GMatchInfo *match_info,
+ gint match_num);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_match_info_fetch_pos (const GMatchInfo *match_info,
+ gint match_num,
+ gint *start_pos,
+ gint *end_pos);
+GLIB_AVAILABLE_IN_ALL
+gchar *g_match_info_fetch_named (const GMatchInfo *match_info,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_match_info_fetch_named_pos (const GMatchInfo *match_info,
+ const gchar *name,
+ gint *start_pos,
+ gint *end_pos);
+GLIB_AVAILABLE_IN_ALL
+gchar **g_match_info_fetch_all (const GMatchInfo *match_info);
+
+G_END_DECLS
+
+#endif /* __G_REGEX_H__ */
diff --git a/include/glib/glib/gscanner.h b/include/glib/glib/gscanner.h
new file mode 100644
index 0000000000..d87b4533ec
--- /dev/null
+++ b/include/glib/glib/gscanner.h
@@ -0,0 +1,299 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_SCANNER_H__
+#define __G_SCANNER_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gdataset.h>
+#include <glib/ghash.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GScanner GScanner;
+typedef struct _GScannerConfig GScannerConfig;
+typedef union _GTokenValue GTokenValue;
+
+typedef void (*GScannerMsgFunc) (GScanner *scanner,
+ gchar *message,
+ gboolean error);
+
+/* GScanner: Flexible lexical scanner for general purpose.
+ */
+
+/* Character sets */
+#define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz"
+#define G_CSET_DIGITS "0123456789"
+#define G_CSET_LATINC "\300\301\302\303\304\305\306"\
+ "\307\310\311\312\313\314\315\316\317\320"\
+ "\321\322\323\324\325\326"\
+ "\330\331\332\333\334\335\336"
+#define G_CSET_LATINS "\337\340\341\342\343\344\345\346"\
+ "\347\350\351\352\353\354\355\356\357\360"\
+ "\361\362\363\364\365\366"\
+ "\370\371\372\373\374\375\376\377"
+
+/* Error types */
+typedef enum
+{
+ G_ERR_UNKNOWN,
+ G_ERR_UNEXP_EOF,
+ G_ERR_UNEXP_EOF_IN_STRING,
+ G_ERR_UNEXP_EOF_IN_COMMENT,
+ G_ERR_NON_DIGIT_IN_CONST,
+ G_ERR_DIGIT_RADIX,
+ G_ERR_FLOAT_RADIX,
+ G_ERR_FLOAT_MALFORMED
+} GErrorType;
+
+/* Token types */
+typedef enum
+{
+ G_TOKEN_EOF = 0,
+
+ G_TOKEN_LEFT_PAREN = '(',
+ G_TOKEN_RIGHT_PAREN = ')',
+ G_TOKEN_LEFT_CURLY = '{',
+ G_TOKEN_RIGHT_CURLY = '}',
+ G_TOKEN_LEFT_BRACE = '[',
+ G_TOKEN_RIGHT_BRACE = ']',
+ G_TOKEN_EQUAL_SIGN = '=',
+ G_TOKEN_COMMA = ',',
+
+ G_TOKEN_NONE = 256,
+
+ G_TOKEN_ERROR,
+
+ G_TOKEN_CHAR,
+ G_TOKEN_BINARY,
+ G_TOKEN_OCTAL,
+ G_TOKEN_INT,
+ G_TOKEN_HEX,
+ G_TOKEN_FLOAT,
+ G_TOKEN_STRING,
+
+ G_TOKEN_SYMBOL,
+ G_TOKEN_IDENTIFIER,
+ G_TOKEN_IDENTIFIER_NULL,
+
+ G_TOKEN_COMMENT_SINGLE,
+ G_TOKEN_COMMENT_MULTI,
+
+ /*< private >*/
+ G_TOKEN_LAST
+} GTokenType;
+
+union _GTokenValue
+{
+ gpointer v_symbol;
+ gchar *v_identifier;
+ gulong v_binary;
+ gulong v_octal;
+ gulong v_int;
+ guint64 v_int64;
+ gdouble v_float;
+ gulong v_hex;
+ gchar *v_string;
+ gchar *v_comment;
+ guchar v_char;
+ guint v_error;
+};
+
+struct _GScannerConfig
+{
+ /* Character sets
+ */
+ gchar *cset_skip_characters; /* default: " \t\n" */
+ gchar *cset_identifier_first;
+ gchar *cset_identifier_nth;
+ gchar *cpair_comment_single; /* default: "#\n" */
+
+ /* Should symbol lookup work case sensitive?
+ */
+ guint case_sensitive : 1;
+
+ /* Boolean values to be adjusted "on the fly"
+ * to configure scanning behaviour.
+ */
+ guint skip_comment_multi : 1; /* C like comment */
+ guint skip_comment_single : 1; /* single line comment */
+ guint scan_comment_multi : 1; /* scan multi line comments? */
+ guint scan_identifier : 1;
+ guint scan_identifier_1char : 1;
+ guint scan_identifier_NULL : 1;
+ guint scan_symbols : 1;
+ guint scan_binary : 1;
+ guint scan_octal : 1;
+ guint scan_float : 1;
+ guint scan_hex : 1; /* '0x0ff0' */
+ guint scan_hex_dollar : 1; /* '$0ff0' */
+ guint scan_string_sq : 1; /* string: 'anything' */
+ guint scan_string_dq : 1; /* string: "\\-escapes!\n" */
+ guint numbers_2_int : 1; /* bin, octal, hex => int */
+ guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */
+ guint identifier_2_string : 1;
+ guint char_2_token : 1; /* return G_TOKEN_CHAR? */
+ guint symbol_2_token : 1;
+ guint scope_0_fallback : 1; /* try scope 0 on lookups? */
+ guint store_int64 : 1; /* use value.v_int64 rather than v_int */
+
+ /*< private >*/
+ guint padding_dummy;
+};
+
+struct _GScanner
+{
+ /* unused fields */
+ gpointer user_data;
+ guint max_parse_errors;
+
+ /* g_scanner_error() increments this field */
+ guint parse_errors;
+
+ /* name of input stream, featured by the default message handler */
+ const gchar *input_name;
+
+ /* quarked data */
+ GData *qdata;
+
+ /* link into the scanner configuration */
+ GScannerConfig *config;
+
+ /* fields filled in after g_scanner_get_next_token() */
+ GTokenType token;
+ GTokenValue value;
+ guint line;
+ guint position;
+
+ /* fields filled in after g_scanner_peek_next_token() */
+ GTokenType next_token;
+ GTokenValue next_value;
+ guint next_line;
+ guint next_position;
+
+ /*< private >*/
+ /* to be considered private */
+ GHashTable *symbol_table;
+ gint input_fd;
+ const gchar *text;
+ const gchar *text_end;
+ gchar *buffer;
+ guint scope_id;
+
+ /*< public >*/
+ /* handler function for _warn and _error */
+ GScannerMsgFunc msg_handler;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GScanner* g_scanner_new (const GScannerConfig *config_templ);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_destroy (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_input_file (GScanner *scanner,
+ gint input_fd);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_sync_file_offset (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_input_text (GScanner *scanner,
+ const gchar *text,
+ guint text_len);
+GLIB_AVAILABLE_IN_ALL
+GTokenType g_scanner_get_next_token (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+GTokenType g_scanner_peek_next_token (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+GTokenType g_scanner_cur_token (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+GTokenValue g_scanner_cur_value (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+guint g_scanner_cur_line (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+guint g_scanner_cur_position (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_scanner_eof (GScanner *scanner);
+GLIB_AVAILABLE_IN_ALL
+guint g_scanner_set_scope (GScanner *scanner,
+ guint scope_id);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_scope_add_symbol (GScanner *scanner,
+ guint scope_id,
+ const gchar *symbol,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_scope_remove_symbol (GScanner *scanner,
+ guint scope_id,
+ const gchar *symbol);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_scanner_scope_lookup_symbol (GScanner *scanner,
+ guint scope_id,
+ const gchar *symbol);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_scope_foreach_symbol (GScanner *scanner,
+ guint scope_id,
+ GHFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_scanner_lookup_symbol (GScanner *scanner,
+ const gchar *symbol);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_unexp_token (GScanner *scanner,
+ GTokenType expected_token,
+ const gchar *identifier_spec,
+ const gchar *symbol_spec,
+ const gchar *symbol_name,
+ const gchar *message,
+ gint is_error);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_error (GScanner *scanner,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2,3);
+GLIB_AVAILABLE_IN_ALL
+void g_scanner_warn (GScanner *scanner,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2,3);
+
+/* keep downward source compatibility */
+#define g_scanner_add_symbol( scanner, symbol, value ) G_STMT_START { \
+ g_scanner_scope_add_symbol ((scanner), 0, (symbol), (value)); \
+} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_add_symbol)
+#define g_scanner_remove_symbol( scanner, symbol ) G_STMT_START { \
+ g_scanner_scope_remove_symbol ((scanner), 0, (symbol)); \
+} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_remove_symbol)
+#define g_scanner_foreach_symbol( scanner, func, data ) G_STMT_START { \
+ g_scanner_scope_foreach_symbol ((scanner), 0, (func), (data)); \
+} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_foreach_symbol)
+
+/* The following two functions are deprecated and will be removed in
+ * the next major release. They do no good. */
+#define g_scanner_freeze_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26
+#define g_scanner_thaw_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26
+
+G_END_DECLS
+
+#endif /* __G_SCANNER_H__ */
diff --git a/include/glib/glib/gsequence.h b/include/glib/glib/gsequence.h
new file mode 100644
index 0000000000..6dce2f4fba
--- /dev/null
+++ b/include/glib/glib/gsequence.h
@@ -0,0 +1,173 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ * Soeren Sandmann (sandmann@daimi.au.dk)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SEQUENCE_H__
+#define __G_SEQUENCE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GSequence GSequence;
+typedef struct _GSequenceNode GSequenceIter;
+
+typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a,
+ GSequenceIter *b,
+ gpointer data);
+
+
+/* GSequence */
+GLIB_AVAILABLE_IN_ALL
+GSequence * g_sequence_new (GDestroyNotify data_destroy);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_free (GSequence *seq);
+GLIB_AVAILABLE_IN_ALL
+gint g_sequence_get_length (GSequence *seq);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_foreach (GSequence *seq,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_foreach_range (GSequenceIter *begin,
+ GSequenceIter *end,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_sort (GSequence *seq,
+ GCompareDataFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_sort_iter (GSequence *seq,
+ GSequenceIterCompareFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_2_48
+gboolean g_sequence_is_empty (GSequence *seq);
+
+
+/* Getting iters */
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_get_begin_iter (GSequence *seq);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_get_end_iter (GSequence *seq);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq,
+ gint pos);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_append (GSequence *seq,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_prepend (GSequence *seq,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_insert_before (GSequenceIter *iter,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_move (GSequenceIter *src,
+ GSequenceIter *dest);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_swap (GSequenceIter *a,
+ GSequenceIter *b);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_insert_sorted (GSequence *seq,
+ gpointer data,
+ GCompareDataFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq,
+ gpointer data,
+ GSequenceIterCompareFunc iter_cmp,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_sort_changed (GSequenceIter *iter,
+ GCompareDataFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_sort_changed_iter (GSequenceIter *iter,
+ GSequenceIterCompareFunc iter_cmp,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_remove (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_remove_range (GSequenceIter *begin,
+ GSequenceIter *end);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_move_range (GSequenceIter *dest,
+ GSequenceIter *begin,
+ GSequenceIter *end);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_search (GSequence *seq,
+ gpointer data,
+ GCompareDataFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_search_iter (GSequence *seq,
+ gpointer data,
+ GSequenceIterCompareFunc iter_cmp,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_lookup (GSequence *seq,
+ gpointer data,
+ GCompareDataFunc cmp_func,
+ gpointer cmp_data);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_lookup_iter (GSequence *seq,
+ gpointer data,
+ GSequenceIterCompareFunc iter_cmp,
+ gpointer cmp_data);
+
+
+/* Dereferencing */
+GLIB_AVAILABLE_IN_ALL
+gpointer g_sequence_get (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+void g_sequence_set (GSequenceIter *iter,
+ gpointer data);
+
+/* Operations on GSequenceIter * */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_sequence_iter_is_begin (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_sequence_iter_is_end (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_iter_next (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_iter_prev (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+gint g_sequence_iter_get_position (GSequenceIter *iter);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_iter_move (GSequenceIter *iter,
+ gint delta);
+GLIB_AVAILABLE_IN_ALL
+GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter);
+
+
+/* Search */
+GLIB_AVAILABLE_IN_ALL
+gint g_sequence_iter_compare (GSequenceIter *a,
+ GSequenceIter *b);
+GLIB_AVAILABLE_IN_ALL
+GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin,
+ GSequenceIter *end);
+
+G_END_DECLS
+
+#endif /* __G_SEQUENCE_H__ */
diff --git a/include/glib/glib/gshell.h b/include/glib/glib/gshell.h
new file mode 100644
index 0000000000..798dd78084
--- /dev/null
+++ b/include/glib/glib/gshell.h
@@ -0,0 +1,57 @@
+/* gshell.h - Shell-related utilities
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SHELL_H__
+#define __G_SHELL_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+#define G_SHELL_ERROR g_shell_error_quark ()
+
+typedef enum
+{
+ /* mismatched or otherwise mangled quoting */
+ G_SHELL_ERROR_BAD_QUOTING,
+ /* string to be parsed was empty */
+ G_SHELL_ERROR_EMPTY_STRING,
+ G_SHELL_ERROR_FAILED
+} GShellError;
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_shell_error_quark (void);
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_shell_quote (const gchar *unquoted_string);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_shell_unquote (const gchar *quoted_string,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_shell_parse_argv (const gchar *command_line,
+ gint *argcp,
+ gchar ***argvp,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_SHELL_H__ */
diff --git a/include/glib/glib/gslice.h b/include/glib/glib/gslice.h
new file mode 100644
index 0000000000..ff8b02a65d
--- /dev/null
+++ b/include/glib/glib/gslice.h
@@ -0,0 +1,99 @@
+/* GLIB sliced memory - fast threaded memory chunk allocator
+ * Copyright (C) 2005 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SLICE_H__
+#define __G_SLICE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* slices - fast allocation/release of small memory blocks
+ */
+GLIB_AVAILABLE_IN_ALL
+gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_slice_copy (gsize block_size,
+ gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1);
+GLIB_AVAILABLE_IN_ALL
+void g_slice_free1 (gsize block_size,
+ gpointer mem_block);
+GLIB_AVAILABLE_IN_ALL
+void g_slice_free_chain_with_offset (gsize block_size,
+ gpointer mem_chain,
+ gsize next_offset);
+#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
+#define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type)))
+/* MemoryBlockType *
+ * g_slice_dup (MemoryBlockType,
+ * MemoryBlockType *mem_block);
+ * g_slice_free (MemoryBlockType,
+ * MemoryBlockType *mem_block);
+ * g_slice_free_chain (MemoryBlockType,
+ * MemoryBlockType *first_chain_block,
+ * memory_block_next_field);
+ * pseudo prototypes for the macro
+ * definitions following below.
+ */
+
+/* we go through extra hoops to ensure type safety */
+#define g_slice_dup(type, mem) \
+ (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \
+ : ((void) ((type*) 0 == (mem)), (type*) 0))
+#define g_slice_free(type, mem) \
+G_STMT_START { \
+ if (1) g_slice_free1 (sizeof (type), (mem)); \
+ else (void) ((type*) 0 == (mem)); \
+} G_STMT_END
+#define g_slice_free_chain(type, mem_chain, next) \
+G_STMT_START { \
+ if (1) g_slice_free_chain_with_offset (sizeof (type), \
+ (mem_chain), G_STRUCT_OFFSET (type, next)); \
+ else (void) ((type*) 0 == (mem_chain)); \
+} G_STMT_END
+
+/* --- internal debugging API --- */
+typedef enum {
+ G_SLICE_CONFIG_ALWAYS_MALLOC = 1,
+ G_SLICE_CONFIG_BYPASS_MAGAZINES,
+ G_SLICE_CONFIG_WORKING_SET_MSECS,
+ G_SLICE_CONFIG_COLOR_INCREMENT,
+ G_SLICE_CONFIG_CHUNK_SIZES,
+ G_SLICE_CONFIG_CONTENTION_COUNTER
+} GSliceConfig;
+
+GLIB_DEPRECATED_IN_2_34
+void g_slice_set_config (GSliceConfig ckey, gint64 value);
+GLIB_DEPRECATED_IN_2_34
+gint64 g_slice_get_config (GSliceConfig ckey);
+GLIB_DEPRECATED_IN_2_34
+gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values);
+
+#ifdef G_ENABLE_DEBUG
+GLIB_AVAILABLE_IN_ALL
+void g_slice_debug_tree_statistics (void);
+#endif
+
+G_END_DECLS
+
+#endif /* __G_SLICE_H__ */
diff --git a/include/glib/glib/gslist.h b/include/glib/glib/gslist.h
new file mode 100644
index 0000000000..2704ef7d35
--- /dev/null
+++ b/include/glib/glib/gslist.h
@@ -0,0 +1,143 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_SLIST_H__
+#define __G_SLIST_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmem.h>
+#include <glib/gnode.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GSList GSList;
+
+struct _GSList
+{
+ gpointer data;
+ GSList *next;
+};
+
+/* Singly linked lists
+ */
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+void g_slist_free (GSList *list);
+GLIB_AVAILABLE_IN_ALL
+void g_slist_free_1 (GSList *list);
+#define g_slist_free1 g_slist_free_1
+GLIB_AVAILABLE_IN_ALL
+void g_slist_free_full (GSList *list,
+ GDestroyNotify free_func);
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_append (GSList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_prepend (GSList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_insert (GSList *list,
+ gpointer data,
+ gint position) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_insert_sorted (GSList *list,
+ gpointer data,
+ GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_insert_sorted_with_data (GSList *list,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_insert_before (GSList *slist,
+ GSList *sibling,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_concat (GSList *list1,
+ GSList *list2) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_remove (GSList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_remove_all (GSList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_remove_link (GSList *list,
+ GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_delete_link (GSList *list,
+ GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
+
+GLIB_AVAILABLE_IN_2_34
+GSList* g_slist_copy_deep (GSList *list,
+ GCopyFunc func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_nth (GSList *list,
+ guint n);
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_find (GSList *list,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_find_custom (GSList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GLIB_AVAILABLE_IN_ALL
+gint g_slist_position (GSList *list,
+ GSList *llink);
+GLIB_AVAILABLE_IN_ALL
+gint g_slist_index (GSList *list,
+ gconstpointer data);
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_last (GSList *list);
+GLIB_AVAILABLE_IN_ALL
+guint g_slist_length (GSList *list);
+GLIB_AVAILABLE_IN_ALL
+void g_slist_foreach (GSList *list,
+ GFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_sort (GSList *list,
+ GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+GSList* g_slist_sort_with_data (GSList *list,
+ GCompareDataFunc compare_func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_slist_nth_data (GSList *list,
+ guint n);
+
+#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)
+
+G_END_DECLS
+
+#endif /* __G_SLIST_H__ */
diff --git a/include/glib/glib/gspawn.h b/include/glib/glib/gspawn.h
new file mode 100644
index 0000000000..240aae768e
--- /dev/null
+++ b/include/glib/glib/gspawn.h
@@ -0,0 +1,265 @@
+/* gspawn.h - Process launching
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_SPAWN_H__
+#define __G_SPAWN_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+
+/* I'm not sure I remember our proposed naming convention here. */
+/**
+ * G_SPAWN_ERROR:
+ *
+ * Error domain for spawning processes. Errors in this domain will
+ * be from the #GSpawnError enumeration. See #GError for information on
+ * error domains.
+ */
+#define G_SPAWN_ERROR g_spawn_error_quark ()
+
+/**
+ * GSpawnError:
+ * @G_SPAWN_ERROR_FORK: Fork failed due to lack of memory.
+ * @G_SPAWN_ERROR_READ: Read or select on pipes failed.
+ * @G_SPAWN_ERROR_CHDIR: Changing to working directory failed.
+ * @G_SPAWN_ERROR_ACCES: execv() returned `EACCES`
+ * @G_SPAWN_ERROR_PERM: execv() returned `EPERM`
+ * @G_SPAWN_ERROR_TOO_BIG: execv() returned `E2BIG`
+ * @G_SPAWN_ERROR_2BIG: deprecated alias for %G_SPAWN_ERROR_TOO_BIG (deprecated since GLib 2.32)
+ * @G_SPAWN_ERROR_NOEXEC: execv() returned `ENOEXEC`
+ * @G_SPAWN_ERROR_NAMETOOLONG: execv() returned `ENAMETOOLONG`
+ * @G_SPAWN_ERROR_NOENT: execv() returned `ENOENT`
+ * @G_SPAWN_ERROR_NOMEM: execv() returned `ENOMEM`
+ * @G_SPAWN_ERROR_NOTDIR: execv() returned `ENOTDIR`
+ * @G_SPAWN_ERROR_LOOP: execv() returned `ELOOP`
+ * @G_SPAWN_ERROR_TXTBUSY: execv() returned `ETXTBUSY`
+ * @G_SPAWN_ERROR_IO: execv() returned `EIO`
+ * @G_SPAWN_ERROR_NFILE: execv() returned `ENFILE`
+ * @G_SPAWN_ERROR_MFILE: execv() returned `EMFILE`
+ * @G_SPAWN_ERROR_INVAL: execv() returned `EINVAL`
+ * @G_SPAWN_ERROR_ISDIR: execv() returned `EISDIR`
+ * @G_SPAWN_ERROR_LIBBAD: execv() returned `ELIBBAD`
+ * @G_SPAWN_ERROR_FAILED: Some other fatal failure,
+ * `error->message` should explain.
+ *
+ * Error codes returned by spawning processes.
+ */
+typedef enum
+{
+ G_SPAWN_ERROR_FORK, /* fork failed due to lack of memory */
+ G_SPAWN_ERROR_READ, /* read or select on pipes failed */
+ G_SPAWN_ERROR_CHDIR, /* changing to working dir failed */
+ G_SPAWN_ERROR_ACCES, /* execv() returned EACCES */
+ G_SPAWN_ERROR_PERM, /* execv() returned EPERM */
+ G_SPAWN_ERROR_TOO_BIG,/* execv() returned E2BIG */
+ G_SPAWN_ERROR_2BIG GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(G_SPAWN_ERROR_TOO_BIG) = G_SPAWN_ERROR_TOO_BIG,
+ G_SPAWN_ERROR_NOEXEC, /* execv() returned ENOEXEC */
+ G_SPAWN_ERROR_NAMETOOLONG, /* "" "" ENAMETOOLONG */
+ G_SPAWN_ERROR_NOENT, /* "" "" ENOENT */
+ G_SPAWN_ERROR_NOMEM, /* "" "" ENOMEM */
+ G_SPAWN_ERROR_NOTDIR, /* "" "" ENOTDIR */
+ G_SPAWN_ERROR_LOOP, /* "" "" ELOOP */
+ G_SPAWN_ERROR_TXTBUSY, /* "" "" ETXTBUSY */
+ G_SPAWN_ERROR_IO, /* "" "" EIO */
+ G_SPAWN_ERROR_NFILE, /* "" "" ENFILE */
+ G_SPAWN_ERROR_MFILE, /* "" "" EMFLE */
+ G_SPAWN_ERROR_INVAL, /* "" "" EINVAL */
+ G_SPAWN_ERROR_ISDIR, /* "" "" EISDIR */
+ G_SPAWN_ERROR_LIBBAD, /* "" "" ELIBBAD */
+ G_SPAWN_ERROR_FAILED /* other fatal failure, error->message
+ * should explain
+ */
+} GSpawnError;
+
+/**
+ * G_SPAWN_EXIT_ERROR:
+ *
+ * Error domain used by g_spawn_check_exit_status(). The code
+ * will be the program exit code.
+ */
+#define G_SPAWN_EXIT_ERROR g_spawn_exit_error_quark ()
+
+/**
+ * GSpawnChildSetupFunc:
+ * @user_data: (closure): user data to pass to the function.
+ *
+ * Specifies the type of the setup function passed to g_spawn_async(),
+ * g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very
+ * limited ways, be used to affect the child's execution.
+ *
+ * On POSIX platforms, the function is called in the child after GLib
+ * has performed all the setup it plans to perform, but before calling
+ * exec(). Actions taken in this function will only affect the child,
+ * not the parent.
+ *
+ * On Windows, the function is called in the parent. Its usefulness on
+ * Windows is thus questionable. In many cases executing the child setup
+ * function in the parent can have ill effects, and you should be very
+ * careful when porting software to Windows that uses child setup
+ * functions.
+ *
+ * However, even on POSIX, you are extremely limited in what you can
+ * safely do from a #GSpawnChildSetupFunc, because any mutexes that were
+ * held by other threads in the parent process at the time of the fork()
+ * will still be locked in the child process, and they will never be
+ * unlocked (since the threads that held them don't exist in the child).
+ * POSIX allows only async-signal-safe functions (see signal(7)) to be
+ * called in the child between fork() and exec(), which drastically limits
+ * the usefulness of child setup functions.
+ *
+ * In particular, it is not safe to call any function which may
+ * call malloc(), which includes POSIX functions such as setenv().
+ * If you need to set up the child environment differently from
+ * the parent, you should use g_get_environ(), g_environ_setenv(),
+ * and g_environ_unsetenv(), and then pass the complete environment
+ * list to the `g_spawn...` function.
+ */
+typedef void (* GSpawnChildSetupFunc) (gpointer user_data);
+
+/**
+ * GSpawnFlags:
+ * @G_SPAWN_DEFAULT: no flags, default behaviour
+ * @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will
+ * be inherited by the child; otherwise all descriptors except stdin,
+ * stdout and stderr will be closed before calling exec() in the child.
+ * @G_SPAWN_DO_NOT_REAP_CHILD: the child will not be automatically reaped;
+ * you must use g_child_watch_add() yourself (or call waitpid() or handle
+ * `SIGCHLD` yourself), or the child will become a zombie.
+ * @G_SPAWN_SEARCH_PATH: `argv[0]` need not be an absolute path, it will be
+ * looked for in the user's `PATH`.
+ * @G_SPAWN_STDOUT_TO_DEV_NULL: the child's standard output will be discarded,
+ * instead of going to the same location as the parent's standard output.
+ * @G_SPAWN_STDERR_TO_DEV_NULL: the child's standard error will be discarded.
+ * @G_SPAWN_CHILD_INHERITS_STDIN: the child will inherit the parent's standard
+ * input (by default, the child's standard input is attached to `/dev/null`).
+ * @G_SPAWN_FILE_AND_ARGV_ZERO: the first element of `argv` is the file to
+ * execute, while the remaining elements are the actual argument vector
+ * to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]`
+ * as the file to execute, and passes all of `argv` to the child.
+ * @G_SPAWN_SEARCH_PATH_FROM_ENVP: if `argv[0]` is not an abolute path,
+ * it will be looked for in the `PATH` from the passed child environment.
+ * Since: 2.34
+ * @G_SPAWN_CLOEXEC_PIPES: create all pipes with the `O_CLOEXEC` flag set.
+ * Since: 2.40
+ *
+ * Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
+ */
+typedef enum
+{
+ G_SPAWN_DEFAULT = 0,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0,
+ G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
+ /* look for argv[0] in the path i.e. use execvp() */
+ G_SPAWN_SEARCH_PATH = 1 << 2,
+ /* Dump output to /dev/null */
+ G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
+ G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
+ G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
+ G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6,
+ G_SPAWN_SEARCH_PATH_FROM_ENVP = 1 << 7,
+ G_SPAWN_CLOEXEC_PIPES = 1 << 8
+} GSpawnFlags;
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_spawn_error_quark (void);
+GLIB_AVAILABLE_IN_ALL
+GQuark g_spawn_exit_error_quark (void);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_spawn_async (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ GError **error);
+
+
+/* Opens pipes for non-NULL standard_output, standard_input, standard_error,
+ * and returns the parent's end of the pipes.
+ */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_spawn_async_with_pipes (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint *standard_input,
+ gint *standard_output,
+ gint *standard_error,
+ GError **error);
+
+/* Lets you provide fds for stdin/stdout/stderr */
+GLIB_AVAILABLE_IN_2_58
+gboolean g_spawn_async_with_fds (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint stdin_fd,
+ gint stdout_fd,
+ gint stderr_fd,
+ GError **error);
+
+/* If standard_output or standard_error are non-NULL, the full
+ * standard output or error of the command will be placed there.
+ */
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_spawn_sync (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ gchar **standard_output,
+ gchar **standard_error,
+ gint *exit_status,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_spawn_command_line_sync (const gchar *command_line,
+ gchar **standard_output,
+ gchar **standard_error,
+ gint *exit_status,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_spawn_command_line_async (const gchar *command_line,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34
+gboolean g_spawn_check_exit_status (gint exit_status,
+ GError **error);
+
+GLIB_AVAILABLE_IN_ALL
+void g_spawn_close_pid (GPid pid);
+
+G_END_DECLS
+
+#endif /* __G_SPAWN_H__ */
diff --git a/include/glib/glib/gstdio.h b/include/glib/glib/gstdio.h
new file mode 100644
index 0000000000..f1781f3e92
--- /dev/null
+++ b/include/glib/glib/gstdio.h
@@ -0,0 +1,177 @@
+/* gstdio.h - GFilename wrappers for C library functions
+ *
+ * Copyright 2004 Tor Lillqvist
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_STDIO_H__
+#define __G_STDIO_H__
+
+#include <glib/gprintf.h>
+
+#include <sys/stat.h>
+
+G_BEGIN_DECLS
+
+#if (defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)) && !defined(_WIN64)
+
+/* Make it clear that we mean the struct with 32-bit st_size and
+ * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally
+ * has been compiled. If you get a compiler warning when calling
+ * g_stat(), do take it seriously and make sure that the type of
+ * struct stat the code in GLib fills in matches the struct the type
+ * of struct stat you pass to g_stat(). To avoid hassle, to get file
+ * attributes just use the GIO API instead which doesn't use struct
+ * stat.
+ *
+ * Sure, it would be nicer to use a struct with 64-bit st_size and
+ * 64-bit st_*time fields, but changing that now would break ABI. And
+ * in MinGW, a plain "struct stat" is the one with 32-bit st_size and
+ * st_*time fields.
+ */
+
+typedef struct _stat32 GStatBuf;
+
+#elif defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
+
+typedef struct _stat64 GStatBuf;
+
+#else
+
+typedef struct stat GStatBuf;
+
+#endif
+
+#if defined(G_OS_UNIX) && !defined(G_STDIO_WRAP_ON_UNIX)
+
+/* Just pass on to the system functions, so there's no potential for data
+ * format mismatches, especially with large file interfaces.
+ * A few functions can't be handled in this way, since they are not defined
+ * in a portable system header that we could include here.
+ *
+ * #G_STDIO_WRAP_ON_UNIX is not public API and its behaviour is not guaranteed
+ * in future.
+ */
+
+#ifndef __GTK_DOC_IGNORE__
+#define g_chmod chmod
+#define g_open open
+#define g_creat creat
+#define g_rename rename
+#define g_mkdir mkdir
+#define g_stat stat
+#define g_lstat lstat
+#define g_remove remove
+#define g_fopen fopen
+#define g_freopen freopen
+#define g_utime utime
+#endif
+
+GLIB_AVAILABLE_IN_ALL
+int g_access (const gchar *filename,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_chdir (const gchar *path);
+
+GLIB_AVAILABLE_IN_ALL
+int g_unlink (const gchar *filename);
+
+GLIB_AVAILABLE_IN_ALL
+int g_rmdir (const gchar *filename);
+
+#else /* ! G_OS_UNIX */
+
+/* Wrappers for C library functions that take pathname arguments. On
+ * Unix, the pathname is a file name as it literally is in the file
+ * system. On well-maintained systems with consistent users who know
+ * what they are doing and no exchange of files with others this would
+ * be a well-defined encoding, preferably UTF-8. On Windows, the
+ * pathname is always in UTF-8, even if that is not the on-disk
+ * encoding, and not the encoding accepted by the C library or Win32
+ * API.
+ */
+
+GLIB_AVAILABLE_IN_ALL
+int g_access (const gchar *filename,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_chmod (const gchar *filename,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_open (const gchar *filename,
+ int flags,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_creat (const gchar *filename,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_rename (const gchar *oldfilename,
+ const gchar *newfilename);
+
+GLIB_AVAILABLE_IN_ALL
+int g_mkdir (const gchar *filename,
+ int mode);
+
+GLIB_AVAILABLE_IN_ALL
+int g_chdir (const gchar *path);
+
+GLIB_AVAILABLE_IN_ALL
+int g_stat (const gchar *filename,
+ GStatBuf *buf);
+
+GLIB_AVAILABLE_IN_ALL
+int g_lstat (const gchar *filename,
+ GStatBuf *buf);
+
+GLIB_AVAILABLE_IN_ALL
+int g_unlink (const gchar *filename);
+
+GLIB_AVAILABLE_IN_ALL
+int g_remove (const gchar *filename);
+
+GLIB_AVAILABLE_IN_ALL
+int g_rmdir (const gchar *filename);
+
+GLIB_AVAILABLE_IN_ALL
+FILE *g_fopen (const gchar *filename,
+ const gchar *mode);
+
+GLIB_AVAILABLE_IN_ALL
+FILE *g_freopen (const gchar *filename,
+ const gchar *mode,
+ FILE *stream);
+
+struct utimbuf; /* Don't need the real definition of struct utimbuf when just
+ * including this header.
+ */
+
+GLIB_AVAILABLE_IN_ALL
+int g_utime (const gchar *filename,
+ struct utimbuf *utb);
+
+#endif /* G_OS_UNIX */
+
+GLIB_AVAILABLE_IN_2_36
+gboolean g_close (gint fd,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_STDIO_H__ */
diff --git a/include/glib/glib/gstrfuncs.h b/include/glib/glib/gstrfuncs.h
new file mode 100644
index 0000000000..fc88cc1c52
--- /dev/null
+++ b/include/glib/glib/gstrfuncs.h
@@ -0,0 +1,362 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_STRFUNCS_H__
+#define __G_STRFUNCS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <stdarg.h>
+#include <glib/gmacros.h>
+#include <glib/gtypes.h>
+#include <glib/gerror.h>
+
+G_BEGIN_DECLS
+
+/* Functions like the ones in <ctype.h> that are not affected by locale. */
+typedef enum {
+ G_ASCII_ALNUM = 1 << 0,
+ G_ASCII_ALPHA = 1 << 1,
+ G_ASCII_CNTRL = 1 << 2,
+ G_ASCII_DIGIT = 1 << 3,
+ G_ASCII_GRAPH = 1 << 4,
+ G_ASCII_LOWER = 1 << 5,
+ G_ASCII_PRINT = 1 << 6,
+ G_ASCII_PUNCT = 1 << 7,
+ G_ASCII_SPACE = 1 << 8,
+ G_ASCII_UPPER = 1 << 9,
+ G_ASCII_XDIGIT = 1 << 10
+} GAsciiType;
+
+GLIB_VAR const guint16 * const g_ascii_table;
+
+#define g_ascii_isalnum(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0)
+
+#define g_ascii_isalpha(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0)
+
+#define g_ascii_iscntrl(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0)
+
+#define g_ascii_isdigit(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0)
+
+#define g_ascii_isgraph(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0)
+
+#define g_ascii_islower(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0)
+
+#define g_ascii_isprint(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0)
+
+#define g_ascii_ispunct(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0)
+
+#define g_ascii_isspace(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0)
+
+#define g_ascii_isupper(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0)
+
+#define g_ascii_isxdigit(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0)
+
+GLIB_AVAILABLE_IN_ALL
+gchar g_ascii_tolower (gchar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gchar g_ascii_toupper (gchar c) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gint g_ascii_digit_value (gchar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST;
+
+/* String utility functions that modify a string argument or
+ * return a constant string that must not be freed.
+ */
+#define G_STR_DELIMITERS "_-|> <."
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strdelimit (gchar *string,
+ const gchar *delimiters,
+ gchar new_delimiter);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strcanon (gchar *string,
+ const gchar *valid_chars,
+ gchar substitutor);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_strerror (gint errnum) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_strsignal (gint signum) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gchar * g_strreverse (gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gsize g_strlcpy (gchar *dest,
+ const gchar *src,
+ gsize dest_size);
+GLIB_AVAILABLE_IN_ALL
+gsize g_strlcat (gchar *dest,
+ const gchar *src,
+ gsize dest_size);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_strstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_strrstr (const gchar *haystack,
+ const gchar *needle);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_strrstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_str_has_suffix (const gchar *str,
+ const gchar *suffix);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_str_has_prefix (const gchar *str,
+ const gchar *prefix);
+
+/* String to/from double conversion functions */
+
+GLIB_AVAILABLE_IN_ALL
+gdouble g_strtod (const gchar *nptr,
+ gchar **endptr);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_ascii_strtod (const gchar *nptr,
+ gchar **endptr);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_ascii_strtoull (const gchar *nptr,
+ gchar **endptr,
+ guint base);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_ascii_strtoll (const gchar *nptr,
+ gchar **endptr,
+ guint base);
+/* 29 bytes should enough for all possible values that
+ * g_ascii_dtostr can produce.
+ * Then add 10 for good measure */
+#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10)
+GLIB_AVAILABLE_IN_ALL
+gchar * g_ascii_dtostr (gchar *buffer,
+ gint buf_len,
+ gdouble d);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_ascii_formatd (gchar *buffer,
+ gint buf_len,
+ const gchar *format,
+ gdouble d);
+
+/* removes leading spaces */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strchug (gchar *string);
+/* removes trailing spaces */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strchomp (gchar *string);
+/* removes leading & trailing spaces */
+#define g_strstrip( string ) g_strchomp (g_strchug (string))
+
+GLIB_AVAILABLE_IN_ALL
+gint g_ascii_strcasecmp (const gchar *s1,
+ const gchar *s2);
+GLIB_AVAILABLE_IN_ALL
+gint g_ascii_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ gsize n);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_ascii_strdown (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_ascii_strup (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_str_is_ascii (const gchar *str);
+
+GLIB_DEPRECATED
+gint g_strcasecmp (const gchar *s1,
+ const gchar *s2);
+GLIB_DEPRECATED
+gint g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n);
+GLIB_DEPRECATED
+gchar* g_strdown (gchar *string);
+GLIB_DEPRECATED
+gchar* g_strup (gchar *string);
+
+
+/* String utility functions that return a newly allocated string which
+ * ought to be freed with g_free from the caller at some point.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strdup (const gchar *str) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strdup_printf (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strdup_vprintf (const gchar *format,
+ va_list args) G_GNUC_PRINTF(1, 0) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strndup (const gchar *str,
+ gsize n) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strnfill (gsize length,
+ gchar fill_char) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strconcat (const gchar *string1,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strjoin (const gchar *separator,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+
+/* Make a copy of a string interpreting C string -style escape
+ * sequences. Inverse of g_strescape. The recognized sequences are \b
+ * \f \n \r \t \\ \" and the octal format.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC;
+
+/* Copy a string escaping nonprintable characters like in C strings.
+ * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
+ * to a string containing characters that are not to be escaped.
+ *
+ * Deprecated API: gchar* g_strescape (const gchar *source);
+ * Luckily this function wasn't used much, using NULL as second parameter
+ * provides mostly identical semantics.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strescape (const gchar *source,
+ const gchar *exceptions) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_memdup (gconstpointer mem,
+ guint byte_size) G_GNUC_ALLOC_SIZE(2);
+
+/* NULL terminated string arrays.
+ * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens
+ * at delim and return a newly allocated string array.
+ * g_strjoinv() concatenates all of str_array's strings, sliding in an
+ * optional separator, the returned string is newly allocated.
+ * g_strfreev() frees the array itself and all of its strings.
+ * g_strdupv() copies a NULL-terminated array of strings
+ * g_strv_length() returns the length of a NULL-terminated array of strings
+ */
+typedef gchar** GStrv;
+GLIB_AVAILABLE_IN_ALL
+gchar** g_strsplit (const gchar *string,
+ const gchar *delimiter,
+ gint max_tokens);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_strsplit_set (const gchar *string,
+ const gchar *delimiters,
+ gint max_tokens);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strjoinv (const gchar *separator,
+ gchar **str_array) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+void g_strfreev (gchar **str_array);
+GLIB_AVAILABLE_IN_ALL
+gchar** g_strdupv (gchar **str_array);
+GLIB_AVAILABLE_IN_ALL
+guint g_strv_length (gchar **str_array);
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_stpcpy (gchar *dest,
+ const char *src);
+
+GLIB_AVAILABLE_IN_2_40
+gchar * g_str_to_ascii (const gchar *str,
+ const gchar *from_locale);
+
+GLIB_AVAILABLE_IN_2_40
+gchar ** g_str_tokenize_and_fold (const gchar *string,
+ const gchar *translit_locale,
+ gchar ***ascii_alternates);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_str_match_string (const gchar *search_term,
+ const gchar *potential_hit,
+ gboolean accept_alternates);
+
+GLIB_AVAILABLE_IN_2_44
+gboolean g_strv_contains (const gchar * const *strv,
+ const gchar *str);
+
+GLIB_AVAILABLE_IN_2_60
+gboolean g_strv_equal (const gchar * const *strv1,
+ const gchar * const *strv2);
+
+/* Convenience ASCII string to number API */
+
+/**
+ * GNumberParserError:
+ * @G_NUMBER_PARSER_ERROR_INVALID: String was not a valid number.
+ * @G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS: String was a number, but out of bounds.
+ *
+ * Error codes returned by functions converting a string to a number.
+ *
+ * Since: 2.54
+ */
+typedef enum
+ {
+ G_NUMBER_PARSER_ERROR_INVALID,
+ G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS,
+ } GNumberParserError;
+
+/**
+ * G_NUMBER_PARSER_ERROR:
+ *
+ * Domain for errors returned by functions converting a string to a
+ * number.
+ *
+ * Since: 2.54
+ */
+#define G_NUMBER_PARSER_ERROR (g_number_parser_error_quark ())
+
+GLIB_AVAILABLE_IN_2_54
+GQuark g_number_parser_error_quark (void);
+
+GLIB_AVAILABLE_IN_2_54
+gboolean g_ascii_string_to_signed (const gchar *str,
+ guint base,
+ gint64 min,
+ gint64 max,
+ gint64 *out_num,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_54
+gboolean g_ascii_string_to_unsigned (const gchar *str,
+ guint base,
+ guint64 min,
+ guint64 max,
+ guint64 *out_num,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_STRFUNCS_H__ */
diff --git a/include/glib/glib/gstring.h b/include/glib/glib/gstring.h
new file mode 100644
index 0000000000..e1b2e7fca7
--- /dev/null
+++ b/include/glib/glib/gstring.h
@@ -0,0 +1,187 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_STRING_H__
+#define __G_STRING_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include <glib/gunicode.h>
+#include <glib/gbytes.h>
+#include <glib/gutils.h> /* for G_CAN_INLINE */
+
+G_BEGIN_DECLS
+
+typedef struct _GString GString;
+
+struct _GString
+{
+ gchar *str;
+ gsize len;
+ gsize allocated_len;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_new (const gchar *init);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_new_len (const gchar *init,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_sized_new (gsize dfl_size);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_string_free (GString *string,
+ gboolean free_segment);
+GLIB_AVAILABLE_IN_2_34
+GBytes* g_string_free_to_bytes (GString *string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_string_equal (const GString *v,
+ const GString *v2);
+GLIB_AVAILABLE_IN_ALL
+guint g_string_hash (const GString *str);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_assign (GString *string,
+ const gchar *rval);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_truncate (GString *string,
+ gsize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_set_size (GString *string,
+ gsize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_insert_len (GString *string,
+ gssize pos,
+ const gchar *val,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_append (GString *string,
+ const gchar *val);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_append_len (GString *string,
+ const gchar *val,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_append_c (GString *string,
+ gchar c);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_append_unichar (GString *string,
+ gunichar wc);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_prepend (GString *string,
+ const gchar *val);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_prepend_c (GString *string,
+ gchar c);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_prepend_unichar (GString *string,
+ gunichar wc);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_prepend_len (GString *string,
+ const gchar *val,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_insert (GString *string,
+ gssize pos,
+ const gchar *val);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_insert_c (GString *string,
+ gssize pos,
+ gchar c);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_insert_unichar (GString *string,
+ gssize pos,
+ gunichar wc);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_overwrite (GString *string,
+ gsize pos,
+ const gchar *val);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_overwrite_len (GString *string,
+ gsize pos,
+ const gchar *val,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_erase (GString *string,
+ gssize pos,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_ascii_down (GString *string);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_ascii_up (GString *string);
+GLIB_AVAILABLE_IN_ALL
+void g_string_vprintf (GString *string,
+ const gchar *format,
+ va_list args)
+ G_GNUC_PRINTF(2, 0);
+GLIB_AVAILABLE_IN_ALL
+void g_string_printf (GString *string,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+GLIB_AVAILABLE_IN_ALL
+void g_string_append_vprintf (GString *string,
+ const gchar *format,
+ va_list args)
+ G_GNUC_PRINTF(2, 0);
+GLIB_AVAILABLE_IN_ALL
+void g_string_append_printf (GString *string,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+GLIB_AVAILABLE_IN_ALL
+GString* g_string_append_uri_escaped (GString *string,
+ const gchar *unescaped,
+ const gchar *reserved_chars_allowed,
+ gboolean allow_utf8);
+
+/* -- optimize g_strig_append_c --- */
+#ifdef G_CAN_INLINE
+static inline GString*
+g_string_append_c_inline (GString *gstring,
+ gchar c)
+{
+ if (gstring->len + 1 < gstring->allocated_len)
+ {
+ gstring->str[gstring->len++] = c;
+ gstring->str[gstring->len] = 0;
+ }
+ else
+ g_string_insert_c (gstring, -1, c);
+ return gstring;
+}
+#define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c)
+#endif /* G_CAN_INLINE */
+
+
+GLIB_DEPRECATED
+GString *g_string_down (GString *string);
+GLIB_DEPRECATED
+GString *g_string_up (GString *string);
+
+#define g_string_sprintf g_string_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_printf)
+#define g_string_sprintfa g_string_append_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_append_printf)
+
+G_END_DECLS
+
+#endif /* __G_STRING_H__ */
diff --git a/include/glib/glib/gstringchunk.h b/include/glib/glib/gstringchunk.h
new file mode 100644
index 0000000000..8d445e349c
--- /dev/null
+++ b/include/glib/glib/gstringchunk.h
@@ -0,0 +1,57 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_STRINGCHUNK_H__
+#define __G_STRINGCHUNK_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GStringChunk GStringChunk;
+
+GLIB_AVAILABLE_IN_ALL
+GStringChunk* g_string_chunk_new (gsize size);
+GLIB_AVAILABLE_IN_ALL
+void g_string_chunk_free (GStringChunk *chunk);
+GLIB_AVAILABLE_IN_ALL
+void g_string_chunk_clear (GStringChunk *chunk);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_string_chunk_insert (GStringChunk *chunk,
+ const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_string_chunk_insert_len (GStringChunk *chunk,
+ const gchar *string,
+ gssize len);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_string_chunk_insert_const (GStringChunk *chunk,
+ const gchar *string);
+
+G_END_DECLS
+
+#endif /* __G_STRING_H__ */
diff --git a/include/glib/glib/gtestutils.h b/include/glib/glib/gtestutils.h
new file mode 100644
index 0000000000..6c475e5f4f
--- /dev/null
+++ b/include/glib/glib/gtestutils.h
@@ -0,0 +1,605 @@
+/* GLib testing utilities
+ * Copyright (C) 2007 Imendio AB
+ * Authors: Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_TEST_UTILS_H__
+#define __G_TEST_UTILS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gmessages.h>
+#include <glib/gstring.h>
+#include <glib/gerror.h>
+#include <glib/gslist.h>
+#include <string.h>
+
+G_BEGIN_DECLS
+
+typedef struct GTestCase GTestCase;
+typedef struct GTestSuite GTestSuite;
+typedef void (*GTestFunc) (void);
+typedef void (*GTestDataFunc) (gconstpointer user_data);
+typedef void (*GTestFixtureFunc) (gpointer fixture,
+ gconstpointer user_data);
+
+/* assertion API */
+#define g_assert_cmpstr(s1, cmp, s2) G_STMT_START { \
+ const char *__s1 = (s1), *__s2 = (s2); \
+ if (g_strcmp0 (__s1, __s2) cmp 0) ; else \
+ g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #s1 " " #cmp " " #s2, __s1, #cmp, __s2); \
+ } G_STMT_END
+#define g_assert_cmpint(n1, cmp, n2) G_STMT_START { \
+ gint64 __n1 = (n1), __n2 = (n2); \
+ if (__n1 cmp __n2) ; else \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \
+ } G_STMT_END
+#define g_assert_cmpuint(n1, cmp, n2) G_STMT_START { \
+ guint64 __n1 = (n1), __n2 = (n2); \
+ if (__n1 cmp __n2) ; else \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \
+ } G_STMT_END
+#define g_assert_cmphex(n1, cmp, n2) G_STMT_START {\
+ guint64 __n1 = (n1), __n2 = (n2); \
+ if (__n1 cmp __n2) ; else \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'x'); \
+ } G_STMT_END
+#define g_assert_cmpfloat(n1,cmp,n2) G_STMT_START { \
+ long double __n1 = (long double) (n1), __n2 = (long double) (n2); \
+ if (__n1 cmp __n2) ; else \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'f'); \
+ } G_STMT_END
+#define g_assert_cmpfloat_with_epsilon(n1,n2,epsilon) \
+ G_STMT_START { \
+ double __n1 = (n1), __n2 = (n2), __epsilon = (epsilon); \
+ if (G_APPROX_VALUE (__n1, __n2, __epsilon)) ; else \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #n1 " == " #n2 " (+/- " #epsilon ")", __n1, "==", __n2, 'f'); \
+ } G_STMT_END
+#define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\
+ gconstpointer __m1 = m1, __m2 = m2; \
+ int __l1 = l1, __l2 = l2; \
+ if (__l1 != __l2) \
+ g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", \
+ (long double) __l1, "==", (long double) __l2, 'i'); \
+ else if (__l1 != 0 && __m2 != NULL && memcmp (__m1, __m2, __l1) != 0) \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "assertion failed (" #m1 " == " #m2 ")"); \
+ } G_STMT_END
+#define g_assert_cmpvariant(v1, v2) \
+ G_STMT_START \
+ { \
+ GVariant *__v1 = (v1), *__v2 = (v2); \
+ if (!g_variant_equal (__v1, __v2)) \
+ { \
+ gchar *__s1, *__s2, *__msg; \
+ __s1 = g_variant_print (__v1, TRUE); \
+ __s2 = g_variant_print (__v2, TRUE); \
+ __msg = g_strdup_printf ("assertion failed (" #v1 " == " #v2 "): %s does not equal %s", __s1, __s2); \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
+ g_free (__s1); \
+ g_free (__s2); \
+ g_free (__msg); \
+ } \
+ } \
+ G_STMT_END
+#define g_assert_no_error(err) G_STMT_START { \
+ if (err) \
+ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #err, err, 0, 0); \
+ } G_STMT_END
+#define g_assert_error(err, dom, c) G_STMT_START { \
+ if (!err || (err)->domain != dom || (err)->code != c) \
+ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #err, err, dom, c); \
+ } G_STMT_END
+#define g_assert_true(expr) G_STMT_START { \
+ if G_LIKELY (expr) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be TRUE"); \
+ } G_STMT_END
+#define g_assert_false(expr) G_STMT_START { \
+ if G_LIKELY (!(expr)) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be FALSE"); \
+ } G_STMT_END
+
+/* Use nullptr in C++ to catch misuse of these macros. */
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == nullptr) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be nullptr"); \
+ } G_STMT_END
+#define g_assert_nonnull(expr) G_STMT_START { \
+ if G_LIKELY ((expr) != nullptr) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should not be nullptr"); \
+ } G_STMT_END
+#else /* not C++ */
+#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should be NULL"); \
+ } G_STMT_END
+#define g_assert_nonnull(expr) G_STMT_START { \
+ if G_LIKELY ((expr) != NULL) ; else \
+ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ "'" #expr "' should not be NULL"); \
+ } G_STMT_END
+#endif
+
+#ifdef G_DISABLE_ASSERT
+/* https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable
+ * GCC 5 is not a strict lower bound for versions of GCC which provide __builtin_unreachable(). */
+#if __GNUC__ >= 5 || g_macro__has_builtin(__builtin_unreachable)
+#define g_assert_not_reached() G_STMT_START { (void) 0; __builtin_unreachable (); } G_STMT_END
+#else /* if __builtin_unreachable() is not supported: */
+#define g_assert_not_reached() G_STMT_START { (void) 0; } G_STMT_END
+#endif
+
+#define g_assert(expr) G_STMT_START { (void) 0; } G_STMT_END
+#else /* !G_DISABLE_ASSERT */
+#define g_assert_not_reached() G_STMT_START { g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } G_STMT_END
+#define g_assert(expr) G_STMT_START { \
+ if G_LIKELY (expr) ; else \
+ g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #expr); \
+ } G_STMT_END
+#endif /* !G_DISABLE_ASSERT */
+
+GLIB_AVAILABLE_IN_ALL
+int g_strcmp0 (const char *str1,
+ const char *str2);
+
+/* report performance results */
+GLIB_AVAILABLE_IN_ALL
+void g_test_minimized_result (double minimized_quantity,
+ const char *format,
+ ...) G_GNUC_PRINTF (2, 3);
+GLIB_AVAILABLE_IN_ALL
+void g_test_maximized_result (double maximized_quantity,
+ const char *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+/* initialize testing framework */
+GLIB_AVAILABLE_IN_ALL
+void g_test_init (int *argc,
+ char ***argv,
+ ...) G_GNUC_NULL_TERMINATED;
+
+/**
+ * G_TEST_OPTION_ISOLATE_DIRS:
+ *
+ * Creates a unique temporary directory for each unit test and uses
+ * g_set_user_dirs() to set XDG directories to point into subdirectories of it
+ * for the duration of the unit test. The directory tree is cleaned up after the
+ * test finishes successfully. Note that this doesn’t take effect until
+ * g_test_run() is called, so calls to (for example) g_get_user_home_dir() will
+ * return the system-wide value when made in a test program’s main() function.
+ *
+ * The following functions will return subdirectories of the temporary directory
+ * when this option is used. The specific subdirectory paths in use are not
+ * guaranteed to be stable API — always use a getter function to retrieve them.
+ *
+ * - g_get_home_dir()
+ * - g_get_user_cache_dir()
+ * - g_get_system_config_dirs()
+ * - g_get_user_config_dir()
+ * - g_get_system_data_dirs()
+ * - g_get_user_data_dir()
+ * - g_get_user_runtime_dir()
+ *
+ * The subdirectories may not be created by the test harness; as with normal
+ * calls to functions like g_get_user_cache_dir(), the caller must be prepared
+ * to create the directory if it doesn’t exist.
+ *
+ * Since: 2.60
+ */
+#define G_TEST_OPTION_ISOLATE_DIRS "isolate_dirs"
+
+/* While we discourage its use, g_assert() is often used in unit tests
+ * (especially in legacy code). g_assert_*() should really be used instead.
+ * g_assert() can be disabled at client program compile time, which can render
+ * tests useless. Highlight that to the user. */
+#ifdef G_DISABLE_ASSERT
+#if defined(G_HAVE_ISO_VARARGS)
+#define g_test_init(argc, argv, ...) \
+ G_STMT_START { \
+ g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \
+ exit (1); \
+ } G_STMT_END
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define g_test_init(argc, argv...) \
+ G_STMT_START { \
+ g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \
+ exit (1); \
+ } G_STMT_END
+#else /* no varargs */
+ /* do nothing */
+#endif /* varargs support */
+#endif /* G_DISABLE_ASSERT */
+
+/* query testing framework config */
+#define g_test_initialized() (g_test_config_vars->test_initialized)
+#define g_test_quick() (g_test_config_vars->test_quick)
+#define g_test_slow() (!g_test_config_vars->test_quick)
+#define g_test_thorough() (!g_test_config_vars->test_quick)
+#define g_test_perf() (g_test_config_vars->test_perf)
+#define g_test_verbose() (g_test_config_vars->test_verbose)
+#define g_test_quiet() (g_test_config_vars->test_quiet)
+#define g_test_undefined() (g_test_config_vars->test_undefined)
+GLIB_AVAILABLE_IN_2_38
+gboolean g_test_subprocess (void);
+
+/* run all tests under toplevel suite (path: /) */
+GLIB_AVAILABLE_IN_ALL
+int g_test_run (void);
+/* hook up a test functions under test path */
+GLIB_AVAILABLE_IN_ALL
+void g_test_add_func (const char *testpath,
+ GTestFunc test_func);
+
+GLIB_AVAILABLE_IN_ALL
+void g_test_add_data_func (const char *testpath,
+ gconstpointer test_data,
+ GTestDataFunc test_func);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_add_data_func_full (const char *testpath,
+ gpointer test_data,
+ GTestDataFunc test_func,
+ GDestroyNotify data_free_func);
+
+/* tell about failure */
+GLIB_AVAILABLE_IN_2_30
+void g_test_fail (void);
+GLIB_AVAILABLE_IN_2_38
+void g_test_incomplete (const gchar *msg);
+GLIB_AVAILABLE_IN_2_38
+void g_test_skip (const gchar *msg);
+GLIB_AVAILABLE_IN_2_38
+gboolean g_test_failed (void);
+GLIB_AVAILABLE_IN_2_38
+void g_test_set_nonfatal_assertions (void);
+
+/**
+ * g_test_add:
+ * @testpath: The test path for a new test case.
+ * @Fixture: The type of a fixture data structure.
+ * @tdata: Data argument for the test functions.
+ * @fsetup: The function to set up the fixture data.
+ * @ftest: The actual test function.
+ * @fteardown: The function to tear down the fixture data.
+ *
+ * Hook up a new test case at @testpath, similar to g_test_add_func().
+ * A fixture data structure with setup and teardown functions may be provided,
+ * similar to g_test_create_case().
+ *
+ * g_test_add() is implemented as a macro, so that the fsetup(), ftest() and
+ * fteardown() callbacks can expect a @Fixture pointer as their first argument
+ * in a type safe manner. They otherwise have type #GTestFixtureFunc.
+ *
+ * Since: 2.16
+ */
+#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
+ G_STMT_START { \
+ void (*add_vtable) (const char*, \
+ gsize, \
+ gconstpointer, \
+ void (*) (Fixture*, gconstpointer), \
+ void (*) (Fixture*, gconstpointer), \
+ void (*) (Fixture*, gconstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer))) g_test_add_vtable; \
+ add_vtable \
+ (testpath, sizeof (Fixture), tdata, fsetup, ftest, fteardown); \
+ } G_STMT_END
+
+/* add test messages to the test report */
+GLIB_AVAILABLE_IN_ALL
+void g_test_message (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+void g_test_bug_base (const char *uri_pattern);
+GLIB_AVAILABLE_IN_ALL
+void g_test_bug (const char *bug_uri_snippet);
+GLIB_AVAILABLE_IN_2_62
+void g_test_summary (const char *summary);
+/* measure test timings */
+GLIB_AVAILABLE_IN_ALL
+void g_test_timer_start (void);
+GLIB_AVAILABLE_IN_ALL
+double g_test_timer_elapsed (void); /* elapsed seconds */
+GLIB_AVAILABLE_IN_ALL
+double g_test_timer_last (void); /* repeat last elapsed() result */
+
+/* automatically g_free or g_object_unref upon teardown */
+GLIB_AVAILABLE_IN_ALL
+void g_test_queue_free (gpointer gfree_pointer);
+GLIB_AVAILABLE_IN_ALL
+void g_test_queue_destroy (GDestroyNotify destroy_func,
+ gpointer destroy_data);
+#define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject)
+
+/**
+ * GTestTrapFlags:
+ * @G_TEST_TRAP_SILENCE_STDOUT: Redirect stdout of the test child to
+ * `/dev/null` so it cannot be observed on the console during test
+ * runs. The actual output is still captured though to allow later
+ * tests with g_test_trap_assert_stdout().
+ * @G_TEST_TRAP_SILENCE_STDERR: Redirect stderr of the test child to
+ * `/dev/null` so it cannot be observed on the console during test
+ * runs. The actual output is still captured though to allow later
+ * tests with g_test_trap_assert_stderr().
+ * @G_TEST_TRAP_INHERIT_STDIN: If this flag is given, stdin of the
+ * child process is shared with stdin of its parent process.
+ * It is redirected to `/dev/null` otherwise.
+ *
+ * Test traps are guards around forked tests.
+ * These flags determine what traps to set.
+ *
+ * Deprecated: 2.38: #GTestTrapFlags is used only with g_test_trap_fork(),
+ * which is deprecated. g_test_trap_subprocess() uses
+ * #GTestSubprocessFlags.
+ */
+typedef enum {
+ G_TEST_TRAP_SILENCE_STDOUT = 1 << 7,
+ G_TEST_TRAP_SILENCE_STDERR = 1 << 8,
+ G_TEST_TRAP_INHERIT_STDIN = 1 << 9
+} GTestTrapFlags GLIB_DEPRECATED_TYPE_IN_2_38_FOR(GTestSubprocessFlags);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess)
+gboolean g_test_trap_fork (guint64 usec_timeout,
+ GTestTrapFlags test_trap_flags);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+typedef enum {
+ G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0,
+ G_TEST_SUBPROCESS_INHERIT_STDOUT = 1 << 1,
+ G_TEST_SUBPROCESS_INHERIT_STDERR = 1 << 2
+} GTestSubprocessFlags;
+
+GLIB_AVAILABLE_IN_2_38
+void g_test_trap_subprocess (const char *test_path,
+ guint64 usec_timeout,
+ GTestSubprocessFlags test_flags);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_test_trap_has_passed (void);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_test_trap_reached_timeout (void);
+#define g_test_trap_assert_passed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 0, 0)
+#define g_test_trap_assert_failed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 1, 0)
+#define g_test_trap_assert_stdout(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 2, soutpattern)
+#define g_test_trap_assert_stdout_unmatched(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 3, soutpattern)
+#define g_test_trap_assert_stderr(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 4, serrpattern)
+#define g_test_trap_assert_stderr_unmatched(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 5, serrpattern)
+
+/* provide seed-able random numbers for tests */
+#define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15)))
+GLIB_AVAILABLE_IN_ALL
+gint32 g_test_rand_int (void);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_test_rand_int_range (gint32 begin,
+ gint32 end);
+GLIB_AVAILABLE_IN_ALL
+double g_test_rand_double (void);
+GLIB_AVAILABLE_IN_ALL
+double g_test_rand_double_range (double range_start,
+ double range_end);
+
+/*
+ * semi-internal API: non-documented symbols with stable ABI. You
+ * should use the non-internal helper macros instead. However, for
+ * compatibility reason, you may use this semi-internal API.
+ */
+GLIB_AVAILABLE_IN_ALL
+GTestCase* g_test_create_case (const char *test_name,
+ gsize data_size,
+ gconstpointer test_data,
+ GTestFixtureFunc data_setup,
+ GTestFixtureFunc data_test,
+ GTestFixtureFunc data_teardown);
+GLIB_AVAILABLE_IN_ALL
+GTestSuite* g_test_create_suite (const char *suite_name);
+GLIB_AVAILABLE_IN_ALL
+GTestSuite* g_test_get_root (void);
+GLIB_AVAILABLE_IN_ALL
+void g_test_suite_add (GTestSuite *suite,
+ GTestCase *test_case);
+GLIB_AVAILABLE_IN_ALL
+void g_test_suite_add_suite (GTestSuite *suite,
+ GTestSuite *nestedsuite);
+GLIB_AVAILABLE_IN_ALL
+int g_test_run_suite (GTestSuite *suite);
+
+GLIB_AVAILABLE_IN_ALL
+void g_test_trap_assertions (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ guint64 assertion_flags, /* 0-pass, 1-fail, 2-outpattern, 4-errpattern */
+ const char *pattern);
+GLIB_AVAILABLE_IN_ALL
+void g_assertion_message (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *message);
+GLIB_AVAILABLE_IN_ALL
+void g_assertion_message_expr (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *expr) G_GNUC_NORETURN;
+GLIB_AVAILABLE_IN_ALL
+void g_assertion_message_cmpstr (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *expr,
+ const char *arg1,
+ const char *cmp,
+ const char *arg2);
+GLIB_AVAILABLE_IN_ALL
+void g_assertion_message_cmpnum (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *expr,
+ long double arg1,
+ const char *cmp,
+ long double arg2,
+ char numtype);
+GLIB_AVAILABLE_IN_ALL
+void g_assertion_message_error (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *expr,
+ const GError *error,
+ GQuark error_domain,
+ int error_code);
+GLIB_AVAILABLE_IN_ALL
+void g_test_add_vtable (const char *testpath,
+ gsize data_size,
+ gconstpointer test_data,
+ GTestFixtureFunc data_setup,
+ GTestFixtureFunc data_test,
+ GTestFixtureFunc data_teardown);
+typedef struct {
+ gboolean test_initialized;
+ gboolean test_quick; /* disable thorough tests */
+ gboolean test_perf; /* run performance tests */
+ gboolean test_verbose; /* extra info */
+ gboolean test_quiet; /* reduce output */
+ gboolean test_undefined; /* run tests that are meant to assert */
+} GTestConfig;
+GLIB_VAR const GTestConfig * const g_test_config_vars;
+
+/* internal logging API */
+typedef enum {
+ G_TEST_RUN_SUCCESS,
+ G_TEST_RUN_SKIPPED,
+ G_TEST_RUN_FAILURE,
+ G_TEST_RUN_INCOMPLETE
+} GTestResult;
+
+typedef enum {
+ G_TEST_LOG_NONE,
+ G_TEST_LOG_ERROR, /* s:msg */
+ G_TEST_LOG_START_BINARY, /* s:binaryname s:seed */
+ G_TEST_LOG_LIST_CASE, /* s:testpath */
+ G_TEST_LOG_SKIP_CASE, /* s:testpath */
+ G_TEST_LOG_START_CASE, /* s:testpath */
+ G_TEST_LOG_STOP_CASE, /* d:status d:nforks d:elapsed */
+ G_TEST_LOG_MIN_RESULT, /* s:blurb d:result */
+ G_TEST_LOG_MAX_RESULT, /* s:blurb d:result */
+ G_TEST_LOG_MESSAGE, /* s:blurb */
+ G_TEST_LOG_START_SUITE,
+ G_TEST_LOG_STOP_SUITE
+} GTestLogType;
+
+typedef struct {
+ GTestLogType log_type;
+ guint n_strings;
+ gchar **strings; /* NULL terminated */
+ guint n_nums;
+ long double *nums;
+} GTestLogMsg;
+typedef struct {
+ /*< private >*/
+ GString *data;
+ GSList *msgs;
+} GTestLogBuffer;
+
+GLIB_AVAILABLE_IN_ALL
+const char* g_test_log_type_name (GTestLogType log_type);
+GLIB_AVAILABLE_IN_ALL
+GTestLogBuffer* g_test_log_buffer_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_test_log_buffer_free (GTestLogBuffer *tbuffer);
+GLIB_AVAILABLE_IN_ALL
+void g_test_log_buffer_push (GTestLogBuffer *tbuffer,
+ guint n_bytes,
+ const guint8 *bytes);
+GLIB_AVAILABLE_IN_ALL
+GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer);
+GLIB_AVAILABLE_IN_ALL
+void g_test_log_msg_free (GTestLogMsg *tmsg);
+
+/**
+ * GTestLogFatalFunc:
+ * @log_domain: the log domain of the message
+ * @log_level: the log level of the message (including the fatal and recursion flags)
+ * @message: the message to process
+ * @user_data: user data, set in g_test_log_set_fatal_handler()
+ *
+ * Specifies the prototype of fatal log handler functions.
+ *
+ * Returns: %TRUE if the program should abort, %FALSE otherwise
+ *
+ * Since: 2.22
+ */
+typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+void
+g_test_log_set_fatal_handler (GTestLogFatalFunc log_func,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_34
+void g_test_expect_message (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *pattern);
+GLIB_AVAILABLE_IN_2_34
+void g_test_assert_expected_messages_internal (const char *domain,
+ const char *file,
+ int line,
+ const char *func);
+
+typedef enum
+{
+ G_TEST_DIST,
+ G_TEST_BUILT
+} GTestFileType;
+
+GLIB_AVAILABLE_IN_2_38
+gchar * g_test_build_filename (GTestFileType file_type,
+ const gchar *first_path,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_2_38
+const gchar *g_test_get_dir (GTestFileType file_type);
+GLIB_AVAILABLE_IN_2_38
+const gchar *g_test_get_filename (GTestFileType file_type,
+ const gchar *first_path,
+ ...) G_GNUC_NULL_TERMINATED;
+
+#define g_test_assert_expected_messages() g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC)
+
+G_END_DECLS
+
+#endif /* __G_TEST_UTILS_H__ */
diff --git a/include/glib/glib/gthread.h b/include/glib/glib/gthread.h
new file mode 100644
index 0000000000..c8761c5e6c
--- /dev/null
+++ b/include/glib/glib/gthread.h
@@ -0,0 +1,556 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_THREAD_H__
+#define __G_THREAD_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gatomic.h>
+#include <glib/gerror.h>
+#include <glib/gutils.h>
+
+G_BEGIN_DECLS
+
+#define G_THREAD_ERROR g_thread_error_quark ()
+GLIB_AVAILABLE_IN_ALL
+GQuark g_thread_error_quark (void);
+
+typedef enum
+{
+ G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
+} GThreadError;
+
+typedef gpointer (*GThreadFunc) (gpointer data);
+
+typedef struct _GThread GThread;
+
+typedef union _GMutex GMutex;
+typedef struct _GRecMutex GRecMutex;
+typedef struct _GRWLock GRWLock;
+typedef struct _GCond GCond;
+typedef struct _GPrivate GPrivate;
+typedef struct _GOnce GOnce;
+
+union _GMutex
+{
+ /*< private >*/
+ gpointer p;
+ guint i[2];
+};
+
+struct _GRWLock
+{
+ /*< private >*/
+ gpointer p;
+ guint i[2];
+};
+
+struct _GCond
+{
+ /*< private >*/
+ gpointer p;
+ guint i[2];
+};
+
+struct _GRecMutex
+{
+ /*< private >*/
+ gpointer p;
+ guint i[2];
+};
+
+#define G_PRIVATE_INIT(notify) { NULL, (notify), { NULL, NULL } }
+struct _GPrivate
+{
+ /*< private >*/
+ gpointer p;
+ GDestroyNotify notify;
+ gpointer future[2];
+};
+
+typedef enum
+{
+ G_ONCE_STATUS_NOTCALLED,
+ G_ONCE_STATUS_PROGRESS,
+ G_ONCE_STATUS_READY
+} GOnceStatus;
+
+#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL }
+struct _GOnce
+{
+ volatile GOnceStatus status;
+ volatile gpointer retval;
+};
+
+#define G_LOCK_NAME(name) g__ ## name ## _lock
+#define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name)
+#define G_LOCK_DEFINE(name) GMutex G_LOCK_NAME (name)
+#define G_LOCK_EXTERN(name) extern GMutex G_LOCK_NAME (name)
+
+#ifdef G_DEBUG_LOCKS
+# define G_LOCK(name) G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ "file %s: line %d (%s): locking: %s ", \
+ __FILE__, __LINE__, G_STRFUNC, \
+ #name); \
+ g_mutex_lock (&G_LOCK_NAME (name)); \
+ }G_STMT_END
+# define G_UNLOCK(name) G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ "file %s: line %d (%s): unlocking: %s ", \
+ __FILE__, __LINE__, G_STRFUNC, \
+ #name); \
+ g_mutex_unlock (&G_LOCK_NAME (name)); \
+ }G_STMT_END
+# define G_TRYLOCK(name) \
+ (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
+ "file %s: line %d (%s): try locking: %s ", \
+ __FILE__, __LINE__, G_STRFUNC, \
+ #name), g_mutex_trylock (&G_LOCK_NAME (name)))
+#else /* !G_DEBUG_LOCKS */
+# define G_LOCK(name) g_mutex_lock (&G_LOCK_NAME (name))
+# define G_UNLOCK(name) g_mutex_unlock (&G_LOCK_NAME (name))
+# define G_TRYLOCK(name) g_mutex_trylock (&G_LOCK_NAME (name))
+#endif /* !G_DEBUG_LOCKS */
+
+GLIB_AVAILABLE_IN_2_32
+GThread * g_thread_ref (GThread *thread);
+GLIB_AVAILABLE_IN_2_32
+void g_thread_unref (GThread *thread);
+GLIB_AVAILABLE_IN_2_32
+GThread * g_thread_new (const gchar *name,
+ GThreadFunc func,
+ gpointer data);
+GLIB_AVAILABLE_IN_2_32
+GThread * g_thread_try_new (const gchar *name,
+ GThreadFunc func,
+ gpointer data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GThread * g_thread_self (void);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_exit (gpointer retval);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_thread_join (GThread *thread);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_yield (void);
+
+
+GLIB_AVAILABLE_IN_2_32
+void g_mutex_init (GMutex *mutex);
+GLIB_AVAILABLE_IN_2_32
+void g_mutex_clear (GMutex *mutex);
+GLIB_AVAILABLE_IN_ALL
+void g_mutex_lock (GMutex *mutex);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_mutex_trylock (GMutex *mutex);
+GLIB_AVAILABLE_IN_ALL
+void g_mutex_unlock (GMutex *mutex);
+
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_init (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_clear (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_writer_lock (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_rw_lock_writer_trylock (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_writer_unlock (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_reader_lock (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_rw_lock_reader_trylock (GRWLock *rw_lock);
+GLIB_AVAILABLE_IN_2_32
+void g_rw_lock_reader_unlock (GRWLock *rw_lock);
+
+GLIB_AVAILABLE_IN_2_32
+void g_rec_mutex_init (GRecMutex *rec_mutex);
+GLIB_AVAILABLE_IN_2_32
+void g_rec_mutex_clear (GRecMutex *rec_mutex);
+GLIB_AVAILABLE_IN_2_32
+void g_rec_mutex_lock (GRecMutex *rec_mutex);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_rec_mutex_trylock (GRecMutex *rec_mutex);
+GLIB_AVAILABLE_IN_2_32
+void g_rec_mutex_unlock (GRecMutex *rec_mutex);
+
+GLIB_AVAILABLE_IN_2_32
+void g_cond_init (GCond *cond);
+GLIB_AVAILABLE_IN_2_32
+void g_cond_clear (GCond *cond);
+GLIB_AVAILABLE_IN_ALL
+void g_cond_wait (GCond *cond,
+ GMutex *mutex);
+GLIB_AVAILABLE_IN_ALL
+void g_cond_signal (GCond *cond);
+GLIB_AVAILABLE_IN_ALL
+void g_cond_broadcast (GCond *cond);
+GLIB_AVAILABLE_IN_2_32
+gboolean g_cond_wait_until (GCond *cond,
+ GMutex *mutex,
+ gint64 end_time);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_private_get (GPrivate *key);
+GLIB_AVAILABLE_IN_ALL
+void g_private_set (GPrivate *key,
+ gpointer value);
+GLIB_AVAILABLE_IN_2_32
+void g_private_replace (GPrivate *key,
+ gpointer value);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_once_impl (GOnce *once,
+ GThreadFunc func,
+ gpointer arg);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_once_init_enter (volatile void *location);
+GLIB_AVAILABLE_IN_ALL
+void g_once_init_leave (volatile void *location,
+ gsize result);
+
+#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED
+# define g_once(once, func, arg) g_once_impl ((once), (func), (arg))
+#else /* !G_ATOMIC_OP_MEMORY_BARRIER_NEEDED*/
+# define g_once(once, func, arg) \
+ (((once)->status == G_ONCE_STATUS_READY) ? \
+ (once)->retval : \
+ g_once_impl ((once), (func), (arg)))
+#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
+
+#ifdef __GNUC__
+# define g_once_init_enter(location) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \
+ (void) (0 ? (gpointer) *(location) : 0); \
+ (!g_atomic_pointer_get (location) && \
+ g_once_init_enter (location)); \
+ }))
+# define g_once_init_leave(location, result) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \
+ (void) (0 ? *(location) = (result) : 0); \
+ g_once_init_leave ((location), (gsize) (result)); \
+ }))
+#else
+# define g_once_init_enter(location) \
+ (g_once_init_enter((location)))
+# define g_once_init_leave(location, result) \
+ (g_once_init_leave((location), (gsize) (result)))
+#endif
+
+GLIB_AVAILABLE_IN_2_36
+guint g_get_num_processors (void);
+
+/**
+ * GMutexLocker:
+ *
+ * Opaque type. See g_mutex_locker_new() for details.
+ * Since: 2.44
+ */
+typedef void GMutexLocker;
+
+/**
+ * g_mutex_locker_new:
+ * @mutex: a mutex to lock
+ *
+ * Lock @mutex and return a new #GMutexLocker. Unlock with
+ * g_mutex_locker_free(). Using g_mutex_unlock() on @mutex
+ * while a #GMutexLocker exists can lead to undefined behaviour.
+ *
+ * This is intended to be used with g_autoptr(). Note that g_autoptr()
+ * is only available when using GCC or clang, so the following example
+ * will only work with those compilers:
+ * |[
+ * typedef struct
+ * {
+ * ...
+ * GMutex mutex;
+ * ...
+ * } MyObject;
+ *
+ * static void
+ * my_object_do_stuff (MyObject *self)
+ * {
+ * g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->mutex);
+ *
+ * // Code with mutex locked here
+ *
+ * if (cond)
+ * // No need to unlock
+ * return;
+ *
+ * // Optionally early unlock
+ * g_clear_pointer (&locker, g_mutex_locker_free);
+ *
+ * // Code with mutex unlocked here
+ * }
+ * ]|
+ *
+ * Returns: a #GMutexLocker
+ * Since: 2.44
+ */
+static inline GMutexLocker *
+g_mutex_locker_new (GMutex *mutex)
+{
+ g_mutex_lock (mutex);
+ return (GMutexLocker *) mutex;
+}
+
+/**
+ * g_mutex_locker_free:
+ * @locker: a GMutexLocker
+ *
+ * Unlock @locker's mutex. See g_mutex_locker_new() for details.
+ *
+ * Since: 2.44
+ */
+static inline void
+g_mutex_locker_free (GMutexLocker *locker)
+{
+ g_mutex_unlock ((GMutex *) locker);
+}
+
+/**
+ * GRecMutexLocker:
+ *
+ * Opaque type. See g_rec_mutex_locker_new() for details.
+ * Since: 2.60
+ */
+typedef void GRecMutexLocker;
+
+/**
+ * g_rec_mutex_locker_new:
+ * @rec_mutex: a recursive mutex to lock
+ *
+ * Lock @rec_mutex and return a new #GRecMutexLocker. Unlock with
+ * g_rec_mutex_locker_free(). Using g_rec_mutex_unlock() on @rec_mutex
+ * while a #GRecMutexLocker exists can lead to undefined behaviour.
+ *
+ * This is intended to be used with g_autoptr(). Note that g_autoptr()
+ * is only available when using GCC or clang, so the following example
+ * will only work with those compilers:
+ * |[
+ * typedef struct
+ * {
+ * ...
+ * GRecMutex rec_mutex;
+ * ...
+ * } MyObject;
+ *
+ * static void
+ * my_object_do_stuff (MyObject *self)
+ * {
+ * g_autoptr(GRecMutexLocker) locker = g_rec_mutex_locker_new (&self->rec_mutex);
+ *
+ * // Code with rec_mutex locked here
+ *
+ * if (cond)
+ * // No need to unlock
+ * return;
+ *
+ * // Optionally early unlock
+ * g_clear_pointer (&locker, g_rec_mutex_locker_free);
+ *
+ * // Code with rec_mutex unlocked here
+ * }
+ * ]|
+ *
+ * Returns: a #GRecMutexLocker
+ * Since: 2.60
+ */
+static inline GRecMutexLocker *
+g_rec_mutex_locker_new (GRecMutex *rec_mutex)
+{
+ g_rec_mutex_lock (rec_mutex);
+ return (GRecMutexLocker *) rec_mutex;
+}
+
+/**
+ * g_rec_mutex_locker_free:
+ * @locker: a GRecMutexLocker
+ *
+ * Unlock @locker's recursive mutex. See g_rec_mutex_locker_new() for details.
+ *
+ * Since: 2.60
+ */
+static inline void
+g_rec_mutex_locker_free (GRecMutexLocker *locker)
+{
+ g_rec_mutex_unlock ((GRecMutex *) locker);
+}
+
+/**
+ * GRWLockWriterLocker:
+ *
+ * Opaque type. See g_rw_lock_writer_locker_new() for details.
+ * Since: 2.62
+ */
+typedef void GRWLockWriterLocker;
+
+/**
+ * g_rw_lock_writer_locker_new:
+ * @rw_lock: a #GRWLock
+ *
+ * Obtain a write lock on @rw_lock and return a new #GRWLockWriterLocker.
+ * Unlock with g_rw_lock_writer_locker_free(). Using g_rw_lock_writer_unlock()
+ * on @rw_lock while a #GRWLockWriterLocker exists can lead to undefined
+ * behaviour.
+ *
+ * This is intended to be used with g_autoptr(). Note that g_autoptr()
+ * is only available when using GCC or clang, so the following example
+ * will only work with those compilers:
+ * |[
+ * typedef struct
+ * {
+ * ...
+ * GRWLock rw_lock;
+ * GPtrArray *array;
+ * ...
+ * } MyObject;
+ *
+ * static gchar *
+ * my_object_get_data (MyObject *self, guint index)
+ * {
+ * g_autoptr(GRWLockReaderLocker) locker = g_rw_lock_reader_locker_new (&self->rw_lock);
+ *
+ * // Code with a read lock obtained on rw_lock here
+ *
+ * if (self->array == NULL)
+ * // No need to unlock
+ * return NULL;
+ *
+ * if (index < self->array->len)
+ * // No need to unlock
+ * return g_ptr_array_index (self->array, index);
+ *
+ * // Optionally early unlock
+ * g_clear_pointer (&locker, g_rw_lock_reader_locker_free);
+ *
+ * // Code with rw_lock unlocked here
+ * return NULL;
+ * }
+ *
+ * static void
+ * my_object_set_data (MyObject *self, guint index, gpointer data)
+ * {
+ * g_autoptr(GRWLockWriterLocker) locker = g_rw_lock_writer_locker_new (&self->rw_lock);
+ *
+ * // Code with a write lock obtained on rw_lock here
+ *
+ * if (self->array == NULL)
+ * self->array = g_ptr_array_new ();
+ *
+ * if (cond)
+ * // No need to unlock
+ * return;
+ *
+ * if (index >= self->array->len)
+ * g_ptr_array_set_size (self->array, index+1);
+ * g_ptr_array_index (self->array, index) = data;
+ *
+ * // Optionally early unlock
+ * g_clear_pointer (&locker, g_rw_lock_writer_locker_free);
+ *
+ * // Code with rw_lock unlocked here
+ * }
+ * ]|
+ *
+ * Returns: a #GRWLockWriterLocker
+ * Since: 2.62
+ */
+static inline GRWLockWriterLocker *
+g_rw_lock_writer_locker_new (GRWLock *rw_lock)
+{
+ g_rw_lock_writer_lock (rw_lock);
+ return (GRWLockWriterLocker *) rw_lock;
+}
+
+/**
+ * g_rw_lock_writer_locker_free:
+ * @locker: a GRWLockWriterLocker
+ *
+ * Release a write lock on @locker's read-write lock. See
+ * g_rw_lock_writer_locker_new() for details.
+ *
+ * Since: 2.62
+ */
+static inline void
+g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker)
+{
+ g_rw_lock_writer_unlock ((GRWLock *) locker);
+}
+
+/**
+ * GRWLockReaderLocker:
+ *
+ * Opaque type. See g_rw_lock_reader_locker_new() for details.
+ * Since: 2.62
+ */
+typedef void GRWLockReaderLocker;
+
+/**
+ * g_rw_lock_reader_locker_new:
+ * @rw_lock: a #GRWLock
+ *
+ * Obtain a read lock on @rw_lock and return a new #GRWLockReaderLocker.
+ * Unlock with g_rw_lock_reader_locker_free(). Using g_rw_lock_reader_unlock()
+ * on @rw_lock while a #GRWLockReaderLocker exists can lead to undefined
+ * behaviour.
+ *
+ * This is intended to be used with g_autoptr(). For a code sample, see
+ * g_rw_lock_writer_locker_new().
+ *
+ * Returns: a #GRWLockReaderLocker
+ * Since: 2.62
+ */
+static inline GRWLockReaderLocker *
+g_rw_lock_reader_locker_new (GRWLock *rw_lock)
+{
+ g_rw_lock_reader_lock (rw_lock);
+ return (GRWLockReaderLocker *) rw_lock;
+}
+
+/**
+ * g_rw_lock_reader_locker_free:
+ * @locker: a GRWLockReaderLocker
+ *
+ * Release a read lock on @locker's read-write lock. See
+ * g_rw_lock_reader_locker_new() for details.
+ *
+ * Since: 2.62
+ */
+static inline void
+g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker)
+{
+ g_rw_lock_reader_unlock ((GRWLock *) locker);
+}
+
+G_END_DECLS
+
+#endif /* __G_THREAD_H__ */
diff --git a/include/glib/glib/gthreadpool.h b/include/glib/glib/gthreadpool.h
new file mode 100644
index 0000000000..11c3d1d164
--- /dev/null
+++ b/include/glib/glib/gthreadpool.h
@@ -0,0 +1,96 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_THREADPOOL_H__
+#define __G_THREADPOOL_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GThreadPool GThreadPool;
+
+/* Thread Pools
+ */
+
+struct _GThreadPool
+{
+ GFunc func;
+ gpointer user_data;
+ gboolean exclusive;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GThreadPool * g_thread_pool_new (GFunc func,
+ gpointer user_data,
+ gint max_threads,
+ gboolean exclusive,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_pool_free (GThreadPool *pool,
+ gboolean immediate,
+ gboolean wait_);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_thread_pool_push (GThreadPool *pool,
+ gpointer data,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+guint g_thread_pool_unprocessed (GThreadPool *pool);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_pool_set_sort_function (GThreadPool *pool,
+ GCompareDataFunc func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_46
+gboolean g_thread_pool_move_to_front (GThreadPool *pool,
+ gpointer data);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_thread_pool_set_max_threads (GThreadPool *pool,
+ gint max_threads,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gint g_thread_pool_get_max_threads (GThreadPool *pool);
+GLIB_AVAILABLE_IN_ALL
+guint g_thread_pool_get_num_threads (GThreadPool *pool);
+
+GLIB_AVAILABLE_IN_ALL
+void g_thread_pool_set_max_unused_threads (gint max_threads);
+GLIB_AVAILABLE_IN_ALL
+gint g_thread_pool_get_max_unused_threads (void);
+GLIB_AVAILABLE_IN_ALL
+guint g_thread_pool_get_num_unused_threads (void);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_pool_stop_unused_threads (void);
+GLIB_AVAILABLE_IN_ALL
+void g_thread_pool_set_max_idle_time (guint interval);
+GLIB_AVAILABLE_IN_ALL
+guint g_thread_pool_get_max_idle_time (void);
+
+G_END_DECLS
+
+#endif /* __G_THREADPOOL_H__ */
diff --git a/include/glib/glib/gtimer.h b/include/glib/glib/gtimer.h
new file mode 100644
index 0000000000..28794d167e
--- /dev/null
+++ b/include/glib/glib/gtimer.h
@@ -0,0 +1,78 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_TIMER_H__
+#define __G_TIMER_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* Timer
+ */
+
+/* microseconds per second */
+typedef struct _GTimer GTimer;
+
+#define G_USEC_PER_SEC 1000000
+
+GLIB_AVAILABLE_IN_ALL
+GTimer* g_timer_new (void);
+GLIB_AVAILABLE_IN_ALL
+void g_timer_destroy (GTimer *timer);
+GLIB_AVAILABLE_IN_ALL
+void g_timer_start (GTimer *timer);
+GLIB_AVAILABLE_IN_ALL
+void g_timer_stop (GTimer *timer);
+GLIB_AVAILABLE_IN_ALL
+void g_timer_reset (GTimer *timer);
+GLIB_AVAILABLE_IN_ALL
+void g_timer_continue (GTimer *timer);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_timer_elapsed (GTimer *timer,
+ gulong *microseconds);
+GLIB_AVAILABLE_IN_2_62
+gboolean g_timer_is_active (GTimer *timer);
+
+GLIB_AVAILABLE_IN_ALL
+void g_usleep (gulong microseconds);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_62
+void g_time_val_add (GTimeVal *time_,
+ glong microseconds);
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_iso8601)
+gboolean g_time_val_from_iso8601 (const gchar *iso_date,
+ GTimeVal *time_);
+GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_format)
+gchar* g_time_val_to_iso8601 (GTimeVal *time_) G_GNUC_MALLOC;
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+G_END_DECLS
+
+#endif /* __G_TIMER_H__ */
diff --git a/include/glib/glib/gtimezone.h b/include/glib/glib/gtimezone.h
new file mode 100644
index 0000000000..4e8b10a715
--- /dev/null
+++ b/include/glib/glib/gtimezone.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_TIME_ZONE_H__
+#define __G_TIME_ZONE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GTimeZone GTimeZone;
+
+/**
+ * GTimeType:
+ * @G_TIME_TYPE_STANDARD: the time is in local standard time
+ * @G_TIME_TYPE_DAYLIGHT: the time is in local daylight time
+ * @G_TIME_TYPE_UNIVERSAL: the time is in UTC
+ *
+ * Disambiguates a given time in two ways.
+ *
+ * First, specifies if the given time is in universal or local time.
+ *
+ * Second, if the time is in local time, specifies if it is local
+ * standard time or local daylight time. This is important for the case
+ * where the same local time occurs twice (during daylight savings time
+ * transitions, for example).
+ */
+typedef enum
+{
+ G_TIME_TYPE_STANDARD,
+ G_TIME_TYPE_DAYLIGHT,
+ G_TIME_TYPE_UNIVERSAL
+} GTimeType;
+
+GLIB_AVAILABLE_IN_ALL
+GTimeZone * g_time_zone_new (const gchar *identifier);
+GLIB_AVAILABLE_IN_ALL
+GTimeZone * g_time_zone_new_utc (void);
+GLIB_AVAILABLE_IN_ALL
+GTimeZone * g_time_zone_new_local (void);
+GLIB_AVAILABLE_IN_2_58
+GTimeZone * g_time_zone_new_offset (gint32 seconds);
+
+GLIB_AVAILABLE_IN_ALL
+GTimeZone * g_time_zone_ref (GTimeZone *tz);
+GLIB_AVAILABLE_IN_ALL
+void g_time_zone_unref (GTimeZone *tz);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_time_zone_find_interval (GTimeZone *tz,
+ GTimeType type,
+ gint64 time_);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_time_zone_adjust_time (GTimeZone *tz,
+ GTimeType type,
+ gint64 *time_);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_time_zone_get_abbreviation (GTimeZone *tz,
+ gint interval);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_time_zone_get_offset (GTimeZone *tz,
+ gint interval);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_time_zone_is_dst (GTimeZone *tz,
+ gint interval);
+GLIB_AVAILABLE_IN_2_58
+const gchar * g_time_zone_get_identifier (GTimeZone *tz);
+
+G_END_DECLS
+
+#endif /* __G_TIME_ZONE_H__ */
diff --git a/include/glib/glib/gtrashstack.h b/include/glib/glib/gtrashstack.h
new file mode 100644
index 0000000000..0730ec296a
--- /dev/null
+++ b/include/glib/glib/gtrashstack.h
@@ -0,0 +1,58 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_TRASH_STACK_H__
+#define __G_TRASH_STACK_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gutils.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+typedef struct _GTrashStack GTrashStack GLIB_DEPRECATED_TYPE_IN_2_48;
+struct _GTrashStack
+{
+ GTrashStack *next;
+} GLIB_DEPRECATED_TYPE_IN_2_48;
+
+GLIB_DEPRECATED_IN_2_48
+void g_trash_stack_push (GTrashStack **stack_p,
+ gpointer data_p);
+GLIB_DEPRECATED_IN_2_48
+gpointer g_trash_stack_pop (GTrashStack **stack_p);
+GLIB_DEPRECATED_IN_2_48
+gpointer g_trash_stack_peek (GTrashStack **stack_p);
+GLIB_DEPRECATED_IN_2_48
+guint g_trash_stack_height (GTrashStack **stack_p);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+G_END_DECLS
+
+#endif /* __G_TRASH_STACK_H_ */
diff --git a/include/glib/glib/gtree.h b/include/glib/glib/gtree.h
new file mode 100644
index 0000000000..ceb148d6b1
--- /dev/null
+++ b/include/glib/glib/gtree.h
@@ -0,0 +1,104 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_TREE_H__
+#define __G_TREE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gnode.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GTree GTree;
+
+typedef gboolean (*GTraverseFunc) (gpointer key,
+ gpointer value,
+ gpointer data);
+
+/* Balanced binary trees
+ */
+GLIB_AVAILABLE_IN_ALL
+GTree* g_tree_new (GCompareFunc key_compare_func);
+GLIB_AVAILABLE_IN_ALL
+GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func,
+ gpointer key_compare_data);
+GLIB_AVAILABLE_IN_ALL
+GTree* g_tree_new_full (GCompareDataFunc key_compare_func,
+ gpointer key_compare_data,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+GLIB_AVAILABLE_IN_ALL
+GTree* g_tree_ref (GTree *tree);
+GLIB_AVAILABLE_IN_ALL
+void g_tree_unref (GTree *tree);
+GLIB_AVAILABLE_IN_ALL
+void g_tree_destroy (GTree *tree);
+GLIB_AVAILABLE_IN_ALL
+void g_tree_insert (GTree *tree,
+ gpointer key,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+void g_tree_replace (GTree *tree,
+ gpointer key,
+ gpointer value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tree_remove (GTree *tree,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tree_steal (GTree *tree,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_tree_lookup (GTree *tree,
+ gconstpointer key);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_tree_lookup_extended (GTree *tree,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value);
+GLIB_AVAILABLE_IN_ALL
+void g_tree_foreach (GTree *tree,
+ GTraverseFunc func,
+ gpointer user_data);
+
+GLIB_DEPRECATED
+void g_tree_traverse (GTree *tree,
+ GTraverseFunc traverse_func,
+ GTraverseType traverse_type,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_tree_search (GTree *tree,
+ GCompareFunc search_func,
+ gconstpointer user_data);
+GLIB_AVAILABLE_IN_ALL
+gint g_tree_height (GTree *tree);
+GLIB_AVAILABLE_IN_ALL
+gint g_tree_nnodes (GTree *tree);
+
+G_END_DECLS
+
+#endif /* __G_TREE_H__ */
diff --git a/include/glib/glib/gtypes.h b/include/glib/glib/gtypes.h
new file mode 100644
index 0000000000..111f1ad3ec
--- /dev/null
+++ b/include/glib/glib/gtypes.h
@@ -0,0 +1,585 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_TYPES_H__
+#define __G_TYPES_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glibconfig.h>
+#include <glib/gmacros.h>
+#include <glib/gversionmacros.h>
+#include <time.h>
+
+G_BEGIN_DECLS
+
+/* Provide type definitions for commonly used types.
+ * These are useful because a "gint8" can be adjusted
+ * to be 1 byte (8 bits) on all platforms. Similarly and
+ * more importantly, "gint32" can be adjusted to be
+ * 4 bytes (32 bits) on all platforms.
+ */
+
+typedef char gchar;
+typedef short gshort;
+typedef long glong;
+typedef int gint;
+typedef gint gboolean;
+
+typedef unsigned char guchar;
+typedef unsigned short gushort;
+typedef unsigned long gulong;
+typedef unsigned int guint;
+
+typedef float gfloat;
+typedef double gdouble;
+
+/* Define min and max constants for the fixed size numerical types */
+/**
+ * G_MININT8: (value -128)
+ *
+ * The minimum value which can be held in a #gint8.
+ *
+ * Since: 2.4
+ */
+#define G_MININT8 ((gint8) (-G_MAXINT8 - 1))
+#define G_MAXINT8 ((gint8) 0x7f)
+#define G_MAXUINT8 ((guint8) 0xff)
+
+/**
+ * G_MININT16: (value -32768)
+ *
+ * The minimum value which can be held in a #gint16.
+ *
+ * Since: 2.4
+ */
+#define G_MININT16 ((gint16) (-G_MAXINT16 - 1))
+#define G_MAXINT16 ((gint16) 0x7fff)
+#define G_MAXUINT16 ((guint16) 0xffff)
+
+/**
+ * G_MININT32: (value -2147483648)
+ *
+ * The minimum value which can be held in a #gint32.
+ *
+ * Since: 2.4
+ */
+#define G_MININT32 ((gint32) (-G_MAXINT32 - 1))
+#define G_MAXINT32 ((gint32) 0x7fffffff)
+#define G_MAXUINT32 ((guint32) 0xffffffff)
+
+/**
+ * G_MININT64: (value -9223372036854775808)
+ *
+ * The minimum value which can be held in a #gint64.
+ */
+#define G_MININT64 ((gint64) (-G_MAXINT64 - G_GINT64_CONSTANT(1)))
+#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff)
+#define G_MAXUINT64 G_GUINT64_CONSTANT(0xffffffffffffffff)
+
+typedef void* gpointer;
+typedef const void *gconstpointer;
+
+typedef gint (*GCompareFunc) (gconstpointer a,
+ gconstpointer b);
+typedef gint (*GCompareDataFunc) (gconstpointer a,
+ gconstpointer b,
+ gpointer user_data);
+typedef gboolean (*GEqualFunc) (gconstpointer a,
+ gconstpointer b);
+typedef void (*GDestroyNotify) (gpointer data);
+typedef void (*GFunc) (gpointer data,
+ gpointer user_data);
+typedef guint (*GHashFunc) (gconstpointer key);
+typedef void (*GHFunc) (gpointer key,
+ gpointer value,
+ gpointer user_data);
+
+/**
+ * GCopyFunc:
+ * @src: (not nullable): A pointer to the data which should be copied
+ * @data: Additional data
+ *
+ * A function of this signature is used to copy the node data
+ * when doing a deep-copy of a tree.
+ *
+ * Returns: (not nullable): A pointer to the copy
+ *
+ * Since: 2.4
+ */
+typedef gpointer (*GCopyFunc) (gconstpointer src,
+ gpointer data);
+/**
+ * GFreeFunc:
+ * @data: a data pointer
+ *
+ * Declares a type of function which takes an arbitrary
+ * data pointer argument and has no return value. It is
+ * not currently used in GLib or GTK+.
+ */
+typedef void (*GFreeFunc) (gpointer data);
+
+/**
+ * GTranslateFunc:
+ * @str: the untranslated string
+ * @data: user data specified when installing the function, e.g.
+ * in g_option_group_set_translate_func()
+ *
+ * The type of functions which are used to translate user-visible
+ * strings, for <option>--help</option> output.
+ *
+ * Returns: a translation of the string for the current locale.
+ * The returned string is owned by GLib and must not be freed.
+ */
+typedef const gchar * (*GTranslateFunc) (const gchar *str,
+ gpointer data);
+
+
+/* Define some mathematical constants that aren't available
+ * symbolically in some strict ISO C implementations.
+ *
+ * Note that the large number of digits used in these definitions
+ * doesn't imply that GLib or current computers in general would be
+ * able to handle floating point numbers with an accuracy like this.
+ * It's mostly an exercise in futility and future proofing. For
+ * extended precision floating point support, look somewhere else
+ * than GLib.
+ */
+#define G_E 2.7182818284590452353602874713526624977572470937000
+#define G_LN2 0.69314718055994530941723212145817656807550013436026
+#define G_LN10 2.3025850929940456840179914546843642076011014886288
+#define G_PI 3.1415926535897932384626433832795028841971693993751
+#define G_PI_2 1.5707963267948966192313216916397514420985846996876
+#define G_PI_4 0.78539816339744830961566084581987572104929234984378
+#define G_SQRT2 1.4142135623730950488016887242096980785696718753769
+
+/* Portable endian checks and conversions
+ *
+ * glibconfig.h defines G_BYTE_ORDER which expands to one of
+ * the below macros.
+ */
+#define G_LITTLE_ENDIAN 1234
+#define G_BIG_ENDIAN 4321
+#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
+
+
+/* Basic bit swapping functions
+ */
+#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
+ (guint16) ((guint16) (val) >> 8) | \
+ (guint16) ((guint16) (val) << 8)))
+
+#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \
+ (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \
+ (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \
+ (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
+
+#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56)))
+
+/* Arch specific stuff for speed
+ */
+#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
+
+# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
+# define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((guint32) (val)))
+# define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((guint64) (val)))
+# endif
+
+# if defined (__i386__)
+# define GUINT16_SWAP_LE_BE_IA32(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint16 __v, __x = ((guint16) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# if !defined (__i486__) && !defined (__i586__) \
+ && !defined (__pentium__) && !defined (__i686__) \
+ && !defined (__pentiumpro__) && !defined (__pentium4__)
+# define GUINT32_SWAP_LE_BE_IA32(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("rorw $8, %w0\n\t" \
+ "rorl $16, %0\n\t" \
+ "rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# else /* 486 and higher has bswap */
+# define GUINT32_SWAP_LE_BE_IA32(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswap %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+# endif /* processor specific 32-bit stuff */
+# define GUINT64_SWAP_LE_BE_IA32(val) \
+ (G_GNUC_EXTENSION \
+ ({ union { guint64 __ll; \
+ guint32 __l[2]; } __w, __r; \
+ __w.__ll = ((guint64) (val)); \
+ if (__builtin_constant_p (__w.__ll)) \
+ __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \
+ else \
+ { \
+ __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \
+ __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
+ } \
+ __r.__ll; }))
+ /* Possibly just use the constant version and let gcc figure it out? */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
+# endif
+# elif defined (__ia64__)
+# define GUINT16_SWAP_LE_BE_IA64(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint16 __v, __x = ((guint16) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \
+ "mux1 %0 = %0, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT32_SWAP_LE_BE_IA64(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \
+ "mux1 %0 = %0, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT64_SWAP_LE_BE_IA64(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint64 __v, __x = ((guint64) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
+# endif
+# elif defined (__x86_64__)
+# define GUINT32_SWAP_LE_BE_X86_64(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswapl %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+# define GUINT64_SWAP_LE_BE_X86_64(val) \
+ (G_GNUC_EXTENSION \
+ ({ guint64 __v, __x = ((guint64) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswapq %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+ /* gcc seems to figure out optimal code for this on its own */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
+# endif
+# else /* generic gcc */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+# endif
+# endif
+#else /* generic */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+#endif /* generic */
+
+#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val))
+#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val))
+#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \
+ (((guint32) (val) & (guint32) 0xffff0000U) >> 16)))
+#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
+ (((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
+
+/* The G*_TO_?E() macros are defined in glibconfig.h.
+ * The transformation is symmetric, so the FROM just maps to the TO.
+ */
+#define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
+#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
+#define GINT16_FROM_BE(val) (GINT16_TO_BE (val))
+#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val))
+#define GINT32_FROM_LE(val) (GINT32_TO_LE (val))
+#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val))
+#define GINT32_FROM_BE(val) (GINT32_TO_BE (val))
+#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val))
+
+#define GINT64_FROM_LE(val) (GINT64_TO_LE (val))
+#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val))
+#define GINT64_FROM_BE(val) (GINT64_TO_BE (val))
+#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val))
+
+#define GLONG_FROM_LE(val) (GLONG_TO_LE (val))
+#define GULONG_FROM_LE(val) (GULONG_TO_LE (val))
+#define GLONG_FROM_BE(val) (GLONG_TO_BE (val))
+#define GULONG_FROM_BE(val) (GULONG_TO_BE (val))
+
+#define GINT_FROM_LE(val) (GINT_TO_LE (val))
+#define GUINT_FROM_LE(val) (GUINT_TO_LE (val))
+#define GINT_FROM_BE(val) (GINT_TO_BE (val))
+#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
+
+#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val))
+#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val))
+#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val))
+#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val))
+
+/* Portable versions of host-network order stuff
+ */
+#define g_ntohl(val) (GUINT32_FROM_BE (val))
+#define g_ntohs(val) (GUINT16_FROM_BE (val))
+#define g_htonl(val) (GUINT32_TO_BE (val))
+#define g_htons(val) (GUINT16_TO_BE (val))
+
+/* Overflow-checked unsigned integer arithmetic
+ */
+#ifndef _GLIB_TEST_OVERFLOW_FALLBACK
+/* https://bugzilla.gnome.org/show_bug.cgi?id=769104 */
+#if __GNUC__ >= 5 && !defined(__INTEL_COMPILER)
+#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
+#elif g_macro__has_builtin(__builtin_uadd_overflow)
+#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
+#endif
+#endif
+
+#define g_uint_checked_add(dest, a, b) \
+ _GLIB_CHECKED_ADD_U32(dest, a, b)
+#define g_uint_checked_mul(dest, a, b) \
+ _GLIB_CHECKED_MUL_U32(dest, a, b)
+
+#define g_uint64_checked_add(dest, a, b) \
+ _GLIB_CHECKED_ADD_U64(dest, a, b)
+#define g_uint64_checked_mul(dest, a, b) \
+ _GLIB_CHECKED_MUL_U64(dest, a, b)
+
+#if GLIB_SIZEOF_SIZE_T == 8
+#define g_size_checked_add(dest, a, b) \
+ _GLIB_CHECKED_ADD_U64(dest, a, b)
+#define g_size_checked_mul(dest, a, b) \
+ _GLIB_CHECKED_MUL_U64(dest, a, b)
+#else
+#define g_size_checked_add(dest, a, b) \
+ _GLIB_CHECKED_ADD_U32(dest, a, b)
+#define g_size_checked_mul(dest, a, b) \
+ _GLIB_CHECKED_MUL_U32(dest, a, b)
+#endif
+
+/* FIXME: Hide this from gtkdoc scanner because it confuses its poor regexes.
+ * https://gitlab.gnome.org/GNOME/gtk-doc/issues/90 */
+#ifndef __GTK_DOC_IGNORE__
+/* The names of the following inlines are private. Use the macro
+ * definitions above.
+ */
+#ifdef _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
+static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) {
+ return !__builtin_uadd_overflow(a, b, dest); }
+static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) {
+ return !__builtin_umul_overflow(a, b, dest); }
+static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) {
+ G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
+ return !__builtin_uaddll_overflow(a, b, (unsigned long long *) dest); }
+static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) {
+ return !__builtin_umulll_overflow(a, b, (unsigned long long *) dest); }
+#else
+static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) {
+ *dest = a + b; return *dest >= a; }
+static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) {
+ *dest = a * b; return !a || *dest / a == b; }
+static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) {
+ *dest = a + b; return *dest >= a; }
+static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) {
+ *dest = a * b; return !a || *dest / a == b; }
+#endif
+#endif /* __GTK_DOC_IGNORE__ */
+
+/* IEEE Standard 754 Single Precision Storage Format (gfloat):
+ *
+ * 31 30 23 22 0
+ * +--------+---------------+---------------+
+ * | s 1bit | e[30:23] 8bit | f[22:0] 23bit |
+ * +--------+---------------+---------------+
+ * B0------------------->B1------->B2-->B3-->
+ *
+ * IEEE Standard 754 Double Precision Storage Format (gdouble):
+ *
+ * 63 62 52 51 32 31 0
+ * +--------+----------------+----------------+ +---------------+
+ * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit |
+ * +--------+----------------+----------------+ +---------------+
+ * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7->
+ */
+/* subtract from biased_exponent to form base2 exponent (normal numbers) */
+typedef union _GDoubleIEEE754 GDoubleIEEE754;
+typedef union _GFloatIEEE754 GFloatIEEE754;
+#define G_IEEE754_FLOAT_BIAS (127)
+#define G_IEEE754_DOUBLE_BIAS (1023)
+/* multiply with base2 exponent to get base10 exponent (normal numbers) */
+#define G_LOG_2_BASE_10 (0.30102999566398119521)
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+union _GFloatIEEE754
+{
+ gfloat v_float;
+ struct {
+ guint mantissa : 23;
+ guint biased_exponent : 8;
+ guint sign : 1;
+ } mpn;
+};
+union _GDoubleIEEE754
+{
+ gdouble v_double;
+ struct {
+ guint mantissa_low : 32;
+ guint mantissa_high : 20;
+ guint biased_exponent : 11;
+ guint sign : 1;
+ } mpn;
+};
+#elif G_BYTE_ORDER == G_BIG_ENDIAN
+union _GFloatIEEE754
+{
+ gfloat v_float;
+ struct {
+ guint sign : 1;
+ guint biased_exponent : 8;
+ guint mantissa : 23;
+ } mpn;
+};
+union _GDoubleIEEE754
+{
+ gdouble v_double;
+ struct {
+ guint sign : 1;
+ guint biased_exponent : 11;
+ guint mantissa_high : 20;
+ guint mantissa_low : 32;
+ } mpn;
+};
+#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+#error unknown ENDIAN type
+#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+
+typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
+
+struct _GTimeVal
+{
+ glong tv_sec;
+ glong tv_usec;
+} GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
+
+typedef gint grefcount;
+typedef volatile gint gatomicrefcount;
+
+G_END_DECLS
+
+/* We prefix variable declarations so they can
+ * properly get exported in Windows DLLs.
+ */
+#ifndef GLIB_VAR
+# ifdef G_PLATFORM_WIN32
+# ifdef GLIB_STATIC_COMPILATION
+# define GLIB_VAR extern
+# else /* !GLIB_STATIC_COMPILATION */
+# ifdef GLIB_COMPILATION
+# ifdef DLL_EXPORT
+# define GLIB_VAR extern __declspec(dllexport)
+# else /* !DLL_EXPORT */
+# define GLIB_VAR extern
+# endif /* !DLL_EXPORT */
+# else /* !GLIB_COMPILATION */
+# define GLIB_VAR extern __declspec(dllimport)
+# endif /* !GLIB_COMPILATION */
+# endif /* !GLIB_STATIC_COMPILATION */
+# else /* !G_PLATFORM_WIN32 */
+# define GLIB_VAR _GLIB_EXTERN
+# endif /* !G_PLATFORM_WIN32 */
+#endif /* GLIB_VAR */
+
+#endif /* __G_TYPES_H__ */
diff --git a/include/glib/glib/gunicode.h b/include/glib/glib/gunicode.h
new file mode 100644
index 0000000000..5663aec7ee
--- /dev/null
+++ b/include/glib/glib/gunicode.h
@@ -0,0 +1,929 @@
+/* gunicode.h - Unicode manipulation functions
+ *
+ * Copyright (C) 1999, 2000 Tom Tromey
+ * Copyright 2000, 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_UNICODE_H__
+#define __G_UNICODE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gerror.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * gunichar:
+ *
+ * A type which can hold any UTF-32 or UCS-4 character code,
+ * also known as a Unicode code point.
+ *
+ * If you want to produce the UTF-8 representation of a #gunichar,
+ * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse
+ * process.
+ *
+ * To print/scan values of this type as integer, use
+ * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
+ *
+ * The notation to express a Unicode code point in running text is
+ * as a hexadecimal number with four to six digits and uppercase
+ * letters, prefixed by the string "U+". Leading zeros are omitted,
+ * unless the code point would have fewer than four hexadecimal digits.
+ * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point
+ * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X".
+ * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X".
+ *
+ * |[
+ * gunichar c;
+ * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &amp;c)
+ * g_print ("Read U+%04"G_GINT32_FORMAT"X", c);
+ * ]|
+ */
+typedef guint32 gunichar;
+
+/**
+ * gunichar2:
+ *
+ * A type which can hold any UTF-16 code
+ * point<footnote id="utf16_surrogate_pairs">UTF-16 also has so called
+ * <firstterm>surrogate pairs</firstterm> to encode characters beyond
+ * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored
+ * in a single gunichar2 field, but all GLib functions accepting gunichar2
+ * arrays will correctly interpret surrogate pairs.</footnote>.
+ *
+ * To print/scan values of this type to/from text you need to convert
+ * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16().
+ *
+ * To print/scan values of this type as integer, use
+ * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
+ */
+typedef guint16 gunichar2;
+
+/**
+ * GUnicodeType:
+ * @G_UNICODE_CONTROL: General category "Other, Control" (Cc)
+ * @G_UNICODE_FORMAT: General category "Other, Format" (Cf)
+ * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn)
+ * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co)
+ * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs)
+ * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll)
+ * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm)
+ * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo)
+ * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt)
+ * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu)
+ * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc)
+ * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me)
+ * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn)
+ * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd)
+ * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl)
+ * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No)
+ * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc)
+ * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd)
+ * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe)
+ * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf)
+ * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi)
+ * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po)
+ * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps)
+ * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc)
+ * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk)
+ * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm)
+ * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So)
+ * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl)
+ * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp)
+ * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs)
+ *
+ * These are the possible character classifications from the
+ * Unicode specification.
+ * See [Unicode Character Database](http://www.unicode.org/reports/tr44/#General_Category_Values).
+ */
+typedef enum
+{
+ G_UNICODE_CONTROL,
+ G_UNICODE_FORMAT,
+ G_UNICODE_UNASSIGNED,
+ G_UNICODE_PRIVATE_USE,
+ G_UNICODE_SURROGATE,
+ G_UNICODE_LOWERCASE_LETTER,
+ G_UNICODE_MODIFIER_LETTER,
+ G_UNICODE_OTHER_LETTER,
+ G_UNICODE_TITLECASE_LETTER,
+ G_UNICODE_UPPERCASE_LETTER,
+ G_UNICODE_SPACING_MARK,
+ G_UNICODE_ENCLOSING_MARK,
+ G_UNICODE_NON_SPACING_MARK,
+ G_UNICODE_DECIMAL_NUMBER,
+ G_UNICODE_LETTER_NUMBER,
+ G_UNICODE_OTHER_NUMBER,
+ G_UNICODE_CONNECT_PUNCTUATION,
+ G_UNICODE_DASH_PUNCTUATION,
+ G_UNICODE_CLOSE_PUNCTUATION,
+ G_UNICODE_FINAL_PUNCTUATION,
+ G_UNICODE_INITIAL_PUNCTUATION,
+ G_UNICODE_OTHER_PUNCTUATION,
+ G_UNICODE_OPEN_PUNCTUATION,
+ G_UNICODE_CURRENCY_SYMBOL,
+ G_UNICODE_MODIFIER_SYMBOL,
+ G_UNICODE_MATH_SYMBOL,
+ G_UNICODE_OTHER_SYMBOL,
+ G_UNICODE_LINE_SEPARATOR,
+ G_UNICODE_PARAGRAPH_SEPARATOR,
+ G_UNICODE_SPACE_SEPARATOR
+} GUnicodeType;
+
+/**
+ * G_UNICODE_COMBINING_MARK:
+ *
+ * Older name for %G_UNICODE_SPACING_MARK.
+ *
+ * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK.
+ */
+#define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK GLIB_DEPRECATED_MACRO_IN_2_30_FOR(G_UNICODE_SPACING_MARK)
+
+/**
+ * GUnicodeBreakType:
+ * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK)
+ * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR)
+ * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF)
+ * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM)
+ * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG)
+ * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW)
+ * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN)
+ * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL)
+ * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB)
+ * @G_UNICODE_BREAK_SPACE: Space (SP)
+ * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA)
+ * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB)
+ * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2)
+ * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY)
+ * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS)
+ * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP)
+ * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL)
+ * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU)
+ * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX)
+ * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID)
+ * @G_UNICODE_BREAK_NUMERIC: Numeric (NU)
+ * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS)
+ * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY)
+ * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL)
+ * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR)
+ * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO)
+ * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA)
+ * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI)
+ * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX)
+ * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL)
+ * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ)
+ * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL)
+ * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV)
+ * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT)
+ * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2)
+ * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3)
+ * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28
+ * @G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER: Conditional Japanese Starter (CJ). Since: 2.32
+ * @G_UNICODE_BREAK_HEBREW_LETTER: Hebrew Letter (HL). Since: 2.32
+ * @G_UNICODE_BREAK_REGIONAL_INDICATOR: Regional Indicator (RI). Since: 2.36
+ * @G_UNICODE_BREAK_EMOJI_BASE: Emoji Base (EB). Since: 2.50
+ * @G_UNICODE_BREAK_EMOJI_MODIFIER: Emoji Modifier (EM). Since: 2.50
+ * @G_UNICODE_BREAK_ZERO_WIDTH_JOINER: Zero Width Joiner (ZWJ). Since: 2.50
+ *
+ * These are the possible line break classifications.
+ *
+ * Since new unicode versions may add new types here, applications should be ready
+ * to handle unknown values. They may be regarded as %G_UNICODE_BREAK_UNKNOWN.
+ *
+ * See [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/).
+ */
+typedef enum
+{
+ G_UNICODE_BREAK_MANDATORY,
+ G_UNICODE_BREAK_CARRIAGE_RETURN,
+ G_UNICODE_BREAK_LINE_FEED,
+ G_UNICODE_BREAK_COMBINING_MARK,
+ G_UNICODE_BREAK_SURROGATE,
+ G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+ G_UNICODE_BREAK_INSEPARABLE,
+ G_UNICODE_BREAK_NON_BREAKING_GLUE,
+ G_UNICODE_BREAK_CONTINGENT,
+ G_UNICODE_BREAK_SPACE,
+ G_UNICODE_BREAK_AFTER,
+ G_UNICODE_BREAK_BEFORE,
+ G_UNICODE_BREAK_BEFORE_AND_AFTER,
+ G_UNICODE_BREAK_HYPHEN,
+ G_UNICODE_BREAK_NON_STARTER,
+ G_UNICODE_BREAK_OPEN_PUNCTUATION,
+ G_UNICODE_BREAK_CLOSE_PUNCTUATION,
+ G_UNICODE_BREAK_QUOTATION,
+ G_UNICODE_BREAK_EXCLAMATION,
+ G_UNICODE_BREAK_IDEOGRAPHIC,
+ G_UNICODE_BREAK_NUMERIC,
+ G_UNICODE_BREAK_INFIX_SEPARATOR,
+ G_UNICODE_BREAK_SYMBOL,
+ G_UNICODE_BREAK_ALPHABETIC,
+ G_UNICODE_BREAK_PREFIX,
+ G_UNICODE_BREAK_POSTFIX,
+ G_UNICODE_BREAK_COMPLEX_CONTEXT,
+ G_UNICODE_BREAK_AMBIGUOUS,
+ G_UNICODE_BREAK_UNKNOWN,
+ G_UNICODE_BREAK_NEXT_LINE,
+ G_UNICODE_BREAK_WORD_JOINER,
+ G_UNICODE_BREAK_HANGUL_L_JAMO,
+ G_UNICODE_BREAK_HANGUL_V_JAMO,
+ G_UNICODE_BREAK_HANGUL_T_JAMO,
+ G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+ G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE,
+ G_UNICODE_BREAK_CLOSE_PARANTHESIS,
+ G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER,
+ G_UNICODE_BREAK_HEBREW_LETTER,
+ G_UNICODE_BREAK_REGIONAL_INDICATOR,
+ G_UNICODE_BREAK_EMOJI_BASE,
+ G_UNICODE_BREAK_EMOJI_MODIFIER,
+ G_UNICODE_BREAK_ZERO_WIDTH_JOINER
+} GUnicodeBreakType;
+
+/**
+ * GUnicodeScript:
+ * @G_UNICODE_SCRIPT_INVALID_CODE:
+ * a value never returned from g_unichar_get_script()
+ * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts
+ * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the
+ * base glyph to which it is attached
+ * @G_UNICODE_SCRIPT_ARABIC: Arabic
+ * @G_UNICODE_SCRIPT_ARMENIAN: Armenian
+ * @G_UNICODE_SCRIPT_BENGALI: Bengali
+ * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo
+ * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee
+ * @G_UNICODE_SCRIPT_COPTIC: Coptic
+ * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic
+ * @G_UNICODE_SCRIPT_DESERET: Deseret
+ * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari
+ * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic
+ * @G_UNICODE_SCRIPT_GEORGIAN: Georgian
+ * @G_UNICODE_SCRIPT_GOTHIC: Gothic
+ * @G_UNICODE_SCRIPT_GREEK: Greek
+ * @G_UNICODE_SCRIPT_GUJARATI: Gujarati
+ * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi
+ * @G_UNICODE_SCRIPT_HAN: Han
+ * @G_UNICODE_SCRIPT_HANGUL: Hangul
+ * @G_UNICODE_SCRIPT_HEBREW: Hebrew
+ * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana
+ * @G_UNICODE_SCRIPT_KANNADA: Kannada
+ * @G_UNICODE_SCRIPT_KATAKANA: Katakana
+ * @G_UNICODE_SCRIPT_KHMER: Khmer
+ * @G_UNICODE_SCRIPT_LAO: Lao
+ * @G_UNICODE_SCRIPT_LATIN: Latin
+ * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam
+ * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian
+ * @G_UNICODE_SCRIPT_MYANMAR: Myanmar
+ * @G_UNICODE_SCRIPT_OGHAM: Ogham
+ * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic
+ * @G_UNICODE_SCRIPT_ORIYA: Oriya
+ * @G_UNICODE_SCRIPT_RUNIC: Runic
+ * @G_UNICODE_SCRIPT_SINHALA: Sinhala
+ * @G_UNICODE_SCRIPT_SYRIAC: Syriac
+ * @G_UNICODE_SCRIPT_TAMIL: Tamil
+ * @G_UNICODE_SCRIPT_TELUGU: Telugu
+ * @G_UNICODE_SCRIPT_THAANA: Thaana
+ * @G_UNICODE_SCRIPT_THAI: Thai
+ * @G_UNICODE_SCRIPT_TIBETAN: Tibetan
+ * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL:
+ * Canadian Aboriginal
+ * @G_UNICODE_SCRIPT_YI: Yi
+ * @G_UNICODE_SCRIPT_TAGALOG: Tagalog
+ * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo
+ * @G_UNICODE_SCRIPT_BUHID: Buhid
+ * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa
+ * @G_UNICODE_SCRIPT_BRAILLE: Braille
+ * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot
+ * @G_UNICODE_SCRIPT_LIMBU: Limbu
+ * @G_UNICODE_SCRIPT_OSMANYA: Osmanya
+ * @G_UNICODE_SCRIPT_SHAVIAN: Shavian
+ * @G_UNICODE_SCRIPT_LINEAR_B: Linear B
+ * @G_UNICODE_SCRIPT_TAI_LE: Tai Le
+ * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic
+ * @G_UNICODE_SCRIPT_NEW_TAI_LUE:
+ * New Tai Lue
+ * @G_UNICODE_SCRIPT_BUGINESE: Buginese
+ * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic
+ * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh
+ * @G_UNICODE_SCRIPT_SYLOTI_NAGRI:
+ * Syloti Nagri
+ * @G_UNICODE_SCRIPT_OLD_PERSIAN:
+ * Old Persian
+ * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi
+ * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point
+ * @G_UNICODE_SCRIPT_BALINESE: Balinese
+ * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform
+ * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician
+ * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa
+ * @G_UNICODE_SCRIPT_NKO: N'Ko
+ * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3
+ * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3
+ * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3
+ * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3
+ * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3
+ * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3
+ * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3
+ * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3
+ * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3
+ * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3
+ * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3
+ * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26
+ * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26
+ * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS:
+ * Egyptian Hieroglpyhs. Since 2.26
+ * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC:
+ * Imperial Aramaic. Since 2.26
+ * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI:
+ * Inscriptional Pahlavi. Since 2.26
+ * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN:
+ * Inscriptional Parthian. Since 2.26
+ * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26
+ * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26
+ * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26
+ * @G_UNICODE_SCRIPT_MEETEI_MAYEK:
+ * Meetei Mayek. Since 2.26
+ * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN:
+ * Old South Arabian. Since 2.26
+ * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28
+ * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26
+ * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26
+ * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26
+ * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28
+ * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28
+ * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28
+ * @G_UNICODE_SCRIPT_CHAKMA: Chakma. Since: 2.32
+ * @G_UNICODE_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 2.32
+ * @G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 2.32
+ * @G_UNICODE_SCRIPT_MIAO: Miao. Since: 2.32
+ * @G_UNICODE_SCRIPT_SHARADA: Sharada. Since: 2.32
+ * @G_UNICODE_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 2.32
+ * @G_UNICODE_SCRIPT_TAKRI: Takri. Since: 2.32
+ * @G_UNICODE_SCRIPT_BASSA_VAH: Bassa. Since: 2.42
+ * @G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN: Caucasian Albanian. Since: 2.42
+ * @G_UNICODE_SCRIPT_DUPLOYAN: Duployan. Since: 2.42
+ * @G_UNICODE_SCRIPT_ELBASAN: Elbasan. Since: 2.42
+ * @G_UNICODE_SCRIPT_GRANTHA: Grantha. Since: 2.42
+ * @G_UNICODE_SCRIPT_KHOJKI: Kjohki. Since: 2.42
+ * @G_UNICODE_SCRIPT_KHUDAWADI: Khudawadi, Sindhi. Since: 2.42
+ * @G_UNICODE_SCRIPT_LINEAR_A: Linear A. Since: 2.42
+ * @G_UNICODE_SCRIPT_MAHAJANI: Mahajani. Since: 2.42
+ * @G_UNICODE_SCRIPT_MANICHAEAN: Manichaean. Since: 2.42
+ * @G_UNICODE_SCRIPT_MENDE_KIKAKUI: Mende Kikakui. Since: 2.42
+ * @G_UNICODE_SCRIPT_MODI: Modi. Since: 2.42
+ * @G_UNICODE_SCRIPT_MRO: Mro. Since: 2.42
+ * @G_UNICODE_SCRIPT_NABATAEAN: Nabataean. Since: 2.42
+ * @G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN: Old North Arabian. Since: 2.42
+ * @G_UNICODE_SCRIPT_OLD_PERMIC: Old Permic. Since: 2.42
+ * @G_UNICODE_SCRIPT_PAHAWH_HMONG: Pahawh Hmong. Since: 2.42
+ * @G_UNICODE_SCRIPT_PALMYRENE: Palmyrene. Since: 2.42
+ * @G_UNICODE_SCRIPT_PAU_CIN_HAU: Pau Cin Hau. Since: 2.42
+ * @G_UNICODE_SCRIPT_PSALTER_PAHLAVI: Psalter Pahlavi. Since: 2.42
+ * @G_UNICODE_SCRIPT_SIDDHAM: Siddham. Since: 2.42
+ * @G_UNICODE_SCRIPT_TIRHUTA: Tirhuta. Since: 2.42
+ * @G_UNICODE_SCRIPT_WARANG_CITI: Warang Citi. Since: 2.42
+ * @G_UNICODE_SCRIPT_AHOM: Ahom. Since: 2.48
+ * @G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS: Anatolian Hieroglyphs. Since: 2.48
+ * @G_UNICODE_SCRIPT_HATRAN: Hatran. Since: 2.48
+ * @G_UNICODE_SCRIPT_MULTANI: Multani. Since: 2.48
+ * @G_UNICODE_SCRIPT_OLD_HUNGARIAN: Old Hungarian. Since: 2.48
+ * @G_UNICODE_SCRIPT_SIGNWRITING: Signwriting. Since: 2.48
+ * @G_UNICODE_SCRIPT_ADLAM: Adlam. Since: 2.50
+ * @G_UNICODE_SCRIPT_BHAIKSUKI: Bhaiksuki. Since: 2.50
+ * @G_UNICODE_SCRIPT_MARCHEN: Marchen. Since: 2.50
+ * @G_UNICODE_SCRIPT_NEWA: Newa. Since: 2.50
+ * @G_UNICODE_SCRIPT_OSAGE: Osage. Since: 2.50
+ * @G_UNICODE_SCRIPT_TANGUT: Tangut. Since: 2.50
+ * @G_UNICODE_SCRIPT_MASARAM_GONDI: Masaram Gondi. Since: 2.54
+ * @G_UNICODE_SCRIPT_NUSHU: Nushu. Since: 2.54
+ * @G_UNICODE_SCRIPT_SOYOMBO: Soyombo. Since: 2.54
+ * @G_UNICODE_SCRIPT_ZANABAZAR_SQUARE: Zanabazar Square. Since: 2.54
+ * @G_UNICODE_SCRIPT_DOGRA: Dogra. Since: 2.58
+ * @G_UNICODE_SCRIPT_GUNJALA_GONDI: Gunjala Gondi. Since: 2.58
+ * @G_UNICODE_SCRIPT_HANIFI_ROHINGYA: Hanifi Rohingya. Since: 2.58
+ * @G_UNICODE_SCRIPT_MAKASAR: Makasar. Since: 2.58
+ * @G_UNICODE_SCRIPT_MEDEFAIDRIN: Medefaidrin. Since: 2.58
+ * @G_UNICODE_SCRIPT_OLD_SOGDIAN: Old Sogdian. Since: 2.58
+ * @G_UNICODE_SCRIPT_SOGDIAN: Sogdian. Since: 2.58
+ * @G_UNICODE_SCRIPT_ELYMAIC: Elym. Since: 2.62
+ * @G_UNICODE_SCRIPT_NANDINAGARI: Nand. Since: 2.62
+ * @G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG: Rohg. Since: 2.62
+ * @G_UNICODE_SCRIPT_WANCHO: Wcho. Since: 2.62
+ *
+ * The #GUnicodeScript enumeration identifies different writing
+ * systems. The values correspond to the names as defined in the
+ * Unicode standard. The enumeration has been added in GLib 2.14,
+ * and is interchangeable with #PangoScript.
+ *
+ * Note that new types may be added in the future. Applications
+ * should be ready to handle unknown values.
+ * See [Unicode Standard Annex #24: Script names](http://www.unicode.org/reports/tr24/).
+ */
+typedef enum
+{ /* ISO 15924 code */
+ G_UNICODE_SCRIPT_INVALID_CODE = -1,
+ G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */
+ G_UNICODE_SCRIPT_INHERITED, /* Zinh (Qaai) */
+ G_UNICODE_SCRIPT_ARABIC, /* Arab */
+ G_UNICODE_SCRIPT_ARMENIAN, /* Armn */
+ G_UNICODE_SCRIPT_BENGALI, /* Beng */
+ G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */
+ G_UNICODE_SCRIPT_CHEROKEE, /* Cher */
+ G_UNICODE_SCRIPT_COPTIC, /* Copt (Qaac) */
+ G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
+ G_UNICODE_SCRIPT_DESERET, /* Dsrt */
+ G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */
+ G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */
+ G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
+ G_UNICODE_SCRIPT_GOTHIC, /* Goth */
+ G_UNICODE_SCRIPT_GREEK, /* Grek */
+ G_UNICODE_SCRIPT_GUJARATI, /* Gujr */
+ G_UNICODE_SCRIPT_GURMUKHI, /* Guru */
+ G_UNICODE_SCRIPT_HAN, /* Hani */
+ G_UNICODE_SCRIPT_HANGUL, /* Hang */
+ G_UNICODE_SCRIPT_HEBREW, /* Hebr */
+ G_UNICODE_SCRIPT_HIRAGANA, /* Hira */
+ G_UNICODE_SCRIPT_KANNADA, /* Knda */
+ G_UNICODE_SCRIPT_KATAKANA, /* Kana */
+ G_UNICODE_SCRIPT_KHMER, /* Khmr */
+ G_UNICODE_SCRIPT_LAO, /* Laoo */
+ G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
+ G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */
+ G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */
+ G_UNICODE_SCRIPT_MYANMAR, /* Mymr */
+ G_UNICODE_SCRIPT_OGHAM, /* Ogam */
+ G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */
+ G_UNICODE_SCRIPT_ORIYA, /* Orya */
+ G_UNICODE_SCRIPT_RUNIC, /* Runr */
+ G_UNICODE_SCRIPT_SINHALA, /* Sinh */
+ G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
+ G_UNICODE_SCRIPT_TAMIL, /* Taml */
+ G_UNICODE_SCRIPT_TELUGU, /* Telu */
+ G_UNICODE_SCRIPT_THAANA, /* Thaa */
+ G_UNICODE_SCRIPT_THAI, /* Thai */
+ G_UNICODE_SCRIPT_TIBETAN, /* Tibt */
+ G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
+ G_UNICODE_SCRIPT_YI, /* Yiii */
+ G_UNICODE_SCRIPT_TAGALOG, /* Tglg */
+ G_UNICODE_SCRIPT_HANUNOO, /* Hano */
+ G_UNICODE_SCRIPT_BUHID, /* Buhd */
+ G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */
+
+ /* Unicode-4.0 additions */
+ G_UNICODE_SCRIPT_BRAILLE, /* Brai */
+ G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */
+ G_UNICODE_SCRIPT_LIMBU, /* Limb */
+ G_UNICODE_SCRIPT_OSMANYA, /* Osma */
+ G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */
+ G_UNICODE_SCRIPT_LINEAR_B, /* Linb */
+ G_UNICODE_SCRIPT_TAI_LE, /* Tale */
+ G_UNICODE_SCRIPT_UGARITIC, /* Ugar */
+
+ /* Unicode-4.1 additions */
+ G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */
+ G_UNICODE_SCRIPT_BUGINESE, /* Bugi */
+ G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */
+ G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */
+ G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
+ G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */
+ G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */
+
+ /* Unicode-5.0 additions */
+ G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */
+ G_UNICODE_SCRIPT_BALINESE, /* Bali */
+ G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */
+ G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */
+ G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */
+ G_UNICODE_SCRIPT_NKO, /* Nkoo */
+
+ /* Unicode-5.1 additions */
+ G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */
+ G_UNICODE_SCRIPT_LEPCHA, /* Lepc */
+ G_UNICODE_SCRIPT_REJANG, /* Rjng */
+ G_UNICODE_SCRIPT_SUNDANESE, /* Sund */
+ G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */
+ G_UNICODE_SCRIPT_CHAM, /* Cham */
+ G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */
+ G_UNICODE_SCRIPT_VAI, /* Vaii */
+ G_UNICODE_SCRIPT_CARIAN, /* Cari */
+ G_UNICODE_SCRIPT_LYCIAN, /* Lyci */
+ G_UNICODE_SCRIPT_LYDIAN, /* Lydi */
+
+ /* Unicode-5.2 additions */
+ G_UNICODE_SCRIPT_AVESTAN, /* Avst */
+ G_UNICODE_SCRIPT_BAMUM, /* Bamu */
+ G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */
+ G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */
+ G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */
+ G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */
+ G_UNICODE_SCRIPT_JAVANESE, /* Java */
+ G_UNICODE_SCRIPT_KAITHI, /* Kthi */
+ G_UNICODE_SCRIPT_LISU, /* Lisu */
+ G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */
+ G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */
+ G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */
+ G_UNICODE_SCRIPT_SAMARITAN, /* Samr */
+ G_UNICODE_SCRIPT_TAI_THAM, /* Lana */
+ G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */
+
+ /* Unicode-6.0 additions */
+ G_UNICODE_SCRIPT_BATAK, /* Batk */
+ G_UNICODE_SCRIPT_BRAHMI, /* Brah */
+ G_UNICODE_SCRIPT_MANDAIC, /* Mand */
+
+ /* Unicode-6.1 additions */
+ G_UNICODE_SCRIPT_CHAKMA, /* Cakm */
+ G_UNICODE_SCRIPT_MEROITIC_CURSIVE, /* Merc */
+ G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, /* Mero */
+ G_UNICODE_SCRIPT_MIAO, /* Plrd */
+ G_UNICODE_SCRIPT_SHARADA, /* Shrd */
+ G_UNICODE_SCRIPT_SORA_SOMPENG, /* Sora */
+ G_UNICODE_SCRIPT_TAKRI, /* Takr */
+
+ /* Unicode 7.0 additions */
+ G_UNICODE_SCRIPT_BASSA_VAH, /* Bass */
+ G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, /* Aghb */
+ G_UNICODE_SCRIPT_DUPLOYAN, /* Dupl */
+ G_UNICODE_SCRIPT_ELBASAN, /* Elba */
+ G_UNICODE_SCRIPT_GRANTHA, /* Gran */
+ G_UNICODE_SCRIPT_KHOJKI, /* Khoj */
+ G_UNICODE_SCRIPT_KHUDAWADI, /* Sind */
+ G_UNICODE_SCRIPT_LINEAR_A, /* Lina */
+ G_UNICODE_SCRIPT_MAHAJANI, /* Mahj */
+ G_UNICODE_SCRIPT_MANICHAEAN, /* Mani */
+ G_UNICODE_SCRIPT_MENDE_KIKAKUI, /* Mend */
+ G_UNICODE_SCRIPT_MODI, /* Modi */
+ G_UNICODE_SCRIPT_MRO, /* Mroo */
+ G_UNICODE_SCRIPT_NABATAEAN, /* Nbat */
+ G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, /* Narb */
+ G_UNICODE_SCRIPT_OLD_PERMIC, /* Perm */
+ G_UNICODE_SCRIPT_PAHAWH_HMONG, /* Hmng */
+ G_UNICODE_SCRIPT_PALMYRENE, /* Palm */
+ G_UNICODE_SCRIPT_PAU_CIN_HAU, /* Pauc */
+ G_UNICODE_SCRIPT_PSALTER_PAHLAVI, /* Phlp */
+ G_UNICODE_SCRIPT_SIDDHAM, /* Sidd */
+ G_UNICODE_SCRIPT_TIRHUTA, /* Tirh */
+ G_UNICODE_SCRIPT_WARANG_CITI, /* Wara */
+
+ /* Unicode 8.0 additions */
+ G_UNICODE_SCRIPT_AHOM, /* Ahom */
+ G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */
+ G_UNICODE_SCRIPT_HATRAN, /* Hatr */
+ G_UNICODE_SCRIPT_MULTANI, /* Mult */
+ G_UNICODE_SCRIPT_OLD_HUNGARIAN, /* Hung */
+ G_UNICODE_SCRIPT_SIGNWRITING, /* Sgnw */
+
+ /* Unicode 9.0 additions */
+ G_UNICODE_SCRIPT_ADLAM, /* Adlm */
+ G_UNICODE_SCRIPT_BHAIKSUKI, /* Bhks */
+ G_UNICODE_SCRIPT_MARCHEN, /* Marc */
+ G_UNICODE_SCRIPT_NEWA, /* Newa */
+ G_UNICODE_SCRIPT_OSAGE, /* Osge */
+ G_UNICODE_SCRIPT_TANGUT, /* Tang */
+
+ /* Unicode 10.0 additions */
+ G_UNICODE_SCRIPT_MASARAM_GONDI, /* Gonm */
+ G_UNICODE_SCRIPT_NUSHU, /* Nshu */
+ G_UNICODE_SCRIPT_SOYOMBO, /* Soyo */
+ G_UNICODE_SCRIPT_ZANABAZAR_SQUARE, /* Zanb */
+
+ /* Unicode 11.0 additions */
+ G_UNICODE_SCRIPT_DOGRA, /* Dogr */
+ G_UNICODE_SCRIPT_GUNJALA_GONDI, /* Gong */
+ G_UNICODE_SCRIPT_HANIFI_ROHINGYA, /* Rohg */
+ G_UNICODE_SCRIPT_MAKASAR, /* Maka */
+ G_UNICODE_SCRIPT_MEDEFAIDRIN, /* Medf */
+ G_UNICODE_SCRIPT_OLD_SOGDIAN, /* Sogo */
+ G_UNICODE_SCRIPT_SOGDIAN, /* Sogd */
+
+ /* Unicode 12.0 additions */
+ G_UNICODE_SCRIPT_ELYMAIC, /* Elym */
+ G_UNICODE_SCRIPT_NANDINAGARI, /* Nand */
+ G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG, /* Rohg */
+ G_UNICODE_SCRIPT_WANCHO /* Wcho */
+} GUnicodeScript;
+
+GLIB_AVAILABLE_IN_ALL
+guint32 g_unicode_script_to_iso15924 (GUnicodeScript script);
+GLIB_AVAILABLE_IN_ALL
+GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924);
+
+/* These are all analogs of the <ctype.h> functions.
+ */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_islower (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST;
+
+/* More <ctype.h> functions. These convert between the three cases.
+ * See the Unicode book to understand title case. */
+GLIB_AVAILABLE_IN_ALL
+gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST;
+
+/* If C is a digit (according to 'g_unichar_isdigit'), then return its
+ numeric value. Otherwise return -1. */
+GLIB_AVAILABLE_IN_ALL
+gint g_unichar_digit_value (gunichar c) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST;
+
+/* Return the Unicode character type of a given character. */
+GLIB_AVAILABLE_IN_ALL
+GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST;
+
+/* Return the line break property for a given character */
+GLIB_AVAILABLE_IN_ALL
+GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST;
+
+/* Returns the combining class for a given character */
+GLIB_AVAILABLE_IN_ALL
+gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_get_mirror_char (gunichar ch,
+ gunichar *mirrored_ch);
+
+GLIB_AVAILABLE_IN_ALL
+GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST;
+
+/* Validate a Unicode character */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST;
+
+/* Pairwise canonical compose/decompose */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_compose (gunichar a,
+ gunichar b,
+ gunichar *ch);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_unichar_decompose (gunichar ch,
+ gunichar *a,
+ gunichar *b);
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_unichar_fully_decompose (gunichar ch,
+ gboolean compat,
+ gunichar *result,
+ gsize result_len);
+
+/**
+ * G_UNICHAR_MAX_DECOMPOSITION_LENGTH:
+ *
+ * The maximum length (in codepoints) of a compatibility or canonical
+ * decomposition of a single Unicode character.
+ *
+ * This is as defined by Unicode 6.1.
+ *
+ * Since: 2.32
+ */
+#define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */
+
+/* Compute canonical ordering of a string in-place. This rearranges
+ decomposed characters in the string according to their combining
+ classes. See the Unicode manual for more information. */
+GLIB_AVAILABLE_IN_ALL
+void g_unicode_canonical_ordering (gunichar *string,
+ gsize len);
+
+
+GLIB_DEPRECATED_IN_2_30
+gunichar *g_unicode_canonical_decomposition (gunichar ch,
+ gsize *result_len) G_GNUC_MALLOC;
+
+/* Array of skip-bytes-per-initial character.
+ */
+GLIB_VAR const gchar * const g_utf8_skip;
+
+/**
+ * g_utf8_next_char:
+ * @p: Pointer to the start of a valid UTF-8 character
+ *
+ * Skips to the next character in a UTF-8 string. The string must be
+ * valid; this macro is as fast as possible, and has no error-checking.
+ * You would use this macro to iterate over a string character by
+ * character. The macro returns the start of the next UTF-8 character.
+ * Before using this macro, use g_utf8_validate() to validate strings
+ * that may contain invalid UTF-8.
+ */
+#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)])
+
+GLIB_AVAILABLE_IN_ALL
+gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gunichar g_utf8_get_char_validated (const gchar *p,
+ gssize max_len) G_GNUC_PURE;
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_offset_to_pointer (const gchar *str,
+ glong offset) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+glong g_utf8_pointer_to_offset (const gchar *str,
+ const gchar *pos) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_find_next_char (const gchar *p,
+ const gchar *end) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_find_prev_char (const gchar *str,
+ const gchar *p) G_GNUC_PURE;
+
+GLIB_AVAILABLE_IN_ALL
+glong g_utf8_strlen (const gchar *p,
+ gssize max) G_GNUC_PURE;
+
+GLIB_AVAILABLE_IN_2_30
+gchar *g_utf8_substring (const gchar *str,
+ glong start_pos,
+ glong end_pos) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_strncpy (gchar *dest,
+ const gchar *src,
+ gsize n);
+
+/* Find the UTF-8 character corresponding to ch, in string p. These
+ functions are equivalants to strchr and strrchr */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_strchr (const gchar *p,
+ gssize len,
+ gunichar c);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_strrchr (const gchar *p,
+ gssize len,
+ gunichar c);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf8_strreverse (const gchar *str,
+ gssize len);
+
+GLIB_AVAILABLE_IN_ALL
+gunichar2 *g_utf8_to_utf16 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gunichar * g_utf8_to_ucs4 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gunichar * g_utf8_to_ucs4_fast (const gchar *str,
+ glong len,
+ glong *items_written) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gunichar * g_utf16_to_ucs4 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_utf16_to_utf8 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar* g_ucs4_to_utf8 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gint g_unichar_to_utf8 (gunichar c,
+ gchar *outbuf);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_utf8_validate (const gchar *str,
+ gssize max_len,
+ const gchar **end);
+GLIB_AVAILABLE_IN_2_60
+gboolean g_utf8_validate_len (const gchar *str,
+ gsize max_len,
+ const gchar **end);
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_strup (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_strdown (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_casefold (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+/**
+ * GNormalizeMode:
+ * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the
+ * text content, such as the above-mentioned accent representation
+ * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT
+ * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with
+ * composed forms rather than a maximally decomposed form
+ * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE
+ * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the
+ * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE
+ * to the standard forms (in this case DIGIT THREE). Formatting
+ * information may be lost but for most text operations such
+ * characters should be considered the same
+ * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL
+ * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed
+ * forms rather than a maximally decomposed form
+ * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE
+ *
+ * Defines how a Unicode string is transformed in a canonical
+ * form, standardizing such issues as whether a character with
+ * an accent is represented as a base character and combining
+ * accent or as a single precomposed character. Unicode strings
+ * should generally be normalized before comparing them.
+ */
+typedef enum {
+ G_NORMALIZE_DEFAULT,
+ G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT,
+ G_NORMALIZE_DEFAULT_COMPOSE,
+ G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE,
+ G_NORMALIZE_ALL,
+ G_NORMALIZE_NFKD = G_NORMALIZE_ALL,
+ G_NORMALIZE_ALL_COMPOSE,
+ G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE
+} GNormalizeMode;
+
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_normalize (const gchar *str,
+ gssize len,
+ GNormalizeMode mode) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_ALL
+gint g_utf8_collate (const gchar *str1,
+ const gchar *str2) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_collate_key (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+GLIB_AVAILABLE_IN_ALL
+gchar *g_utf8_collate_key_for_filename (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+GLIB_AVAILABLE_IN_2_52
+gchar *g_utf8_make_valid (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* __G_UNICODE_H__ */
diff --git a/include/glib/glib/gurifuncs.h b/include/glib/glib/gurifuncs.h
new file mode 100644
index 0000000000..e59a43c877
--- /dev/null
+++ b/include/glib/glib/gurifuncs.h
@@ -0,0 +1,83 @@
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_URI_FUNCS_H__
+#define __G_URI_FUNCS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_URI_RESERVED_CHARS_GENERIC_DELIMITERS:
+ *
+ * Generic delimiters characters as defined in RFC 3986. Includes ":/?#[]@".
+ **/
+#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@"
+
+/**
+ * G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS:
+ *
+ * Subcomponent delimiter characters as defined in RFC 3986. Includes "!$&'()*+,;=".
+ **/
+#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;="
+
+/**
+ * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT:
+ *
+ * Allowed characters in path elements. Includes "!$&'()*+,;=:@".
+ **/
+#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@"
+
+/**
+ * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH:
+ *
+ * Allowed characters in a path. Includes "!$&'()*+,;=:@/".
+ **/
+#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/"
+
+/**
+ * G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO:
+ *
+ * Allowed characters in userinfo as defined in RFC 3986. Includes "!$&'()*+,;=:".
+ **/
+#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":"
+
+GLIB_AVAILABLE_IN_ALL
+char * g_uri_unescape_string (const char *escaped_string,
+ const char *illegal_characters);
+GLIB_AVAILABLE_IN_ALL
+char * g_uri_unescape_segment (const char *escaped_string,
+ const char *escaped_string_end,
+ const char *illegal_characters);
+GLIB_AVAILABLE_IN_ALL
+char * g_uri_parse_scheme (const char *uri);
+GLIB_AVAILABLE_IN_ALL
+char * g_uri_escape_string (const char *unescaped,
+ const char *reserved_chars_allowed,
+ gboolean allow_utf8);
+
+G_END_DECLS
+
+#endif /* __G_URI_FUNCS_H__ */
diff --git a/include/glib/glib/gutils.h b/include/glib/glib/gutils.h
new file mode 100644
index 0000000000..560a84e3ac
--- /dev/null
+++ b/include/glib/glib/gutils.h
@@ -0,0 +1,364 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_UTILS_H__
+#define __G_UTILS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+/* Define G_VA_COPY() to do the right thing for copying va_list variables.
+ * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
+ */
+#if !defined (G_VA_COPY)
+# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
+# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2))
+# elif defined (G_VA_COPY_AS_ARRAY)
+# define G_VA_COPY(ap1, ap2) memmove ((ap1), (ap2), sizeof (va_list))
+# else /* va_list is a pointer */
+# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2))
+# endif /* va_list is a pointer */
+#endif /* !G_VA_COPY */
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_name (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_real_name (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_home_dir (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_tmp_dir (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_host_name (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_prgname (void);
+GLIB_AVAILABLE_IN_ALL
+void g_set_prgname (const gchar *prgname);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_application_name (void);
+GLIB_AVAILABLE_IN_ALL
+void g_set_application_name (const gchar *application_name);
+
+GLIB_AVAILABLE_IN_ALL
+void g_reload_user_special_dirs_cache (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_data_dir (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_config_dir (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_cache_dir (void);
+GLIB_AVAILABLE_IN_ALL
+const gchar * const * g_get_system_data_dirs (void);
+
+#ifdef G_OS_WIN32
+/* This function is not part of the public GLib API */
+GLIB_AVAILABLE_IN_ALL
+const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void));
+#endif
+
+#if defined (G_OS_WIN32) && defined (G_CAN_INLINE)
+/* This function is not part of the public GLib API either. Just call
+ * g_get_system_data_dirs() in your code, never mind that that is
+ * actually a macro and you will in fact call this inline function.
+ */
+static inline const gchar * const *
+_g_win32_get_system_data_dirs (void)
+{
+ return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs);
+}
+#define g_get_system_data_dirs _g_win32_get_system_data_dirs
+#endif
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * const * g_get_system_config_dirs (void);
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_runtime_dir (void);
+
+/**
+ * GUserDirectory:
+ * @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory
+ * @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory
+ * @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory
+ * @G_USER_DIRECTORY_MUSIC: the user's Music directory
+ * @G_USER_DIRECTORY_PICTURES: the user's Pictures directory
+ * @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory
+ * @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory
+ * @G_USER_DIRECTORY_VIDEOS: the user's Movies directory
+ * @G_USER_N_DIRECTORIES: the number of enum values
+ *
+ * These are logical ids for special directories which are defined
+ * depending on the platform used. You should use g_get_user_special_dir()
+ * to retrieve the full path associated to the logical id.
+ *
+ * The #GUserDirectory enumeration can be extended at later date. Not
+ * every platform has a directory for every logical id in this
+ * enumeration.
+ *
+ * Since: 2.14
+ */
+typedef enum {
+ G_USER_DIRECTORY_DESKTOP,
+ G_USER_DIRECTORY_DOCUMENTS,
+ G_USER_DIRECTORY_DOWNLOAD,
+ G_USER_DIRECTORY_MUSIC,
+ G_USER_DIRECTORY_PICTURES,
+ G_USER_DIRECTORY_PUBLIC_SHARE,
+ G_USER_DIRECTORY_TEMPLATES,
+ G_USER_DIRECTORY_VIDEOS,
+
+ G_USER_N_DIRECTORIES
+} GUserDirectory;
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_get_user_special_dir (GUserDirectory directory);
+
+/**
+ * GDebugKey:
+ * @key: the string
+ * @value: the flag
+ *
+ * Associates a string with a bit flag.
+ * Used in g_parse_debug_string().
+ */
+typedef struct _GDebugKey GDebugKey;
+struct _GDebugKey
+{
+ const gchar *key;
+ guint value;
+};
+
+/* Miscellaneous utility functions
+ */
+GLIB_AVAILABLE_IN_ALL
+guint g_parse_debug_string (const gchar *string,
+ const GDebugKey *keys,
+ guint nkeys);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_snprintf (gchar *string,
+ gulong n,
+ gchar const *format,
+ ...) G_GNUC_PRINTF (3, 4);
+GLIB_AVAILABLE_IN_ALL
+gint g_vsnprintf (gchar *string,
+ gulong n,
+ gchar const *format,
+ va_list args)
+ G_GNUC_PRINTF(3, 0);
+
+GLIB_AVAILABLE_IN_ALL
+void g_nullify_pointer (gpointer *nullify_location);
+
+typedef enum
+{
+ G_FORMAT_SIZE_DEFAULT = 0,
+ G_FORMAT_SIZE_LONG_FORMAT = 1 << 0,
+ G_FORMAT_SIZE_IEC_UNITS = 1 << 1,
+ G_FORMAT_SIZE_BITS = 1 << 2
+} GFormatSizeFlags;
+
+GLIB_AVAILABLE_IN_2_30
+gchar *g_format_size_full (guint64 size,
+ GFormatSizeFlags flags);
+GLIB_AVAILABLE_IN_2_30
+gchar *g_format_size (guint64 size);
+
+GLIB_DEPRECATED_IN_2_30_FOR(g_format_size)
+gchar *g_format_size_for_display (goffset size);
+
+#define g_ATEXIT(proc) (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32
+#define g_memmove(dest,src,len) \
+ G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove)
+
+/**
+ * GVoidFunc:
+ *
+ * Declares a type of function which takes no arguments
+ * and has no return value. It is used to specify the type
+ * function passed to g_atexit().
+ */
+typedef void (*GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32;
+#define ATEXIT(proc) g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED
+void g_atexit (GVoidFunc func);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+#ifdef G_OS_WIN32
+/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls
+ * atexit(), the function will be called when the GLib DLL is detached
+ * from the program, which is not what the caller wants. The caller
+ * wants the function to be called when it *itself* exits (or is
+ * detached, in case the caller, too, is a DLL).
+ */
+#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB))
+int atexit (void (*)(void));
+#endif
+#define g_atexit(func) atexit(func) GLIB_DEPRECATED_MACRO_IN_2_32
+#endif
+
+
+/* Look for an executable in PATH, following execvp() rules */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_find_program_in_path (const gchar *program);
+
+/* Bit tests
+ *
+ * These are defined in a convoluted way because we want the compiler to
+ * be able to inline the code for performance reasons, but for
+ * historical reasons, we must continue to provide non-inline versions
+ * on our ABI.
+ *
+ * We define these as functions in gutils.c which are just implemented
+ * as calls to the _impl() versions in order to preserve the ABI.
+ */
+
+#define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit)
+#define g_bit_nth_msf(mask, nth_bit) g_bit_nth_msf_impl(mask, nth_bit)
+#define g_bit_storage(number) g_bit_storage_impl(number)
+
+GLIB_AVAILABLE_IN_ALL
+gint (g_bit_nth_lsf) (gulong mask,
+ gint nth_bit);
+GLIB_AVAILABLE_IN_ALL
+gint (g_bit_nth_msf) (gulong mask,
+ gint nth_bit);
+GLIB_AVAILABLE_IN_ALL
+guint (g_bit_storage) (gulong number);
+
+static inline gint
+g_bit_nth_lsf_impl (gulong mask,
+ gint nth_bit)
+{
+ if (G_UNLIKELY (nth_bit < -1))
+ nth_bit = -1;
+ while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1))
+ {
+ nth_bit++;
+ if (mask & (1UL << nth_bit))
+ return nth_bit;
+ }
+ return -1;
+}
+
+static inline gint
+g_bit_nth_msf_impl (gulong mask,
+ gint nth_bit)
+{
+ if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8))
+ nth_bit = GLIB_SIZEOF_LONG * 8;
+ while (nth_bit > 0)
+ {
+ nth_bit--;
+ if (mask & (1UL << nth_bit))
+ return nth_bit;
+ }
+ return -1;
+}
+
+static inline guint
+g_bit_storage_impl (gulong number)
+{
+#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
+ return G_LIKELY (number) ?
+ ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1;
+#else
+ guint n_bits = 0;
+
+ do
+ {
+ n_bits++;
+ number >>= 1;
+ }
+ while (number);
+ return n_bits;
+#endif
+}
+
+/* Crashes the program. */
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50
+#ifndef G_OS_WIN32
+# include <stdlib.h>
+# define g_abort() abort ()
+#else
+GLIB_AVAILABLE_IN_2_50
+void g_abort (void) G_GNUC_NORETURN G_ANALYZER_NORETURN;
+#endif
+#endif
+
+/*
+ * This macro is deprecated. This DllMain() is too complex. It is
+ * recommended to write an explicit minimal DLlMain() that just saves
+ * the handle to the DLL and then use that handle instead, for
+ * instance passing it to
+ * g_win32_get_package_installation_directory_of_module().
+ *
+ * On Windows, this macro defines a DllMain function that stores the
+ * actual DLL name that the code being compiled will be included in.
+ * STATIC should be empty or 'static'. DLL_NAME is the name of the
+ * (pointer to the) char array where the DLL name will be stored. If
+ * this is used, you must also include <windows.h>. If you need a more complex
+ * DLL entry point function, you cannot use this.
+ *
+ * On non-Windows platforms, expands to nothing.
+ */
+
+#ifndef G_PLATFORM_WIN32
+# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) GLIB_DEPRECATED_MACRO_IN_2_26
+#else
+# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \
+static char *dll_name; \
+ \
+BOOL WINAPI \
+DllMain (HINSTANCE hinstDLL, \
+ DWORD fdwReason, \
+ LPVOID lpvReserved) \
+{ \
+ wchar_t wcbfr[1000]; \
+ char *tem; \
+ switch (fdwReason) \
+ { \
+ case DLL_PROCESS_ATTACH: \
+ GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \
+ tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \
+ dll_name = g_path_get_basename (tem); \
+ g_free (tem); \
+ break; \
+ } \
+ \
+ return TRUE; \
+} GLIB_DEPRECATED_MACRO_IN_2_26
+#endif /* G_PLATFORM_WIN32 */
+
+G_END_DECLS
+
+#endif /* __G_UTILS_H__ */
diff --git a/include/glib/glib/guuid.h b/include/glib/glib/guuid.h
new file mode 100644
index 0000000000..c653188a0e
--- /dev/null
+++ b/include/glib/glib/guuid.h
@@ -0,0 +1,42 @@
+/* guuid.h - UUID functions
+ *
+ * Copyright (C) 2013-2015, 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * licence, or (at your option) any later version.
+ *
+ * This 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA.
+ *
+ * Authors: Marc-André Lureau <marcandre.lureau@redhat.com>
+ */
+
+#ifndef __G_UUID_H__
+#define __G_UUID_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_52
+gboolean g_uuid_string_is_valid (const gchar *str);
+
+GLIB_AVAILABLE_IN_2_52
+gchar * g_uuid_string_random (void);
+
+G_END_DECLS
+
+#endif /* __G_UUID_H__ */
diff --git a/include/glib/glib/gvariant.h b/include/glib/glib/gvariant.h
new file mode 100644
index 0000000000..99e2470e90
--- /dev/null
+++ b/include/glib/glib/gvariant.h
@@ -0,0 +1,521 @@
+/*
+ * Copyright © 2007, 2008 Ryan Lortie
+ * Copyright © 2009, 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_VARIANT_H__
+#define __G_VARIANT_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gvarianttype.h>
+#include <glib/gstring.h>
+#include <glib/gbytes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GVariant GVariant;
+
+typedef enum
+{
+ G_VARIANT_CLASS_BOOLEAN = 'b',
+ G_VARIANT_CLASS_BYTE = 'y',
+ G_VARIANT_CLASS_INT16 = 'n',
+ G_VARIANT_CLASS_UINT16 = 'q',
+ G_VARIANT_CLASS_INT32 = 'i',
+ G_VARIANT_CLASS_UINT32 = 'u',
+ G_VARIANT_CLASS_INT64 = 'x',
+ G_VARIANT_CLASS_UINT64 = 't',
+ G_VARIANT_CLASS_HANDLE = 'h',
+ G_VARIANT_CLASS_DOUBLE = 'd',
+ G_VARIANT_CLASS_STRING = 's',
+ G_VARIANT_CLASS_OBJECT_PATH = 'o',
+ G_VARIANT_CLASS_SIGNATURE = 'g',
+ G_VARIANT_CLASS_VARIANT = 'v',
+ G_VARIANT_CLASS_MAYBE = 'm',
+ G_VARIANT_CLASS_ARRAY = 'a',
+ G_VARIANT_CLASS_TUPLE = '(',
+ G_VARIANT_CLASS_DICT_ENTRY = '{'
+} GVariantClass;
+
+GLIB_AVAILABLE_IN_ALL
+void g_variant_unref (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_ref (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_ref_sink (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_floating (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_take_ref (GVariant *value);
+
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_get_type (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_variant_get_type_string (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_of_type (GVariant *value,
+ const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_container (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariantClass g_variant_classify (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_boolean (gboolean value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_byte (guint8 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_int16 (gint16 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_uint16 (guint16 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_int32 (gint32 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_uint32 (guint32 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_int64 (gint64 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_uint64 (guint64 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_handle (gint32 value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_double (gdouble value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_string (const gchar *string);
+GLIB_AVAILABLE_IN_2_38
+GVariant * g_variant_new_take_string (gchar *string);
+GLIB_AVAILABLE_IN_2_38
+GVariant * g_variant_new_printf (const gchar *format_string,
+ ...) G_GNUC_PRINTF (1, 2);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_object_path (const gchar *object_path);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_object_path (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_signature (const gchar *signature);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_signature (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_variant (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_strv (const gchar * const *strv,
+ gssize length);
+GLIB_AVAILABLE_IN_2_30
+GVariant * g_variant_new_objv (const gchar * const *strv,
+ gssize length);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_bytestring (const gchar *string);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_bytestring_array (const gchar * const *strv,
+ gssize length);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_fixed_array (const GVariantType *element_type,
+ gconstpointer elements,
+ gsize n_elements,
+ gsize element_size);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_get_boolean (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+guint8 g_variant_get_byte (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gint16 g_variant_get_int16 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+guint16 g_variant_get_uint16 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_variant_get_int32 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+guint32 g_variant_get_uint32 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_variant_get_int64 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_variant_get_uint64 (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gint32 g_variant_get_handle (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_variant_get_double (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_get_variant (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_variant_get_string (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_variant_dup_string (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+const gchar ** g_variant_get_strv (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_variant_dup_strv (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_2_30
+const gchar ** g_variant_get_objv (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_variant_dup_objv (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_variant_get_bytestring (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_variant_dup_bytestring (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+const gchar ** g_variant_get_bytestring_array (GVariant *value,
+ gsize *length);
+GLIB_AVAILABLE_IN_ALL
+gchar ** g_variant_dup_bytestring_array (GVariant *value,
+ gsize *length);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_maybe (const GVariantType *child_type,
+ GVariant *child);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_array (const GVariantType *child_type,
+ GVariant * const *children,
+ gsize n_children);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_tuple (GVariant * const *children,
+ gsize n_children);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_dict_entry (GVariant *key,
+ GVariant *value);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_get_maybe (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_n_children (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_get_child (GVariant *value,
+ gsize index_,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_get_child_value (GVariant *value,
+ gsize index_);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_lookup (GVariant *dictionary,
+ const gchar *key,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_lookup_value (GVariant *dictionary,
+ const gchar *key,
+ const GVariantType *expected_type);
+GLIB_AVAILABLE_IN_ALL
+gconstpointer g_variant_get_fixed_array (GVariant *value,
+ gsize *n_elements,
+ gsize element_size);
+
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_get_size (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gconstpointer g_variant_get_data (GVariant *value);
+GLIB_AVAILABLE_IN_2_36
+GBytes * g_variant_get_data_as_bytes (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_store (GVariant *value,
+ gpointer data);
+
+GLIB_AVAILABLE_IN_ALL
+gchar * g_variant_print (GVariant *value,
+ gboolean type_annotate);
+GLIB_AVAILABLE_IN_ALL
+GString * g_variant_print_string (GVariant *value,
+ GString *string,
+ gboolean type_annotate);
+
+GLIB_AVAILABLE_IN_ALL
+guint g_variant_hash (gconstpointer value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_equal (gconstpointer one,
+ gconstpointer two);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_get_normal_form (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_is_normal_form (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_byteswap (GVariant *value);
+
+GLIB_AVAILABLE_IN_2_36
+GVariant * g_variant_new_from_bytes (const GVariantType *type,
+ GBytes *bytes,
+ gboolean trusted);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_from_data (const GVariantType *type,
+ gconstpointer data,
+ gsize size,
+ gboolean trusted,
+ GDestroyNotify notify,
+ gpointer user_data);
+
+typedef struct _GVariantIter GVariantIter;
+struct _GVariantIter {
+ /*< private >*/
+ gsize x[16];
+};
+
+GLIB_AVAILABLE_IN_ALL
+GVariantIter * g_variant_iter_new (GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_iter_init (GVariantIter *iter,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+GVariantIter * g_variant_iter_copy (GVariantIter *iter);
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_iter_n_children (GVariantIter *iter);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_iter_free (GVariantIter *iter);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_iter_next_value (GVariantIter *iter);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_iter_next (GVariantIter *iter,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_iter_loop (GVariantIter *iter,
+ const gchar *format_string,
+ ...);
+
+
+typedef struct _GVariantBuilder GVariantBuilder;
+struct _GVariantBuilder {
+ /*< private >*/
+ union
+ {
+ struct {
+ gsize partial_magic;
+ const GVariantType *type;
+ gsize y[14];
+ } s;
+ gsize x[16];
+ } u;
+};
+
+typedef enum
+{
+ G_VARIANT_PARSE_ERROR_FAILED,
+ G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED,
+ G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE,
+ G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED,
+ G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END,
+ G_VARIANT_PARSE_ERROR_INVALID_CHARACTER,
+ G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING,
+ G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH,
+ G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE,
+ G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING,
+ G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE,
+ G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE,
+ G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG,
+ G_VARIANT_PARSE_ERROR_TYPE_ERROR,
+ G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN,
+ G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD,
+ G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT,
+ G_VARIANT_PARSE_ERROR_VALUE_EXPECTED
+} GVariantParseError;
+#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ())
+
+GLIB_DEPRECATED_IN_2_38_FOR(g_variant_parse_error_quark)
+GQuark g_variant_parser_get_error_quark (void);
+
+GLIB_AVAILABLE_IN_ALL
+GQuark g_variant_parse_error_quark (void);
+
+/**
+ * G_VARIANT_BUILDER_INIT:
+ * @variant_type: a const GVariantType*
+ *
+ * A stack-allocated #GVariantBuilder must be initialized if it is
+ * used together with g_auto() to avoid warnings or crashes if
+ * function returns before g_variant_builder_init() is called on the
+ * builder. This macro can be used as initializer instead of an
+ * explicit zeroing a variable when declaring it and a following
+ * g_variant_builder_init(), but it cannot be assigned to a variable.
+ *
+ * The passed @variant_type should be a static GVariantType to avoid
+ * lifetime issues, as copying the @variant_type does not happen in
+ * the G_VARIANT_BUILDER_INIT() call, but rather in functions that
+ * make sure that #GVariantBuilder is valid.
+ *
+ * |[
+ * g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING);
+ * ]|
+ *
+ * Since: 2.50
+ */
+#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } }
+
+GLIB_AVAILABLE_IN_ALL
+GVariantBuilder * g_variant_builder_new (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_unref (GVariantBuilder *builder);
+GLIB_AVAILABLE_IN_ALL
+GVariantBuilder * g_variant_builder_ref (GVariantBuilder *builder);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_init (GVariantBuilder *builder,
+ const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_builder_end (GVariantBuilder *builder);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_clear (GVariantBuilder *builder);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_open (GVariantBuilder *builder,
+ const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_close (GVariantBuilder *builder);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_add_value (GVariantBuilder *builder,
+ GVariant *value);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_add (GVariantBuilder *builder,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_builder_add_parsed (GVariantBuilder *builder,
+ const gchar *format,
+ ...);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new (const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_get (GVariant *value,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_va (const gchar *format_string,
+ const gchar **endptr,
+ va_list *app);
+GLIB_AVAILABLE_IN_ALL
+void g_variant_get_va (GVariant *value,
+ const gchar *format_string,
+ const gchar **endptr,
+ va_list *app);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_variant_check_format_string (GVariant *value,
+ const gchar *format_string,
+ gboolean copy_only);
+
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_parse (const GVariantType *type,
+ const gchar *text,
+ const gchar *limit,
+ const gchar **endptr,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_parsed (const gchar *format,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+GVariant * g_variant_new_parsed_va (const gchar *format,
+ va_list *app);
+
+GLIB_AVAILABLE_IN_2_40
+gchar * g_variant_parse_error_print_context (GError *error,
+ const gchar *source_str);
+
+GLIB_AVAILABLE_IN_ALL
+gint g_variant_compare (gconstpointer one,
+ gconstpointer two);
+
+typedef struct _GVariantDict GVariantDict;
+struct _GVariantDict {
+ /*< private >*/
+ union
+ {
+ struct {
+ GVariant *asv;
+ gsize partial_magic;
+ gsize y[14];
+ } s;
+ gsize x[16];
+ } u;
+};
+
+/**
+ * G_VARIANT_DICT_INIT:
+ * @asv: (nullable): a GVariant*
+ *
+ * A stack-allocated #GVariantDict must be initialized if it is used
+ * together with g_auto() to avoid warnings or crashes if function
+ * returns before g_variant_dict_init() is called on the builder.
+ * This macro can be used as initializer instead of an explicit
+ * zeroing a variable when declaring it and a following
+ * g_variant_dict_init(), but it cannot be assigned to a variable.
+ *
+ * The passed @asv has to live long enough for #GVariantDict to gather
+ * the entries from, as the gathering does not happen in the
+ * G_VARIANT_DICT_INIT() call, but rather in functions that make sure
+ * that #GVariantDict is valid. In context where the initialization
+ * value has to be a constant expression, the only possible value of
+ * @asv is %NULL. It is still possible to call g_variant_dict_init()
+ * safely with a different @asv right after the variable was
+ * initialized with G_VARIANT_DICT_INIT().
+ *
+ * |[
+ * g_autoptr(GVariant) variant = get_asv_variant ();
+ * g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT (variant);
+ * ]|
+ *
+ * Since: 2.50
+ */
+#define G_VARIANT_DICT_INIT(asv) { { { asv, 3488698669u, { 0, } } } }
+
+GLIB_AVAILABLE_IN_2_40
+GVariantDict * g_variant_dict_new (GVariant *from_asv);
+
+GLIB_AVAILABLE_IN_2_40
+void g_variant_dict_init (GVariantDict *dict,
+ GVariant *from_asv);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_variant_dict_lookup (GVariantDict *dict,
+ const gchar *key,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_variant_dict_lookup_value (GVariantDict *dict,
+ const gchar *key,
+ const GVariantType *expected_type);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_variant_dict_contains (GVariantDict *dict,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_40
+void g_variant_dict_insert (GVariantDict *dict,
+ const gchar *key,
+ const gchar *format_string,
+ ...);
+GLIB_AVAILABLE_IN_2_40
+void g_variant_dict_insert_value (GVariantDict *dict,
+ const gchar *key,
+ GVariant *value);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_variant_dict_remove (GVariantDict *dict,
+ const gchar *key);
+GLIB_AVAILABLE_IN_2_40
+void g_variant_dict_clear (GVariantDict *dict);
+GLIB_AVAILABLE_IN_2_40
+GVariant * g_variant_dict_end (GVariantDict *dict);
+GLIB_AVAILABLE_IN_2_40
+GVariantDict * g_variant_dict_ref (GVariantDict *dict);
+GLIB_AVAILABLE_IN_2_40
+void g_variant_dict_unref (GVariantDict *dict);
+
+G_END_DECLS
+
+#endif /* __G_VARIANT_H__ */
diff --git a/include/glib/glib/gvarianttype.h b/include/glib/glib/gvarianttype.h
new file mode 100644
index 0000000000..fdc3641660
--- /dev/null
+++ b/include/glib/glib/gvarianttype.h
@@ -0,0 +1,382 @@
+/*
+ * Copyright © 2007, 2008 Ryan Lortie
+ * Copyright © 2009, 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __G_VARIANT_TYPE_H__
+#define __G_VARIANT_TYPE_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GVariantType:
+ *
+ * A type in the GVariant type system.
+ *
+ * Two types may not be compared by value; use g_variant_type_equal() or
+ * g_variant_type_is_subtype_of(). May be copied using
+ * g_variant_type_copy() and freed using g_variant_type_free().
+ **/
+typedef struct _GVariantType GVariantType;
+
+/**
+ * G_VARIANT_TYPE_BOOLEAN:
+ *
+ * The type of a value that can be either %TRUE or %FALSE.
+ **/
+#define G_VARIANT_TYPE_BOOLEAN ((const GVariantType *) "b")
+
+/**
+ * G_VARIANT_TYPE_BYTE:
+ *
+ * The type of an integer value that can range from 0 to 255.
+ **/
+#define G_VARIANT_TYPE_BYTE ((const GVariantType *) "y")
+
+/**
+ * G_VARIANT_TYPE_INT16:
+ *
+ * The type of an integer value that can range from -32768 to 32767.
+ **/
+#define G_VARIANT_TYPE_INT16 ((const GVariantType *) "n")
+
+/**
+ * G_VARIANT_TYPE_UINT16:
+ *
+ * The type of an integer value that can range from 0 to 65535.
+ * There were about this many people living in Toronto in the 1870s.
+ **/
+#define G_VARIANT_TYPE_UINT16 ((const GVariantType *) "q")
+
+/**
+ * G_VARIANT_TYPE_INT32:
+ *
+ * The type of an integer value that can range from -2147483648 to
+ * 2147483647.
+ **/
+#define G_VARIANT_TYPE_INT32 ((const GVariantType *) "i")
+
+/**
+ * G_VARIANT_TYPE_UINT32:
+ *
+ * The type of an integer value that can range from 0 to 4294967295.
+ * That's one number for everyone who was around in the late 1970s.
+ **/
+#define G_VARIANT_TYPE_UINT32 ((const GVariantType *) "u")
+
+/**
+ * G_VARIANT_TYPE_INT64:
+ *
+ * The type of an integer value that can range from
+ * -9223372036854775808 to 9223372036854775807.
+ **/
+#define G_VARIANT_TYPE_INT64 ((const GVariantType *) "x")
+
+/**
+ * G_VARIANT_TYPE_UINT64:
+ *
+ * The type of an integer value that can range from 0
+ * to 18446744073709551615 (inclusive). That's a really big number,
+ * but a Rubik's cube can have a bit more than twice as many possible
+ * positions.
+ **/
+#define G_VARIANT_TYPE_UINT64 ((const GVariantType *) "t")
+
+/**
+ * G_VARIANT_TYPE_DOUBLE:
+ *
+ * The type of a double precision IEEE754 floating point number.
+ * These guys go up to about 1.80e308 (plus and minus) but miss out on
+ * some numbers in between. In any case, that's far greater than the
+ * estimated number of fundamental particles in the observable
+ * universe.
+ **/
+#define G_VARIANT_TYPE_DOUBLE ((const GVariantType *) "d")
+
+/**
+ * G_VARIANT_TYPE_STRING:
+ *
+ * The type of a string. "" is a string. %NULL is not a string.
+ **/
+#define G_VARIANT_TYPE_STRING ((const GVariantType *) "s")
+
+/**
+ * G_VARIANT_TYPE_OBJECT_PATH:
+ *
+ * The type of a D-Bus object reference. These are strings of a
+ * specific format used to identify objects at a given destination on
+ * the bus.
+ *
+ * If you are not interacting with D-Bus, then there is no reason to make
+ * use of this type. If you are, then the D-Bus specification contains a
+ * precise description of valid object paths.
+ **/
+#define G_VARIANT_TYPE_OBJECT_PATH ((const GVariantType *) "o")
+
+/**
+ * G_VARIANT_TYPE_SIGNATURE:
+ *
+ * The type of a D-Bus type signature. These are strings of a specific
+ * format used as type signatures for D-Bus methods and messages.
+ *
+ * If you are not interacting with D-Bus, then there is no reason to make
+ * use of this type. If you are, then the D-Bus specification contains a
+ * precise description of valid signature strings.
+ **/
+#define G_VARIANT_TYPE_SIGNATURE ((const GVariantType *) "g")
+
+/**
+ * G_VARIANT_TYPE_VARIANT:
+ *
+ * The type of a box that contains any other value (including another
+ * variant).
+ **/
+#define G_VARIANT_TYPE_VARIANT ((const GVariantType *) "v")
+
+/**
+ * G_VARIANT_TYPE_HANDLE:
+ *
+ * The type of a 32bit signed integer value, that by convention, is used
+ * as an index into an array of file descriptors that are sent alongside
+ * a D-Bus message.
+ *
+ * If you are not interacting with D-Bus, then there is no reason to make
+ * use of this type.
+ **/
+#define G_VARIANT_TYPE_HANDLE ((const GVariantType *) "h")
+
+/**
+ * G_VARIANT_TYPE_UNIT:
+ *
+ * The empty tuple type. Has only one instance. Known also as "triv"
+ * or "void".
+ **/
+#define G_VARIANT_TYPE_UNIT ((const GVariantType *) "()")
+
+/**
+ * G_VARIANT_TYPE_ANY:
+ *
+ * An indefinite type that is a supertype of every type (including
+ * itself).
+ **/
+#define G_VARIANT_TYPE_ANY ((const GVariantType *) "*")
+
+/**
+ * G_VARIANT_TYPE_BASIC:
+ *
+ * An indefinite type that is a supertype of every basic (ie:
+ * non-container) type.
+ **/
+#define G_VARIANT_TYPE_BASIC ((const GVariantType *) "?")
+
+/**
+ * G_VARIANT_TYPE_MAYBE:
+ *
+ * An indefinite type that is a supertype of every maybe type.
+ **/
+#define G_VARIANT_TYPE_MAYBE ((const GVariantType *) "m*")
+
+/**
+ * G_VARIANT_TYPE_ARRAY:
+ *
+ * An indefinite type that is a supertype of every array type.
+ **/
+#define G_VARIANT_TYPE_ARRAY ((const GVariantType *) "a*")
+
+/**
+ * G_VARIANT_TYPE_TUPLE:
+ *
+ * An indefinite type that is a supertype of every tuple type,
+ * regardless of the number of items in the tuple.
+ **/
+#define G_VARIANT_TYPE_TUPLE ((const GVariantType *) "r")
+
+/**
+ * G_VARIANT_TYPE_DICT_ENTRY:
+ *
+ * An indefinite type that is a supertype of every dictionary entry
+ * type.
+ **/
+#define G_VARIANT_TYPE_DICT_ENTRY ((const GVariantType *) "{?*}")
+
+/**
+ * G_VARIANT_TYPE_DICTIONARY:
+ *
+ * An indefinite type that is a supertype of every dictionary type --
+ * that is, any array type that has an element type equal to any
+ * dictionary entry type.
+ **/
+#define G_VARIANT_TYPE_DICTIONARY ((const GVariantType *) "a{?*}")
+
+/**
+ * G_VARIANT_TYPE_STRING_ARRAY:
+ *
+ * The type of an array of strings.
+ **/
+#define G_VARIANT_TYPE_STRING_ARRAY ((const GVariantType *) "as")
+
+/**
+ * G_VARIANT_TYPE_OBJECT_PATH_ARRAY:
+ *
+ * The type of an array of object paths.
+ **/
+#define G_VARIANT_TYPE_OBJECT_PATH_ARRAY ((const GVariantType *) "ao")
+
+/**
+ * G_VARIANT_TYPE_BYTESTRING:
+ *
+ * The type of an array of bytes. This type is commonly used to pass
+ * around strings that may not be valid utf8. In that case, the
+ * convention is that the nul terminator character should be included as
+ * the last character in the array.
+ **/
+#define G_VARIANT_TYPE_BYTESTRING ((const GVariantType *) "ay")
+
+/**
+ * G_VARIANT_TYPE_BYTESTRING_ARRAY:
+ *
+ * The type of an array of byte strings (an array of arrays of bytes).
+ **/
+#define G_VARIANT_TYPE_BYTESTRING_ARRAY ((const GVariantType *) "aay")
+
+/**
+ * G_VARIANT_TYPE_VARDICT:
+ *
+ * The type of a dictionary mapping strings to variants (the ubiquitous
+ * "a{sv}" type).
+ *
+ * Since: 2.30
+ **/
+#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}")
+
+
+/**
+ * G_VARIANT_TYPE:
+ * @type_string: a well-formed #GVariantType type string
+ *
+ * Converts a string to a const #GVariantType. Depending on the
+ * current debugging level, this function may perform a runtime check
+ * to ensure that @string is a valid GVariant type string.
+ *
+ * It is always a programmer error to use this macro with an invalid
+ * type string. If in doubt, use g_variant_type_string_is_valid() to
+ * check if the string is valid.
+ *
+ * Since 2.24
+ **/
+#ifndef G_DISABLE_CHECKS
+# define G_VARIANT_TYPE(type_string) (g_variant_type_checked_ ((type_string)))
+#else
+# define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string))
+#endif
+
+/* type string checking */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_string_is_valid (const gchar *type_string);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_string_scan (const gchar *string,
+ const gchar *limit,
+ const gchar **endptr);
+
+/* create/destroy */
+GLIB_AVAILABLE_IN_ALL
+void g_variant_type_free (GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_copy (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_new (const gchar *type_string);
+
+/* getters */
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_type_get_string_length (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_variant_type_peek_string (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gchar * g_variant_type_dup_string (const GVariantType *type);
+
+/* classification */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_definite (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_container (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_basic (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_maybe (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_array (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_tuple (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_dict_entry (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_variant (const GVariantType *type);
+
+/* for hash tables */
+GLIB_AVAILABLE_IN_ALL
+guint g_variant_type_hash (gconstpointer type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_equal (gconstpointer type1,
+ gconstpointer type2);
+
+/* subtypes */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_variant_type_is_subtype_of (const GVariantType *type,
+ const GVariantType *supertype);
+
+/* type iterator interface */
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_element (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_first (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_next (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+gsize g_variant_type_n_items (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_key (const GVariantType *type);
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_value (const GVariantType *type);
+
+/* constructors */
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_new_array (const GVariantType *element);
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_new_maybe (const GVariantType *element);
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_new_tuple (const GVariantType * const *items,
+ gint length);
+GLIB_AVAILABLE_IN_ALL
+GVariantType * g_variant_type_new_dict_entry (const GVariantType *key,
+ const GVariantType *value);
+
+/*< private >*/
+GLIB_AVAILABLE_IN_ALL
+const GVariantType * g_variant_type_checked_ (const gchar *);
+GLIB_AVAILABLE_IN_2_60
+gsize g_variant_type_string_get_depth_ (const gchar *type_string);
+
+G_END_DECLS
+
+#endif /* __G_VARIANT_TYPE_H__ */
diff --git a/include/glib/glib/gversion.h b/include/glib/glib/gversion.h
new file mode 100644
index 0000000000..68343f7278
--- /dev/null
+++ b/include/glib/glib/gversion.h
@@ -0,0 +1,55 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_VERSION_H__
+#define __G_VERSION_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+GLIB_VAR const guint glib_major_version;
+GLIB_VAR const guint glib_minor_version;
+GLIB_VAR const guint glib_micro_version;
+GLIB_VAR const guint glib_interface_age;
+GLIB_VAR const guint glib_binary_age;
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * glib_check_version (guint required_major,
+ guint required_minor,
+ guint required_micro);
+
+#define GLIB_CHECK_VERSION(major,minor,micro) \
+ (GLIB_MAJOR_VERSION > (major) || \
+ (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \
+ (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \
+ GLIB_MICRO_VERSION >= (micro)))
+
+G_END_DECLS
+
+#endif /* __G_VERSION_H__ */
diff --git a/include/glib/glib/gversionmacros.h b/include/glib/glib/gversionmacros.h
new file mode 100644
index 0000000000..ee91f6d5b2
--- /dev/null
+++ b/include/glib/glib/gversionmacros.h
@@ -0,0 +1,923 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_VERSION_MACROS_H__
+#define __G_VERSION_MACROS_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+/* Version boundaries checks */
+
+#define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8)
+
+/* XXX: Every new stable minor release bump should add a macro here */
+
+/**
+ * GLIB_VERSION_2_26:
+ *
+ * A macro that evaluates to the 2.26 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.32
+ */
+#define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
+
+/**
+ * GLIB_VERSION_2_28:
+ *
+ * A macro that evaluates to the 2.28 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.32
+ */
+#define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
+
+/**
+ * GLIB_VERSION_2_30:
+ *
+ * A macro that evaluates to the 2.30 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.32
+ */
+#define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
+
+/**
+ * GLIB_VERSION_2_32:
+ *
+ * A macro that evaluates to the 2.32 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.32
+ */
+#define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
+
+/**
+ * GLIB_VERSION_2_34:
+ *
+ * A macro that evaluates to the 2.34 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.34
+ */
+#define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
+
+/**
+ * GLIB_VERSION_2_36:
+ *
+ * A macro that evaluates to the 2.36 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.36
+ */
+#define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
+
+/**
+ * GLIB_VERSION_2_38:
+ *
+ * A macro that evaluates to the 2.38 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.38
+ */
+#define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
+
+/**
+ * GLIB_VERSION_2_40:
+ *
+ * A macro that evaluates to the 2.40 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.40
+ */
+#define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
+
+/**
+ * GLIB_VERSION_2_42:
+ *
+ * A macro that evaluates to the 2.42 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.42
+ */
+#define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42))
+
+/**
+ * GLIB_VERSION_2_44:
+ *
+ * A macro that evaluates to the 2.44 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.44
+ */
+#define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44))
+
+/**
+ * GLIB_VERSION_2_46:
+ *
+ * A macro that evaluates to the 2.46 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.46
+ */
+#define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46))
+
+/**
+ * GLIB_VERSION_2_48:
+ *
+ * A macro that evaluates to the 2.48 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.48
+ */
+#define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48))
+
+/**
+ * GLIB_VERSION_2_50:
+ *
+ * A macro that evaluates to the 2.50 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.50
+ */
+#define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50))
+
+/**
+ * GLIB_VERSION_2_52:
+ *
+ * A macro that evaluates to the 2.52 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.52
+ */
+#define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52))
+
+/**
+ * GLIB_VERSION_2_54:
+ *
+ * A macro that evaluates to the 2.54 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.54
+ */
+#define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54))
+
+/**
+ * GLIB_VERSION_2_56:
+ *
+ * A macro that evaluates to the 2.56 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.56
+ */
+#define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56))
+
+/**
+ * GLIB_VERSION_2_58:
+ *
+ * A macro that evaluates to the 2.58 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.58
+ */
+#define GLIB_VERSION_2_58 (G_ENCODE_VERSION (2, 58))
+
+/**
+ * GLIB_VERSION_2_60:
+ *
+ * A macro that evaluates to the 2.60 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.60
+ */
+#define GLIB_VERSION_2_60 (G_ENCODE_VERSION (2, 60))
+
+/**
+ * GLIB_VERSION_2_62:
+ *
+ * A macro that evaluates to the 2.62 version of GLib, in a format
+ * that can be used by the C pre-processor.
+ *
+ * Since: 2.62
+ */
+#define GLIB_VERSION_2_62 (G_ENCODE_VERSION (2, 62))
+
+/* evaluates to the current stable version; for development cycles,
+ * this means the next stable target
+ */
+#if (GLIB_MINOR_VERSION % 2)
+#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
+#else
+#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
+#endif
+
+/* evaluates to the previous stable version */
+#if (GLIB_MINOR_VERSION % 2)
+#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
+#else
+#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
+#endif
+
+/**
+ * GLIB_VERSION_MIN_REQUIRED:
+ *
+ * A macro that should be defined by the user prior to including
+ * the glib.h header.
+ * The definition should be one of the predefined GLib version
+ * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
+ *
+ * This macro defines the earliest version of GLib that the package is
+ * required to be able to compile against.
+ *
+ * If the compiler is configured to warn about the use of deprecated
+ * functions, then using functions that were deprecated in version
+ * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
+ * using functions deprecated in later releases will not).
+ *
+ * Since: 2.32
+ */
+/* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
+ * GLIB_VERSION_X_Y value that we don't know about, it will compare as
+ * 0 in preprocessor tests.
+ */
+#ifndef GLIB_VERSION_MIN_REQUIRED
+# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
+#elif GLIB_VERSION_MIN_REQUIRED == 0
+# undef GLIB_VERSION_MIN_REQUIRED
+# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
+#endif
+
+/**
+ * GLIB_VERSION_MAX_ALLOWED:
+ *
+ * A macro that should be defined by the user prior to including
+ * the glib.h header.
+ * The definition should be one of the predefined GLib version
+ * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
+ *
+ * This macro defines the latest version of the GLib API that the
+ * package is allowed to make use of.
+ *
+ * If the compiler is configured to warn about the use of deprecated
+ * functions, then using functions added after version
+ * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
+ *
+ * Unless you are using GLIB_CHECK_VERSION() or the like to compile
+ * different code depending on the GLib version, then this should be
+ * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
+ *
+ * Since: 2.32
+ */
+#if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
+# undef GLIB_VERSION_MAX_ALLOWED
+# define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
+#endif
+
+/* sanity checks */
+#if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
+#error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
+#endif
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
+#error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
+#endif
+#if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
+#error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
+#endif
+
+/* These macros are used to mark deprecated functions in GLib headers,
+ * and thus have to be exposed in installed headers. But please
+ * do *not* use them in other projects. Instead, use G_DEPRECATED
+ * or define your own wrappers around it.
+ */
+#define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
+
+/* XXX: Every new stable minor release should add a set of macros here */
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
+# define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_26
+# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_26
+# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
+# define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
+# define GLIB_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO(2, 26)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR(2, 26)
+# define GLIB_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE(2, 26)
+#else
+# define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_26
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26
+# define GLIB_AVAILABLE_TYPE_IN_2_26
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
+# define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_28
+# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_28
+# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
+# define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
+# define GLIB_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO(2, 28)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR(2, 28)
+# define GLIB_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE(2, 28)
+#else
+# define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_28
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28
+# define GLIB_AVAILABLE_TYPE_IN_2_28
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
+# define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_30
+# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_30
+# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
+# define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
+# define GLIB_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO(2, 30)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR(2, 30)
+# define GLIB_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE(2, 30)
+#else
+# define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_30
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30
+# define GLIB_AVAILABLE_TYPE_IN_2_30
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
+# define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_32
+# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_32
+# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_32
+# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
+# define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
+# define GLIB_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO(2, 32)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR(2, 32)
+# define GLIB_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE(2, 32)
+#else
+# define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_32
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32
+# define GLIB_AVAILABLE_TYPE_IN_2_32
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
+# define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_34
+# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_34
+# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
+# define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
+# define GLIB_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO(2, 34)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR(2, 34)
+# define GLIB_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE(2, 34)
+#else
+# define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_34
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34
+# define GLIB_AVAILABLE_TYPE_IN_2_34
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
+# define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_36
+# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_36
+# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
+# define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
+# define GLIB_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO(2, 36)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR(2, 36)
+# define GLIB_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE(2, 36)
+#else
+# define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_36
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36
+# define GLIB_AVAILABLE_TYPE_IN_2_36
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
+# define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_38
+# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_38
+# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
+# define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
+# define GLIB_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO(2, 38)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR(2, 38)
+# define GLIB_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE(2, 38)
+#else
+# define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_38
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38
+# define GLIB_AVAILABLE_TYPE_IN_2_38
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
+# define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_40
+# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_40
+# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
+# define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
+# define GLIB_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO(2, 40)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR(2, 40)
+# define GLIB_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE(2, 40)
+#else
+# define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_40
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40
+# define GLIB_AVAILABLE_TYPE_IN_2_40
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
+# define GLIB_DEPRECATED_IN_2_42 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_42_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_42 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_42_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_42
+# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_42
+# define GLIB_DEPRECATED_TYPE_IN_2_42_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
+# define GLIB_AVAILABLE_IN_2_42 GLIB_UNAVAILABLE(2, 42)
+# define GLIB_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO(2, 42)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR(2, 42)
+# define GLIB_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE(2, 42)
+#else
+# define GLIB_AVAILABLE_IN_2_42 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_42
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42
+# define GLIB_AVAILABLE_TYPE_IN_2_42
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
+# define GLIB_DEPRECATED_IN_2_44 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_44_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_44 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_44_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_44
+# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_44
+# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
+# define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44)
+# define GLIB_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO(2, 44)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR(2, 44)
+# define GLIB_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE(2, 44)
+#else
+# define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_44
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44
+# define GLIB_AVAILABLE_TYPE_IN_2_44
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
+# define GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_46_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_46 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_46_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_46
+# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_46
+# define GLIB_DEPRECATED_TYPE_IN_2_46_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
+# define GLIB_AVAILABLE_IN_2_46 GLIB_UNAVAILABLE(2, 46)
+# define GLIB_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO(2, 46)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR(2, 46)
+# define GLIB_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE(2, 46)
+#else
+# define GLIB_AVAILABLE_IN_2_46 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_46
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46
+# define GLIB_AVAILABLE_TYPE_IN_2_46
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48
+# define GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_48_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_48 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_48_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_48
+# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_48
+# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48
+# define GLIB_AVAILABLE_IN_2_48 GLIB_UNAVAILABLE(2, 48)
+# define GLIB_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO(2, 48)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR(2, 48)
+# define GLIB_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE(2, 48)
+#else
+# define GLIB_AVAILABLE_IN_2_48 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_48
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48
+# define GLIB_AVAILABLE_TYPE_IN_2_48
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50
+# define GLIB_DEPRECATED_IN_2_50 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_50_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_50 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_50_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_50
+# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_50
+# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50
+# define GLIB_AVAILABLE_IN_2_50 GLIB_UNAVAILABLE(2, 50)
+# define GLIB_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO(2, 50)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR(2, 50)
+# define GLIB_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE(2, 50)
+#else
+# define GLIB_AVAILABLE_IN_2_50 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_50
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50
+# define GLIB_AVAILABLE_TYPE_IN_2_50
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52
+# define GLIB_DEPRECATED_IN_2_52 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_52_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_52 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_52_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_52
+# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_52
+# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52
+# define GLIB_AVAILABLE_IN_2_52 GLIB_UNAVAILABLE(2, 52)
+# define GLIB_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO(2, 52)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR(2, 52)
+# define GLIB_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE(2, 52)
+#else
+# define GLIB_AVAILABLE_IN_2_52 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_52
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52
+# define GLIB_AVAILABLE_TYPE_IN_2_52
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54
+# define GLIB_DEPRECATED_IN_2_54 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_54_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_54 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_54_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_54
+# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_54
+# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54
+# define GLIB_AVAILABLE_IN_2_54 GLIB_UNAVAILABLE(2, 54)
+# define GLIB_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO(2, 54)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR(2, 54)
+# define GLIB_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE(2, 54)
+#else
+# define GLIB_AVAILABLE_IN_2_54 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_54
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54
+# define GLIB_AVAILABLE_TYPE_IN_2_54
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56
+# define GLIB_DEPRECATED_IN_2_56 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_56_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_56 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_56_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_56
+# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_56
+# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56
+# define GLIB_AVAILABLE_IN_2_56 GLIB_UNAVAILABLE(2, 56)
+# define GLIB_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO(2, 56)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR(2, 56)
+# define GLIB_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE(2, 56)
+#else
+# define GLIB_AVAILABLE_IN_2_56 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_56
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56
+# define GLIB_AVAILABLE_TYPE_IN_2_56
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58
+# define GLIB_DEPRECATED_IN_2_58 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_58_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_58 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_58_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_58
+# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_58
+# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58
+# define GLIB_AVAILABLE_IN_2_58 GLIB_UNAVAILABLE(2, 58)
+# define GLIB_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO(2, 58)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR(2, 58)
+# define GLIB_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE(2, 58)
+#else
+# define GLIB_AVAILABLE_IN_2_58 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_58
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58
+# define GLIB_AVAILABLE_TYPE_IN_2_58
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60
+# define GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_60_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_60 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_60_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_60
+# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_60
+# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60
+# define GLIB_AVAILABLE_IN_2_60 GLIB_UNAVAILABLE(2, 60)
+# define GLIB_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO(2, 60)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR(2, 60)
+# define GLIB_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE(2, 60)
+#else
+# define GLIB_AVAILABLE_IN_2_60 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_60
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60
+# define GLIB_AVAILABLE_TYPE_IN_2_60
+#endif
+
+#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62
+# define GLIB_DEPRECATED_IN_2_62 GLIB_DEPRECATED
+# define GLIB_DEPRECATED_IN_2_62_FOR(f) GLIB_DEPRECATED_FOR(f)
+# define GLIB_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO
+# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE
+# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f)
+#else
+# define GLIB_DEPRECATED_IN_2_62 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_62_FOR(f) _GLIB_EXTERN
+# define GLIB_DEPRECATED_MACRO_IN_2_62
+# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f)
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62
+# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f)
+# define GLIB_DEPRECATED_TYPE_IN_2_62
+# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f)
+#endif
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62
+# define GLIB_AVAILABLE_IN_2_62 GLIB_UNAVAILABLE(2, 62)
+# define GLIB_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO(2, 62)
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR(2, 62)
+# define GLIB_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE(2, 62)
+#else
+# define GLIB_AVAILABLE_IN_2_62 _GLIB_EXTERN
+# define GLIB_AVAILABLE_MACRO_IN_2_62
+# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62
+# define GLIB_AVAILABLE_TYPE_IN_2_62
+#endif
+
+#endif /* __G_VERSION_MACROS_H__ */
diff --git a/include/glib/glib/gwin32.h b/include/glib/glib/gwin32.h
new file mode 100644
index 0000000000..6696afa9aa
--- /dev/null
+++ b/include/glib/glib/gwin32.h
@@ -0,0 +1,140 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_WIN32_H__
+#define __G_WIN32_H__
+
+#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#include <glib/gtypes.h>
+
+#ifdef G_PLATFORM_WIN32
+
+G_BEGIN_DECLS
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
+#ifdef G_OS_WIN32
+
+/*
+ * To get prototypes for the following POSIXish functions, you have to
+ * include the indicated non-POSIX headers. The functions are defined
+ * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). But note that
+ * for POSIX functions that take or return file names in the system
+ * codepage, in many cases you would want to use the GLib wrappers in
+ * gstdio.h and UTF-8 instead.
+ *
+ * getcwd: <direct.h> (MSVC), <io.h> (mingw32)
+ * getpid: <process.h>
+ * access: <io.h>
+ * unlink: <stdio.h> or <io.h>
+ * open, read, write, lseek, close: <io.h>
+ * rmdir: <io.h>
+ * pipe: <io.h> (actually, _pipe())
+ */
+
+/* For some POSIX functions that are not provided by the MS runtime,
+ * we provide emulation functions in glib, which are prefixed with
+ * g_win32_. Or that was the idea at some time, but there is just one
+ * of those:
+ */
+GLIB_AVAILABLE_IN_ALL
+gint g_win32_ftruncate (gint f,
+ guint size);
+#endif /* G_OS_WIN32 */
+
+/* The MS setlocale uses locale names of the form "English_United
+ * States.1252" etc. We want the Unixish standard form "en", "zh_TW"
+ * etc. This function gets the current thread locale from Windows and
+ * returns it as a string of the above form for use in forming file
+ * names etc. The returned string should be deallocated with g_free().
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_win32_getlocale (void);
+
+/* Translate a Win32 error code (as returned by GetLastError()) into
+ * the corresponding message. The returned string should be deallocated
+ * with g_free().
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_win32_error_message (gint error);
+
+GLIB_DEPRECATED
+gchar* g_win32_get_package_installation_directory (const gchar *package,
+ const gchar *dll_name);
+
+GLIB_DEPRECATED
+gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
+ const gchar *dll_name,
+ const gchar *subdir);
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
+
+GLIB_DEPRECATED_IN_2_44_FOR(g_win32_check_windows_version)
+guint g_win32_get_windows_version (void);
+
+GLIB_AVAILABLE_IN_ALL
+gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename);
+
+GLIB_AVAILABLE_IN_2_40
+gchar ** g_win32_get_command_line (void);
+
+/* As of GLib 2.14 we only support NT-based Windows */
+#define G_WIN32_IS_NT_BASED() TRUE
+#define G_WIN32_HAVE_WIDECHAR_API() TRUE
+
+/**
+ * GWin32OSType:
+ * @G_WIN32_OS_ANY: The running system can be a workstation or a server edition of
+ * Windows. The type of the running system is therefore not checked.
+ * @G_WIN32_OS_WORKSTATION: The running system is a workstation edition of Windows,
+ * such as Windows 7 Professional.
+ * @G_WIN32_OS_SERVER: The running system is a server edition of Windows, such as
+ * Windows Server 2008 R2.
+ *
+ * Type of Windows edition to check for at run-time.
+ **/
+typedef enum
+{
+ G_WIN32_OS_ANY,
+ G_WIN32_OS_WORKSTATION,
+ G_WIN32_OS_SERVER,
+} GWin32OSType;
+
+GLIB_AVAILABLE_IN_2_44
+gboolean g_win32_check_windows_version (const gint major,
+ const gint minor,
+ const gint spver,
+ const GWin32OSType os_type);
+
+G_END_DECLS
+
+#endif /* G_PLATFORM_WIN32 */
+
+#endif /* __G_WIN32_H__ */
diff --git a/include/glib/glibconfig.h b/include/glib/glibconfig.h
new file mode 100644
index 0000000000..9d4394dc4c
--- /dev/null
+++ b/include/glib/glibconfig.h
@@ -0,0 +1,216 @@
+/* glibconfig.h
+ *
+ * This is a generated file. Please modify 'glibconfig.h.in'
+ */
+
+#ifndef __GLIBCONFIG_H__
+#define __GLIBCONFIG_H__
+
+#include <glib/gmacros.h>
+
+#include <limits.h>
+#include <float.h>
+/* #undef GLIB_HAVE_ALLOCA_H */
+
+/* Specifies that GLib's g_print*() functions wrap the
+ * system printf functions. This is useful to know, for example,
+ * when using glibc's register_printf_function().
+ */
+#undef GLIB_USING_SYSTEM_PRINTF
+
+/* #undef GLIB_STATIC_COMPILATION */
+/* #undef GOBJECT_STATIC_COMPILATION */
+
+G_BEGIN_DECLS
+
+#define G_MINFLOAT FLT_MIN
+#define G_MAXFLOAT FLT_MAX
+#define G_MINDOUBLE DBL_MIN
+#define G_MAXDOUBLE DBL_MAX
+#define G_MINSHORT SHRT_MIN
+#define G_MAXSHORT SHRT_MAX
+#define G_MAXUSHORT USHRT_MAX
+#define G_MININT INT_MIN
+#define G_MAXINT INT_MAX
+#define G_MAXUINT UINT_MAX
+#define G_MINLONG LONG_MIN
+#define G_MAXLONG LONG_MAX
+#define G_MAXULONG ULONG_MAX
+
+typedef signed char gint8;
+typedef unsigned char guint8;
+
+typedef signed short gint16;
+typedef unsigned short guint16;
+
+#define G_GINT16_MODIFIER "h"
+#define G_GINT16_FORMAT "hi"
+#define G_GUINT16_FORMAT "hu"
+
+
+typedef signed int gint32;
+typedef unsigned int guint32;
+
+#define G_GINT32_MODIFIER ""
+#define G_GINT32_FORMAT "i"
+#define G_GUINT32_FORMAT "u"
+
+
+#define G_HAVE_GINT64 1 /* deprecated, always true */
+
+G_GNUC_EXTENSION typedef signed long long gint64;
+G_GNUC_EXTENSION typedef unsigned long long guint64;
+
+#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
+#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
+
+#define G_GINT64_MODIFIER "ll"
+#define G_GINT64_FORMAT "lli"
+#define G_GUINT64_FORMAT "llu"
+
+
+#define GLIB_SIZEOF_VOID_P 4
+#define GLIB_SIZEOF_LONG 4
+#define GLIB_SIZEOF_SIZE_T 4
+#define GLIB_SIZEOF_SSIZE_T 4
+
+typedef signed int gssize;
+typedef unsigned int gsize;
+#define G_GSIZE_MODIFIER ""
+#define G_GSSIZE_MODIFIER ""
+#define G_GSIZE_FORMAT "u"
+#define G_GSSIZE_FORMAT "i"
+
+#define G_MAXSIZE G_MAXUINT
+#define G_MINSSIZE G_MININT
+#define G_MAXSSIZE G_MAXINT
+
+typedef gint64 goffset;
+#define G_MINOFFSET G_MININT64
+#define G_MAXOFFSET G_MAXINT64
+
+#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
+#define G_GOFFSET_FORMAT G_GINT64_FORMAT
+#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
+
+#define G_POLLFD_FORMAT "%#x"
+
+#define GPOINTER_TO_INT(p) ((gint) (gint) (p))
+#define GPOINTER_TO_UINT(p) ((guint) (guint) (p))
+
+#define GINT_TO_POINTER(i) ((gpointer) (gint) (i))
+#define GUINT_TO_POINTER(u) ((gpointer) (guint) (u))
+
+typedef signed int gintptr;
+typedef unsigned int guintptr;
+
+#define G_GINTPTR_MODIFIER ""
+#define G_GINTPTR_FORMAT "i"
+#define G_GUINTPTR_FORMAT "u"
+
+#define GLIB_MAJOR_VERSION 2
+#define GLIB_MINOR_VERSION 62
+#define GLIB_MICRO_VERSION 6
+
+#define G_OS_WIN32
+#define G_PLATFORM_WIN32
+
+/* #undef G_VA_COPY */
+
+
+#ifndef __cplusplus
+# define G_HAVE_ISO_VARARGS 1
+#endif
+
+#ifdef __cplusplus
+# define G_HAVE_ISO_VARARGS 1
+#endif
+
+/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
+ * is passed ISO vararg support is turned off, and there is no work
+ * around to turn it on, so we unconditionally turn it off.
+ */
+#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
+# undef G_HAVE_ISO_VARARGS
+#endif
+
+#define G_HAVE_GROWING_STACK 0
+/* #undef G_HAVE_GNUC_VISIBILITY */
+
+#ifndef _MSC_VER
+# define G_HAVE_GNUC_VARARGS 1
+#endif
+
+#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+#define G_GNUC_INTERNAL __hidden
+#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
+#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
+#else
+#define G_GNUC_INTERNAL
+#endif
+
+#define G_THREADS_ENABLED
+#define G_THREADS_IMPL_WIN32
+
+#undef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED
+#define G_ATOMIC_LOCK_FREE
+
+#define GINT16_TO_LE(val) ((gint16) (val))
+#define GUINT16_TO_LE(val) ((guint16) (val))
+#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
+#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
+
+#define GINT32_TO_LE(val) ((gint32) (val))
+#define GUINT32_TO_LE(val) ((guint32) (val))
+#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
+#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
+
+#define GINT64_TO_LE(val) ((gint64) (val))
+#define GUINT64_TO_LE(val) ((guint64) (val))
+#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
+#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
+
+#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
+#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
+#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
+#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
+#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
+#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
+#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
+#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
+#define GSIZE_TO_LE(val) ((gsize) GUINT32_TO_LE (val))
+#define GSSIZE_TO_LE(val) ((gssize) GINT32_TO_LE (val))
+#define GSIZE_TO_BE(val) ((gsize) GUINT32_TO_BE (val))
+#define GSSIZE_TO_BE(val) ((gssize) GINT32_TO_BE (val))
+#define G_BYTE_ORDER G_LITTLE_ENDIAN
+
+#define GLIB_SYSDEF_POLLIN =1
+#define GLIB_SYSDEF_POLLOUT =4
+#define GLIB_SYSDEF_POLLPRI =2
+#define GLIB_SYSDEF_POLLHUP =16
+#define GLIB_SYSDEF_POLLERR =8
+#define GLIB_SYSDEF_POLLNVAL =32
+
+#define G_MODULE_SUFFIX "dll"
+
+typedef void* GPid;
+#define G_PID_FORMAT "p"
+
+#define GLIB_SYSDEF_AF_UNIX 1
+#define GLIB_SYSDEF_AF_INET 2
+#define GLIB_SYSDEF_AF_INET6 23
+
+#define GLIB_SYSDEF_MSG_OOB 1
+#define GLIB_SYSDEF_MSG_PEEK 2
+#define GLIB_SYSDEF_MSG_DONTROUTE 4
+
+#define G_DIR_SEPARATOR '\\'
+#define G_DIR_SEPARATOR_S "\\"
+#define G_SEARCHPATH_SEPARATOR ';'
+#define G_SEARCHPATH_SEPARATOR_S ";"
+
+G_END_DECLS
+
+#endif /* __GLIBCONFIG_H__ */
diff --git a/include/glib/gmodule.h b/include/glib/gmodule.h
new file mode 100644
index 0000000000..8982f5952d
--- /dev/null
+++ b/include/glib/gmodule.h
@@ -0,0 +1,117 @@
+/* GMODULE - GLIB wrapper code for dynamic module loading
+ * Copyright (C) 1998 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GMODULE_H__
+#define __GMODULE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* exporting and importing functions, this is special cased
+ * to feature Windows dll stubs.
+ */
+#define G_MODULE_IMPORT extern
+#ifdef G_PLATFORM_WIN32
+# define G_MODULE_EXPORT __declspec(dllexport)
+#elif __GNUC__ >= 4
+# define G_MODULE_EXPORT __attribute__((visibility("default")))
+#else /* !G_PLATFORM_WIN32 && __GNUC__ < 4 */
+# define G_MODULE_EXPORT
+#endif /* !G_PLATFORM_WIN32 */
+
+/**
+ * GModuleFlags:
+ * @G_MODULE_BIND_LAZY: specifies that symbols are only resolved when
+ * needed. The default action is to bind all symbols when the module
+ * is loaded.
+ * @G_MODULE_BIND_LOCAL: specifies that symbols in the module should
+ * not be added to the global name space. The default action on most
+ * platforms is to place symbols in the module in the global name space,
+ * which may cause conflicts with existing symbols.
+ * @G_MODULE_BIND_MASK: mask for all flags.
+ *
+ * Flags passed to g_module_open().
+ * Note that these flags are not supported on all platforms.
+ */
+typedef enum
+{
+ G_MODULE_BIND_LAZY = 1 << 0,
+ G_MODULE_BIND_LOCAL = 1 << 1,
+ G_MODULE_BIND_MASK = 0x03
+} GModuleFlags;
+
+typedef struct _GModule GModule;
+typedef const gchar* (*GModuleCheckInit) (GModule *module);
+typedef void (*GModuleUnload) (GModule *module);
+
+/* return TRUE if dynamic module loading is supported */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_module_supported (void) G_GNUC_CONST;
+
+/* open a module 'file_name' and return handle, which is NULL on error */
+GLIB_AVAILABLE_IN_ALL
+GModule* g_module_open (const gchar *file_name,
+ GModuleFlags flags);
+
+/* close a previously opened module, returns TRUE on success */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_module_close (GModule *module);
+
+/* make a module resident so g_module_close on it will be ignored */
+GLIB_AVAILABLE_IN_ALL
+void g_module_make_resident (GModule *module);
+
+/* query the last module error as a string */
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_module_error (void);
+
+/* retrieve a symbol pointer from 'module', returns TRUE on success */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_module_symbol (GModule *module,
+ const gchar *symbol_name,
+ gpointer *symbol);
+
+/* retrieve the file name from an existing module */
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_module_name (GModule *module);
+
+/* Build the actual file name containing a module. 'directory' is the
+ * directory where the module file is supposed to be, or NULL or empty
+ * in which case it should either be in the current directory or, on
+ * some operating systems, in some standard place, for instance on the
+ * PATH. Hence, to be absoultely sure to get the correct module,
+ * always pass in a directory. The file name consists of the directory,
+ * if supplied, and 'module_name' suitably decorated according to
+ * the operating system's conventions (for instance lib*.so or *.dll).
+ *
+ * No checks are made that the file exists, or is of correct type.
+ */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_module_build_path (const gchar *directory,
+ const gchar *module_name);
+
+G_END_DECLS
+
+#endif /* __GMODULE_H__ */
diff --git a/include/glib/gobject/gbinding.h b/include/glib/gobject/gbinding.h
new file mode 100644
index 0000000000..b4eb233b34
--- /dev/null
+++ b/include/glib/gobject/gbinding.h
@@ -0,0 +1,149 @@
+/* gbinding.h: Binding for object properties
+ *
+ * Copyright (C) 2010 Intel Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Emmanuele Bassi <ebassi@linux.intel.com>
+ */
+
+#ifndef __G_BINDING_H__
+#define __G_BINDING_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <glib.h>
+#include <gobject/gobject.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_BINDING_FLAGS (g_binding_flags_get_type ())
+
+#define G_TYPE_BINDING (g_binding_get_type ())
+#define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding))
+#define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING))
+
+/**
+ * GBinding:
+ *
+ * GBinding is an opaque structure whose members
+ * cannot be accessed directly.
+ *
+ * Since: 2.26
+ */
+typedef struct _GBinding GBinding;
+
+/**
+ * GBindingTransformFunc:
+ * @binding: a #GBinding
+ * @from_value: the #GValue containing the value to transform
+ * @to_value: the #GValue in which to store the transformed value
+ * @user_data: data passed to the transform function
+ *
+ * A function to be called to transform @from_value to @to_value. If
+ * this is the @transform_to function of a binding, then @from_value
+ * is the @source_property on the @source object, and @to_value is the
+ * @target_property on the @target object. If this is the
+ * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding,
+ * then those roles are reversed.
+ *
+ * Returns: %TRUE if the transformation was successful, and %FALSE
+ * otherwise
+ *
+ * Since: 2.26
+ */
+typedef gboolean (* GBindingTransformFunc) (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data);
+
+/**
+ * GBindingFlags:
+ * @G_BINDING_DEFAULT: The default binding; if the source property
+ * changes, the target property is updated with its value.
+ * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the
+ * property of the source or the property of the target changes,
+ * the other is updated.
+ * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and
+ * target properties when creating the binding; the direction of
+ * the synchronization is always from the source to the target.
+ * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are
+ * booleans, setting one to %TRUE will result in the other being
+ * set to %FALSE and vice versa. This flag will only work for
+ * boolean properties, and cannot be used when passing custom
+ * transformation functions to g_object_bind_property_full().
+ *
+ * Flags to be passed to g_object_bind_property() or
+ * g_object_bind_property_full().
+ *
+ * This enumeration can be extended at later date.
+ *
+ * Since: 2.26
+ */
+typedef enum { /*< prefix=G_BINDING >*/
+ G_BINDING_DEFAULT = 0,
+
+ G_BINDING_BIDIRECTIONAL = 1 << 0,
+ G_BINDING_SYNC_CREATE = 1 << 1,
+ G_BINDING_INVERT_BOOLEAN = 1 << 2
+} GBindingFlags;
+
+GLIB_AVAILABLE_IN_ALL
+GType g_binding_flags_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_binding_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GBindingFlags g_binding_get_flags (GBinding *binding);
+GLIB_AVAILABLE_IN_ALL
+GObject * g_binding_get_source (GBinding *binding);
+GLIB_AVAILABLE_IN_ALL
+GObject * g_binding_get_target (GBinding *binding);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_binding_get_source_property (GBinding *binding);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_binding_get_target_property (GBinding *binding);
+GLIB_AVAILABLE_IN_2_38
+void g_binding_unbind (GBinding *binding);
+
+GLIB_AVAILABLE_IN_ALL
+GBinding *g_object_bind_property (gpointer source,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GBinding *g_object_bind_property_full (gpointer source,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GBindingTransformFunc transform_to,
+ GBindingTransformFunc transform_from,
+ gpointer user_data,
+ GDestroyNotify notify);
+GLIB_AVAILABLE_IN_ALL
+GBinding *g_object_bind_property_with_closures (gpointer source,
+ const gchar *source_property,
+ gpointer target,
+ const gchar *target_property,
+ GBindingFlags flags,
+ GClosure *transform_to,
+ GClosure *transform_from);
+
+G_END_DECLS
+
+#endif /* __G_BINDING_H__ */
diff --git a/include/glib/gobject/gboxed.h b/include/glib/gobject/gboxed.h
new file mode 100644
index 0000000000..bcaf0b01a2
--- /dev/null
+++ b/include/glib/gobject/gboxed.h
@@ -0,0 +1,122 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000-2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_BOXED_H__
+#define __G_BOXED_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+
+#ifndef __GI_SCANNER__
+#include <gobject/glib-types.h>
+#endif
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+#define G_TYPE_IS_BOXED(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
+/**
+ * G_VALUE_HOLDS_BOXED:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values derived
+ * from type %G_TYPE_BOXED.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED))
+
+
+/* --- typedefs --- */
+/**
+ * GBoxedCopyFunc:
+ * @boxed: (not nullable): The boxed structure to be copied.
+ *
+ * This function is provided by the user and should produce a copy
+ * of the passed in boxed structure.
+ *
+ * Returns: (not nullable): The newly created copy of the boxed structure.
+ */
+typedef gpointer (*GBoxedCopyFunc) (gpointer boxed);
+
+/**
+ * GBoxedFreeFunc:
+ * @boxed: (not nullable): The boxed structure to be freed.
+ *
+ * This function is provided by the user and should free the boxed
+ * structure passed.
+ */
+typedef void (*GBoxedFreeFunc) (gpointer boxed);
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+gpointer g_boxed_copy (GType boxed_type,
+ gconstpointer src_boxed);
+GLIB_AVAILABLE_IN_ALL
+void g_boxed_free (GType boxed_type,
+ gpointer boxed);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_boxed (GValue *value,
+ gconstpointer v_boxed);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_static_boxed (GValue *value,
+ gconstpointer v_boxed);
+GLIB_AVAILABLE_IN_ALL
+void g_value_take_boxed (GValue *value,
+ gconstpointer v_boxed);
+GLIB_DEPRECATED_FOR(g_value_take_boxed)
+void g_value_set_boxed_take_ownership (GValue *value,
+ gconstpointer v_boxed);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_get_boxed (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_dup_boxed (const GValue *value);
+
+
+/* --- convenience --- */
+GLIB_AVAILABLE_IN_ALL
+GType g_boxed_type_register_static (const gchar *name,
+ GBoxedCopyFunc boxed_copy,
+ GBoxedFreeFunc boxed_free);
+
+/* --- GObject boxed types --- */
+/**
+ * G_TYPE_CLOSURE:
+ *
+ * The #GType for #GClosure.
+ */
+#define G_TYPE_CLOSURE (g_closure_get_type ())
+
+/**
+ * G_TYPE_VALUE:
+ *
+ * The type ID of the "GValue" type which is a boxed type,
+ * used to pass around pointers to GValues.
+ */
+#define G_TYPE_VALUE (g_value_get_type ())
+
+GLIB_AVAILABLE_IN_ALL
+GType g_closure_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_value_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_BOXED_H__ */
diff --git a/include/glib/gobject/gclosure.h b/include/glib/gobject/gclosure.h
new file mode 100644
index 0000000000..a5c1c3fcb7
--- /dev/null
+++ b/include/glib/gobject/gclosure.h
@@ -0,0 +1,317 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000-2001 Red Hat, Inc.
+ * Copyright (C) 2005 Imendio AB
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_CLOSURE_H__
+#define __G_CLOSURE_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+
+G_BEGIN_DECLS
+
+/* --- defines --- */
+/**
+ * G_CLOSURE_NEEDS_MARSHAL:
+ * @closure: a #GClosure
+ *
+ * Check if the closure still needs a marshaller. See g_closure_set_marshal().
+ *
+ * Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on
+ * @closure.
+ */
+#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
+/**
+ * G_CLOSURE_N_NOTIFIERS:
+ * @cl: a #GClosure
+ *
+ * Get the total number of notifiers connected with the closure @cl.
+ * The count includes the meta marshaller, the finalize and invalidate notifiers
+ * and the marshal guards. Note that each guard counts as two notifiers.
+ * See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(),
+ * g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards().
+ *
+ * Returns: number of notifiers
+ */
+#define G_CLOSURE_N_NOTIFIERS(cl) (((cl)->n_guards << 1L) + \
+ (cl)->n_fnotifiers + (cl)->n_inotifiers)
+/**
+ * G_CCLOSURE_SWAP_DATA:
+ * @cclosure: a #GCClosure
+ *
+ * Checks whether the user data of the #GCClosure should be passed as the
+ * first parameter to the callback. See g_cclosure_new_swap().
+ *
+ * Returns: %TRUE if data has to be swapped.
+ */
+#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag)
+/**
+ * G_CALLBACK:
+ * @f: a function pointer.
+ *
+ * Cast a function pointer to a #GCallback.
+ */
+#define G_CALLBACK(f) ((GCallback) (f))
+
+
+/* -- typedefs --- */
+typedef struct _GClosure GClosure;
+typedef struct _GClosureNotifyData GClosureNotifyData;
+
+/**
+ * GCallback:
+ *
+ * The type used for callback functions in structure definitions and function
+ * signatures. This doesn't mean that all callback functions must take no
+ * parameters and return void. The required signature of a callback function
+ * is determined by the context in which is used (e.g. the signal to which it
+ * is connected). Use G_CALLBACK() to cast the callback function to a #GCallback.
+ */
+typedef void (*GCallback) (void);
+/**
+ * GClosureNotify:
+ * @data: data specified when registering the notification callback
+ * @closure: the #GClosure on which the notification is emitted
+ *
+ * The type used for the various notification callbacks which can be registered
+ * on closures.
+ */
+typedef void (*GClosureNotify) (gpointer data,
+ GClosure *closure);
+/**
+ * GClosureMarshal:
+ * @closure: the #GClosure to which the marshaller belongs
+ * @return_value: (nullable): a #GValue to store the return
+ * value. May be %NULL if the callback of @closure doesn't return a
+ * value.
+ * @n_param_values: the length of the @param_values array
+ * @param_values: (array length=n_param_values): an array of
+ * #GValues holding the arguments on which to invoke the
+ * callback of @closure
+ * @invocation_hint: (nullable): the invocation hint given as the
+ * last argument to g_closure_invoke()
+ * @marshal_data: (nullable): additional data specified when
+ * registering the marshaller, see g_closure_set_marshal() and
+ * g_closure_set_meta_marshal()
+ *
+ * The type used for marshaller functions.
+ */
+typedef void (*GClosureMarshal) (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+/**
+ * GVaClosureMarshal:
+ * @closure: the #GClosure to which the marshaller belongs
+ * @return_value: (nullable): a #GValue to store the return
+ * value. May be %NULL if the callback of @closure doesn't return a
+ * value.
+ * @instance: (type GObject.TypeInstance): the instance on which the closure is
+ * invoked.
+ * @args: va_list of arguments to be passed to the closure.
+ * @marshal_data: (nullable): additional data specified when
+ * registering the marshaller, see g_closure_set_marshal() and
+ * g_closure_set_meta_marshal()
+ * @n_params: the length of the @param_types array
+ * @param_types: (array length=n_params): the #GType of each argument from
+ * @args.
+ *
+ * This is the signature of va_list marshaller functions, an optional
+ * marshaller that can be used in some situations to avoid
+ * marshalling the signal argument into GValues.
+ */
+typedef void (* GVaClosureMarshal) (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/**
+ * GCClosure:
+ * @closure: the #GClosure
+ * @callback: the callback function
+ *
+ * A #GCClosure is a specialization of #GClosure for C function callbacks.
+ */
+typedef struct _GCClosure GCClosure;
+
+
+/* --- structures --- */
+struct _GClosureNotifyData
+{
+ gpointer data;
+ GClosureNotify notify;
+};
+/**
+ * GClosure:
+ * @in_marshal: Indicates whether the closure is currently being invoked with
+ * g_closure_invoke()
+ * @is_invalid: Indicates whether the closure has been invalidated by
+ * g_closure_invalidate()
+ *
+ * A #GClosure represents a callback supplied by the programmer.
+ */
+struct _GClosure
+{
+ /*< private >*/
+ volatile guint ref_count : 15;
+ /* meta_marshal is not used anymore but must be zero for historical reasons
+ as it was exposed in the G_CLOSURE_N_NOTIFIERS macro */
+ volatile guint meta_marshal_nouse : 1;
+ volatile guint n_guards : 1;
+ volatile guint n_fnotifiers : 2; /* finalization notifiers */
+ volatile guint n_inotifiers : 8; /* invalidation notifiers */
+ volatile guint in_inotify : 1;
+ volatile guint floating : 1;
+ /*< protected >*/
+ volatile guint derivative_flag : 1;
+ /*< public >*/
+ volatile guint in_marshal : 1;
+ volatile guint is_invalid : 1;
+
+ /*< private >*/ void (*marshal) (GClosure *closure,
+ GValue /*out*/ *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+ /*< protected >*/ gpointer data;
+
+ /*< private >*/ GClosureNotifyData *notifiers;
+
+ /* invariants/constraints:
+ * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE
+ * - invocation of all inotifiers occours prior to fnotifiers
+ * - order of inotifiers is random
+ * inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
+ * - order of fnotifiers is random
+ * - each notifier may only be removed before or during its invocation
+ * - reference counting may only happen prior to fnotify invocation
+ * (in that sense, fnotifiers are really finalization handlers)
+ */
+};
+/* closure for C function calls, callback() is the user function
+ */
+struct _GCClosure
+{
+ GClosure closure;
+ gpointer callback;
+};
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_cclosure_new (GCallback callback_func,
+ gpointer user_data,
+ GClosureNotify destroy_data);
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_cclosure_new_swap (GCallback callback_func,
+ gpointer user_data,
+ GClosureNotify destroy_data);
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_signal_type_cclosure_new (GType itype,
+ guint struct_offset);
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_closure_ref (GClosure *closure);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_sink (GClosure *closure);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_unref (GClosure *closure);
+/* intimidating */
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_closure_new_simple (guint sizeof_closure,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_add_finalize_notifier (GClosure *closure,
+ gpointer notify_data,
+ GClosureNotify notify_func);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_remove_finalize_notifier (GClosure *closure,
+ gpointer notify_data,
+ GClosureNotify notify_func);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_add_invalidate_notifier (GClosure *closure,
+ gpointer notify_data,
+ GClosureNotify notify_func);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_remove_invalidate_notifier (GClosure *closure,
+ gpointer notify_data,
+ GClosureNotify notify_func);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_add_marshal_guards (GClosure *closure,
+ gpointer pre_marshal_data,
+ GClosureNotify pre_marshal_notify,
+ gpointer post_marshal_data,
+ GClosureNotify post_marshal_notify);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_set_marshal (GClosure *closure,
+ GClosureMarshal marshal);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_set_meta_marshal (GClosure *closure,
+ gpointer marshal_data,
+ GClosureMarshal meta_marshal);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_invalidate (GClosure *closure);
+GLIB_AVAILABLE_IN_ALL
+void g_closure_invoke (GClosure *closure,
+ GValue /*out*/ *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint);
+
+/* FIXME:
+ OK: data_object::destroy -> closure_invalidate();
+ MIS: closure_invalidate() -> disconnect(closure);
+ MIS: disconnect(closure) -> (unlink) closure_unref();
+ OK: closure_finalize() -> g_free (data_string);
+
+ random remarks:
+ - need marshaller repo with decent aliasing to base types
+ - provide marshaller collection, virtually covering anything out there
+*/
+
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_generic (GClosure *closure,
+ GValue *return_gvalue,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_generic_va (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args_list,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+
+G_END_DECLS
+
+#endif /* __G_CLOSURE_H__ */
diff --git a/include/glib/gobject/genums.h b/include/glib/gobject/genums.h
new file mode 100644
index 0000000000..c66ce45c00
--- /dev/null
+++ b/include/glib/gobject/genums.h
@@ -0,0 +1,279 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_ENUMS_H__
+#define __G_ENUMS_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+/**
+ * G_TYPE_IS_ENUM:
+ * @type: a #GType ID.
+ *
+ * Checks whether @type "is a" %G_TYPE_ENUM.
+ *
+ * Returns: %TRUE if @type "is a" %G_TYPE_ENUM.
+ */
+#define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
+/**
+ * G_ENUM_CLASS:
+ * @class: a valid #GEnumClass
+ *
+ * Casts a derived #GEnumClass structure into a #GEnumClass structure.
+ */
+#define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
+/**
+ * G_IS_ENUM_CLASS:
+ * @class: a #GEnumClass
+ *
+ * Checks whether @class "is a" valid #GEnumClass structure of type %G_TYPE_ENUM
+ * or derived.
+ */
+#define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
+/**
+ * G_ENUM_CLASS_TYPE:
+ * @class: a #GEnumClass
+ *
+ * Get the type identifier from a given #GEnumClass structure.
+ *
+ * Returns: the #GType
+ */
+#define G_ENUM_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
+/**
+ * G_ENUM_CLASS_TYPE_NAME:
+ * @class: a #GEnumClass
+ *
+ * Get the static type name from a given #GEnumClass structure.
+ *
+ * Returns: the type name.
+ */
+#define G_ENUM_CLASS_TYPE_NAME(class) (g_type_name (G_ENUM_CLASS_TYPE (class)))
+
+
+/**
+ * G_TYPE_IS_FLAGS:
+ * @type: a #GType ID.
+ *
+ * Checks whether @type "is a" %G_TYPE_FLAGS.
+ *
+ * Returns: %TRUE if @type "is a" %G_TYPE_FLAGS.
+ */
+#define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
+/**
+ * G_FLAGS_CLASS:
+ * @class: a valid #GFlagsClass
+ *
+ * Casts a derived #GFlagsClass structure into a #GFlagsClass structure.
+ */
+#define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
+/**
+ * G_IS_FLAGS_CLASS:
+ * @class: a #GFlagsClass
+ *
+ * Checks whether @class "is a" valid #GFlagsClass structure of type %G_TYPE_FLAGS
+ * or derived.
+ */
+#define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
+/**
+ * G_FLAGS_CLASS_TYPE:
+ * @class: a #GFlagsClass
+ *
+ * Get the type identifier from a given #GFlagsClass structure.
+ *
+ * Returns: the #GType
+ */
+#define G_FLAGS_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
+/**
+ * G_FLAGS_CLASS_TYPE_NAME:
+ * @class: a #GFlagsClass
+ *
+ * Get the static type name from a given #GFlagsClass structure.
+ *
+ * Returns: the type name.
+ */
+#define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class)))
+
+
+/**
+ * G_VALUE_HOLDS_ENUM:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values derived from type %G_TYPE_ENUM.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_ENUM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM))
+/**
+ * G_VALUE_HOLDS_FLAGS:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values derived from type %G_TYPE_FLAGS.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_FLAGS(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS))
+
+
+/* --- enum/flag values & classes --- */
+typedef struct _GEnumClass GEnumClass;
+typedef struct _GFlagsClass GFlagsClass;
+typedef struct _GEnumValue GEnumValue;
+typedef struct _GFlagsValue GFlagsValue;
+
+/**
+ * GEnumClass:
+ * @g_type_class: the parent class
+ * @minimum: the smallest possible value.
+ * @maximum: the largest possible value.
+ * @n_values: the number of possible values.
+ * @values: an array of #GEnumValue structs describing the
+ * individual values.
+ *
+ * The class of an enumeration type holds information about its
+ * possible values.
+ */
+struct _GEnumClass
+{
+ GTypeClass g_type_class;
+
+ /*< public >*/
+ gint minimum;
+ gint maximum;
+ guint n_values;
+ GEnumValue *values;
+};
+/**
+ * GFlagsClass:
+ * @g_type_class: the parent class
+ * @mask: a mask covering all possible values.
+ * @n_values: the number of possible values.
+ * @values: an array of #GFlagsValue structs describing the
+ * individual values.
+ *
+ * The class of a flags type holds information about its
+ * possible values.
+ */
+struct _GFlagsClass
+{
+ GTypeClass g_type_class;
+
+ /*< public >*/
+ guint mask;
+ guint n_values;
+ GFlagsValue *values;
+};
+/**
+ * GEnumValue:
+ * @value: the enum value
+ * @value_name: the name of the value
+ * @value_nick: the nickname of the value
+ *
+ * A structure which contains a single enum value, its name, and its
+ * nickname.
+ */
+struct _GEnumValue
+{
+ gint value;
+ const gchar *value_name;
+ const gchar *value_nick;
+};
+/**
+ * GFlagsValue:
+ * @value: the flags value
+ * @value_name: the name of the value
+ * @value_nick: the nickname of the value
+ *
+ * A structure which contains a single flags value, its name, and its
+ * nickname.
+ */
+struct _GFlagsValue
+{
+ guint value;
+ const gchar *value_name;
+ const gchar *value_nick;
+};
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GEnumValue* g_enum_get_value (GEnumClass *enum_class,
+ gint value);
+GLIB_AVAILABLE_IN_ALL
+GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class,
+ const gchar *nick);
+GLIB_AVAILABLE_IN_ALL
+GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class,
+ guint value);
+GLIB_AVAILABLE_IN_ALL
+GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class,
+ const gchar *nick);
+GLIB_AVAILABLE_IN_2_54
+gchar *g_enum_to_string (GType g_enum_type,
+ gint value);
+GLIB_AVAILABLE_IN_2_54
+gchar *g_flags_to_string (GType flags_type,
+ guint value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_enum (GValue *value,
+ gint v_enum);
+GLIB_AVAILABLE_IN_ALL
+gint g_value_get_enum (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_flags (GValue *value,
+ guint v_flags);
+GLIB_AVAILABLE_IN_ALL
+guint g_value_get_flags (const GValue *value);
+
+
+
+/* --- registration functions --- */
+/* const_static_values is a NULL terminated array of enum/flags
+ * values that is taken over!
+ */
+GLIB_AVAILABLE_IN_ALL
+GType g_enum_register_static (const gchar *name,
+ const GEnumValue *const_static_values);
+GLIB_AVAILABLE_IN_ALL
+GType g_flags_register_static (const gchar *name,
+ const GFlagsValue *const_static_values);
+/* functions to complete the type information
+ * for enums/flags implemented by plugins
+ */
+GLIB_AVAILABLE_IN_ALL
+void g_enum_complete_type_info (GType g_enum_type,
+ GTypeInfo *info,
+ const GEnumValue *const_values);
+GLIB_AVAILABLE_IN_ALL
+void g_flags_complete_type_info (GType g_flags_type,
+ GTypeInfo *info,
+ const GFlagsValue *const_values);
+
+G_END_DECLS
+
+#endif /* __G_ENUMS_H__ */
diff --git a/include/glib/gobject/glib-enumtypes.h b/include/glib/gobject/glib-enumtypes.h
new file mode 100644
index 0000000000..9844954982
--- /dev/null
+++ b/include/glib/gobject/glib-enumtypes.h
@@ -0,0 +1,25 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#ifndef __GOBJECT_ENUM_TYPES_H__
+#define __GOBJECT_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "../gobject/../glib/gunicode.h" */
+GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type ())
+GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void) G_GNUC_CONST;
+#define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type ())
+GLIB_AVAILABLE_IN_2_60 GType g_unicode_script_get_type (void) G_GNUC_CONST;
+#define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type ())
+GLIB_AVAILABLE_IN_2_60 GType g_normalize_mode_get_type (void) G_GNUC_CONST;
+#define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type ())
+G_END_DECLS
+
+#endif /* __GOBJECT_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/include/glib/gobject/glib-types.h b/include/glib/gobject/glib-types.h
new file mode 100644
index 0000000000..78a199d1d1
--- /dev/null
+++ b/include/glib/gobject/glib-types.h
@@ -0,0 +1,362 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000-2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __GLIB_TYPES_H__
+#define __GLIB_TYPES_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) && !defined(GLIB_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* A hack necesssary to preprocess this file with g-ir-scanner */
+#ifdef __GI_SCANNER__
+typedef gsize GType;
+#endif
+
+/* --- GLib boxed types --- */
+/**
+ * G_TYPE_DATE:
+ *
+ * The #GType for #GDate.
+ */
+#define G_TYPE_DATE (g_date_get_type ())
+
+/**
+ * G_TYPE_STRV:
+ *
+ * The #GType for a boxed type holding a %NULL-terminated array of strings.
+ *
+ * The code fragments in the following example show the use of a property of
+ * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set()
+ * and g_object_get().
+ *
+ * |[
+ * g_object_class_install_property (object_class,
+ * PROP_AUTHORS,
+ * g_param_spec_boxed ("authors",
+ * _("Authors"),
+ * _("List of authors"),
+ * G_TYPE_STRV,
+ * G_PARAM_READWRITE));
+ *
+ * gchar *authors[] = { "Owen", "Tim", NULL };
+ * g_object_set (obj, "authors", authors, NULL);
+ *
+ * gchar *writers[];
+ * g_object_get (obj, "authors", &writers, NULL);
+ * /&ast; do something with writers &ast;/
+ * g_strfreev (writers);
+ * ]|
+ *
+ * Since: 2.4
+ */
+#define G_TYPE_STRV (g_strv_get_type ())
+
+/**
+ * G_TYPE_GSTRING:
+ *
+ * The #GType for #GString.
+ */
+#define G_TYPE_GSTRING (g_gstring_get_type ())
+
+/**
+ * G_TYPE_HASH_TABLE:
+ *
+ * The #GType for a boxed type holding a #GHashTable reference.
+ *
+ * Since: 2.10
+ */
+#define G_TYPE_HASH_TABLE (g_hash_table_get_type ())
+
+/**
+ * G_TYPE_REGEX:
+ *
+ * The #GType for a boxed type holding a #GRegex reference.
+ *
+ * Since: 2.14
+ */
+#define G_TYPE_REGEX (g_regex_get_type ())
+
+/**
+ * G_TYPE_MATCH_INFO:
+ *
+ * The #GType for a boxed type holding a #GMatchInfo reference.
+ *
+ * Since: 2.30
+ */
+#define G_TYPE_MATCH_INFO (g_match_info_get_type ())
+
+/**
+ * G_TYPE_ARRAY:
+ *
+ * The #GType for a boxed type holding a #GArray reference.
+ *
+ * Since: 2.22
+ */
+#define G_TYPE_ARRAY (g_array_get_type ())
+
+/**
+ * G_TYPE_BYTE_ARRAY:
+ *
+ * The #GType for a boxed type holding a #GByteArray reference.
+ *
+ * Since: 2.22
+ */
+#define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ())
+
+/**
+ * G_TYPE_PTR_ARRAY:
+ *
+ * The #GType for a boxed type holding a #GPtrArray reference.
+ *
+ * Since: 2.22
+ */
+#define G_TYPE_PTR_ARRAY (g_ptr_array_get_type ())
+
+/**
+ * G_TYPE_BYTES:
+ *
+ * The #GType for #GBytes.
+ *
+ * Since: 2.32
+ */
+#define G_TYPE_BYTES (g_bytes_get_type ())
+
+/**
+ * G_TYPE_VARIANT_TYPE:
+ *
+ * The #GType for a boxed type holding a #GVariantType.
+ *
+ * Since: 2.24
+ */
+#define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ())
+
+/**
+ * G_TYPE_ERROR:
+ *
+ * The #GType for a boxed type holding a #GError.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_ERROR (g_error_get_type ())
+
+/**
+ * G_TYPE_DATE_TIME:
+ *
+ * The #GType for a boxed type holding a #GDateTime.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_DATE_TIME (g_date_time_get_type ())
+
+/**
+ * G_TYPE_TIME_ZONE:
+ *
+ * The #GType for a boxed type holding a #GTimeZone.
+ *
+ * Since: 2.34
+ */
+#define G_TYPE_TIME_ZONE (g_time_zone_get_type ())
+
+/**
+ * G_TYPE_IO_CHANNEL:
+ *
+ * The #GType for #GIOChannel.
+ */
+#define G_TYPE_IO_CHANNEL (g_io_channel_get_type ())
+
+/**
+ * G_TYPE_IO_CONDITION:
+ *
+ * The #GType for #GIOCondition.
+ */
+#define G_TYPE_IO_CONDITION (g_io_condition_get_type ())
+
+/**
+ * G_TYPE_VARIANT_BUILDER:
+ *
+ * The #GType for a boxed type holding a #GVariantBuilder.
+ *
+ * Since: 2.30
+ */
+#define G_TYPE_VARIANT_BUILDER (g_variant_builder_get_type ())
+
+/**
+ * G_TYPE_VARIANT_DICT:
+ *
+ * The #GType for a boxed type holding a #GVariantDict.
+ *
+ * Since: 2.40
+ */
+#define G_TYPE_VARIANT_DICT (g_variant_dict_get_type ())
+
+/**
+ * G_TYPE_MAIN_LOOP:
+ *
+ * The #GType for a boxed type holding a #GMainLoop.
+ *
+ * Since: 2.30
+ */
+#define G_TYPE_MAIN_LOOP (g_main_loop_get_type ())
+
+/**
+ * G_TYPE_MAIN_CONTEXT:
+ *
+ * The #GType for a boxed type holding a #GMainContext.
+ *
+ * Since: 2.30
+ */
+#define G_TYPE_MAIN_CONTEXT (g_main_context_get_type ())
+
+/**
+ * G_TYPE_SOURCE:
+ *
+ * The #GType for a boxed type holding a #GSource.
+ *
+ * Since: 2.30
+ */
+#define G_TYPE_SOURCE (g_source_get_type ())
+
+/**
+ * G_TYPE_POLLFD:
+ *
+ * The #GType for a boxed type holding a #GPollFD.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_POLLFD (g_pollfd_get_type ())
+
+/**
+ * G_TYPE_MARKUP_PARSE_CONTEXT:
+ *
+ * The #GType for a boxed type holding a #GMarkupParseContext.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_MARKUP_PARSE_CONTEXT (g_markup_parse_context_get_type ())
+
+/**
+ * G_TYPE_KEY_FILE:
+ *
+ * The #GType for a boxed type holding a #GKeyFile.
+ *
+ * Since: 2.32
+ */
+#define G_TYPE_KEY_FILE (g_key_file_get_type ())
+
+/**
+ * G_TYPE_MAPPED_FILE:
+ *
+ * The #GType for a boxed type holding a #GMappedFile.
+ *
+ * Since: 2.40
+ */
+#define G_TYPE_MAPPED_FILE (g_mapped_file_get_type ())
+
+/**
+ * G_TYPE_THREAD:
+ *
+ * The #GType for a boxed type holding a #GThread.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_THREAD (g_thread_get_type ())
+
+/**
+ * G_TYPE_CHECKSUM:
+ *
+ * The #GType for a boxed type holding a #GChecksum.
+ *
+ * Since: 2.36
+ */
+#define G_TYPE_CHECKSUM (g_checksum_get_type ())
+
+/**
+ * G_TYPE_OPTION_GROUP:
+ *
+ * The #GType for a boxed type holding a #GOptionGroup.
+ *
+ * Since: 2.44
+ */
+#define G_TYPE_OPTION_GROUP (g_option_group_get_type ())
+
+GLIB_AVAILABLE_IN_ALL
+GType g_date_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_strv_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_gstring_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_hash_table_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_array_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_byte_array_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_ptr_array_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_bytes_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_variant_type_get_gtype (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_regex_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_30
+GType g_match_info_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_error_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_date_time_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_time_zone_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_io_channel_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_io_condition_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_variant_builder_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_40
+GType g_variant_dict_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+GType g_key_file_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_30
+GType g_main_loop_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_30
+GType g_main_context_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_30
+GType g_source_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType g_pollfd_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType g_thread_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType g_checksum_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_36
+GType g_markup_parse_context_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_40
+GType g_mapped_file_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_2_44
+GType g_option_group_get_type (void) G_GNUC_CONST;
+
+GLIB_DEPRECATED_FOR('G_TYPE_VARIANT')
+GType g_variant_get_gtype (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GLIB_TYPES_H__ */
diff --git a/include/glib/gobject/gmarshal.h b/include/glib/gobject/gmarshal.h
new file mode 100644
index 0000000000..fdd6c042e1
--- /dev/null
+++ b/include/glib/gobject/gmarshal.h
@@ -0,0 +1,434 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_MARSHAL_H__
+#define __G_MARSHAL_H__
+
+G_BEGIN_DECLS
+
+/* VOID:VOID */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__VOID (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__VOIDv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:BOOLEAN */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__BOOLEANv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:CHAR */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__CHAR (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__CHARv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:UCHAR */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UCHAR (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UCHARv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:INT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__INT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__INTv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:UINT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UINT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UINTv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:LONG */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__LONG (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__LONGv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:ULONG */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__ULONG (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__ULONGv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:ENUM */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__ENUM (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__ENUMv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:FLAGS */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__FLAGS (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__FLAGSv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:FLOAT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__FLOAT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__FLOATv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:DOUBLE */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__DOUBLE (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__DOUBLEv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:STRING */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__STRING (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__STRINGv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:PARAM */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__PARAM (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__PARAMv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:BOXED */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__BOXED (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__BOXEDv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:POINTER */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__POINTERv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:OBJECT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__OBJECT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__OBJECTv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:VARIANT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__VARIANT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__VARIANTv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* VOID:UINT,POINTER */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UINT_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__UINT_POINTERv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* BOOL:FLAGS */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_BOOLEAN__FLAGS (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_BOOLEAN__FLAGSv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/**
+ * g_cclosure_marshal_BOOL__FLAGS:
+ * @closure: A #GClosure.
+ * @return_value: A #GValue to store the return value. May be %NULL
+ * if the callback of closure doesn't return a value.
+ * @n_param_values: The length of the @param_values array.
+ * @param_values: An array of #GValues holding the arguments
+ * on which to invoke the callback of closure.
+ * @invocation_hint: The invocation hint given as the last argument to
+ * g_closure_invoke().
+ * @marshal_data: Additional data specified when registering the
+ * marshaller, see g_closure_set_marshal() and
+ * g_closure_set_meta_marshal()
+ *
+ * An old alias for g_cclosure_marshal_BOOLEAN__FLAGS().
+ */
+#define g_cclosure_marshal_BOOL__FLAGS g_cclosure_marshal_BOOLEAN__FLAGS
+
+/* STRING:OBJECT,POINTER */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_STRING__OBJECT_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_STRING__OBJECT_POINTERv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/* BOOL:BOXED,BOXED */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_BOOLEAN__BOXED_BOXED (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv (GClosure *closure,
+ GValue *return_value,
+ gpointer instance,
+ va_list args,
+ gpointer marshal_data,
+ int n_params,
+ GType *param_types);
+
+/**
+ * g_cclosure_marshal_BOOL__BOXED_BOXED:
+ * @closure: A #GClosure.
+ * @return_value: A #GValue to store the return value. May be %NULL
+ * if the callback of closure doesn't return a value.
+ * @n_param_values: The length of the @param_values array.
+ * @param_values: An array of #GValues holding the arguments
+ * on which to invoke the callback of closure.
+ * @invocation_hint: The invocation hint given as the last argument to
+ * g_closure_invoke().
+ * @marshal_data: Additional data specified when registering the
+ * marshaller, see g_closure_set_marshal() and
+ * g_closure_set_meta_marshal()
+ *
+ * An old alias for g_cclosure_marshal_BOOLEAN__BOXED_BOXED().
+ */
+#define g_cclosure_marshal_BOOL__BOXED_BOXED g_cclosure_marshal_BOOLEAN__BOXED_BOXED
+
+G_END_DECLS
+
+#endif /* __G_MARSHAL_H__ */
diff --git a/include/glib/gobject/gobject-autocleanups.h b/include/glib/gobject/gobject-autocleanups.h
new file mode 100644
index 0000000000..1613857ecd
--- /dev/null
+++ b/include/glib/gobject/gobject-autocleanups.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2015 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeClass, g_type_class_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)
diff --git a/include/glib/gobject/gobject.h b/include/glib/gobject/gobject.h
new file mode 100644
index 0000000000..91b9f63283
--- /dev/null
+++ b/include/glib/gobject/gobject.h
@@ -0,0 +1,899 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_OBJECT_H__
+#define __G_OBJECT_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+#include <gobject/gvalue.h>
+#include <gobject/gparam.h>
+#include <gobject/gclosure.h>
+#include <gobject/gsignal.h>
+#include <gobject/gboxed.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+/**
+ * G_TYPE_IS_OBJECT:
+ * @type: Type id to check
+ *
+ * Check if the passed in type id is a %G_TYPE_OBJECT or derived from it.
+ *
+ * Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT.
+ */
+#define G_TYPE_IS_OBJECT(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
+/**
+ * G_OBJECT:
+ * @object: Object which is subject to casting.
+ *
+ * Casts a #GObject or derived pointer into a (GObject*) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
+#define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
+/**
+ * G_OBJECT_CLASS:
+ * @class: a valid #GObjectClass
+ *
+ * Casts a derived #GObjectClass structure into a #GObjectClass structure.
+ */
+#define G_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
+/**
+ * G_IS_OBJECT:
+ * @object: Instance to check for being a %G_TYPE_OBJECT.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT.
+ */
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42
+#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT))
+#else
+#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
+#endif
+/**
+ * G_IS_OBJECT_CLASS:
+ * @class: a #GObjectClass
+ *
+ * Checks whether @class "is a" valid #GObjectClass structure of type
+ * %G_TYPE_OBJECT or derived.
+ */
+#define G_IS_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
+/**
+ * G_OBJECT_GET_CLASS:
+ * @object: a #GObject instance.
+ *
+ * Get the class structure associated to a #GObject instance.
+ *
+ * Returns: pointer to object class structure.
+ */
+#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
+/**
+ * G_OBJECT_TYPE:
+ * @object: Object to return the type id for.
+ *
+ * Get the type id of an object.
+ *
+ * Returns: Type id of @object.
+ */
+#define G_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object))
+/**
+ * G_OBJECT_TYPE_NAME:
+ * @object: Object to return the type name for.
+ *
+ * Get the name of an object's type.
+ *
+ * Returns: Type name of @object. The string is owned by the type system and
+ * should not be freed.
+ */
+#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object)))
+/**
+ * G_OBJECT_CLASS_TYPE:
+ * @class: a valid #GObjectClass
+ *
+ * Get the type id of a class structure.
+ *
+ * Returns: Type id of @class.
+ */
+#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
+/**
+ * G_OBJECT_CLASS_NAME:
+ * @class: a valid #GObjectClass
+ *
+ * Return the name of a class structure's type.
+ *
+ * Returns: Type name of @class. The string is owned by the type system and
+ * should not be freed.
+ */
+#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class)))
+/**
+ * G_VALUE_HOLDS_OBJECT:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values derived from type %G_TYPE_OBJECT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT))
+
+/* --- type macros --- */
+/**
+ * G_TYPE_INITIALLY_UNOWNED:
+ *
+ * The type for #GInitiallyUnowned.
+ */
+#define G_TYPE_INITIALLY_UNOWNED (g_initially_unowned_get_type())
+/**
+ * G_INITIALLY_UNOWNED:
+ * @object: Object which is subject to casting.
+ *
+ * Casts a #GInitiallyUnowned or derived pointer into a (GInitiallyUnowned*)
+ * pointer. Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
+#define G_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned))
+/**
+ * G_INITIALLY_UNOWNED_CLASS:
+ * @class: a valid #GInitiallyUnownedClass
+ *
+ * Casts a derived #GInitiallyUnownedClass structure into a
+ * #GInitiallyUnownedClass structure.
+ */
+#define G_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass))
+/**
+ * G_IS_INITIALLY_UNOWNED:
+ * @object: Instance to check for being a %G_TYPE_INITIALLY_UNOWNED.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_INITIALLY_UNOWNED.
+ */
+#define G_IS_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_INITIALLY_UNOWNED))
+/**
+ * G_IS_INITIALLY_UNOWNED_CLASS:
+ * @class: a #GInitiallyUnownedClass
+ *
+ * Checks whether @class "is a" valid #GInitiallyUnownedClass structure of type
+ * %G_TYPE_INITIALLY_UNOWNED or derived.
+ */
+#define G_IS_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_INITIALLY_UNOWNED))
+/**
+ * G_INITIALLY_UNOWNED_GET_CLASS:
+ * @object: a #GInitiallyUnowned instance.
+ *
+ * Get the class structure associated to a #GInitiallyUnowned instance.
+ *
+ * Returns: pointer to object class structure.
+ */
+#define G_INITIALLY_UNOWNED_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass))
+/* GInitiallyUnowned ia a GObject with initially floating reference count */
+
+
+/* --- typedefs & structures --- */
+typedef struct _GObject GObject;
+typedef struct _GObjectClass GObjectClass;
+typedef struct _GObject GInitiallyUnowned;
+typedef struct _GObjectClass GInitiallyUnownedClass;
+typedef struct _GObjectConstructParam GObjectConstructParam;
+/**
+ * GObjectGetPropertyFunc:
+ * @object: a #GObject
+ * @property_id: the numeric id under which the property was registered with
+ * g_object_class_install_property().
+ * @value: a #GValue to return the property value in
+ * @pspec: the #GParamSpec describing the property
+ *
+ * The type of the @get_property function of #GObjectClass.
+ */
+typedef void (*GObjectGetPropertyFunc) (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+/**
+ * GObjectSetPropertyFunc:
+ * @object: a #GObject
+ * @property_id: the numeric id under which the property was registered with
+ * g_object_class_install_property().
+ * @value: the new value for the property
+ * @pspec: the #GParamSpec describing the property
+ *
+ * The type of the @set_property function of #GObjectClass.
+ */
+typedef void (*GObjectSetPropertyFunc) (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+/**
+ * GObjectFinalizeFunc:
+ * @object: the #GObject being finalized
+ *
+ * The type of the @finalize function of #GObjectClass.
+ */
+typedef void (*GObjectFinalizeFunc) (GObject *object);
+/**
+ * GWeakNotify:
+ * @data: data that was provided when the weak reference was established
+ * @where_the_object_was: the object being finalized
+ *
+ * A #GWeakNotify function can be added to an object as a callback that gets
+ * triggered when the object is finalized. Since the object is already being
+ * finalized when the #GWeakNotify is called, there's not much you could do
+ * with the object, apart from e.g. using its address as hash-index or the like.
+ */
+typedef void (*GWeakNotify) (gpointer data,
+ GObject *where_the_object_was);
+/**
+ * GObject:
+ *
+ * All the fields in the GObject structure are private
+ * to the #GObject implementation and should never be accessed directly.
+ */
+struct _GObject
+{
+ GTypeInstance g_type_instance;
+
+ /*< private >*/
+ volatile guint ref_count;
+ GData *qdata;
+};
+/**
+ * GObjectClass:
+ * @g_type_class: the parent class
+ * @constructor: the @constructor function is called by g_object_new () to
+ * complete the object initialization after all the construction properties are
+ * set. The first thing a @constructor implementation must do is chain up to the
+ * @constructor of the parent class. Overriding @constructor should be rarely
+ * needed, e.g. to handle construct properties, or to implement singletons.
+ * @set_property: the generic setter for all properties of this type. Should be
+ * overridden for every type with properties. If implementations of
+ * @set_property don't emit property change notification explicitly, this will
+ * be done implicitly by the type system. However, if the notify signal is
+ * emitted explicitly, the type system will not emit it a second time.
+ * @get_property: the generic getter for all properties of this type. Should be
+ * overridden for every type with properties.
+ * @dispose: the @dispose function is supposed to drop all references to other
+ * objects, but keep the instance otherwise intact, so that client method
+ * invocations still work. It may be run multiple times (due to reference
+ * loops). Before returning, @dispose should chain up to the @dispose method
+ * of the parent class.
+ * @finalize: instance finalization function, should finish the finalization of
+ * the instance begun in @dispose and chain up to the @finalize method of the
+ * parent class.
+ * @dispatch_properties_changed: emits property change notification for a bunch
+ * of properties. Overriding @dispatch_properties_changed should be rarely
+ * needed.
+ * @notify: the class closure for the notify signal
+ * @constructed: the @constructed function is called by g_object_new() as the
+ * final step of the object creation process. At the point of the call, all
+ * construction properties have been set on the object. The purpose of this
+ * call is to allow for object initialisation steps that can only be performed
+ * after construction properties have been set. @constructed implementors
+ * should chain up to the @constructed call of their parent class to allow it
+ * to complete its initialisation.
+ *
+ * The class structure for the GObject type.
+ *
+ * |[<!-- language="C" -->
+ * // Example of implementing a singleton using a constructor.
+ * static MySingleton *the_singleton = NULL;
+ *
+ * static GObject*
+ * my_singleton_constructor (GType type,
+ * guint n_construct_params,
+ * GObjectConstructParam *construct_params)
+ * {
+ * GObject *object;
+ *
+ * if (!the_singleton)
+ * {
+ * object = G_OBJECT_CLASS (parent_class)->constructor (type,
+ * n_construct_params,
+ * construct_params);
+ * the_singleton = MY_SINGLETON (object);
+ * }
+ * else
+ * object = g_object_ref (G_OBJECT (the_singleton));
+ *
+ * return object;
+ * }
+ * ]|
+ */
+struct _GObjectClass
+{
+ GTypeClass g_type_class;
+
+ /*< private >*/
+ GSList *construct_properties;
+
+ /*< public >*/
+ /* seldom overidden */
+ GObject* (*constructor) (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
+ /* overridable methods */
+ void (*set_property) (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+ void (*get_property) (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+ void (*dispose) (GObject *object);
+ void (*finalize) (GObject *object);
+ /* seldom overidden */
+ void (*dispatch_properties_changed) (GObject *object,
+ guint n_pspecs,
+ GParamSpec **pspecs);
+ /* signals */
+ void (*notify) (GObject *object,
+ GParamSpec *pspec);
+
+ /* called when done constructing */
+ void (*constructed) (GObject *object);
+
+ /*< private >*/
+ gsize flags;
+
+ /* padding */
+ gpointer pdummy[6];
+};
+/**
+ * GObjectConstructParam:
+ * @pspec: the #GParamSpec of the construct parameter
+ * @value: the value to set the parameter to
+ *
+ * The GObjectConstructParam struct is an auxiliary
+ * structure used to hand #GParamSpec/#GValue pairs to the @constructor of
+ * a #GObjectClass.
+ */
+struct _GObjectConstructParam
+{
+ GParamSpec *pspec;
+ GValue *value;
+};
+
+/**
+ * GInitiallyUnowned:
+ *
+ * All the fields in the GInitiallyUnowned structure
+ * are private to the #GInitiallyUnowned implementation and should never be
+ * accessed directly.
+ */
+/**
+ * GInitiallyUnownedClass:
+ *
+ * The class structure for the GInitiallyUnowned type.
+ */
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GType g_initially_unowned_get_type (void);
+GLIB_AVAILABLE_IN_ALL
+void g_object_class_install_property (GObjectClass *oclass,
+ guint property_id,
+ GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_object_class_find_property (GObjectClass *oclass,
+ const gchar *property_name);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec**g_object_class_list_properties (GObjectClass *oclass,
+ guint *n_properties);
+GLIB_AVAILABLE_IN_ALL
+void g_object_class_override_property (GObjectClass *oclass,
+ guint property_id,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+void g_object_class_install_properties (GObjectClass *oclass,
+ guint n_pspecs,
+ GParamSpec **pspecs);
+
+GLIB_AVAILABLE_IN_ALL
+void g_object_interface_install_property (gpointer g_iface,
+ GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_object_interface_find_property (gpointer g_iface,
+ const gchar *property_name);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec**g_object_interface_list_properties (gpointer g_iface,
+ guint *n_properties_p);
+
+GLIB_AVAILABLE_IN_ALL
+GType g_object_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_new (GType object_type,
+ const gchar *first_property_name,
+ ...);
+GLIB_AVAILABLE_IN_2_54
+GObject* g_object_new_with_properties (GType object_type,
+ guint n_properties,
+ const char *names[],
+ const GValue values[]);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties)
+gpointer g_object_newv (GType object_type,
+ guint n_parameters,
+ GParameter *parameters);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+GObject* g_object_new_valist (GType object_type,
+ const gchar *first_property_name,
+ va_list var_args);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set (gpointer object,
+ const gchar *first_property_name,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+void g_object_get (gpointer object,
+ const gchar *first_property_name,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_connect (gpointer object,
+ const gchar *signal_spec,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_ALL
+void g_object_disconnect (gpointer object,
+ const gchar *signal_spec,
+ ...) G_GNUC_NULL_TERMINATED;
+GLIB_AVAILABLE_IN_2_54
+void g_object_setv (GObject *object,
+ guint n_properties,
+ const gchar *names[],
+ const GValue values[]);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_valist (GObject *object,
+ const gchar *first_property_name,
+ va_list var_args);
+GLIB_AVAILABLE_IN_2_54
+void g_object_getv (GObject *object,
+ guint n_properties,
+ const gchar *names[],
+ GValue values[]);
+GLIB_AVAILABLE_IN_ALL
+void g_object_get_valist (GObject *object,
+ const gchar *first_property_name,
+ va_list var_args);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_property (GObject *object,
+ const gchar *property_name,
+ const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_object_get_property (GObject *object,
+ const gchar *property_name,
+ GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_object_freeze_notify (GObject *object);
+GLIB_AVAILABLE_IN_ALL
+void g_object_notify (GObject *object,
+ const gchar *property_name);
+GLIB_AVAILABLE_IN_ALL
+void g_object_notify_by_pspec (GObject *object,
+ GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+void g_object_thaw_notify (GObject *object);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_object_is_floating (gpointer object);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_ref_sink (gpointer object);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_ref (gpointer object);
+GLIB_AVAILABLE_IN_ALL
+void g_object_unref (gpointer object);
+GLIB_AVAILABLE_IN_ALL
+void g_object_weak_ref (GObject *object,
+ GWeakNotify notify,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_object_weak_unref (GObject *object,
+ GWeakNotify notify,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_object_add_weak_pointer (GObject *object,
+ gpointer *weak_pointer_location);
+GLIB_AVAILABLE_IN_ALL
+void g_object_remove_weak_pointer (GObject *object,
+ gpointer *weak_pointer_location);
+
+#if defined(g_has_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
+/* Make reference APIs type safe with macros */
+#define g_object_ref(Obj) ((__typeof__(Obj)) (g_object_ref) (Obj))
+#define g_object_ref_sink(Obj) ((__typeof__(Obj)) (g_object_ref_sink) (Obj))
+#endif
+
+/**
+ * GToggleNotify:
+ * @data: Callback data passed to g_object_add_toggle_ref()
+ * @object: The object on which g_object_add_toggle_ref() was called.
+ * @is_last_ref: %TRUE if the toggle reference is now the
+ * last reference to the object. %FALSE if the toggle
+ * reference was the last reference and there are now other
+ * references.
+ *
+ * A callback function used for notification when the state
+ * of a toggle reference changes. See g_object_add_toggle_ref().
+ */
+typedef void (*GToggleNotify) (gpointer data,
+ GObject *object,
+ gboolean is_last_ref);
+
+GLIB_AVAILABLE_IN_ALL
+void g_object_add_toggle_ref (GObject *object,
+ GToggleNotify notify,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_object_remove_toggle_ref (GObject *object,
+ GToggleNotify notify,
+ gpointer data);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_get_qdata (GObject *object,
+ GQuark quark);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_qdata (GObject *object,
+ GQuark quark,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_qdata_full (GObject *object,
+ GQuark quark,
+ gpointer data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_steal_qdata (GObject *object,
+ GQuark quark);
+
+GLIB_AVAILABLE_IN_2_34
+gpointer g_object_dup_qdata (GObject *object,
+ GQuark quark,
+ GDuplicateFunc dup_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_object_replace_qdata (GObject *object,
+ GQuark quark,
+ gpointer oldval,
+ gpointer newval,
+ GDestroyNotify destroy,
+ GDestroyNotify *old_destroy);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_get_data (GObject *object,
+ const gchar *key);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_data (GObject *object,
+ const gchar *key,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_object_set_data_full (GObject *object,
+ const gchar *key,
+ gpointer data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_object_steal_data (GObject *object,
+ const gchar *key);
+
+GLIB_AVAILABLE_IN_2_34
+gpointer g_object_dup_data (GObject *object,
+ const gchar *key,
+ GDuplicateFunc dup_func,
+ gpointer user_data);
+GLIB_AVAILABLE_IN_2_34
+gboolean g_object_replace_data (GObject *object,
+ const gchar *key,
+ gpointer oldval,
+ gpointer newval,
+ GDestroyNotify destroy,
+ GDestroyNotify *old_destroy);
+
+
+GLIB_AVAILABLE_IN_ALL
+void g_object_watch_closure (GObject *object,
+ GClosure *closure);
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_cclosure_new_object (GCallback callback_func,
+ GObject *object);
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_cclosure_new_object_swap (GCallback callback_func,
+ GObject *object);
+GLIB_AVAILABLE_IN_ALL
+GClosure* g_closure_new_object (guint sizeof_closure,
+ GObject *object);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_object (GValue *value,
+ gpointer v_object);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_get_object (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_dup_object (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_connect_object (gpointer instance,
+ const gchar *detailed_signal,
+ GCallback c_handler,
+ gpointer gobject,
+ GConnectFlags connect_flags);
+
+/*< protected >*/
+GLIB_AVAILABLE_IN_ALL
+void g_object_force_floating (GObject *object);
+GLIB_AVAILABLE_IN_ALL
+void g_object_run_dispose (GObject *object);
+
+
+GLIB_AVAILABLE_IN_ALL
+void g_value_take_object (GValue *value,
+ gpointer v_object);
+GLIB_DEPRECATED_FOR(g_value_take_object)
+void g_value_set_object_take_ownership (GValue *value,
+ gpointer v_object);
+
+GLIB_DEPRECATED
+gsize g_object_compat_control (gsize what,
+ gpointer data);
+
+/* --- implementation macros --- */
+#define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \
+G_STMT_START { \
+ GObject *_glib__object = (GObject*) (object); \
+ GParamSpec *_glib__pspec = (GParamSpec*) (pspec); \
+ guint _glib__property_id = (property_id); \
+ g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'", \
+ __FILE__, __LINE__, \
+ (pname), \
+ _glib__property_id, \
+ _glib__pspec->name, \
+ g_type_name (G_PARAM_SPEC_TYPE (_glib__pspec)), \
+ G_OBJECT_TYPE_NAME (_glib__object)); \
+} G_STMT_END
+/**
+ * G_OBJECT_WARN_INVALID_PROPERTY_ID:
+ * @object: the #GObject on which set_property() or get_property() was called
+ * @property_id: the numeric id of the property
+ * @pspec: the #GParamSpec of the property
+ *
+ * This macro should be used to emit a standard warning about unexpected
+ * properties in set_property() and get_property() implementations.
+ */
+#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \
+ G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
+
+GLIB_AVAILABLE_IN_ALL
+void g_clear_object (GObject **object_ptr);
+#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref)
+
+/**
+ * g_set_object: (skip)
+ * @object_ptr: a pointer to a #GObject reference
+ * @new_object: (nullable) (transfer none): a pointer to the new #GObject to
+ * assign to it, or %NULL to clear the pointer
+ *
+ * Updates a #GObject pointer to refer to @new_object. It increments the
+ * reference count of @new_object (if non-%NULL), decrements the reference
+ * count of the current value of @object_ptr (if non-%NULL), and assigns
+ * @new_object to @object_ptr. The assignment is not atomic.
+ *
+ * @object_ptr must not be %NULL.
+ *
+ * A macro is also included that allows this function to be used without
+ * pointer casts. The function itself is static inline, so its address may vary
+ * between compilation units.
+ *
+ * One convenient usage of this function is in implementing property setters:
+ * |[
+ * void
+ * foo_set_bar (Foo *foo,
+ * Bar *new_bar)
+ * {
+ * g_return_if_fail (IS_FOO (foo));
+ * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar));
+ *
+ * if (g_set_object (&foo->bar, new_bar))
+ * g_object_notify (foo, "bar");
+ * }
+ * ]|
+ *
+ * Returns: %TRUE if the value of @object_ptr changed, %FALSE otherwise
+ *
+ * Since: 2.44
+ */
+static inline gboolean
+(g_set_object) (GObject **object_ptr,
+ GObject *new_object)
+{
+ GObject *old_object = *object_ptr;
+
+ /* rely on g_object_[un]ref() to check the pointers are actually GObjects;
+ * elide a (object_ptr != NULL) check because most of the time we will be
+ * operating on struct members with a constant offset, so a NULL check would
+ * not catch bugs
+ */
+
+ if (old_object == new_object)
+ return FALSE;
+
+ if (new_object != NULL)
+ g_object_ref (new_object);
+
+ *object_ptr = new_object;
+
+ if (old_object != NULL)
+ g_object_unref (old_object);
+
+ return TRUE;
+}
+
+#define g_set_object(object_ptr, new_object) \
+ (/* Check types match. */ \
+ 0 ? *(object_ptr) = (new_object), FALSE : \
+ (g_set_object) ((GObject **) (object_ptr), (GObject *) (new_object)) \
+ )
+
+/**
+ * g_assert_finalize_object: (skip)
+ * @object: (transfer full) (type GObject.Object): an object
+ *
+ * Assert that @object is non-%NULL, then release one reference to it with
+ * g_object_unref() and assert that it has been finalized (i.e. that there
+ * are no more references).
+ *
+ * If assertions are disabled via `G_DISABLE_ASSERT`,
+ * this macro just calls g_object_unref() without any further checks.
+ *
+ * This macro should only be used in regression tests.
+ *
+ * Since: 2.62
+ */
+static inline void
+(g_assert_finalize_object) (GObject *object)
+{
+ gpointer weak_pointer = object;
+
+ g_assert_true (G_IS_OBJECT (weak_pointer));
+ g_object_add_weak_pointer (object, &weak_pointer);
+ g_object_unref (weak_pointer);
+ g_assert_null (weak_pointer);
+}
+
+#ifdef G_DISABLE_ASSERT
+#define g_assert_finalize_object(object) g_object_unref (object)
+#else
+#define g_assert_finalize_object(object) (g_assert_finalize_object ((GObject *) object))
+#endif
+
+/**
+ * g_clear_weak_pointer: (skip)
+ * @weak_pointer_location: The memory address of a pointer
+ *
+ * Clears a weak reference to a #GObject.
+ *
+ * @weak_pointer_location must not be %NULL.
+ *
+ * If the weak reference is %NULL then this function does nothing.
+ * Otherwise, the weak reference to the object is removed for that location
+ * and the pointer is set to %NULL.
+ *
+ * A macro is also included that allows this function to be used without
+ * pointer casts. The function itself is static inline, so its address may vary
+ * between compilation units.
+ *
+ * Since: 2.56
+ */
+static inline void
+(g_clear_weak_pointer) (gpointer *weak_pointer_location)
+{
+ GObject *object = (GObject *) *weak_pointer_location;
+
+ if (object != NULL)
+ {
+ g_object_remove_weak_pointer (object, weak_pointer_location);
+ *weak_pointer_location = NULL;
+ }
+}
+
+#define g_clear_weak_pointer(weak_pointer_location) \
+ (/* Check types match. */ \
+ (g_clear_weak_pointer) ((gpointer *) (weak_pointer_location)) \
+ )
+
+/**
+ * g_set_weak_pointer: (skip)
+ * @weak_pointer_location: the memory address of a pointer
+ * @new_object: (nullable) (transfer none): a pointer to the new #GObject to
+ * assign to it, or %NULL to clear the pointer
+ *
+ * Updates a pointer to weakly refer to @new_object. It assigns @new_object
+ * to @weak_pointer_location and ensures that @weak_pointer_location will
+ * automaticaly be set to %NULL if @new_object gets destroyed. The assignment
+ * is not atomic. The weak reference is not thread-safe, see
+ * g_object_add_weak_pointer() for details.
+ *
+ * @weak_pointer_location must not be %NULL.
+ *
+ * A macro is also included that allows this function to be used without
+ * pointer casts. The function itself is static inline, so its address may vary
+ * between compilation units.
+ *
+ * One convenient usage of this function is in implementing property setters:
+ * |[
+ * void
+ * foo_set_bar (Foo *foo,
+ * Bar *new_bar)
+ * {
+ * g_return_if_fail (IS_FOO (foo));
+ * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar));
+ *
+ * if (g_set_weak_pointer (&foo->bar, new_bar))
+ * g_object_notify (foo, "bar");
+ * }
+ * ]|
+ *
+ * Returns: %TRUE if the value of @weak_pointer_location changed, %FALSE otherwise
+ *
+ * Since: 2.56
+ */
+static inline gboolean
+(g_set_weak_pointer) (gpointer *weak_pointer_location,
+ GObject *new_object)
+{
+ GObject *old_object = (GObject *) *weak_pointer_location;
+
+ /* elide a (weak_pointer_location != NULL) check because most of the time we
+ * will be operating on struct members with a constant offset, so a NULL
+ * check would not catch bugs
+ */
+
+ if (old_object == new_object)
+ return FALSE;
+
+ if (old_object != NULL)
+ g_object_remove_weak_pointer (old_object, weak_pointer_location);
+
+ *weak_pointer_location = new_object;
+
+ if (new_object != NULL)
+ g_object_add_weak_pointer (new_object, weak_pointer_location);
+
+ return TRUE;
+}
+
+#define g_set_weak_pointer(weak_pointer_location, new_object) \
+ (/* Check types match. */ \
+ 0 ? *(weak_pointer_location) = (new_object), FALSE : \
+ (g_set_weak_pointer) ((gpointer *) (weak_pointer_location), (GObject *) (new_object)) \
+ )
+
+typedef struct {
+ /*<private>*/
+ union { gpointer p; } priv;
+} GWeakRef;
+
+GLIB_AVAILABLE_IN_ALL
+void g_weak_ref_init (GWeakRef *weak_ref,
+ gpointer object);
+GLIB_AVAILABLE_IN_ALL
+void g_weak_ref_clear (GWeakRef *weak_ref);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_weak_ref_get (GWeakRef *weak_ref);
+GLIB_AVAILABLE_IN_ALL
+void g_weak_ref_set (GWeakRef *weak_ref,
+ gpointer object);
+
+G_END_DECLS
+
+#endif /* __G_OBJECT_H__ */
diff --git a/include/glib/gobject/gobjectnotifyqueue.c b/include/glib/gobject/gobjectnotifyqueue.c
new file mode 100644
index 0000000000..1a7d23f266
--- /dev/null
+++ b/include/glib/gobject/gobjectnotifyqueue.c
@@ -0,0 +1,197 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* WARNING:
+ *
+ * This file is INSTALLED and other projects (outside of glib)
+ * #include its contents.
+ */
+
+#ifndef __G_OBJECT_NOTIFY_QUEUE_H__
+#define __G_OBJECT_NOTIFY_QUEUE_H__
+
+#include <string.h> /* memset */
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+
+/* --- typedefs --- */
+typedef struct _GObjectNotifyContext GObjectNotifyContext;
+typedef struct _GObjectNotifyQueue GObjectNotifyQueue;
+typedef void (*GObjectNotifyQueueDispatcher) (GObject *object,
+ guint n_pspecs,
+ GParamSpec **pspecs);
+
+
+/* --- structures --- */
+struct _GObjectNotifyContext
+{
+ GQuark quark_notify_queue;
+ GObjectNotifyQueueDispatcher dispatcher;
+ GTrashStack *_nqueue_trash; /* unused */
+};
+struct _GObjectNotifyQueue
+{
+ GObjectNotifyContext *context;
+ GSList *pspecs;
+ guint16 n_pspecs;
+ guint16 freeze_count;
+};
+
+G_LOCK_DEFINE_STATIC(notify_lock);
+
+/* --- functions --- */
+static void
+g_object_notify_queue_free (gpointer data)
+{
+ GObjectNotifyQueue *nqueue = data;
+
+ g_slist_free (nqueue->pspecs);
+ g_slice_free (GObjectNotifyQueue, nqueue);
+}
+
+static inline GObjectNotifyQueue*
+g_object_notify_queue_freeze (GObject *object,
+ GObjectNotifyContext *context)
+{
+ GObjectNotifyQueue *nqueue;
+
+ G_LOCK(notify_lock);
+ nqueue = g_datalist_id_get_data (&object->qdata, context->quark_notify_queue);
+ if (!nqueue)
+ {
+ nqueue = g_slice_new0 (GObjectNotifyQueue);
+ nqueue->context = context;
+ g_datalist_id_set_data_full (&object->qdata, context->quark_notify_queue,
+ nqueue, g_object_notify_queue_free);
+ }
+
+ if (nqueue->freeze_count >= 65535)
+ g_critical("Free queue for %s (%p) is larger than 65535,"
+ " called g_object_freeze_notify() too often."
+ " Forgot to call g_object_thaw_notify() or infinite loop",
+ G_OBJECT_TYPE_NAME (object), object);
+ else
+ nqueue->freeze_count++;
+ G_UNLOCK(notify_lock);
+
+ return nqueue;
+}
+
+static inline void
+g_object_notify_queue_thaw (GObject *object,
+ GObjectNotifyQueue *nqueue)
+{
+ GObjectNotifyContext *context = nqueue->context;
+ GParamSpec *pspecs_mem[16], **pspecs, **free_me = NULL;
+ GSList *slist;
+ guint n_pspecs = 0;
+
+ g_return_if_fail (nqueue->freeze_count > 0);
+ g_return_if_fail (g_atomic_int_get(&object->ref_count) > 0);
+
+ G_LOCK(notify_lock);
+
+ /* Just make sure we never get into some nasty race condition */
+ if (G_UNLIKELY(nqueue->freeze_count == 0)) {
+ G_UNLOCK(notify_lock);
+ g_warning ("%s: property-changed notification for %s(%p) is not frozen",
+ G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
+ return;
+ }
+
+ nqueue->freeze_count--;
+ if (nqueue->freeze_count) {
+ G_UNLOCK(notify_lock);
+ return;
+ }
+
+ pspecs = nqueue->n_pspecs > 16 ? free_me = g_new (GParamSpec*, nqueue->n_pspecs) : pspecs_mem;
+
+ for (slist = nqueue->pspecs; slist; slist = slist->next)
+ {
+ pspecs[n_pspecs++] = slist->data;
+ }
+ g_datalist_id_set_data (&object->qdata, context->quark_notify_queue, NULL);
+
+ G_UNLOCK(notify_lock);
+
+ if (n_pspecs)
+ context->dispatcher (object, n_pspecs, pspecs);
+ g_free (free_me);
+}
+
+static inline void
+g_object_notify_queue_clear (GObject *object,
+ GObjectNotifyQueue *nqueue)
+{
+ g_return_if_fail (nqueue->freeze_count > 0);
+
+ G_LOCK(notify_lock);
+
+ g_slist_free (nqueue->pspecs);
+ nqueue->pspecs = NULL;
+ nqueue->n_pspecs = 0;
+
+ G_UNLOCK(notify_lock);
+}
+
+static inline void
+g_object_notify_queue_add (GObject *object,
+ GObjectNotifyQueue *nqueue,
+ GParamSpec *pspec)
+{
+ if (pspec->flags & G_PARAM_READABLE)
+ {
+ GParamSpec *redirect;
+
+ G_LOCK(notify_lock);
+
+ g_return_if_fail (nqueue->n_pspecs < 65535);
+
+ redirect = g_param_spec_get_redirect_target (pspec);
+ if (redirect)
+ pspec = redirect;
+
+ /* we do the deduping in _thaw */
+ if (g_slist_find (nqueue->pspecs, pspec) == NULL)
+ {
+ nqueue->pspecs = g_slist_prepend (nqueue->pspecs, pspec);
+ nqueue->n_pspecs++;
+ }
+
+ G_UNLOCK(notify_lock);
+ }
+}
+
+/* NB: This function is not threadsafe, do not ever use it if
+ * you need a threadsafe notify queue.
+ * Use g_object_notify_queue_freeze() to acquire the queue and
+ * g_object_notify_queue_thaw() after you are done instead.
+ */
+static inline GObjectNotifyQueue*
+g_object_notify_queue_from_object (GObject *object,
+ GObjectNotifyContext *context)
+{
+ return g_datalist_id_get_data (&object->qdata, context->quark_notify_queue);
+}
+
+G_END_DECLS
+
+#endif /* __G_OBJECT_NOTIFY_QUEUE_H__ */
diff --git a/include/glib/gobject/gparam.h b/include/glib/gobject/gparam.h
new file mode 100644
index 0000000000..33f95f0c5c
--- /dev/null
+++ b/include/glib/gobject/gparam.h
@@ -0,0 +1,452 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gparam.h: GParamSpec base class implementation
+ */
+#ifndef __G_PARAM_H__
+#define __G_PARAM_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gvalue.h>
+
+G_BEGIN_DECLS
+
+/* --- standard type macros --- */
+/**
+ * G_TYPE_IS_PARAM:
+ * @type: a #GType ID
+ *
+ * Checks whether @type "is a" %G_TYPE_PARAM.
+ */
+#define G_TYPE_IS_PARAM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM)
+/**
+ * G_PARAM_SPEC:
+ * @pspec: a valid #GParamSpec
+ *
+ * Casts a derived #GParamSpec object (e.g. of type #GParamSpecInt) into
+ * a #GParamSpec object.
+ */
+#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec))
+/**
+ * G_IS_PARAM_SPEC:
+ * @pspec: a #GParamSpec
+ *
+ * Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM
+ * or derived.
+ */
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42
+#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM))
+#else
+#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
+#endif
+/**
+ * G_PARAM_SPEC_CLASS:
+ * @pclass: a valid #GParamSpecClass
+ *
+ * Casts a derived #GParamSpecClass structure into a #GParamSpecClass structure.
+ */
+#define G_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), G_TYPE_PARAM, GParamSpecClass))
+/**
+ * G_IS_PARAM_SPEC_CLASS:
+ * @pclass: a #GParamSpecClass
+ *
+ * Checks whether @pclass "is a" valid #GParamSpecClass structure of type
+ * %G_TYPE_PARAM or derived.
+ */
+#define G_IS_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), G_TYPE_PARAM))
+/**
+ * G_PARAM_SPEC_GET_CLASS:
+ * @pspec: a valid #GParamSpec
+ *
+ * Retrieves the #GParamSpecClass of a #GParamSpec.
+ */
+#define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass))
+
+
+/* --- convenience macros --- */
+/**
+ * G_PARAM_SPEC_TYPE:
+ * @pspec: a valid #GParamSpec
+ *
+ * Retrieves the #GType of this @pspec.
+ */
+#define G_PARAM_SPEC_TYPE(pspec) (G_TYPE_FROM_INSTANCE (pspec))
+/**
+ * G_PARAM_SPEC_TYPE_NAME:
+ * @pspec: a valid #GParamSpec
+ *
+ * Retrieves the #GType name of this @pspec.
+ */
+#define G_PARAM_SPEC_TYPE_NAME(pspec) (g_type_name (G_PARAM_SPEC_TYPE (pspec)))
+/**
+ * G_PARAM_SPEC_VALUE_TYPE:
+ * @pspec: a valid #GParamSpec
+ *
+ * Retrieves the #GType to initialize a #GValue for this parameter.
+ */
+#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type)
+/**
+ * G_VALUE_HOLDS_PARAM:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values derived from type %G_TYPE_PARAM.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
+
+
+/* --- flags --- */
+/**
+ * GParamFlags:
+ * @G_PARAM_READABLE: the parameter is readable
+ * @G_PARAM_WRITABLE: the parameter is writable
+ * @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE
+ * @G_PARAM_CONSTRUCT: the parameter will be set upon object construction
+ * @G_PARAM_CONSTRUCT_ONLY: the parameter can only be set upon object construction
+ * @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert())
+ * strict validation is not required
+ * @G_PARAM_STATIC_NAME: the string used as name when constructing the
+ * parameter is guaranteed to remain valid and
+ * unmodified for the lifetime of the parameter.
+ * Since 2.8
+ * @G_PARAM_STATIC_NICK: the string used as nick when constructing the
+ * parameter is guaranteed to remain valid and
+ * unmmodified for the lifetime of the parameter.
+ * Since 2.8
+ * @G_PARAM_STATIC_BLURB: the string used as blurb when constructing the
+ * parameter is guaranteed to remain valid and
+ * unmodified for the lifetime of the parameter.
+ * Since 2.8
+ * @G_PARAM_EXPLICIT_NOTIFY: calls to g_object_set_property() for this
+ * property will not automatically result in a "notify" signal being
+ * emitted: the implementation must call g_object_notify() themselves
+ * in case the property actually changes. Since: 2.42.
+ * @G_PARAM_PRIVATE: internal
+ * @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed
+ * in a future version. A warning will be generated if it is used
+ * while running with G_ENABLE_DIAGNOSTIC=1.
+ * Since 2.26
+ *
+ * Through the #GParamFlags flag values, certain aspects of parameters
+ * can be configured. See also #G_PARAM_STATIC_STRINGS.
+ */
+typedef enum
+{
+ G_PARAM_READABLE = 1 << 0,
+ G_PARAM_WRITABLE = 1 << 1,
+ G_PARAM_READWRITE = (G_PARAM_READABLE | G_PARAM_WRITABLE),
+ G_PARAM_CONSTRUCT = 1 << 2,
+ G_PARAM_CONSTRUCT_ONLY = 1 << 3,
+ G_PARAM_LAX_VALIDATION = 1 << 4,
+ G_PARAM_STATIC_NAME = 1 << 5,
+ G_PARAM_PRIVATE GLIB_DEPRECATED_ENUMERATOR_IN_2_26 = G_PARAM_STATIC_NAME,
+ G_PARAM_STATIC_NICK = 1 << 6,
+ G_PARAM_STATIC_BLURB = 1 << 7,
+ /* User defined flags go here */
+ G_PARAM_EXPLICIT_NOTIFY = 1 << 30,
+ /* Avoid warning with -Wpedantic for gcc6 */
+ G_PARAM_DEPRECATED = (gint)(1u << 31)
+} GParamFlags;
+
+/**
+ * G_PARAM_STATIC_STRINGS:
+ *
+ * #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB.
+ *
+ * Since 2.13.0
+ */
+#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+/* bits in the range 0xffffff00 are reserved for 3rd party usage */
+/**
+ * G_PARAM_MASK:
+ *
+ * Mask containing the bits of #GParamSpec.flags which are reserved for GLib.
+ */
+#define G_PARAM_MASK (0x000000ff)
+/**
+ * G_PARAM_USER_SHIFT:
+ *
+ * Minimum shift count to be used for user defined flags, to be stored in
+ * #GParamSpec.flags. The maximum allowed is 10.
+ */
+#define G_PARAM_USER_SHIFT (8)
+
+/* --- typedefs & structures --- */
+typedef struct _GParamSpec GParamSpec;
+typedef struct _GParamSpecClass GParamSpecClass;
+typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54;
+typedef struct _GParamSpecPool GParamSpecPool;
+/**
+ * GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param)
+ * @g_type_instance: private #GTypeInstance portion
+ * @name: name of this parameter: always an interned string
+ * @flags: #GParamFlags flags for this parameter
+ * @value_type: the #GValue type for this parameter
+ * @owner_type: #GType type that uses (introduces) this parameter
+ *
+ * All other fields of the GParamSpec struct are private and
+ * should not be used directly.
+ */
+struct _GParamSpec
+{
+ GTypeInstance g_type_instance;
+
+ const gchar *name; /* interned string */
+ GParamFlags flags;
+ GType value_type;
+ GType owner_type; /* class or interface using this property */
+
+ /*< private >*/
+ gchar *_nick;
+ gchar *_blurb;
+ GData *qdata;
+ guint ref_count;
+ guint param_id; /* sort-criteria */
+};
+/**
+ * GParamSpecClass:
+ * @g_type_class: the parent class
+ * @value_type: the #GValue type for this parameter
+ * @finalize: The instance finalization function (optional), should chain
+ * up to the finalize method of the parent class.
+ * @value_set_default: Resets a @value to the default value for this type
+ * (recommended, the default is g_value_reset()), see
+ * g_param_value_set_default().
+ * @value_validate: Ensures that the contents of @value comply with the
+ * specifications set out by this type (optional), see
+ * g_param_value_validate().
+ * @values_cmp: Compares @value1 with @value2 according to this type
+ * (recommended, the default is memcmp()), see g_param_values_cmp().
+ *
+ * The class structure for the GParamSpec type.
+ * Normally, GParamSpec classes are filled by
+ * g_param_type_register_static().
+ */
+struct _GParamSpecClass
+{
+ GTypeClass g_type_class;
+
+ GType value_type;
+
+ void (*finalize) (GParamSpec *pspec);
+
+ /* GParam methods */
+ void (*value_set_default) (GParamSpec *pspec,
+ GValue *value);
+ gboolean (*value_validate) (GParamSpec *pspec,
+ GValue *value);
+ gint (*values_cmp) (GParamSpec *pspec,
+ const GValue *value1,
+ const GValue *value2);
+ /*< private >*/
+ gpointer dummy[4];
+};
+/**
+ * GParameter:
+ * @name: the parameter name
+ * @value: the parameter value
+ *
+ * The GParameter struct is an auxiliary structure used
+ * to hand parameter name/value pairs to g_object_newv().
+ *
+ * Deprecated: 2.54: This type is not introspectable.
+ */
+struct _GParameter /* auxiliary structure for _setv() variants */
+{
+ const gchar *name;
+ GValue value;
+} GLIB_DEPRECATED_TYPE_IN_2_54;
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_ref (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_unref (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_sink (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_param_spec_get_qdata (GParamSpec *pspec,
+ GQuark quark);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_set_qdata (GParamSpec *pspec,
+ GQuark quark,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_set_qdata_full (GParamSpec *pspec,
+ GQuark quark,
+ gpointer data,
+ GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_param_spec_steal_qdata (GParamSpec *pspec,
+ GQuark quark);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec);
+
+GLIB_AVAILABLE_IN_ALL
+void g_param_value_set_default (GParamSpec *pspec,
+ GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_param_value_defaults (GParamSpec *pspec,
+ GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_param_value_validate (GParamSpec *pspec,
+ GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_param_value_convert (GParamSpec *pspec,
+ const GValue *src_value,
+ GValue *dest_value,
+ gboolean strict_validation);
+GLIB_AVAILABLE_IN_ALL
+gint g_param_values_cmp (GParamSpec *pspec,
+ const GValue *value1,
+ const GValue *value2);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_param_spec_get_name (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_param_spec_get_nick (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_param_spec_get_blurb (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_param (GValue *value,
+ GParamSpec *param);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_value_get_param (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_value_dup_param (const GValue *value);
+
+
+GLIB_AVAILABLE_IN_ALL
+void g_value_take_param (GValue *value,
+ GParamSpec *param);
+GLIB_DEPRECATED_FOR(g_value_take_param)
+void g_value_set_param_take_ownership (GValue *value,
+ GParamSpec *param);
+GLIB_AVAILABLE_IN_2_36
+const GValue * g_param_spec_get_default_value (GParamSpec *pspec);
+
+GLIB_AVAILABLE_IN_2_46
+GQuark g_param_spec_get_name_quark (GParamSpec *pspec);
+
+/* --- convenience functions --- */
+typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
+/**
+ * GParamSpecTypeInfo:
+ * @instance_size: Size of the instance (object) structure.
+ * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now.
+ * @instance_init: Location of the instance initialization function (optional).
+ * @value_type: The #GType of values conforming to this #GParamSpec
+ * @finalize: The instance finalization function (optional).
+ * @value_set_default: Resets a @value to the default value for @pspec
+ * (recommended, the default is g_value_reset()), see
+ * g_param_value_set_default().
+ * @value_validate: Ensures that the contents of @value comply with the
+ * specifications set out by @pspec (optional), see
+ * g_param_value_validate().
+ * @values_cmp: Compares @value1 with @value2 according to @pspec
+ * (recommended, the default is memcmp()), see g_param_values_cmp().
+ *
+ * This structure is used to provide the type system with the information
+ * required to initialize and destruct (finalize) a parameter's class and
+ * instances thereof.
+ * The initialized structure is passed to the g_param_type_register_static()
+ * The type system will perform a deep copy of this structure, so its memory
+ * does not need to be persistent across invocation of
+ * g_param_type_register_static().
+ */
+struct _GParamSpecTypeInfo
+{
+ /* type system portion */
+ guint16 instance_size; /* obligatory */
+ guint16 n_preallocs; /* optional */
+ void (*instance_init) (GParamSpec *pspec); /* optional */
+
+ /* class portion */
+ GType value_type; /* obligatory */
+ void (*finalize) (GParamSpec *pspec); /* optional */
+ void (*value_set_default) (GParamSpec *pspec, /* recommended */
+ GValue *value);
+ gboolean (*value_validate) (GParamSpec *pspec, /* optional */
+ GValue *value);
+ gint (*values_cmp) (GParamSpec *pspec, /* recommended */
+ const GValue *value1,
+ const GValue *value2);
+};
+GLIB_AVAILABLE_IN_ALL
+GType g_param_type_register_static (const gchar *name,
+ const GParamSpecTypeInfo *pspec_info);
+
+/* For registering builting types */
+GType _g_param_type_register_static_constant (const gchar *name,
+ const GParamSpecTypeInfo *pspec_info,
+ GType opt_type);
+
+
+/* --- protected --- */
+GLIB_AVAILABLE_IN_ALL
+gpointer g_param_spec_internal (GType param_type,
+ const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_pool_insert (GParamSpecPool *pool,
+ GParamSpec *pspec,
+ GType owner_type);
+GLIB_AVAILABLE_IN_ALL
+void g_param_spec_pool_remove (GParamSpecPool *pool,
+ GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool,
+ const gchar *param_name,
+ GType owner_type,
+ gboolean walk_ancestors);
+GLIB_AVAILABLE_IN_ALL
+GList* g_param_spec_pool_list_owned (GParamSpecPool *pool,
+ GType owner_type);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool,
+ GType owner_type,
+ guint *n_pspecs_p);
+
+
+/* contracts:
+ *
+ * gboolean value_validate (GParamSpec *pspec,
+ * GValue *value):
+ * modify value contents in the least destructive way, so
+ * that it complies with pspec's requirements (i.e.
+ * according to minimum/maximum ranges etc...). return
+ * whether modification was necessary.
+ *
+ * gint values_cmp (GParamSpec *pspec,
+ * const GValue *value1,
+ * const GValue *value2):
+ * return value1 - value2, i.e. (-1) if value1 < value2,
+ * (+1) if value1 > value2, and (0) otherwise (equality)
+ */
+
+G_END_DECLS
+
+#endif /* __G_PARAM_H__ */
diff --git a/include/glib/gobject/gparamspecs.h b/include/glib/gobject/gparamspecs.h
new file mode 100644
index 0000000000..d0e4d5953f
--- /dev/null
+++ b/include/glib/gobject/gparamspecs.h
@@ -0,0 +1,1170 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gparamspecs.h: GLib default param specs
+ */
+#ifndef __G_PARAMSPECS_H__
+#define __G_PARAMSPECS_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gvalue.h>
+#include <gobject/genums.h>
+#include <gobject/gboxed.h>
+#include <gobject/gobject.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+/**
+ * G_TYPE_PARAM_CHAR:
+ *
+ * The #GType of #GParamSpecChar.
+ */
+#define G_TYPE_PARAM_CHAR (g_param_spec_types[0])
+/**
+ * G_IS_PARAM_SPEC_CHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_CHAR.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
+/**
+ * G_PARAM_SPEC_CHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecChar.
+ */
+#define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
+
+/**
+ * G_TYPE_PARAM_UCHAR:
+ *
+ * The #GType of #GParamSpecUChar.
+ */
+#define G_TYPE_PARAM_UCHAR (g_param_spec_types[1])
+/**
+ * G_IS_PARAM_SPEC_UCHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UCHAR.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
+/**
+ * G_PARAM_SPEC_UCHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecUChar.
+ */
+#define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
+
+/**
+ * G_TYPE_PARAM_BOOLEAN:
+ *
+ * The #GType of #GParamSpecBoolean.
+ */
+#define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2])
+/**
+ * G_IS_PARAM_SPEC_BOOLEAN:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOOLEAN.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
+/**
+ * G_PARAM_SPEC_BOOLEAN:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecBoolean.
+ */
+#define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
+
+/**
+ * G_TYPE_PARAM_INT:
+ *
+ * The #GType of #GParamSpecInt.
+ */
+#define G_TYPE_PARAM_INT (g_param_spec_types[3])
+/**
+ * G_IS_PARAM_SPEC_INT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
+/**
+ * G_PARAM_SPEC_INT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecInt.
+ */
+#define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
+
+/**
+ * G_TYPE_PARAM_UINT:
+ *
+ * The #GType of #GParamSpecUInt.
+ */
+#define G_TYPE_PARAM_UINT (g_param_spec_types[4])
+/**
+ * G_IS_PARAM_SPEC_UINT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
+/**
+ * G_PARAM_SPEC_UINT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecUInt.
+ */
+#define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
+
+/**
+ * G_TYPE_PARAM_LONG:
+ *
+ * The #GType of #GParamSpecLong.
+ */
+#define G_TYPE_PARAM_LONG (g_param_spec_types[5])
+/**
+ * G_IS_PARAM_SPEC_LONG:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_LONG.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
+/**
+ * G_PARAM_SPEC_LONG:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecLong.
+ */
+#define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
+
+/**
+ * G_TYPE_PARAM_ULONG:
+ *
+ * The #GType of #GParamSpecULong.
+ */
+#define G_TYPE_PARAM_ULONG (g_param_spec_types[6])
+/**
+ * G_IS_PARAM_SPEC_ULONG:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ULONG.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
+/**
+ * G_PARAM_SPEC_ULONG:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecULong.
+ */
+#define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
+
+/**
+ * G_TYPE_PARAM_INT64:
+ *
+ * The #GType of #GParamSpecInt64.
+ */
+#define G_TYPE_PARAM_INT64 (g_param_spec_types[7])
+/**
+ * G_IS_PARAM_SPEC_INT64:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT64.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
+/**
+ * G_PARAM_SPEC_INT64:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecInt64.
+ */
+#define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
+
+/**
+ * G_TYPE_PARAM_UINT64:
+ *
+ * The #GType of #GParamSpecUInt64.
+ */
+#define G_TYPE_PARAM_UINT64 (g_param_spec_types[8])
+/**
+ * G_IS_PARAM_SPEC_UINT64:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT64.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
+/**
+ * G_PARAM_SPEC_UINT64:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecUInt64.
+ */
+#define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
+
+/**
+ * G_TYPE_PARAM_UNICHAR:
+ *
+ * The #GType of #GParamSpecUnichar.
+ */
+#define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9])
+/**
+ * G_PARAM_SPEC_UNICHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecUnichar.
+ */
+#define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
+/**
+ * G_IS_PARAM_SPEC_UNICHAR:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UNICHAR.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
+
+/**
+ * G_TYPE_PARAM_ENUM:
+ *
+ * The #GType of #GParamSpecEnum.
+ */
+#define G_TYPE_PARAM_ENUM (g_param_spec_types[10])
+/**
+ * G_IS_PARAM_SPEC_ENUM:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ENUM.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
+/**
+ * G_PARAM_SPEC_ENUM:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecEnum.
+ */
+#define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
+
+/**
+ * G_TYPE_PARAM_FLAGS:
+ *
+ * The #GType of #GParamSpecFlags.
+ */
+#define G_TYPE_PARAM_FLAGS (g_param_spec_types[11])
+/**
+ * G_IS_PARAM_SPEC_FLAGS:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLAGS.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
+/**
+ * G_PARAM_SPEC_FLAGS:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecFlags.
+ */
+#define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
+
+/**
+ * G_TYPE_PARAM_FLOAT:
+ *
+ * The #GType of #GParamSpecFloat.
+ */
+#define G_TYPE_PARAM_FLOAT (g_param_spec_types[12])
+/**
+ * G_IS_PARAM_SPEC_FLOAT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLOAT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
+/**
+ * G_PARAM_SPEC_FLOAT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecFloat.
+ */
+#define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
+
+/**
+ * G_TYPE_PARAM_DOUBLE:
+ *
+ * The #GType of #GParamSpecDouble.
+ */
+#define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13])
+/**
+ * G_IS_PARAM_SPEC_DOUBLE:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_DOUBLE.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
+/**
+ * G_PARAM_SPEC_DOUBLE:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecDouble.
+ */
+#define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
+
+/**
+ * G_TYPE_PARAM_STRING:
+ *
+ * The #GType of #GParamSpecString.
+ */
+#define G_TYPE_PARAM_STRING (g_param_spec_types[14])
+/**
+ * G_IS_PARAM_SPEC_STRING:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_STRING.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
+/**
+ * G_PARAM_SPEC_STRING:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Casts a #GParamSpec instance into a #GParamSpecString.
+ */
+#define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
+
+/**
+ * G_TYPE_PARAM_PARAM:
+ *
+ * The #GType of #GParamSpecParam.
+ */
+#define G_TYPE_PARAM_PARAM (g_param_spec_types[15])
+/**
+ * G_IS_PARAM_SPEC_PARAM:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_PARAM.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
+/**
+ * G_PARAM_SPEC_PARAM:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Casts a #GParamSpec instance into a #GParamSpecParam.
+ */
+#define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
+
+/**
+ * G_TYPE_PARAM_BOXED:
+ *
+ * The #GType of #GParamSpecBoxed.
+ */
+#define G_TYPE_PARAM_BOXED (g_param_spec_types[16])
+/**
+ * G_IS_PARAM_SPEC_BOXED:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOXED.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
+/**
+ * G_PARAM_SPEC_BOXED:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecBoxed.
+ */
+#define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
+
+/**
+ * G_TYPE_PARAM_POINTER:
+ *
+ * The #GType of #GParamSpecPointer.
+ */
+#define G_TYPE_PARAM_POINTER (g_param_spec_types[17])
+/**
+ * G_IS_PARAM_SPEC_POINTER:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_POINTER.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
+/**
+ * G_PARAM_SPEC_POINTER:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Casts a #GParamSpec instance into a #GParamSpecPointer.
+ */
+#define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
+
+/**
+ * G_TYPE_PARAM_VALUE_ARRAY:
+ *
+ * The #GType of #GParamSpecValueArray.
+ *
+ * Deprecated: 2.32: Use #GArray instead of #GValueArray
+ */
+#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) GLIB_DEPRECATED_MACRO_IN_2_32
+/**
+ * G_IS_PARAM_SPEC_VALUE_ARRAY:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VALUE_ARRAY.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Deprecated: 2.32: Use #GArray instead of #GValueArray
+ */
+#define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY)) GLIB_DEPRECATED_MACRO_IN_2_32
+/**
+ * G_PARAM_SPEC_VALUE_ARRAY:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Cast a #GParamSpec instance into a #GParamSpecValueArray.
+ *
+ * Deprecated: 2.32: Use #GArray instead of #GValueArray
+ */
+#define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray)) GLIB_DEPRECATED_MACRO_IN_2_32
+
+/**
+ * G_TYPE_PARAM_OBJECT:
+ *
+ * The #GType of #GParamSpecObject.
+ */
+#define G_TYPE_PARAM_OBJECT (g_param_spec_types[19])
+/**
+ * G_IS_PARAM_SPEC_OBJECT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OBJECT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
+/**
+ * G_PARAM_SPEC_OBJECT:
+ * @pspec: a valid #GParamSpec instance
+ *
+ * Casts a #GParamSpec instance into a #GParamSpecObject.
+ */
+#define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
+
+/**
+ * G_TYPE_PARAM_OVERRIDE:
+ *
+ * The #GType of #GParamSpecOverride.
+ *
+ * Since: 2.4
+ */
+#define G_TYPE_PARAM_OVERRIDE (g_param_spec_types[20])
+/**
+ * G_IS_PARAM_SPEC_OVERRIDE:
+ * @pspec: a #GParamSpec
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OVERRIDE.
+ *
+ * Since: 2.4
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OVERRIDE))
+/**
+ * G_PARAM_SPEC_OVERRIDE:
+ * @pspec: a #GParamSpec
+ *
+ * Casts a #GParamSpec into a #GParamSpecOverride.
+ *
+ * Since: 2.4
+ */
+#define G_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OVERRIDE, GParamSpecOverride))
+
+/**
+ * G_TYPE_PARAM_GTYPE:
+ *
+ * The #GType of #GParamSpecGType.
+ *
+ * Since: 2.10
+ */
+#define G_TYPE_PARAM_GTYPE (g_param_spec_types[21])
+/**
+ * G_IS_PARAM_SPEC_GTYPE:
+ * @pspec: a #GParamSpec
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_GTYPE.
+ *
+ * Since: 2.10
+ * Returns: %TRUE on success.
+ */
+#define G_IS_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_GTYPE))
+/**
+ * G_PARAM_SPEC_GTYPE:
+ * @pspec: a #GParamSpec
+ *
+ * Casts a #GParamSpec into a #GParamSpecGType.
+ *
+ * Since: 2.10
+ */
+#define G_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_GTYPE, GParamSpecGType))
+
+/**
+ * G_TYPE_PARAM_VARIANT:
+ *
+ * The #GType of #GParamSpecVariant.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_PARAM_VARIANT (g_param_spec_types[22])
+/**
+ * G_IS_PARAM_SPEC_VARIANT:
+ * @pspec: a #GParamSpec
+ *
+ * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VARIANT.
+ *
+ * Returns: %TRUE on success
+ *
+ * Since: 2.26
+ */
+#define G_IS_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VARIANT))
+/**
+ * G_PARAM_SPEC_VARIANT:
+ * @pspec: a #GParamSpec
+ *
+ * Casts a #GParamSpec into a #GParamSpecVariant.
+ *
+ * Since: 2.26
+ */
+#define G_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VARIANT, GParamSpecVariant))
+
+/* --- typedefs & structures --- */
+typedef struct _GParamSpecChar GParamSpecChar;
+typedef struct _GParamSpecUChar GParamSpecUChar;
+typedef struct _GParamSpecBoolean GParamSpecBoolean;
+typedef struct _GParamSpecInt GParamSpecInt;
+typedef struct _GParamSpecUInt GParamSpecUInt;
+typedef struct _GParamSpecLong GParamSpecLong;
+typedef struct _GParamSpecULong GParamSpecULong;
+typedef struct _GParamSpecInt64 GParamSpecInt64;
+typedef struct _GParamSpecUInt64 GParamSpecUInt64;
+typedef struct _GParamSpecUnichar GParamSpecUnichar;
+typedef struct _GParamSpecEnum GParamSpecEnum;
+typedef struct _GParamSpecFlags GParamSpecFlags;
+typedef struct _GParamSpecFloat GParamSpecFloat;
+typedef struct _GParamSpecDouble GParamSpecDouble;
+typedef struct _GParamSpecString GParamSpecString;
+typedef struct _GParamSpecParam GParamSpecParam;
+typedef struct _GParamSpecBoxed GParamSpecBoxed;
+typedef struct _GParamSpecPointer GParamSpecPointer;
+typedef struct _GParamSpecValueArray GParamSpecValueArray;
+typedef struct _GParamSpecObject GParamSpecObject;
+typedef struct _GParamSpecOverride GParamSpecOverride;
+typedef struct _GParamSpecGType GParamSpecGType;
+typedef struct _GParamSpecVariant GParamSpecVariant;
+
+/**
+ * GParamSpecChar:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for character properties.
+ */
+struct _GParamSpecChar
+{
+ GParamSpec parent_instance;
+
+ gint8 minimum;
+ gint8 maximum;
+ gint8 default_value;
+};
+/**
+ * GParamSpecUChar:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for unsigned character properties.
+ */
+struct _GParamSpecUChar
+{
+ GParamSpec parent_instance;
+
+ guint8 minimum;
+ guint8 maximum;
+ guint8 default_value;
+};
+/**
+ * GParamSpecBoolean:
+ * @parent_instance: private #GParamSpec portion
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for boolean properties.
+ */
+struct _GParamSpecBoolean
+{
+ GParamSpec parent_instance;
+
+ gboolean default_value;
+};
+/**
+ * GParamSpecInt:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for integer properties.
+ */
+struct _GParamSpecInt
+{
+ GParamSpec parent_instance;
+
+ gint minimum;
+ gint maximum;
+ gint default_value;
+};
+/**
+ * GParamSpecUInt:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for unsigned integer properties.
+ */
+struct _GParamSpecUInt
+{
+ GParamSpec parent_instance;
+
+ guint minimum;
+ guint maximum;
+ guint default_value;
+};
+/**
+ * GParamSpecLong:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for long integer properties.
+ */
+struct _GParamSpecLong
+{
+ GParamSpec parent_instance;
+
+ glong minimum;
+ glong maximum;
+ glong default_value;
+};
+/**
+ * GParamSpecULong:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for unsigned long integer properties.
+ */
+struct _GParamSpecULong
+{
+ GParamSpec parent_instance;
+
+ gulong minimum;
+ gulong maximum;
+ gulong default_value;
+};
+/**
+ * GParamSpecInt64:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for 64bit integer properties.
+ */
+struct _GParamSpecInt64
+{
+ GParamSpec parent_instance;
+
+ gint64 minimum;
+ gint64 maximum;
+ gint64 default_value;
+};
+/**
+ * GParamSpecUInt64:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties.
+ */
+struct _GParamSpecUInt64
+{
+ GParamSpec parent_instance;
+
+ guint64 minimum;
+ guint64 maximum;
+ guint64 default_value;
+};
+/**
+ * GParamSpecUnichar:
+ * @parent_instance: private #GParamSpec portion
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties.
+ */
+struct _GParamSpecUnichar
+{
+ GParamSpec parent_instance;
+
+ gunichar default_value;
+};
+/**
+ * GParamSpecEnum:
+ * @parent_instance: private #GParamSpec portion
+ * @enum_class: the #GEnumClass for the enum
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for enum
+ * properties.
+ */
+struct _GParamSpecEnum
+{
+ GParamSpec parent_instance;
+
+ GEnumClass *enum_class;
+ gint default_value;
+};
+/**
+ * GParamSpecFlags:
+ * @parent_instance: private #GParamSpec portion
+ * @flags_class: the #GFlagsClass for the flags
+ * @default_value: default value for the property specified
+ *
+ * A #GParamSpec derived structure that contains the meta data for flags
+ * properties.
+ */
+struct _GParamSpecFlags
+{
+ GParamSpec parent_instance;
+
+ GFlagsClass *flags_class;
+ guint default_value;
+};
+/**
+ * GParamSpecFloat:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ * @epsilon: values closer than @epsilon will be considered identical
+ * by g_param_values_cmp(); the default value is 1e-30.
+ *
+ * A #GParamSpec derived structure that contains the meta data for float properties.
+ */
+struct _GParamSpecFloat
+{
+ GParamSpec parent_instance;
+
+ gfloat minimum;
+ gfloat maximum;
+ gfloat default_value;
+ gfloat epsilon;
+};
+/**
+ * GParamSpecDouble:
+ * @parent_instance: private #GParamSpec portion
+ * @minimum: minimum value for the property specified
+ * @maximum: maximum value for the property specified
+ * @default_value: default value for the property specified
+ * @epsilon: values closer than @epsilon will be considered identical
+ * by g_param_values_cmp(); the default value is 1e-90.
+ *
+ * A #GParamSpec derived structure that contains the meta data for double properties.
+ */
+struct _GParamSpecDouble
+{
+ GParamSpec parent_instance;
+
+ gdouble minimum;
+ gdouble maximum;
+ gdouble default_value;
+ gdouble epsilon;
+};
+/**
+ * GParamSpecString:
+ * @parent_instance: private #GParamSpec portion
+ * @default_value: default value for the property specified
+ * @cset_first: a string containing the allowed values for the first byte
+ * @cset_nth: a string containing the allowed values for the subsequent bytes
+ * @substitutor: the replacement byte for bytes which don't match @cset_first or @cset_nth.
+ * @null_fold_if_empty: replace empty string by %NULL
+ * @ensure_non_null: replace %NULL strings by an empty string
+ *
+ * A #GParamSpec derived structure that contains the meta data for string
+ * properties.
+ */
+struct _GParamSpecString
+{
+ GParamSpec parent_instance;
+
+ gchar *default_value;
+ gchar *cset_first;
+ gchar *cset_nth;
+ gchar substitutor;
+ guint null_fold_if_empty : 1;
+ guint ensure_non_null : 1;
+};
+/**
+ * GParamSpecParam:
+ * @parent_instance: private #GParamSpec portion
+ *
+ * A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM
+ * properties.
+ */
+struct _GParamSpecParam
+{
+ GParamSpec parent_instance;
+};
+/**
+ * GParamSpecBoxed:
+ * @parent_instance: private #GParamSpec portion
+ *
+ * A #GParamSpec derived structure that contains the meta data for boxed properties.
+ */
+struct _GParamSpecBoxed
+{
+ GParamSpec parent_instance;
+};
+/**
+ * GParamSpecPointer:
+ * @parent_instance: private #GParamSpec portion
+ *
+ * A #GParamSpec derived structure that contains the meta data for pointer properties.
+ */
+struct _GParamSpecPointer
+{
+ GParamSpec parent_instance;
+};
+/**
+ * GParamSpecValueArray:
+ * @parent_instance: private #GParamSpec portion
+ * @element_spec: a #GParamSpec describing the elements contained in arrays of this property, may be %NULL
+ * @fixed_n_elements: if greater than 0, arrays of this property will always have this many elements
+ *
+ * A #GParamSpec derived structure that contains the meta data for #GValueArray properties.
+ */
+struct _GParamSpecValueArray
+{
+ GParamSpec parent_instance;
+ GParamSpec *element_spec;
+ guint fixed_n_elements;
+};
+/**
+ * GParamSpecObject:
+ * @parent_instance: private #GParamSpec portion
+ *
+ * A #GParamSpec derived structure that contains the meta data for object properties.
+ */
+struct _GParamSpecObject
+{
+ GParamSpec parent_instance;
+};
+/**
+ * GParamSpecOverride:
+ *
+ * This is a type of #GParamSpec type that simply redirects operations to
+ * another paramspec. All operations other than getting or
+ * setting the value are redirected, including accessing the nick and
+ * blurb, validating a value, and so forth. See
+ * g_param_spec_get_redirect_target() for retrieving the overidden
+ * property. #GParamSpecOverride is used in implementing
+ * g_object_class_override_property(), and will not be directly useful
+ * unless you are implementing a new base type similar to GObject.
+ *
+ * Since: 2.4
+ */
+struct _GParamSpecOverride
+{
+ /*< private >*/
+ GParamSpec parent_instance;
+ GParamSpec *overridden;
+};
+/**
+ * GParamSpecGType:
+ * @parent_instance: private #GParamSpec portion
+ * @is_a_type: a #GType whose subtypes can occur as values
+ *
+ * A #GParamSpec derived structure that contains the meta data for #GType properties.
+ *
+ * Since: 2.10
+ */
+struct _GParamSpecGType
+{
+ GParamSpec parent_instance;
+ GType is_a_type;
+};
+/**
+ * GParamSpecVariant:
+ * @parent_instance: private #GParamSpec portion
+ * @type: a #GVariantType, or %NULL
+ * @default_value: a #GVariant, or %NULL
+ *
+ * A #GParamSpec derived structure that contains the meta data for #GVariant properties.
+ *
+ * When comparing values with g_param_values_cmp(), scalar values with the same
+ * type will be compared with g_variant_compare(). Other non-%NULL variants will
+ * be checked for equality with g_variant_equal(), and their sort order is
+ * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL
+ * values compare equal.
+ *
+ * Since: 2.26
+ */
+struct _GParamSpecVariant
+{
+ GParamSpec parent_instance;
+ GVariantType *type;
+ GVariant *default_value;
+
+ /*< private >*/
+ gpointer padding[4];
+};
+
+/* --- GParamSpec prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_char (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gint8 minimum,
+ gint8 maximum,
+ gint8 default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_uchar (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ guint8 minimum,
+ guint8 maximum,
+ guint8 default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_boolean (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gboolean default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_int (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gint minimum,
+ gint maximum,
+ gint default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_uint (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ guint minimum,
+ guint maximum,
+ guint default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_long (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ glong minimum,
+ glong maximum,
+ glong default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_ulong (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gulong minimum,
+ gulong maximum,
+ gulong default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_int64 (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gint64 minimum,
+ gint64 maximum,
+ gint64 default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_uint64 (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ guint64 minimum,
+ guint64 maximum,
+ guint64 default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_unichar (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gunichar default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_enum (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType enum_type,
+ gint default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_flags (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType flags_type,
+ guint default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_float (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gfloat minimum,
+ gfloat maximum,
+ gfloat default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_double (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gdouble minimum,
+ gdouble maximum,
+ gdouble default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_string (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ const gchar *default_value,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_param (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType param_type,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_boxed (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType boxed_type,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_pointer (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_value_array (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GParamSpec *element_spec,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_object (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType object_type,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_override (const gchar *name,
+ GParamSpec *overridden);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_gtype (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ GType is_a_type,
+ GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GParamSpec* g_param_spec_variant (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ const GVariantType *type,
+ GVariant *default_value,
+ GParamFlags flags);
+
+/* --- internal --- */
+/* We prefix variable declarations so they can
+ * properly get exported in windows dlls.
+ */
+#ifndef GOBJECT_VAR
+# ifdef G_PLATFORM_WIN32
+# ifdef GOBJECT_STATIC_COMPILATION
+# define GOBJECT_VAR extern
+# else /* !GOBJECT_STATIC_COMPILATION */
+# ifdef GOBJECT_COMPILATION
+# ifdef DLL_EXPORT
+# define GOBJECT_VAR extern __declspec(dllexport)
+# else /* !DLL_EXPORT */
+# define GOBJECT_VAR extern
+# endif /* !DLL_EXPORT */
+# else /* !GOBJECT_COMPILATION */
+# define GOBJECT_VAR extern __declspec(dllimport)
+# endif /* !GOBJECT_COMPILATION */
+# endif /* !GOBJECT_STATIC_COMPILATION */
+# else /* !G_PLATFORM_WIN32 */
+# define GOBJECT_VAR _GLIB_EXTERN
+# endif /* !G_PLATFORM_WIN32 */
+#endif /* GOBJECT_VAR */
+
+GOBJECT_VAR GType *g_param_spec_types;
+
+G_END_DECLS
+
+#endif /* __G_PARAMSPECS_H__ */
diff --git a/include/glib/gobject/gsignal.h b/include/glib/gobject/gsignal.h
new file mode 100644
index 0000000000..a79b9f662a
--- /dev/null
+++ b/include/glib/gobject/gsignal.h
@@ -0,0 +1,623 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000-2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_SIGNAL_H__
+#define __G_SIGNAL_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gclosure.h>
+#include <gobject/gvalue.h>
+#include <gobject/gparam.h>
+#include <gobject/gmarshal.h>
+
+G_BEGIN_DECLS
+
+/* --- typedefs --- */
+typedef struct _GSignalQuery GSignalQuery;
+typedef struct _GSignalInvocationHint GSignalInvocationHint;
+/**
+ * GSignalCMarshaller:
+ *
+ * This is the signature of marshaller functions, required to marshall
+ * arrays of parameter values to signal emissions into C language callback
+ * invocations. It is merely an alias to #GClosureMarshal since the #GClosure
+ * mechanism takes over responsibility of actual function invocation for the
+ * signal system.
+ */
+typedef GClosureMarshal GSignalCMarshaller;
+/**
+ * GSignalCVaMarshaller:
+ *
+ * This is the signature of va_list marshaller functions, an optional
+ * marshaller that can be used in some situations to avoid
+ * marshalling the signal argument into GValues.
+ */
+typedef GVaClosureMarshal GSignalCVaMarshaller;
+/**
+ * GSignalEmissionHook:
+ * @ihint: Signal invocation hint, see #GSignalInvocationHint.
+ * @n_param_values: the number of parameters to the function, including
+ * the instance on which the signal was emitted.
+ * @param_values: (array length=n_param_values): the instance on which
+ * the signal was emitted, followed by the parameters of the emission.
+ * @data: user data associated with the hook.
+ *
+ * A simple function pointer to get invoked when the signal is emitted. This
+ * allows you to tie a hook to the signal type, so that it will trap all
+ * emissions of that signal, from any object.
+ *
+ * You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag.
+ *
+ * Returns: whether it wants to stay connected. If it returns %FALSE, the signal
+ * hook is disconnected (and destroyed).
+ */
+typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer data);
+/**
+ * GSignalAccumulator:
+ * @ihint: Signal invocation hint, see #GSignalInvocationHint.
+ * @return_accu: Accumulator to collect callback return values in, this
+ * is the return value of the current signal emission.
+ * @handler_return: A #GValue holding the return value of the signal handler.
+ * @data: Callback data that was specified when creating the signal.
+ *
+ * The signal accumulator is a special callback function that can be used
+ * to collect return values of the various callbacks that are called
+ * during a signal emission. The signal accumulator is specified at signal
+ * creation time, if it is left %NULL, no accumulation of callback return
+ * values is performed. The return value of signal emissions is then the
+ * value returned by the last callback.
+ *
+ * Returns: The accumulator function returns whether the signal emission
+ * should be aborted. Returning %FALSE means to abort the
+ * current emission and %TRUE is returned for continuation.
+ */
+typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer data);
+
+
+/* --- run, match and connect types --- */
+/**
+ * GSignalFlags:
+ * @G_SIGNAL_RUN_FIRST: Invoke the object method handler in the first emission stage.
+ * @G_SIGNAL_RUN_LAST: Invoke the object method handler in the third emission stage.
+ * @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage.
+ * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in
+ * emission for this very object will not be emitted recursively,
+ * but instead cause the first emission to be restarted.
+ * @G_SIGNAL_DETAILED: This signal supports "::detail" appendices to the signal name
+ * upon handler connections and emissions.
+ * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive
+ * objects from user code via g_signal_emit() and friends, without
+ * the need of being embedded into extra code that performs pre or
+ * post emission adjustments on the object. They can also be thought
+ * of as object methods which can be called generically by
+ * third-party code.
+ * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal.
+ * @G_SIGNAL_MUST_COLLECT: Varargs signal emission will always collect the
+ * arguments, even if there are no signal handlers connected. Since 2.30.
+ * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed
+ * in a future version. A warning will be generated if it is connected while
+ * running with G_ENABLE_DIAGNOSTIC=1. Since 2.32.
+ *
+ * The signal flags are used to specify a signal's behaviour, the overall
+ * signal description outlines how especially the RUN flags control the
+ * stages of a signal emission.
+ */
+typedef enum
+{
+ G_SIGNAL_RUN_FIRST = 1 << 0,
+ G_SIGNAL_RUN_LAST = 1 << 1,
+ G_SIGNAL_RUN_CLEANUP = 1 << 2,
+ G_SIGNAL_NO_RECURSE = 1 << 3,
+ G_SIGNAL_DETAILED = 1 << 4,
+ G_SIGNAL_ACTION = 1 << 5,
+ G_SIGNAL_NO_HOOKS = 1 << 6,
+ G_SIGNAL_MUST_COLLECT = 1 << 7,
+ G_SIGNAL_DEPRECATED = 1 << 8
+} GSignalFlags;
+/**
+ * G_SIGNAL_FLAGS_MASK:
+ *
+ * A mask for all #GSignalFlags bits.
+ */
+#define G_SIGNAL_FLAGS_MASK 0x1ff
+/**
+ * GConnectFlags:
+ * @G_CONNECT_AFTER: whether the handler should be called before or after the
+ * default handler of the signal.
+ * @G_CONNECT_SWAPPED: whether the instance and data should be swapped when
+ * calling the handler; see g_signal_connect_swapped() for an example.
+ *
+ * The connection flags are used to specify the behaviour of a signal's
+ * connection.
+ */
+typedef enum
+{
+ G_CONNECT_AFTER = 1 << 0,
+ G_CONNECT_SWAPPED = 1 << 1
+} GConnectFlags;
+/**
+ * GSignalMatchType:
+ * @G_SIGNAL_MATCH_ID: The signal id must be equal.
+ * @G_SIGNAL_MATCH_DETAIL: The signal detail be equal.
+ * @G_SIGNAL_MATCH_CLOSURE: The closure must be the same.
+ * @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same.
+ * @G_SIGNAL_MATCH_DATA: The closure data must be the same.
+ * @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may matched.
+ *
+ * The match types specify what g_signal_handlers_block_matched(),
+ * g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
+ * match signals by.
+ */
+typedef enum
+{
+ G_SIGNAL_MATCH_ID = 1 << 0,
+ G_SIGNAL_MATCH_DETAIL = 1 << 1,
+ G_SIGNAL_MATCH_CLOSURE = 1 << 2,
+ G_SIGNAL_MATCH_FUNC = 1 << 3,
+ G_SIGNAL_MATCH_DATA = 1 << 4,
+ G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
+} GSignalMatchType;
+/**
+ * G_SIGNAL_MATCH_MASK:
+ *
+ * A mask for all #GSignalMatchType bits.
+ */
+#define G_SIGNAL_MATCH_MASK 0x3f
+/**
+ * G_SIGNAL_TYPE_STATIC_SCOPE:
+ *
+ * This macro flags signal argument types for which the signal system may
+ * assume that instances thereof remain persistent across all signal emissions
+ * they are used in. This is only useful for non ref-counted, value-copy types.
+ *
+ * To flag a signal argument in this way, add `| G_SIGNAL_TYPE_STATIC_SCOPE`
+ * to the corresponding argument of g_signal_new().
+ * |[
+ * g_signal_new ("size_request",
+ * G_TYPE_FROM_CLASS (gobject_class),
+ * G_SIGNAL_RUN_FIRST,
+ * G_STRUCT_OFFSET (GtkWidgetClass, size_request),
+ * NULL, NULL,
+ * _gtk_marshal_VOID__BOXED,
+ * G_TYPE_NONE, 1,
+ * GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
+ * ]|
+ */
+#define G_SIGNAL_TYPE_STATIC_SCOPE (G_TYPE_FLAG_RESERVED_ID_BIT)
+
+
+/* --- signal information --- */
+/**
+ * GSignalInvocationHint:
+ * @signal_id: The signal id of the signal invoking the callback
+ * @detail: The detail passed on for this emission
+ * @run_type: The stage the signal emission is currently in, this
+ * field will contain one of %G_SIGNAL_RUN_FIRST,
+ * %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP.
+ *
+ * The #GSignalInvocationHint structure is used to pass on additional information
+ * to callbacks during a signal emission.
+ */
+struct _GSignalInvocationHint
+{
+ guint signal_id;
+ GQuark detail;
+ GSignalFlags run_type;
+};
+/**
+ * GSignalQuery:
+ * @signal_id: The signal id of the signal being queried, or 0 if the
+ * signal to be queried was unknown.
+ * @signal_name: The signal name.
+ * @itype: The interface/instance type that this signal can be emitted for.
+ * @signal_flags: The signal flags as passed in to g_signal_new().
+ * @return_type: The return type for user callbacks.
+ * @n_params: The number of parameters that user callbacks take.
+ * @param_types: (array length=n_params): The individual parameter types for
+ * user callbacks, note that the effective callback signature is:
+ * |[<!-- language="C" -->
+ * @return_type callback (#gpointer data1,
+ * [param_types param_names,]
+ * gpointer data2);
+ * ]|
+ *
+ * A structure holding in-depth information for a specific signal. It is
+ * filled in by the g_signal_query() function.
+ */
+struct _GSignalQuery
+{
+ guint signal_id;
+ const gchar *signal_name;
+ GType itype;
+ GSignalFlags signal_flags;
+ GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
+ guint n_params;
+ const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
+};
+
+
+/* --- signals --- */
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_newv (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ GClosure *class_closure,
+ GSignalAccumulator accumulator,
+ gpointer accu_data,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ GType *param_types);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_new_valist (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ GClosure *class_closure,
+ GSignalAccumulator accumulator,
+ gpointer accu_data,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ va_list args);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_new (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ guint class_offset,
+ GSignalAccumulator accumulator,
+ gpointer accu_data,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_new_class_handler (const gchar *signal_name,
+ GType itype,
+ GSignalFlags signal_flags,
+ GCallback class_handler,
+ GSignalAccumulator accumulator,
+ gpointer accu_data,
+ GSignalCMarshaller c_marshaller,
+ GType return_type,
+ guint n_params,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_set_va_marshaller (guint signal_id,
+ GType instance_type,
+ GSignalCVaMarshaller va_marshaller);
+
+GLIB_AVAILABLE_IN_ALL
+void g_signal_emitv (const GValue *instance_and_params,
+ guint signal_id,
+ GQuark detail,
+ GValue *return_value);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_emit_valist (gpointer instance,
+ guint signal_id,
+ GQuark detail,
+ va_list var_args);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_emit (gpointer instance,
+ guint signal_id,
+ GQuark detail,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_emit_by_name (gpointer instance,
+ const gchar *detailed_signal,
+ ...);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_lookup (const gchar *name,
+ GType itype);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_signal_name (guint signal_id);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_query (guint signal_id,
+ GSignalQuery *query);
+GLIB_AVAILABLE_IN_ALL
+guint* g_signal_list_ids (GType itype,
+ guint *n_ids);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_signal_parse_name (const gchar *detailed_signal,
+ GType itype,
+ guint *signal_id_p,
+ GQuark *detail_p,
+ gboolean force_detail_quark);
+GLIB_AVAILABLE_IN_ALL
+GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance);
+
+
+/* --- signal emissions --- */
+GLIB_AVAILABLE_IN_ALL
+void g_signal_stop_emission (gpointer instance,
+ guint signal_id,
+ GQuark detail);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_stop_emission_by_name (gpointer instance,
+ const gchar *detailed_signal);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_add_emission_hook (guint signal_id,
+ GQuark detail,
+ GSignalEmissionHook hook_func,
+ gpointer hook_data,
+ GDestroyNotify data_destroy);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_remove_emission_hook (guint signal_id,
+ gulong hook_id);
+
+
+/* --- signal handlers --- */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_signal_has_handler_pending (gpointer instance,
+ guint signal_id,
+ GQuark detail,
+ gboolean may_be_blocked);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_connect_closure_by_id (gpointer instance,
+ guint signal_id,
+ GQuark detail,
+ GClosure *closure,
+ gboolean after);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_connect_closure (gpointer instance,
+ const gchar *detailed_signal,
+ GClosure *closure,
+ gboolean after);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_connect_data (gpointer instance,
+ const gchar *detailed_signal,
+ GCallback c_handler,
+ gpointer data,
+ GClosureNotify destroy_data,
+ GConnectFlags connect_flags);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_handler_block (gpointer instance,
+ gulong handler_id);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_handler_unblock (gpointer instance,
+ gulong handler_id);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_handler_disconnect (gpointer instance,
+ gulong handler_id);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_signal_handler_is_connected (gpointer instance,
+ gulong handler_id);
+GLIB_AVAILABLE_IN_ALL
+gulong g_signal_handler_find (gpointer instance,
+ GSignalMatchType mask,
+ guint signal_id,
+ GQuark detail,
+ GClosure *closure,
+ gpointer func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_handlers_block_matched (gpointer instance,
+ GSignalMatchType mask,
+ guint signal_id,
+ GQuark detail,
+ GClosure *closure,
+ gpointer func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_handlers_unblock_matched (gpointer instance,
+ GSignalMatchType mask,
+ guint signal_id,
+ GQuark detail,
+ GClosure *closure,
+ gpointer func,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+guint g_signal_handlers_disconnect_matched (gpointer instance,
+ GSignalMatchType mask,
+ guint signal_id,
+ GQuark detail,
+ GClosure *closure,
+ gpointer func,
+ gpointer data);
+
+GLIB_AVAILABLE_IN_2_62
+void g_clear_signal_handler (gulong *handler_id_ptr,
+ gpointer instance);
+
+#define g_clear_signal_handler(handler_id_ptr, instance) \
+ G_STMT_START { \
+ G_STATIC_ASSERT (sizeof *(handler_id_ptr) == sizeof (gulong)); \
+ gulong _handler_id = *(handler_id_ptr); \
+ \
+ if (_handler_id > 0) \
+ { \
+ g_signal_handler_disconnect ((instance), _handler_id); \
+ *(handler_id_ptr) = 0; \
+ } \
+ } G_STMT_END \
+ GLIB_AVAILABLE_MACRO_IN_2_62
+
+/* --- overriding and chaining --- */
+GLIB_AVAILABLE_IN_ALL
+void g_signal_override_class_closure (guint signal_id,
+ GType instance_type,
+ GClosure *class_closure);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_override_class_handler (const gchar *signal_name,
+ GType instance_type,
+ GCallback class_handler);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_chain_from_overridden (const GValue *instance_and_params,
+ GValue *return_value);
+GLIB_AVAILABLE_IN_ALL
+void g_signal_chain_from_overridden_handler (gpointer instance,
+ ...);
+
+
+/* --- convenience --- */
+/**
+ * g_signal_connect:
+ * @instance: the instance to connect to.
+ * @detailed_signal: a string of the form "signal-name::detail".
+ * @c_handler: the #GCallback to connect.
+ * @data: data to pass to @c_handler calls.
+ *
+ * Connects a #GCallback function to a signal for a particular object.
+ *
+ * The handler will be called before the default handler of the signal.
+ *
+ * See [memory management of signal handlers][signal-memory-management] for
+ * details on how to handle the return value and memory management of @data.
+ *
+ * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections)
+ */
+#define g_signal_connect(instance, detailed_signal, c_handler, data) \
+ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
+/**
+ * g_signal_connect_after:
+ * @instance: the instance to connect to.
+ * @detailed_signal: a string of the form "signal-name::detail".
+ * @c_handler: the #GCallback to connect.
+ * @data: data to pass to @c_handler calls.
+ *
+ * Connects a #GCallback function to a signal for a particular object.
+ *
+ * The handler will be called after the default handler of the signal.
+ *
+ * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections)
+ */
+#define g_signal_connect_after(instance, detailed_signal, c_handler, data) \
+ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER)
+/**
+ * g_signal_connect_swapped:
+ * @instance: the instance to connect to.
+ * @detailed_signal: a string of the form "signal-name::detail".
+ * @c_handler: the #GCallback to connect.
+ * @data: data to pass to @c_handler calls.
+ *
+ * Connects a #GCallback function to a signal for a particular object.
+ *
+ * The instance on which the signal is emitted and @data will be swapped when
+ * calling the handler. This is useful when calling pre-existing functions to
+ * operate purely on the @data, rather than the @instance: swapping the
+ * parameters avoids the need to write a wrapper function.
+ *
+ * For example, this allows the shorter code:
+ * |[<!-- language="C" -->
+ * g_signal_connect_swapped (button, "clicked",
+ * (GCallback) gtk_widget_hide, other_widget);
+ * ]|
+ *
+ * Rather than the cumbersome:
+ * |[<!-- language="C" -->
+ * static void
+ * button_clicked_cb (GtkButton *button, GtkWidget *other_widget)
+ * {
+ * gtk_widget_hide (other_widget);
+ * }
+ *
+ * ...
+ *
+ * g_signal_connect (button, "clicked",
+ * (GCallback) button_clicked_cb, other_widget);
+ * ]|
+ *
+ * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections)
+ */
+#define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \
+ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED)
+/**
+ * g_signal_handlers_disconnect_by_func:
+ * @instance: The instance to remove handlers from.
+ * @func: The C closure callback of the handlers (useless for non-C closures).
+ * @data: The closure data of the handlers' closures.
+ *
+ * Disconnects all handlers on an instance that match @func and @data.
+ *
+ * Returns: The number of handlers that matched.
+ */
+#define g_signal_handlers_disconnect_by_func(instance, func, data) \
+ g_signal_handlers_disconnect_matched ((instance), \
+ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
+ 0, 0, NULL, (func), (data))
+
+/**
+ * g_signal_handlers_disconnect_by_data:
+ * @instance: The instance to remove handlers from
+ * @data: the closure data of the handlers' closures
+ *
+ * Disconnects all handlers on an instance that match @data.
+ *
+ * Returns: The number of handlers that matched.
+ *
+ * Since: 2.32
+ */
+#define g_signal_handlers_disconnect_by_data(instance, data) \
+ g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data))
+
+/**
+ * g_signal_handlers_block_by_func:
+ * @instance: The instance to block handlers from.
+ * @func: The C closure callback of the handlers (useless for non-C closures).
+ * @data: The closure data of the handlers' closures.
+ *
+ * Blocks all handlers on an instance that match @func and @data.
+ *
+ * Returns: The number of handlers that matched.
+ */
+#define g_signal_handlers_block_by_func(instance, func, data) \
+ g_signal_handlers_block_matched ((instance), \
+ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
+ 0, 0, NULL, (func), (data))
+/**
+ * g_signal_handlers_unblock_by_func:
+ * @instance: The instance to unblock handlers from.
+ * @func: The C closure callback of the handlers (useless for non-C closures).
+ * @data: The closure data of the handlers' closures.
+ *
+ * Unblocks all handlers on an instance that match @func and @data.
+ *
+ * Returns: The number of handlers that matched.
+ */
+#define g_signal_handlers_unblock_by_func(instance, func, data) \
+ g_signal_handlers_unblock_matched ((instance), \
+ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \
+ 0, 0, NULL, (func), (data))
+
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy);
+
+GLIB_AVAILABLE_IN_ALL
+gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy);
+
+/*< private >*/
+GLIB_AVAILABLE_IN_ALL
+void g_signal_handlers_destroy (gpointer instance);
+void _g_signals_destroy (GType itype);
+
+G_END_DECLS
+
+#endif /* __G_SIGNAL_H__ */
diff --git a/include/glib/gobject/gsourceclosure.h b/include/glib/gobject/gsourceclosure.h
new file mode 100644
index 0000000000..4847677033
--- /dev/null
+++ b/include/glib/gobject/gsourceclosure.h
@@ -0,0 +1,38 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_SOURCECLOSURE_H__
+#define __G_SOURCECLOSURE_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gclosure.h>
+#include <gobject/glib-types.h>
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_closure (GSource *source,
+ GClosure *closure);
+
+GLIB_AVAILABLE_IN_ALL
+void g_source_set_dummy_callback (GSource *source);
+
+G_END_DECLS
+
+#endif /* __G_SOURCECLOSURE_H__ */
diff --git a/include/glib/gobject/gtype.h b/include/glib/gobject/gtype.h
new file mode 100644
index 0000000000..d9e5d110ce
--- /dev/null
+++ b/include/glib/gobject/gtype.h
@@ -0,0 +1,2356 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_TYPE_H__
+#define __G_TYPE_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* Basic Type Macros
+ */
+/**
+ * G_TYPE_FUNDAMENTAL:
+ * @type: A #GType value.
+ *
+ * The fundamental type which is the ancestor of @type.
+ * Fundamental types are types that serve as ultimate bases for the derived types,
+ * thus they are the roots of distinct inheritance hierarchies.
+ */
+#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type))
+/**
+ * G_TYPE_FUNDAMENTAL_MAX:
+ *
+ * An integer constant that represents the number of identifiers reserved
+ * for types that are assigned at compile-time.
+ */
+#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT)
+
+/* Constant fundamental types,
+ */
+/**
+ * G_TYPE_INVALID:
+ *
+ * An invalid #GType used as error return value in some functions which return
+ * a #GType.
+ */
+#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0)
+/**
+ * G_TYPE_NONE:
+ *
+ * A fundamental type which is used as a replacement for the C
+ * void return type.
+ */
+#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1)
+/**
+ * G_TYPE_INTERFACE:
+ *
+ * The fundamental type from which all interfaces are derived.
+ */
+#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2)
+/**
+ * G_TYPE_CHAR:
+ *
+ * The fundamental type corresponding to #gchar.
+ * The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer.
+ * This may or may not be the same type a the C type "gchar".
+ */
+#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3)
+/**
+ * G_TYPE_UCHAR:
+ *
+ * The fundamental type corresponding to #guchar.
+ */
+#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4)
+/**
+ * G_TYPE_BOOLEAN:
+ *
+ * The fundamental type corresponding to #gboolean.
+ */
+#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5)
+/**
+ * G_TYPE_INT:
+ *
+ * The fundamental type corresponding to #gint.
+ */
+#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)
+/**
+ * G_TYPE_UINT:
+ *
+ * The fundamental type corresponding to #guint.
+ */
+#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7)
+/**
+ * G_TYPE_LONG:
+ *
+ * The fundamental type corresponding to #glong.
+ */
+#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8)
+/**
+ * G_TYPE_ULONG:
+ *
+ * The fundamental type corresponding to #gulong.
+ */
+#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9)
+/**
+ * G_TYPE_INT64:
+ *
+ * The fundamental type corresponding to #gint64.
+ */
+#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10)
+/**
+ * G_TYPE_UINT64:
+ *
+ * The fundamental type corresponding to #guint64.
+ */
+#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11)
+/**
+ * G_TYPE_ENUM:
+ *
+ * The fundamental type from which all enumeration types are derived.
+ */
+#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12)
+/**
+ * G_TYPE_FLAGS:
+ *
+ * The fundamental type from which all flags types are derived.
+ */
+#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13)
+/**
+ * G_TYPE_FLOAT:
+ *
+ * The fundamental type corresponding to #gfloat.
+ */
+#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14)
+/**
+ * G_TYPE_DOUBLE:
+ *
+ * The fundamental type corresponding to #gdouble.
+ */
+#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15)
+/**
+ * G_TYPE_STRING:
+ *
+ * The fundamental type corresponding to nul-terminated C strings.
+ */
+#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16)
+/**
+ * G_TYPE_POINTER:
+ *
+ * The fundamental type corresponding to #gpointer.
+ */
+#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17)
+/**
+ * G_TYPE_BOXED:
+ *
+ * The fundamental type from which all boxed types are derived.
+ */
+#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18)
+/**
+ * G_TYPE_PARAM:
+ *
+ * The fundamental type from which all #GParamSpec types are derived.
+ */
+#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19)
+/**
+ * G_TYPE_OBJECT:
+ *
+ * The fundamental type for #GObject.
+ */
+#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
+/**
+ * G_TYPE_VARIANT:
+ *
+ * The fundamental type corresponding to #GVariant.
+ *
+ * All floating #GVariant instances passed through the #GType system are
+ * consumed.
+ *
+ * Note that callbacks in closures, and signal handlers
+ * for signals of return type %G_TYPE_VARIANT, must never return floating
+ * variants.
+ *
+ * Note: GLib 2.24 did include a boxed type with this name. It was replaced
+ * with this fundamental type in 2.26.
+ *
+ * Since: 2.26
+ */
+#define G_TYPE_VARIANT G_TYPE_MAKE_FUNDAMENTAL (21)
+
+
+/* Reserved fundamental type numbers to create new fundamental
+ * type IDs with G_TYPE_MAKE_FUNDAMENTAL().
+ *
+ * Open an issue on https://gitlab.gnome.org/GNOME/glib/issues/new for
+ * reservations.
+ */
+/**
+ * G_TYPE_FUNDAMENTAL_SHIFT:
+ *
+ * Shift value used in converting numbers to type IDs.
+ */
+#define G_TYPE_FUNDAMENTAL_SHIFT (2)
+/**
+ * G_TYPE_MAKE_FUNDAMENTAL:
+ * @x: the fundamental type number.
+ *
+ * Get the type ID for the fundamental type number @x.
+ * Use g_type_fundamental_next() instead of this macro to create new fundamental
+ * types.
+ *
+ * Returns: the GType
+ */
+#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
+/**
+ * G_TYPE_RESERVED_GLIB_FIRST:
+ *
+ * First fundamental type number to create a new fundamental type id with
+ * G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
+ */
+#define G_TYPE_RESERVED_GLIB_FIRST (22)
+/**
+ * G_TYPE_RESERVED_GLIB_LAST:
+ *
+ * Last fundamental type number reserved for GLib.
+ */
+#define G_TYPE_RESERVED_GLIB_LAST (31)
+/**
+ * G_TYPE_RESERVED_BSE_FIRST:
+ *
+ * First fundamental type number to create a new fundamental type id with
+ * G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
+ */
+#define G_TYPE_RESERVED_BSE_FIRST (32)
+/**
+ * G_TYPE_RESERVED_BSE_LAST:
+ *
+ * Last fundamental type number reserved for BSE.
+ */
+#define G_TYPE_RESERVED_BSE_LAST (48)
+/**
+ * G_TYPE_RESERVED_USER_FIRST:
+ *
+ * First available fundamental type number to create new fundamental
+ * type id with G_TYPE_MAKE_FUNDAMENTAL().
+ */
+#define G_TYPE_RESERVED_USER_FIRST (49)
+
+
+/* Type Checking Macros
+ */
+/**
+ * G_TYPE_IS_FUNDAMENTAL:
+ * @type: A #GType value
+ *
+ * Checks if @type is a fundamental type.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX)
+/**
+ * G_TYPE_IS_DERIVED:
+ * @type: A #GType value
+ *
+ * Checks if @type is derived (or in object-oriented terminology:
+ * inherited) from another type (this holds true for all non-fundamental
+ * types).
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX)
+/**
+ * G_TYPE_IS_INTERFACE:
+ * @type: A #GType value
+ *
+ * Checks if @type is an interface type.
+ * An interface type provides a pure API, the implementation
+ * of which is provided by another type (which is then said to conform
+ * to the interface). GLib interfaces are somewhat analogous to Java
+ * interfaces and C++ classes containing only pure virtual functions,
+ * with the difference that GType interfaces are not derivable (but see
+ * g_type_interface_add_prerequisite() for an alternative).
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
+/**
+ * G_TYPE_IS_CLASSED:
+ * @type: A #GType value
+ *
+ * Checks if @type is a classed type.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
+/**
+ * G_TYPE_IS_INSTANTIATABLE:
+ * @type: A #GType value
+ *
+ * Checks if @type can be instantiated. Instantiation is the
+ * process of creating an instance (object) of this type.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
+/**
+ * G_TYPE_IS_DERIVABLE:
+ * @type: A #GType value
+ *
+ * Checks if @type is a derivable type. A derivable type can
+ * be used as the base class of a flat (single-level) class hierarchy.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))
+/**
+ * G_TYPE_IS_DEEP_DERIVABLE:
+ * @type: A #GType value
+ *
+ * Checks if @type is a deep derivable type. A deep derivable type
+ * can be used as the base class of a deep (multi-level) class hierarchy.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
+/**
+ * G_TYPE_IS_ABSTRACT:
+ * @type: A #GType value
+ *
+ * Checks if @type is an abstract type. An abstract type cannot be
+ * instantiated and is normally used as an abstract base class for
+ * derived classes.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))
+/**
+ * G_TYPE_IS_VALUE_ABSTRACT:
+ * @type: A #GType value
+ *
+ * Checks if @type is an abstract value type. An abstract value type introduces
+ * a value table, but can't be used for g_value_init() and is normally used as
+ * an abstract base type for derived value types.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_VALUE_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT))
+/**
+ * G_TYPE_IS_VALUE_TYPE:
+ * @type: A #GType value
+ *
+ * Checks if @type is a value type and can be used with g_value_init().
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type))
+/**
+ * G_TYPE_HAS_VALUE_TABLE:
+ * @type: A #GType value
+ *
+ * Checks if @type has a #GTypeValueTable.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL)
+
+
+/* Typedefs
+ */
+/**
+ * GType:
+ *
+ * A numerical value which represents the unique identifier of a registered
+ * type.
+ */
+#if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus
+typedef gsize GType;
+#else /* for historic reasons, C++ links against gulong GTypes */
+typedef gulong GType;
+#endif
+typedef struct _GValue GValue;
+typedef union _GTypeCValue GTypeCValue;
+typedef struct _GTypePlugin GTypePlugin;
+typedef struct _GTypeClass GTypeClass;
+typedef struct _GTypeInterface GTypeInterface;
+typedef struct _GTypeInstance GTypeInstance;
+typedef struct _GTypeInfo GTypeInfo;
+typedef struct _GTypeFundamentalInfo GTypeFundamentalInfo;
+typedef struct _GInterfaceInfo GInterfaceInfo;
+typedef struct _GTypeValueTable GTypeValueTable;
+typedef struct _GTypeQuery GTypeQuery;
+
+
+/* Basic Type Structures
+ */
+/**
+ * GTypeClass:
+ *
+ * An opaque structure used as the base of all classes.
+ */
+struct _GTypeClass
+{
+ /*< private >*/
+ GType g_type;
+};
+/**
+ * GTypeInstance:
+ *
+ * An opaque structure used as the base of all type instances.
+ */
+struct _GTypeInstance
+{
+ /*< private >*/
+ GTypeClass *g_class;
+};
+/**
+ * GTypeInterface:
+ *
+ * An opaque structure used as the base of all interface types.
+ */
+struct _GTypeInterface
+{
+ /*< private >*/
+ GType g_type; /* iface type */
+ GType g_instance_type;
+};
+/**
+ * GTypeQuery:
+ * @type: the #GType value of the type
+ * @type_name: the name of the type
+ * @class_size: the size of the class structure
+ * @instance_size: the size of the instance structure
+ *
+ * A structure holding information for a specific type.
+ * It is filled in by the g_type_query() function.
+ */
+struct _GTypeQuery
+{
+ GType type;
+ const gchar *type_name;
+ guint class_size;
+ guint instance_size;
+};
+
+
+/* Casts, checks and accessors for structured types
+ * usage of these macros is reserved to type implementations only
+ */
+/*< protected >*/
+/**
+ * G_TYPE_CHECK_INSTANCE:
+ * @instance: Location of a #GTypeInstance structure
+ *
+ * Checks if @instance is a valid #GTypeInstance structure,
+ * otherwise issues a warning and returns %FALSE. %NULL is not a valid
+ * #GTypeInstance.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_INSTANCE(instance) (_G_TYPE_CHI ((GTypeInstance*) (instance)))
+/**
+ * G_TYPE_CHECK_INSTANCE_CAST:
+ * @instance: (nullable): Location of a #GTypeInstance structure
+ * @g_type: The type to be returned
+ * @c_type: The corresponding C type of @g_type
+ *
+ * Checks that @instance is an instance of the type identified by @g_type
+ * and issues a warning if this is not the case. Returns @instance casted
+ * to a pointer to @c_type.
+ *
+ * No warning will be issued if @instance is %NULL, and %NULL will be returned.
+ *
+ * This macro should only be used in type implementations.
+ */
+#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
+/**
+ * G_TYPE_CHECK_INSTANCE_TYPE:
+ * @instance: (nullable): Location of a #GTypeInstance structure.
+ * @g_type: The type to be checked
+ *
+ * Checks if @instance is an instance of the type identified by @g_type. If
+ * @instance is %NULL, %FALSE will be returned.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type)))
+/**
+ * G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE:
+ * @instance: (nullable): Location of a #GTypeInstance structure.
+ * @g_type: The fundamental type to be checked
+ *
+ * Checks if @instance is an instance of the fundamental type identified by @g_type.
+ * If @instance is %NULL, %FALSE will be returned.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE(instance, g_type) (_G_TYPE_CIFT ((instance), (g_type)))
+/**
+ * G_TYPE_INSTANCE_GET_CLASS:
+ * @instance: Location of the #GTypeInstance structure
+ * @g_type: The #GType of the class to be returned
+ * @c_type: The C type of the class structure
+ *
+ * Get the class structure of a given @instance, casted
+ * to a specified ancestor type @g_type of the instance.
+ *
+ * Note that while calling a GInstanceInitFunc(), the class pointer
+ * gets modified, so it might not always return the expected pointer.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: a pointer to the class structure
+ */
+#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type))
+/**
+ * G_TYPE_INSTANCE_GET_INTERFACE:
+ * @instance: Location of the #GTypeInstance structure
+ * @g_type: The #GType of the interface to be returned
+ * @c_type: The C type of the interface structure
+ *
+ * Get the interface structure for interface @g_type of a given @instance.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: a pointer to the interface structure
+ */
+#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))
+/**
+ * G_TYPE_CHECK_CLASS_CAST:
+ * @g_class: Location of a #GTypeClass structure
+ * @g_type: The type to be returned
+ * @c_type: The corresponding C type of class structure of @g_type
+ *
+ * Checks that @g_class is a class structure of the type identified by @g_type
+ * and issues a warning if this is not the case. Returns @g_class casted
+ * to a pointer to @c_type. %NULL is not a valid class structure.
+ *
+ * This macro should only be used in type implementations.
+ */
+#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type) (_G_TYPE_CCC ((g_class), (g_type), c_type))
+/**
+ * G_TYPE_CHECK_CLASS_TYPE:
+ * @g_class: (nullable): Location of a #GTypeClass structure
+ * @g_type: The type to be checked
+ *
+ * Checks if @g_class is a class structure of the type identified by
+ * @g_type. If @g_class is %NULL, %FALSE will be returned.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) (_G_TYPE_CCT ((g_class), (g_type)))
+/**
+ * G_TYPE_CHECK_VALUE:
+ * @value: a #GValue
+ *
+ * Checks if @value has been initialized to hold values
+ * of a value type.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_VALUE(value) (_G_TYPE_CHV ((value)))
+/**
+ * G_TYPE_CHECK_VALUE_TYPE:
+ * @value: a #GValue
+ * @g_type: The type to be checked
+ *
+ * Checks if @value has been initialized to hold values
+ * of type @g_type.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: %TRUE on success
+ */
+#define G_TYPE_CHECK_VALUE_TYPE(value, g_type) (_G_TYPE_CVH ((value), (g_type)))
+/**
+ * G_TYPE_FROM_INSTANCE:
+ * @instance: Location of a valid #GTypeInstance structure
+ *
+ * Get the type identifier from a given @instance structure.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: the #GType
+ */
+#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
+/**
+ * G_TYPE_FROM_CLASS:
+ * @g_class: Location of a valid #GTypeClass structure
+ *
+ * Get the type identifier from a given @class structure.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: the #GType
+ */
+#define G_TYPE_FROM_CLASS(g_class) (((GTypeClass*) (g_class))->g_type)
+/**
+ * G_TYPE_FROM_INTERFACE:
+ * @g_iface: Location of a valid #GTypeInterface structure
+ *
+ * Get the type identifier from a given @interface structure.
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Returns: the #GType
+ */
+#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type)
+
+/**
+ * G_TYPE_INSTANCE_GET_PRIVATE:
+ * @instance: the instance of a type deriving from @private_type
+ * @g_type: the type identifying which private data to retrieve
+ * @c_type: The C type for the private structure
+ *
+ * Gets the private structure for a particular type.
+ * The private structure must have been registered in the
+ * class_init function with g_type_class_add_private().
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Since: 2.4
+ * Deprecated: 2.58: Use %G_ADD_PRIVATE and the generated
+ * `your_type_get_instance_private()` function instead
+ * Returns: (not nullable): a pointer to the private data structure
+ */
+#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) GLIB_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE)
+
+/**
+ * G_TYPE_CLASS_GET_PRIVATE:
+ * @klass: the class of a type deriving from @private_type
+ * @g_type: the type identifying which private data to retrieve
+ * @c_type: The C type for the private structure
+ *
+ * Gets the private class structure for a particular type.
+ * The private structure must have been registered in the
+ * get_type() function with g_type_add_class_private().
+ *
+ * This macro should only be used in type implementations.
+ *
+ * Since: 2.24
+ * Returns: (not nullable): a pointer to the private data structure
+ */
+#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type)))
+
+/**
+ * GTypeDebugFlags:
+ * @G_TYPE_DEBUG_NONE: Print no messages
+ * @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping
+ * @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions
+ * @G_TYPE_DEBUG_MASK: Mask covering all debug flags
+ * @G_TYPE_DEBUG_INSTANCE_COUNT: Keep a count of instances of each type
+ *
+ * These flags used to be passed to g_type_init_with_debug_flags() which
+ * is now deprecated.
+ *
+ * If you need to enable debugging features, use the GOBJECT_DEBUG
+ * environment variable.
+ *
+ * Deprecated: 2.36: g_type_init() is now done automatically
+ */
+typedef enum /*< skip >*/
+{
+ G_TYPE_DEBUG_NONE = 0,
+ G_TYPE_DEBUG_OBJECTS = 1 << 0,
+ G_TYPE_DEBUG_SIGNALS = 1 << 1,
+ G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
+ G_TYPE_DEBUG_MASK = 0x07
+} GTypeDebugFlags GLIB_DEPRECATED_TYPE_IN_2_36;
+
+
+/* --- prototypes --- */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GLIB_DEPRECATED_IN_2_36
+void g_type_init (void);
+GLIB_DEPRECATED_IN_2_36
+void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_type_name (GType type);
+GLIB_AVAILABLE_IN_ALL
+GQuark g_type_qname (GType type);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_from_name (const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_parent (GType type);
+GLIB_AVAILABLE_IN_ALL
+guint g_type_depth (GType type);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_next_base (GType leaf_type,
+ GType root_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_is_a (GType type,
+ GType is_a_type);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_class_ref (GType type);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_class_peek (GType type);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_class_peek_static (GType type);
+GLIB_AVAILABLE_IN_ALL
+void g_type_class_unref (gpointer g_class);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_class_peek_parent (gpointer g_class);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_interface_peek (gpointer instance_class,
+ GType iface_type);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_interface_peek_parent (gpointer g_iface);
+
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_default_interface_ref (GType g_type);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_default_interface_peek (GType g_type);
+GLIB_AVAILABLE_IN_ALL
+void g_type_default_interface_unref (gpointer g_iface);
+
+/* g_free() the returned arrays */
+GLIB_AVAILABLE_IN_ALL
+GType* g_type_children (GType type,
+ guint *n_children);
+GLIB_AVAILABLE_IN_ALL
+GType* g_type_interfaces (GType type,
+ guint *n_interfaces);
+
+/* per-type _static_ data */
+GLIB_AVAILABLE_IN_ALL
+void g_type_set_qdata (GType type,
+ GQuark quark,
+ gpointer data);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_get_qdata (GType type,
+ GQuark quark);
+GLIB_AVAILABLE_IN_ALL
+void g_type_query (GType type,
+ GTypeQuery *query);
+
+GLIB_AVAILABLE_IN_2_44
+int g_type_get_instance_count (GType type);
+
+/* --- type registration --- */
+/**
+ * GBaseInitFunc:
+ * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize
+ *
+ * A callback function used by the type system to do base initialization
+ * of the class structures of derived types. It is called as part of the
+ * initialization process of all derived classes and should reallocate
+ * or reset all dynamic class members copied over from the parent class.
+ * For example, class members (such as strings) that are not sufficiently
+ * handled by a plain memory copy of the parent class into the derived class
+ * have to be altered. See GClassInitFunc() for a discussion of the class
+ * initialization process.
+ */
+typedef void (*GBaseInitFunc) (gpointer g_class);
+/**
+ * GBaseFinalizeFunc:
+ * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
+ *
+ * A callback function used by the type system to finalize those portions
+ * of a derived types class structure that were setup from the corresponding
+ * GBaseInitFunc() function. Class finalization basically works the inverse
+ * way in which class initialization is performed.
+ * See GClassInitFunc() for a discussion of the class initialization process.
+ */
+typedef void (*GBaseFinalizeFunc) (gpointer g_class);
+/**
+ * GClassInitFunc:
+ * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize.
+ * @class_data: The @class_data member supplied via the #GTypeInfo structure.
+ *
+ * A callback function used by the type system to initialize the class
+ * of a specific type. This function should initialize all static class
+ * members.
+ *
+ * The initialization process of a class involves:
+ *
+ * - Copying common members from the parent class over to the
+ * derived class structure.
+ * - Zero initialization of the remaining members not copied
+ * over from the parent class.
+ * - Invocation of the GBaseInitFunc() initializers of all parent
+ * types and the class' type.
+ * - Invocation of the class' GClassInitFunc() initializer.
+ *
+ * Since derived classes are partially initialized through a memory copy
+ * of the parent class, the general rule is that GBaseInitFunc() and
+ * GBaseFinalizeFunc() should take care of necessary reinitialization
+ * and release of those class members that were introduced by the type
+ * that specified these GBaseInitFunc()/GBaseFinalizeFunc().
+ * GClassInitFunc() should only care about initializing static
+ * class members, while dynamic class members (such as allocated strings
+ * or reference counted resources) are better handled by a GBaseInitFunc()
+ * for this type, so proper initialization of the dynamic class members
+ * is performed for class initialization of derived types as well.
+ *
+ * An example may help to correspond the intend of the different class
+ * initializers:
+ *
+ * |[<!-- language="C" -->
+ * typedef struct {
+ * GObjectClass parent_class;
+ * gint static_integer;
+ * gchar *dynamic_string;
+ * } TypeAClass;
+ * static void
+ * type_a_base_class_init (TypeAClass *class)
+ * {
+ * class->dynamic_string = g_strdup ("some string");
+ * }
+ * static void
+ * type_a_base_class_finalize (TypeAClass *class)
+ * {
+ * g_free (class->dynamic_string);
+ * }
+ * static void
+ * type_a_class_init (TypeAClass *class)
+ * {
+ * class->static_integer = 42;
+ * }
+ *
+ * typedef struct {
+ * TypeAClass parent_class;
+ * gfloat static_float;
+ * GString *dynamic_gstring;
+ * } TypeBClass;
+ * static void
+ * type_b_base_class_init (TypeBClass *class)
+ * {
+ * class->dynamic_gstring = g_string_new ("some other string");
+ * }
+ * static void
+ * type_b_base_class_finalize (TypeBClass *class)
+ * {
+ * g_string_free (class->dynamic_gstring);
+ * }
+ * static void
+ * type_b_class_init (TypeBClass *class)
+ * {
+ * class->static_float = 3.14159265358979323846;
+ * }
+ * ]|
+ * Initialization of TypeBClass will first cause initialization of
+ * TypeAClass (derived classes reference their parent classes, see
+ * g_type_class_ref() on this).
+ *
+ * Initialization of TypeAClass roughly involves zero-initializing its fields,
+ * then calling its GBaseInitFunc() type_a_base_class_init() to allocate
+ * its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
+ * type_a_class_init() to initialize its static members (static_integer).
+ * The first step in the initialization process of TypeBClass is then
+ * a plain memory copy of the contents of TypeAClass into TypeBClass and
+ * zero-initialization of the remaining fields in TypeBClass.
+ * The dynamic members of TypeAClass within TypeBClass now need
+ * reinitialization which is performed by calling type_a_base_class_init()
+ * with an argument of TypeBClass.
+ *
+ * After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
+ * is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
+ * and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
+ * is called to complete the initialization process with the static members
+ * (static_float).
+ *
+ * Corresponding finalization counter parts to the GBaseInitFunc() functions
+ * have to be provided to release allocated resources at class finalization
+ * time.
+ */
+typedef void (*GClassInitFunc) (gpointer g_class,
+ gpointer class_data);
+/**
+ * GClassFinalizeFunc:
+ * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
+ * @class_data: The @class_data member supplied via the #GTypeInfo structure
+ *
+ * A callback function used by the type system to finalize a class.
+ * This function is rarely needed, as dynamically allocated class resources
+ * should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
+ * Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
+ * structure of a static type is invalid, because classes of static types
+ * will never be finalized (they are artificially kept alive when their
+ * reference count drops to zero).
+ */
+typedef void (*GClassFinalizeFunc) (gpointer g_class,
+ gpointer class_data);
+/**
+ * GInstanceInitFunc:
+ * @instance: The instance to initialize
+ * @g_class: (type GObject.TypeClass): The class of the type the instance is
+ * created for
+ *
+ * A callback function used by the type system to initialize a new
+ * instance of a type. This function initializes all instance members and
+ * allocates any resources required by it.
+ *
+ * Initialization of a derived instance involves calling all its parent
+ * types instance initializers, so the class member of the instance
+ * is altered during its initialization to always point to the class that
+ * belongs to the type the current initializer was introduced for.
+ *
+ * The extended members of @instance are guaranteed to have been filled with
+ * zeros before this function is called.
+ */
+typedef void (*GInstanceInitFunc) (GTypeInstance *instance,
+ gpointer g_class);
+/**
+ * GInterfaceInitFunc:
+ * @g_iface: (type GObject.TypeInterface): The interface structure to initialize
+ * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
+ *
+ * A callback function used by the type system to initialize a new
+ * interface. This function should initialize all internal data and
+ * allocate any resources required by the interface.
+ *
+ * The members of @iface_data are guaranteed to have been filled with
+ * zeros before this function is called.
+ */
+typedef void (*GInterfaceInitFunc) (gpointer g_iface,
+ gpointer iface_data);
+/**
+ * GInterfaceFinalizeFunc:
+ * @g_iface: (type GObject.TypeInterface): The interface structure to finalize
+ * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
+ *
+ * A callback function used by the type system to finalize an interface.
+ * This function should destroy any internal data and release any resources
+ * allocated by the corresponding GInterfaceInitFunc() function.
+ */
+typedef void (*GInterfaceFinalizeFunc) (gpointer g_iface,
+ gpointer iface_data);
+/**
+ * GTypeClassCacheFunc:
+ * @cache_data: data that was given to the g_type_add_class_cache_func() call
+ * @g_class: (type GObject.TypeClass): The #GTypeClass structure which is
+ * unreferenced
+ *
+ * A callback function which is called when the reference count of a class
+ * drops to zero. It may use g_type_class_ref() to prevent the class from
+ * being freed. You should not call g_type_class_unref() from a
+ * #GTypeClassCacheFunc function to prevent infinite recursion, use
+ * g_type_class_unref_uncached() instead.
+ *
+ * The functions have to check the class id passed in to figure
+ * whether they actually want to cache the class of this type, since all
+ * classes are routed through the same #GTypeClassCacheFunc chain.
+ *
+ * Returns: %TRUE to stop further #GTypeClassCacheFuncs from being
+ * called, %FALSE to continue
+ */
+typedef gboolean (*GTypeClassCacheFunc) (gpointer cache_data,
+ GTypeClass *g_class);
+/**
+ * GTypeInterfaceCheckFunc:
+ * @check_data: data passed to g_type_add_interface_check()
+ * @g_iface: (type GObject.TypeInterface): the interface that has been
+ * initialized
+ *
+ * A callback called after an interface vtable is initialized.
+ * See g_type_add_interface_check().
+ *
+ * Since: 2.4
+ */
+typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data,
+ gpointer g_iface);
+/**
+ * GTypeFundamentalFlags:
+ * @G_TYPE_FLAG_CLASSED: Indicates a classed type
+ * @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiable type (implies classed)
+ * @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type
+ * @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable)
+ *
+ * Bit masks used to check or determine specific characteristics of a
+ * fundamental type.
+ */
+typedef enum /*< skip >*/
+{
+ G_TYPE_FLAG_CLASSED = (1 << 0),
+ G_TYPE_FLAG_INSTANTIATABLE = (1 << 1),
+ G_TYPE_FLAG_DERIVABLE = (1 << 2),
+ G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3)
+} GTypeFundamentalFlags;
+/**
+ * GTypeFlags:
+ * @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be
+ * created for an abstract type
+ * @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type
+ * that introduces a value table, but can't be used for
+ * g_value_init()
+ *
+ * Bit masks used to check or determine characteristics of a type.
+ */
+typedef enum /*< skip >*/
+{
+ G_TYPE_FLAG_ABSTRACT = (1 << 4),
+ G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5)
+} GTypeFlags;
+/**
+ * GTypeInfo:
+ * @class_size: Size of the class structure (required for interface, classed and instantiatable types)
+ * @base_init: Location of the base initialization function (optional)
+ * @base_finalize: Location of the base finalization function (optional)
+ * @class_init: Location of the class initialization function for
+ * classed and instantiatable types. Location of the default vtable
+ * inititalization function for interface types. (optional) This function
+ * is used both to fill in virtual functions in the class or default vtable,
+ * and to do type-specific setup such as registering signals and object
+ * properties.
+ * @class_finalize: Location of the class finalization function for
+ * classed and instantiatable types. Location of the default vtable
+ * finalization function for interface types. (optional)
+ * @class_data: User-supplied data passed to the class init/finalize functions
+ * @instance_size: Size of the instance (object) structure (required for instantiatable types only)
+ * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now.
+ * @instance_init: Location of the instance initialization function (optional, for instantiatable types only)
+ * @value_table: A #GTypeValueTable function table for generic handling of GValues
+ * of this type (usually only useful for fundamental types)
+ *
+ * This structure is used to provide the type system with the information
+ * required to initialize and destruct (finalize) a type's class and
+ * its instances.
+ *
+ * The initialized structure is passed to the g_type_register_static() function
+ * (or is copied into the provided #GTypeInfo structure in the
+ * g_type_plugin_complete_type_info()). The type system will perform a deep
+ * copy of this structure, so its memory does not need to be persistent
+ * across invocation of g_type_register_static().
+ */
+struct _GTypeInfo
+{
+ /* interface types, classed types, instantiated types */
+ guint16 class_size;
+
+ GBaseInitFunc base_init;
+ GBaseFinalizeFunc base_finalize;
+
+ /* interface types, classed types, instantiated types */
+ GClassInitFunc class_init;
+ GClassFinalizeFunc class_finalize;
+ gconstpointer class_data;
+
+ /* instantiated types */
+ guint16 instance_size;
+ guint16 n_preallocs;
+ GInstanceInitFunc instance_init;
+
+ /* value handling */
+ const GTypeValueTable *value_table;
+};
+/**
+ * GTypeFundamentalInfo:
+ * @type_flags: #GTypeFundamentalFlags describing the characteristics of the fundamental type
+ *
+ * A structure that provides information to the type system which is
+ * used specifically for managing fundamental types.
+ */
+struct _GTypeFundamentalInfo
+{
+ GTypeFundamentalFlags type_flags;
+};
+/**
+ * GInterfaceInfo:
+ * @interface_init: location of the interface initialization function
+ * @interface_finalize: location of the interface finalization function
+ * @interface_data: user-supplied data passed to the interface init/finalize functions
+ *
+ * A structure that provides information to the type system which is
+ * used specifically for managing interface types.
+ */
+struct _GInterfaceInfo
+{
+ GInterfaceInitFunc interface_init;
+ GInterfaceFinalizeFunc interface_finalize;
+ gpointer interface_data;
+};
+/**
+ * GTypeValueTable:
+ * @value_init: Default initialize @values contents by poking values
+ * directly into the value->data array. The data array of
+ * the #GValue passed into this function was zero-filled
+ * with `memset()`, so no care has to be taken to free any
+ * old contents. E.g. for the implementation of a string
+ * value that may never be %NULL, the implementation might
+ * look like:
+ * |[<!-- language="C" -->
+ * value->data[0].v_pointer = g_strdup ("");
+ * ]|
+ * @value_free: Free any old contents that might be left in the
+ * data array of the passed in @value. No resources may
+ * remain allocated through the #GValue contents after
+ * this function returns. E.g. for our above string type:
+ * |[<!-- language="C" -->
+ * // only free strings without a specific flag for static storage
+ * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
+ * g_free (value->data[0].v_pointer);
+ * ]|
+ * @value_copy: @dest_value is a #GValue with zero-filled data section
+ * and @src_value is a properly setup #GValue of same or
+ * derived type.
+ * The purpose of this function is to copy the contents of
+ * @src_value into @dest_value in a way, that even after
+ * @src_value has been freed, the contents of @dest_value
+ * remain valid. String type example:
+ * |[<!-- language="C" -->
+ * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
+ * ]|
+ * @value_peek_pointer: If the value contents fit into a pointer, such as objects
+ * or strings, return this pointer, so the caller can peek at
+ * the current contents. To extend on our above string example:
+ * |[<!-- language="C" -->
+ * return value->data[0].v_pointer;
+ * ]|
+ * @collect_format: A string format describing how to collect the contents of
+ * this value bit-by-bit. Each character in the format represents
+ * an argument to be collected, and the characters themselves indicate
+ * the type of the argument. Currently supported arguments are:
+ * - 'i' - Integers. passed as collect_values[].v_int.
+ * - 'l' - Longs. passed as collect_values[].v_long.
+ * - 'd' - Doubles. passed as collect_values[].v_double.
+ * - 'p' - Pointers. passed as collect_values[].v_pointer.
+ * It should be noted that for variable argument list construction,
+ * ANSI C promotes every type smaller than an integer to an int, and
+ * floats to doubles. So for collection of short int or char, 'i'
+ * needs to be used, and for collection of floats 'd'.
+ * @collect_value: The collect_value() function is responsible for converting the
+ * values collected from a variable argument list into contents
+ * suitable for storage in a GValue. This function should setup
+ * @value similar to value_init(); e.g. for a string value that
+ * does not allow %NULL pointers, it needs to either spew an error,
+ * or do an implicit conversion by storing an empty string.
+ * The @value passed in to this function has a zero-filled data
+ * array, so just like for value_init() it is guaranteed to not
+ * contain any old contents that might need freeing.
+ * @n_collect_values is exactly the string length of @collect_format,
+ * and @collect_values is an array of unions #GTypeCValue with
+ * length @n_collect_values, containing the collected values
+ * according to @collect_format.
+ * @collect_flags is an argument provided as a hint by the caller.
+ * It may contain the flag %G_VALUE_NOCOPY_CONTENTS indicating,
+ * that the collected value contents may be considered "static"
+ * for the duration of the @value lifetime.
+ * Thus an extra copy of the contents stored in @collect_values is
+ * not required for assignment to @value.
+ * For our above string example, we continue with:
+ * |[<!-- language="C" -->
+ * if (!collect_values[0].v_pointer)
+ * value->data[0].v_pointer = g_strdup ("");
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
+ * {
+ * value->data[0].v_pointer = collect_values[0].v_pointer;
+ * // keep a flag for the value_free() implementation to not free this string
+ * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
+ * }
+ * else
+ * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
+ * return NULL;
+ * ]|
+ * It should be noted, that it is generally a bad idea to follow the
+ * #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
+ * reentrancy requirements and reference count assertions performed
+ * by the signal emission code, reference counts should always be
+ * incremented for reference counted contents stored in the value->data
+ * array. To deviate from our string example for a moment, and taking
+ * a look at an exemplary implementation for collect_value() of
+ * #GObject:
+ * |[<!-- language="C" -->
+ * if (collect_values[0].v_pointer)
+ * {
+ * GObject *object = G_OBJECT (collect_values[0].v_pointer);
+ * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
+ * value->data[0].v_pointer = g_object_ref (object);
+ * return NULL;
+ * }
+ * else
+ * return g_strdup_printf ("Object passed as invalid NULL pointer");
+ * }
+ * ]|
+ * The reference count for valid objects is always incremented,
+ * regardless of @collect_flags. For invalid objects, the example
+ * returns a newly allocated string without altering @value.
+ * Upon success, collect_value() needs to return %NULL. If, however,
+ * an error condition occurred, collect_value() may spew an
+ * error by returning a newly allocated non-%NULL string, giving
+ * a suitable description of the error condition.
+ * The calling code makes no assumptions about the @value
+ * contents being valid upon error returns, @value
+ * is simply thrown away without further freeing. As such, it is
+ * a good idea to not allocate #GValue contents, prior to returning
+ * an error, however, collect_values() is not obliged to return
+ * a correctly setup @value for error returns, simply because
+ * any non-%NULL return is considered a fatal condition so further
+ * program behaviour is undefined.
+ * @lcopy_format: Format description of the arguments to collect for @lcopy_value,
+ * analogous to @collect_format. Usually, @lcopy_format string consists
+ * only of 'p's to provide lcopy_value() with pointers to storage locations.
+ * @lcopy_value: This function is responsible for storing the @value contents into
+ * arguments passed through a variable argument list which got
+ * collected into @collect_values according to @lcopy_format.
+ * @n_collect_values equals the string length of @lcopy_format,
+ * and @collect_flags may contain %G_VALUE_NOCOPY_CONTENTS.
+ * In contrast to collect_value(), lcopy_value() is obliged to
+ * always properly support %G_VALUE_NOCOPY_CONTENTS.
+ * Similar to collect_value() the function may prematurely abort
+ * by returning a newly allocated string describing an error condition.
+ * To complete the string example:
+ * |[<!-- language="C" -->
+ * gchar **string_p = collect_values[0].v_pointer;
+ * if (!string_p)
+ * return g_strdup_printf ("string location passed as NULL");
+ * if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
+ * *string_p = value->data[0].v_pointer;
+ * else
+ * *string_p = g_strdup (value->data[0].v_pointer);
+ * ]|
+ * And an illustrative version of lcopy_value() for
+ * reference-counted types:
+ * |[<!-- language="C" -->
+ * GObject **object_p = collect_values[0].v_pointer;
+ * if (!object_p)
+ * return g_strdup_printf ("object location passed as NULL");
+ * if (!value->data[0].v_pointer)
+ * *object_p = NULL;
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
+ * *object_p = value->data[0].v_pointer;
+ * else
+ * *object_p = g_object_ref (value->data[0].v_pointer);
+ * return NULL;
+ * ]|
+ *
+ * The #GTypeValueTable provides the functions required by the #GValue
+ * implementation, to serve as a container for values of a type.
+ */
+
+struct _GTypeValueTable
+{
+ void (*value_init) (GValue *value);
+ void (*value_free) (GValue *value);
+ void (*value_copy) (const GValue *src_value,
+ GValue *dest_value);
+ /* varargs functionality (optional) */
+ gpointer (*value_peek_pointer) (const GValue *value);
+ const gchar *collect_format;
+ gchar* (*collect_value) (GValue *value,
+ guint n_collect_values,
+ GTypeCValue *collect_values,
+ guint collect_flags);
+ const gchar *lcopy_format;
+ gchar* (*lcopy_value) (const GValue *value,
+ guint n_collect_values,
+ GTypeCValue *collect_values,
+ guint collect_flags);
+};
+GLIB_AVAILABLE_IN_ALL
+GType g_type_register_static (GType parent_type,
+ const gchar *type_name,
+ const GTypeInfo *info,
+ GTypeFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_register_static_simple (GType parent_type,
+ const gchar *type_name,
+ guint class_size,
+ GClassInitFunc class_init,
+ guint instance_size,
+ GInstanceInitFunc instance_init,
+ GTypeFlags flags);
+
+GLIB_AVAILABLE_IN_ALL
+GType g_type_register_dynamic (GType parent_type,
+ const gchar *type_name,
+ GTypePlugin *plugin,
+ GTypeFlags flags);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_register_fundamental (GType type_id,
+ const gchar *type_name,
+ const GTypeInfo *info,
+ const GTypeFundamentalInfo *finfo,
+ GTypeFlags flags);
+GLIB_AVAILABLE_IN_ALL
+void g_type_add_interface_static (GType instance_type,
+ GType interface_type,
+ const GInterfaceInfo *info);
+GLIB_AVAILABLE_IN_ALL
+void g_type_add_interface_dynamic (GType instance_type,
+ GType interface_type,
+ GTypePlugin *plugin);
+GLIB_AVAILABLE_IN_ALL
+void g_type_interface_add_prerequisite (GType interface_type,
+ GType prerequisite_type);
+GLIB_AVAILABLE_IN_ALL
+GType*g_type_interface_prerequisites (GType interface_type,
+ guint *n_prerequisites);
+GLIB_DEPRECATED_IN_2_58
+void g_type_class_add_private (gpointer g_class,
+ gsize private_size);
+GLIB_AVAILABLE_IN_2_38
+gint g_type_add_instance_private (GType class_type,
+ gsize private_size);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_instance_get_private (GTypeInstance *instance,
+ GType private_type);
+GLIB_AVAILABLE_IN_2_38
+void g_type_class_adjust_private_offset (gpointer g_class,
+ gint *private_size_or_offset);
+
+GLIB_AVAILABLE_IN_ALL
+void g_type_add_class_private (GType class_type,
+ gsize private_size);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_type_class_get_private (GTypeClass *klass,
+ GType private_type);
+GLIB_AVAILABLE_IN_2_38
+gint g_type_class_get_instance_private_offset (gpointer g_class);
+
+GLIB_AVAILABLE_IN_2_34
+void g_type_ensure (GType type);
+GLIB_AVAILABLE_IN_2_36
+guint g_type_get_type_registration_serial (void);
+
+
+/* --- GType boilerplate --- */
+/**
+ * G_DECLARE_FINAL_TYPE:
+ * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
+ * @module_obj_name: The name of the new type in lowercase, with words
+ * separated by '_' (like 'gtk_widget')
+ * @MODULE: The name of the module, in all caps (like 'GTK')
+ * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
+ * @ParentName: the name of the parent type, in camel case (like GtkWidget)
+ *
+ * A convenience macro for emitting the usual declarations in the header file for a type which is not (at the
+ * present time) intended to be subclassed.
+ *
+ * You might use it in a header as follows:
+ *
+ * |[
+ * #ifndef _myapp_window_h_
+ * #define _myapp_window_h_
+ *
+ * #include <gtk/gtk.h>
+ *
+ * #define MY_APP_TYPE_WINDOW my_app_window_get_type ()
+ * G_DECLARE_FINAL_TYPE (MyAppWindow, my_app_window, MY_APP, WINDOW, GtkWindow)
+ *
+ * MyAppWindow * my_app_window_new (void);
+ *
+ * ...
+ *
+ * #endif
+ * ]|
+ *
+ * This results in the following things happening:
+ *
+ * - the usual my_app_window_get_type() function is declared with a return type of #GType
+ *
+ * - the MyAppWindow types is defined as a typedef of struct _MyAppWindow. The struct itself is not
+ * defined and should be defined from the .c file before G_DEFINE_TYPE() is used.
+ *
+ * - the MY_APP_WINDOW() cast is emitted as static inline function along with the MY_APP_IS_WINDOW() type
+ * checking function
+ *
+ * - the MyAppWindowClass type is defined as a struct containing GtkWindowClass. This is done for the
+ * convenience of the person defining the type and should not be considered to be part of the ABI. In
+ * particular, without a firm declaration of the instance structure, it is not possible to subclass the type
+ * and therefore the fact that the size of the class structure is exposed is not a concern and it can be
+ * freely changed at any point in the future.
+ *
+ * - g_autoptr() support being added for your type, based on the type of your parent class
+ *
+ * You can only use this function if your parent type also supports g_autoptr().
+ *
+ * Because the type macro (MY_APP_TYPE_WINDOW in the above example) is not a callable, you must continue to
+ * manually define this as a macro for yourself.
+ *
+ * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro
+ * to be used in the usual way with export control and API versioning macros.
+ *
+ * If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE().
+ *
+ * If you are writing a library, it is important to note that it is possible to convert a type from using
+ * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
+ * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
+ * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
+ * reorder items without breaking the API and/or ABI.
+ *
+ * Since: 2.44
+ **/
+#define G_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
+ GType module_obj_name##_get_type (void); \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ typedef struct _##ModuleObjName ModuleObjName; \
+ typedef struct { ParentName##Class parent_class; } ModuleObjName##Class; \
+ \
+ _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
+ \
+ static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
+ static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+/**
+ * G_DECLARE_DERIVABLE_TYPE:
+ * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
+ * @module_obj_name: The name of the new type in lowercase, with words
+ * separated by '_' (like 'gtk_widget')
+ * @MODULE: The name of the module, in all caps (like 'GTK')
+ * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
+ * @ParentName: the name of the parent type, in camel case (like GtkWidget)
+ *
+ * A convenience macro for emitting the usual declarations in the
+ * header file for a type which is intended to be subclassed.
+ *
+ * You might use it in a header as follows:
+ *
+ * |[
+ * #ifndef _gtk_frobber_h_
+ * #define _gtk_frobber_h_
+ *
+ * #define GTK_TYPE_FROBBER gtk_frobber_get_type ()
+ * GDK_AVAILABLE_IN_3_12
+ * G_DECLARE_DERIVABLE_TYPE (GtkFrobber, gtk_frobber, GTK, FROBBER, GtkWidget)
+ *
+ * struct _GtkFrobberClass
+ * {
+ * GtkWidgetClass parent_class;
+ *
+ * void (* handle_frob) (GtkFrobber *frobber,
+ * guint n_frobs);
+ *
+ * gpointer padding[12];
+ * };
+ *
+ * GtkWidget * gtk_frobber_new (void);
+ *
+ * ...
+ *
+ * #endif
+ * ]|
+ *
+ * This results in the following things happening:
+ *
+ * - the usual gtk_frobber_get_type() function is declared with a return type of #GType
+ *
+ * - the GtkFrobber struct is created with GtkWidget as the first and only item. You are expected to use
+ * a private structure from your .c file to store your instance variables.
+ *
+ * - the GtkFrobberClass type is defined as a typedef to struct _GtkFrobberClass, which is left undefined.
+ * You should do this from the header file directly after you use the macro.
+ *
+ * - the GTK_FROBBER() and GTK_FROBBER_CLASS() casts are emitted as static inline functions along with
+ * the GTK_IS_FROBBER() and GTK_IS_FROBBER_CLASS() type checking functions and GTK_FROBBER_GET_CLASS()
+ * function.
+ *
+ * - g_autoptr() support being added for your type, based on the type of your parent class
+ *
+ * You can only use this function if your parent type also supports g_autoptr().
+ *
+ * Because the type macro (GTK_TYPE_FROBBER in the above example) is not a callable, you must continue to
+ * manually define this as a macro for yourself.
+ *
+ * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro
+ * to be used in the usual way with export control and API versioning macros.
+ *
+ * If you are writing a library, it is important to note that it is possible to convert a type from using
+ * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
+ * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
+ * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
+ * reorder items without breaking the API and/or ABI. If you want to declare your own class structure, use
+ * G_DECLARE_DERIVABLE_TYPE(). If you want to declare a class without exposing the class or instance
+ * structures, use G_DECLARE_FINAL_TYPE().
+ *
+ * If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your
+ * class structure to leave space for the addition of future virtual functions.
+ *
+ * Since: 2.44
+ **/
+#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
+ GType module_obj_name##_get_type (void); \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ typedef struct _##ModuleObjName ModuleObjName; \
+ typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
+ struct _##ModuleObjName { ParentName parent_instance; }; \
+ \
+ _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
+ \
+ static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
+ static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \
+ return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
+ static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
+ static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \
+ return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \
+ static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \
+ return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+/**
+ * G_DECLARE_INTERFACE:
+ * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
+ * @module_obj_name: The name of the new type in lowercase, with words
+ * separated by '_' (like 'gtk_widget')
+ * @MODULE: The name of the module, in all caps (like 'GTK')
+ * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
+ * @PrerequisiteName: the name of the prerequisite type, in camel case (like GtkWidget)
+ *
+ * A convenience macro for emitting the usual declarations in the header file for a GInterface type.
+ *
+ * You might use it in a header as follows:
+ *
+ * |[
+ * #ifndef _my_model_h_
+ * #define _my_model_h_
+ *
+ * #define MY_TYPE_MODEL my_model_get_type ()
+ * GDK_AVAILABLE_IN_3_12
+ * G_DECLARE_INTERFACE (MyModel, my_model, MY, MODEL, GObject)
+ *
+ * struct _MyModelInterface
+ * {
+ * GTypeInterface g_iface;
+ *
+ * gpointer (* get_item) (MyModel *model);
+ * };
+ *
+ * gpointer my_model_get_item (MyModel *model);
+ *
+ * ...
+ *
+ * #endif
+ * ]|
+ *
+ * This results in the following things happening:
+ *
+ * - the usual my_model_get_type() function is declared with a return type of #GType
+ *
+ * - the MyModelInterface type is defined as a typedef to struct _MyModelInterface,
+ * which is left undefined. You should do this from the header file directly after
+ * you use the macro.
+ *
+ * - the MY_MODEL() cast is emitted as static inline functions along with
+ * the MY_IS_MODEL() type checking function and MY_MODEL_GET_IFACE() function.
+ *
+ * - g_autoptr() support being added for your type, based on your prerequisite type.
+ *
+ * You can only use this function if your prerequisite type also supports g_autoptr().
+ *
+ * Because the type macro (MY_TYPE_MODEL in the above example) is not a callable, you must continue to
+ * manually define this as a macro for yourself.
+ *
+ * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro
+ * to be used in the usual way with export control and API versioning macros.
+ *
+ * Since: 2.44
+ **/
+#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName) \
+ GType module_obj_name##_get_type (void); \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ typedef struct _##ModuleObjName ModuleObjName; \
+ typedef struct _##ModuleObjName##Interface ModuleObjName##Interface; \
+ \
+ _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, PrerequisiteName) \
+ \
+ static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
+ static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
+ return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
+ static inline ModuleObjName##Interface * MODULE##_##OBJ_NAME##_GET_IFACE (gpointer ptr) { \
+ return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+/**
+ * G_DEFINE_TYPE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ *
+ * A convenience macro for type implementations, which declares a class
+ * initialization function, an instance initialization function (see #GTypeInfo
+ * for information about these) and a static variable named `t_n_parent_class`
+ * pointing to the parent class. Furthermore, it defines a *_get_type() function.
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.4
+ */
+#define G_DEFINE_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
+/**
+ * G_DEFINE_TYPE_WITH_CODE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type in lowercase, with words separated by '_'.
+ * @T_P: The #GType of the parent type.
+ * @_C_: Custom code that gets inserted in the *_get_type() function.
+ *
+ * A convenience macro for type implementations.
+ * Similar to G_DEFINE_TYPE(), but allows you to insert custom code into the
+ * *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE().
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.4
+ */
+#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
+/**
+ * G_DEFINE_TYPE_WITH_PRIVATE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ *
+ * A convenience macro for type implementations, which declares a class
+ * initialization function, an instance initialization function (see #GTypeInfo
+ * for information about these), a static variable named `t_n_parent_class`
+ * pointing to the parent class, and adds private instance data to the type.
+ * Furthermore, it defines a *_get_type() function. See G_DEFINE_TYPE_EXTENDED()
+ * for an example.
+ *
+ * Note that private structs added with this macros must have a struct
+ * name of the form @TN Private.
+ *
+ * The private instance data can be retrieved using the automatically generated
+ * getter function `t_n_get_instance_private()`.
+ *
+ * See also: G_ADD_PRIVATE()
+ *
+ * Since: 2.38
+ */
+#define G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, G_ADD_PRIVATE (TN))
+/**
+ * G_DEFINE_ABSTRACT_TYPE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ *
+ * A convenience macro for type implementations.
+ * Similar to G_DEFINE_TYPE(), but defines an abstract type.
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.4
+ */
+#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
+/**
+ * G_DEFINE_ABSTRACT_TYPE_WITH_CODE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ * @_C_: Custom code that gets inserted in the @type_name_get_type() function.
+ *
+ * A convenience macro for type implementations.
+ * Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and
+ * allows you to insert custom code into the *_get_type() function, e.g.
+ * interface implementations via G_IMPLEMENT_INTERFACE().
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.4
+ */
+#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
+/**
+ * G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ *
+ * Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines an abstract type.
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.38
+ */
+#define G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, G_ADD_PRIVATE (TN))
+/**
+ * G_DEFINE_TYPE_EXTENDED:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ * @_f_: #GTypeFlags to pass to g_type_register_static()
+ * @_C_: Custom code that gets inserted in the *_get_type() function.
+ *
+ * The most general convenience macro for type implementations, on which
+ * G_DEFINE_TYPE(), etc are based.
+ *
+ * |[<!-- language="C" -->
+ * G_DEFINE_TYPE_EXTENDED (GtkGadget,
+ * gtk_gadget,
+ * GTK_TYPE_WIDGET,
+ * 0,
+ * G_ADD_PRIVATE (GtkGadget)
+ * G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
+ * gtk_gadget_gizmo_init));
+ * ]|
+ * expands to
+ * |[<!-- language="C" -->
+ * static void gtk_gadget_init (GtkGadget *self);
+ * static void gtk_gadget_class_init (GtkGadgetClass *klass);
+ * static gpointer gtk_gadget_parent_class = NULL;
+ * static gint GtkGadget_private_offset;
+ * static void gtk_gadget_class_intern_init (gpointer klass)
+ * {
+ * gtk_gadget_parent_class = g_type_class_peek_parent (klass);
+ * if (GtkGadget_private_offset != 0)
+ * g_type_class_adjust_private_offset (klass, &GtkGadget_private_offset);
+ * gtk_gadget_class_init ((GtkGadgetClass*) klass);
+ * }
+ * static inline gpointer gtk_gadget_get_instance_private (GtkGadget *self)
+ * {
+ * return (G_STRUCT_MEMBER_P (self, GtkGadget_private_offset));
+ * }
+ *
+ * GType
+ * gtk_gadget_get_type (void)
+ * {
+ * static volatile gsize g_define_type_id__volatile = 0;
+ * if (g_once_init_enter (&g_define_type_id__volatile))
+ * {
+ * GType g_define_type_id =
+ * g_type_register_static_simple (GTK_TYPE_WIDGET,
+ * g_intern_static_string ("GtkGadget"),
+ * sizeof (GtkGadgetClass),
+ * (GClassInitFunc) gtk_gadget_class_intern_init,
+ * sizeof (GtkGadget),
+ * (GInstanceInitFunc) gtk_gadget_init,
+ * 0);
+ * {
+ * GtkGadget_private_offset =
+ * g_type_add_instance_private (g_define_type_id, sizeof (GtkGadgetPrivate));
+ * }
+ * {
+ * const GInterfaceInfo g_implement_interface_info = {
+ * (GInterfaceInitFunc) gtk_gadget_gizmo_init
+ * };
+ * g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
+ * }
+ * g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ * }
+ * return g_define_type_id__volatile;
+ * }
+ * ]|
+ * The only pieces which have to be manually provided are the definitions of
+ * the instance and class structure and the definitions of the instance and
+ * class init functions.
+ *
+ * Since: 2.4
+ */
+#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
+
+/**
+ * G_DEFINE_INTERFACE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words separated by '_'.
+ * @T_P: The #GType of the prerequisite type for the interface, or 0
+ * (%G_TYPE_INVALID) for no prerequisite type.
+ *
+ * A convenience macro for #GTypeInterface definitions, which declares
+ * a default vtable initialization function and defines a *_get_type()
+ * function.
+ *
+ * The macro expects the interface initialization function to have the
+ * name `t_n ## _default_init`, and the interface structure to have the
+ * name `TN ## Interface`.
+ *
+ * The initialization function has signature
+ * `static void t_n ## _default_init (TypeName##Interface *klass);`, rather than
+ * the full #GInterfaceInitFunc signature, for brevity and convenience. If you
+ * need to use an initialization function with an `iface_data` argument, you
+ * must write the #GTypeInterface definitions manually.
+ *
+ * Since: 2.24
+ */
+#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
+
+/**
+ * G_DEFINE_INTERFACE_WITH_CODE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words separated by '_'.
+ * @T_P: The #GType of the prerequisite type for the interface, or 0
+ * (%G_TYPE_INVALID) for no prerequisite type.
+ * @_C_: Custom code that gets inserted in the *_get_type() function.
+ *
+ * A convenience macro for #GTypeInterface definitions. Similar to
+ * G_DEFINE_INTERFACE(), but allows you to insert custom code into the
+ * *_get_type() function, e.g. additional interface implementations
+ * via G_IMPLEMENT_INTERFACE(), or additional prerequisite types. See
+ * G_DEFINE_TYPE_EXTENDED() for a similar example using
+ * G_DEFINE_TYPE_WITH_CODE().
+ *
+ * Since: 2.24
+ */
+#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
+
+/**
+ * G_IMPLEMENT_INTERFACE:
+ * @TYPE_IFACE: The #GType of the interface to add
+ * @iface_init: (type GInterfaceInitFunc): The interface init function, of type #GInterfaceInitFunc
+ *
+ * A convenience macro to ease interface addition in the `_C_` section
+ * of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
+ * See G_DEFINE_TYPE_EXTENDED() for an example.
+ *
+ * Note that this macro can only be used together with the G_DEFINE_TYPE_*
+ * macros, since it depends on variable names from those macros.
+ *
+ * Since: 2.4
+ */
+#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \
+ const GInterfaceInfo g_implement_interface_info = { \
+ (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \
+ }; \
+ g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
+}
+
+/**
+ * G_ADD_PRIVATE:
+ * @TypeName: the name of the type in CamelCase
+ *
+ * A convenience macro to ease adding private data to instances of a new type
+ * in the @_C_ section of G_DEFINE_TYPE_WITH_CODE() or
+ * G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
+ *
+ * For instance:
+ *
+ * |[<!-- language="C" -->
+ * typedef struct _MyObject MyObject;
+ * typedef struct _MyObjectClass MyObjectClass;
+ *
+ * typedef struct {
+ * gint foo;
+ * gint bar;
+ * } MyObjectPrivate;
+ *
+ * G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT,
+ * G_ADD_PRIVATE (MyObject))
+ * ]|
+ *
+ * Will add MyObjectPrivate as the private data to any instance of the MyObject
+ * type.
+ *
+ * G_DEFINE_TYPE_* macros will automatically create a private function
+ * based on the arguments to this macro, which can be used to safely
+ * retrieve the private data from an instance of the type; for instance:
+ *
+ * |[<!-- language="C" -->
+ * gint
+ * my_object_get_foo (MyObject *obj)
+ * {
+ * MyObjectPrivate *priv = my_object_get_instance_private (obj);
+ *
+ * g_return_val_if_fail (MY_IS_OBJECT (obj), 0);
+ *
+ * return priv->foo;
+ * }
+ *
+ * void
+ * my_object_set_bar (MyObject *obj,
+ * gint bar)
+ * {
+ * MyObjectPrivate *priv = my_object_get_instance_private (obj);
+ *
+ * g_return_if_fail (MY_IS_OBJECT (obj));
+ *
+ * if (priv->bar != bar)
+ * priv->bar = bar;
+ * }
+ * ]|
+ *
+ * Note that this macro can only be used together with the G_DEFINE_TYPE_*
+ * macros, since it depends on variable names from those macros.
+ *
+ * Also note that private structs added with these macros must have a struct
+ * name of the form `TypeNamePrivate`.
+ *
+ * It is safe to call the `_get_instance_private` function on %NULL or invalid
+ * objects since it's only adding an offset to the instance pointer. In that
+ * case the returned pointer must not be dereferenced.
+ *
+ * Since: 2.38
+ */
+#define G_ADD_PRIVATE(TypeName) { \
+ TypeName##_private_offset = \
+ g_type_add_instance_private (g_define_type_id, sizeof (TypeName##Private)); \
+}
+
+/**
+ * G_PRIVATE_OFFSET:
+ * @TypeName: the name of the type in CamelCase
+ * @field: the name of the field in the private data structure
+ *
+ * Evaluates to the offset of the @field inside the instance private data
+ * structure for @TypeName.
+ *
+ * Note that this macro can only be used together with the G_DEFINE_TYPE_*
+ * and G_ADD_PRIVATE() macros, since it depends on variable names from
+ * those macros.
+ *
+ * Since: 2.38
+ */
+#define G_PRIVATE_OFFSET(TypeName, field) \
+ (TypeName##_private_offset + (G_STRUCT_OFFSET (TypeName##Private, field)))
+
+/**
+ * G_PRIVATE_FIELD_P:
+ * @TypeName: the name of the type in CamelCase
+ * @inst: the instance of @TypeName you wish to access
+ * @field_name: the name of the field in the private data structure
+ *
+ * Evaluates to a pointer to the @field_name inside the @inst private data
+ * structure for @TypeName.
+ *
+ * Note that this macro can only be used together with the G_DEFINE_TYPE_*
+ * and G_ADD_PRIVATE() macros, since it depends on variable names from
+ * those macros.
+ *
+ * Since: 2.38
+ */
+#define G_PRIVATE_FIELD_P(TypeName, inst, field_name) \
+ G_STRUCT_MEMBER_P (inst, G_PRIVATE_OFFSET (TypeName, field_name))
+
+/**
+ * G_PRIVATE_FIELD:
+ * @TypeName: the name of the type in CamelCase
+ * @inst: the instance of @TypeName you wish to access
+ * @field_type: the type of the field in the private data structure
+ * @field_name: the name of the field in the private data structure
+ *
+ * Evaluates to the @field_name inside the @inst private data
+ * structure for @TypeName.
+ *
+ * Note that this macro can only be used together with the G_DEFINE_TYPE_*
+ * and G_ADD_PRIVATE() macros, since it depends on variable names from
+ * those macros.
+ *
+ * Since: 2.38
+ */
+#define G_PRIVATE_FIELD(TypeName, inst, field_type, field_name) \
+ G_STRUCT_MEMBER (field_type, inst, G_PRIVATE_OFFSET (TypeName, field_name))
+
+/* we need to have this macro under conditional expansion, as it references
+ * a function that has been added in 2.38. see bug:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=703191
+ */
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
+static void type_name##_class_intern_init (gpointer klass) \
+{ \
+ type_name##_parent_class = g_type_class_peek_parent (klass); \
+ if (TypeName##_private_offset != 0) \
+ g_type_class_adjust_private_offset (klass, &TypeName##_private_offset); \
+ type_name##_class_init ((TypeName##Class*) klass); \
+}
+
+#else
+#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
+static void type_name##_class_intern_init (gpointer klass) \
+{ \
+ type_name##_parent_class = g_type_class_peek_parent (klass); \
+ type_name##_class_init ((TypeName##Class*) klass); \
+}
+#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 */
+
+/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
+#define _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
+\
+static void type_name##_init (TypeName *self); \
+static void type_name##_class_init (TypeName##Class *klass); \
+static GType type_name##_get_type_once (void); \
+static gpointer type_name##_parent_class = NULL; \
+static gint TypeName##_private_offset; \
+\
+_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
+\
+G_GNUC_UNUSED \
+static inline gpointer \
+type_name##_get_instance_private (TypeName *self) \
+{ \
+ return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \
+} \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static volatile gsize g_define_type_id__volatile = 0;
+ /* Prelude goes here */
+
+/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
+#define _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ GType g_define_type_id = type_name##_get_type_once (); \
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} /* closes type_name##_get_type() */ \
+\
+G_GNUC_NO_INLINE \
+static GType \
+type_name##_get_type_once (void) \
+{ \
+ GType g_define_type_id = \
+ g_type_register_static_simple (TYPE_PARENT, \
+ g_intern_static_string (#TypeName), \
+ sizeof (TypeName##Class), \
+ (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \
+ sizeof (TypeName), \
+ (GInstanceInitFunc)(void (*)(void)) type_name##_init, \
+ (GTypeFlags) flags); \
+ { /* custom code follows */
+#define _G_DEFINE_TYPE_EXTENDED_END() \
+ /* following custom code */ \
+ } \
+ return g_define_type_id; \
+} /* closes type_name##_get_type_once() */
+
+/* This was defined before we had G_DEFINE_TYPE_WITH_CODE_AND_PRELUDE, it's simplest
+ * to keep it.
+ */
+#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
+
+#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \
+\
+static void type_name##_default_init (TypeName##Interface *klass); \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static volatile gsize g_define_type_id__volatile = 0; \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ GType g_define_type_id = \
+ g_type_register_static_simple (G_TYPE_INTERFACE, \
+ g_intern_static_string (#TypeName), \
+ sizeof (TypeName##Interface), \
+ (GClassInitFunc)(void (*)(void)) type_name##_default_init, \
+ 0, \
+ (GInstanceInitFunc)NULL, \
+ (GTypeFlags) 0); \
+ if (TYPE_PREREQ != G_TYPE_INVALID) \
+ g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \
+ { /* custom code follows */
+#define _G_DEFINE_INTERFACE_EXTENDED_END() \
+ /* following custom code */ \
+ } \
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} /* closes type_name##_get_type() */
+
+/**
+ * G_DEFINE_BOXED_TYPE:
+ * @TypeName: The name of the new type, in Camel case
+ * @type_name: The name of the new type, in lowercase, with words
+ * separated by '_'
+ * @copy_func: the #GBoxedCopyFunc for the new type
+ * @free_func: the #GBoxedFreeFunc for the new type
+ *
+ * A convenience macro for boxed type implementations, which defines a
+ * type_name_get_type() function registering the boxed type.
+ *
+ * Since: 2.26
+ */
+#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {})
+/**
+ * G_DEFINE_BOXED_TYPE_WITH_CODE:
+ * @TypeName: The name of the new type, in Camel case
+ * @type_name: The name of the new type, in lowercase, with words
+ * separated by '_'
+ * @copy_func: the #GBoxedCopyFunc for the new type
+ * @free_func: the #GBoxedFreeFunc for the new type
+ * @_C_: Custom code that gets inserted in the *_get_type() function
+ *
+ * A convenience macro for boxed type implementations.
+ * Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the
+ * type_name_get_type() function, e.g. to register value transformations with
+ * g_value_register_transform_func(), for instance:
+ *
+ * |[<!-- language="C" -->
+ * G_DEFINE_BOXED_TYPE_WITH_CODE (GdkRectangle, gdk_rectangle,
+ * gdk_rectangle_copy,
+ * gdk_rectangle_free,
+ * register_rectangle_transform_funcs (g_define_type_id))
+ * ]|
+ *
+ * Similarly to the %G_DEFINE_TYPE family of macros, the #GType of the newly
+ * defined boxed type is exposed in the `g_define_type_id` variable.
+ *
+ * Since: 2.26
+ */
+#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
+
+/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=647145
+ */
+#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE__) && defined (__ppc64__))
+#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
+static GType type_name##_get_type_once (void); \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static volatile gsize g_define_type_id__volatile = 0; \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ GType g_define_type_id = type_name##_get_type_once (); \
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} \
+\
+G_GNUC_NO_INLINE \
+static GType \
+type_name##_get_type_once (void) \
+{ \
+ GType (* _g_register_boxed) \
+ (const gchar *, \
+ union \
+ { \
+ TypeName * (*do_copy_type) (TypeName *); \
+ TypeName * (*do_const_copy_type) (const TypeName *); \
+ GBoxedCopyFunc do_copy_boxed; \
+ } __attribute__((__transparent_union__)), \
+ union \
+ { \
+ void (* do_free_type) (TypeName *); \
+ GBoxedFreeFunc do_free_boxed; \
+ } __attribute__((__transparent_union__)) \
+ ) = g_boxed_type_register_static; \
+ GType g_define_type_id = \
+ _g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \
+ { /* custom code follows */
+#else
+#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
+static GType type_name##_get_type_once (void); \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static volatile gsize g_define_type_id__volatile = 0; \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ GType g_define_type_id = type_name##_get_type_once (); \
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} \
+\
+G_GNUC_NO_INLINE \
+static GType \
+type_name##_get_type_once (void) \
+{ \
+ GType g_define_type_id = \
+ g_boxed_type_register_static (g_intern_static_string (#TypeName), \
+ (GBoxedCopyFunc) copy_func, \
+ (GBoxedFreeFunc) free_func); \
+ { /* custom code follows */
+#endif /* __GNUC__ */
+
+/**
+ * G_DEFINE_POINTER_TYPE:
+ * @TypeName: The name of the new type, in Camel case
+ * @type_name: The name of the new type, in lowercase, with words
+ * separated by '_'
+ *
+ * A convenience macro for pointer type implementations, which defines a
+ * type_name_get_type() function registering the pointer type.
+ *
+ * Since: 2.26
+ */
+#define G_DEFINE_POINTER_TYPE(TypeName, type_name) G_DEFINE_POINTER_TYPE_WITH_CODE (TypeName, type_name, {})
+/**
+ * G_DEFINE_POINTER_TYPE_WITH_CODE:
+ * @TypeName: The name of the new type, in Camel case
+ * @type_name: The name of the new type, in lowercase, with words
+ * separated by '_'
+ * @_C_: Custom code that gets inserted in the *_get_type() function
+ *
+ * A convenience macro for pointer type implementations.
+ * Similar to G_DEFINE_POINTER_TYPE(), but allows to insert
+ * custom code into the type_name_get_type() function.
+ *
+ * Since: 2.26
+ */
+#define G_DEFINE_POINTER_TYPE_WITH_CODE(TypeName, type_name, _C_) _G_DEFINE_POINTER_TYPE_BEGIN (TypeName, type_name) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
+
+#define _G_DEFINE_POINTER_TYPE_BEGIN(TypeName, type_name) \
+static GType type_name##_get_type_once (void); \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static volatile gsize g_define_type_id__volatile = 0; \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ GType g_define_type_id = type_name##_get_type_once (); \
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} \
+\
+G_GNUC_NO_INLINE \
+static GType \
+type_name##_get_type_once (void) \
+{ \
+ GType g_define_type_id = \
+ g_pointer_type_register_static (g_intern_static_string (#TypeName)); \
+ { /* custom code follows */
+
+/* --- protected (for fundamental type implementations) --- */
+GLIB_AVAILABLE_IN_ALL
+GTypePlugin* g_type_get_plugin (GType type);
+GLIB_AVAILABLE_IN_ALL
+GTypePlugin* g_type_interface_get_plugin (GType instance_type,
+ GType interface_type);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_fundamental_next (void);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_fundamental (GType type_id);
+GLIB_AVAILABLE_IN_ALL
+GTypeInstance* g_type_create_instance (GType type);
+GLIB_AVAILABLE_IN_ALL
+void g_type_free_instance (GTypeInstance *instance);
+
+GLIB_AVAILABLE_IN_ALL
+void g_type_add_class_cache_func (gpointer cache_data,
+ GTypeClassCacheFunc cache_func);
+GLIB_AVAILABLE_IN_ALL
+void g_type_remove_class_cache_func (gpointer cache_data,
+ GTypeClassCacheFunc cache_func);
+GLIB_AVAILABLE_IN_ALL
+void g_type_class_unref_uncached (gpointer g_class);
+
+GLIB_AVAILABLE_IN_ALL
+void g_type_add_interface_check (gpointer check_data,
+ GTypeInterfaceCheckFunc check_func);
+GLIB_AVAILABLE_IN_ALL
+void g_type_remove_interface_check (gpointer check_data,
+ GTypeInterfaceCheckFunc check_func);
+
+GLIB_AVAILABLE_IN_ALL
+GTypeValueTable* g_type_value_table_peek (GType type);
+
+
+/*< private >*/
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_instance (GTypeInstance *instance) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+GTypeInstance* g_type_check_instance_cast (GTypeInstance *instance,
+ GType iface_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_instance_is_a (GTypeInstance *instance,
+ GType iface_type) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_2_42
+gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *instance,
+ GType fundamental_type) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+GTypeClass* g_type_check_class_cast (GTypeClass *g_class,
+ GType is_a_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_class_is_a (GTypeClass *g_class,
+ GType is_a_type) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_is_value_type (GType type) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_value (const GValue *value) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_check_value_holds (const GValue *value,
+ GType type) G_GNUC_PURE;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_test_flags (GType type,
+ guint flags) G_GNUC_CONST;
+
+
+/* --- debugging functions --- */
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_type_name_from_instance (GTypeInstance *instance);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_type_name_from_class (GTypeClass *g_class);
+
+
+/* --- implementation bits --- */
+#ifndef G_DISABLE_CAST_CHECKS
+# define _G_TYPE_CIC(ip, gt, ct) \
+ ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
+# define _G_TYPE_CCC(cp, gt, ct) \
+ ((ct*) g_type_check_class_cast ((GTypeClass*) cp, gt))
+#else /* G_DISABLE_CAST_CHECKS */
+# define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
+# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp)
+#endif /* G_DISABLE_CAST_CHECKS */
+#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip))
+#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
+#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
+#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
+#define _G_TYPE_CIFT(ip, ft) (g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ip, ft))
+#ifdef __GNUC__
+# define _G_TYPE_CIT(ip, gt) (G_GNUC_EXTENSION ({ \
+ GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \
+ if (!__inst) \
+ __r = FALSE; \
+ else if (__inst->g_class && __inst->g_class->g_type == __t) \
+ __r = TRUE; \
+ else \
+ __r = g_type_check_instance_is_a (__inst, __t); \
+ __r; \
+}))
+# define _G_TYPE_CCT(cp, gt) (G_GNUC_EXTENSION ({ \
+ GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \
+ if (!__class) \
+ __r = FALSE; \
+ else if (__class->g_type == __t) \
+ __r = TRUE; \
+ else \
+ __r = g_type_check_class_is_a (__class, __t); \
+ __r; \
+}))
+# define _G_TYPE_CVH(vl, gt) (G_GNUC_EXTENSION ({ \
+ const GValue *__val = (const GValue*) vl; GType __t = gt; gboolean __r; \
+ if (!__val) \
+ __r = FALSE; \
+ else if (__val->g_type == __t) \
+ __r = TRUE; \
+ else \
+ __r = g_type_check_value_holds (__val, __t); \
+ __r; \
+}))
+#else /* !__GNUC__ */
+# define _G_TYPE_CIT(ip, gt) (g_type_check_instance_is_a ((GTypeInstance*) ip, gt))
+# define _G_TYPE_CCT(cp, gt) (g_type_check_class_is_a ((GTypeClass*) cp, gt))
+# define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((const GValue*) vl, gt))
+#endif /* !__GNUC__ */
+/**
+ * G_TYPE_FLAG_RESERVED_ID_BIT:
+ *
+ * A bit in the type number that's supposed to be left untouched.
+ */
+#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0))
+
+G_END_DECLS
+
+#endif /* __G_TYPE_H__ */
diff --git a/include/glib/gobject/gtypemodule.h b/include/glib/gobject/gtypemodule.h
new file mode 100644
index 0000000000..5c40250631
--- /dev/null
+++ b/include/glib/gobject/gtypemodule.h
@@ -0,0 +1,295 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_TYPE_MODULE_H__
+#define __G_TYPE_MODULE_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gobject.h>
+#include <gobject/genums.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GTypeModule GTypeModule;
+typedef struct _GTypeModuleClass GTypeModuleClass;
+
+#define G_TYPE_TYPE_MODULE (g_type_module_get_type ())
+#define G_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), G_TYPE_TYPE_MODULE, GTypeModule))
+#define G_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TYPE_MODULE, GTypeModuleClass))
+#define G_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), G_TYPE_TYPE_MODULE))
+#define G_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TYPE_MODULE))
+#define G_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((module), G_TYPE_TYPE_MODULE, GTypeModuleClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeModule, g_object_unref)
+
+/**
+ * GTypeModule:
+ * @name: the name of the module
+ *
+ * The members of the GTypeModule structure should not
+ * be accessed directly, except for the @name field.
+ */
+struct _GTypeModule
+{
+ GObject parent_instance;
+
+ guint use_count;
+ GSList *type_infos;
+ GSList *interface_infos;
+
+ /*< public >*/
+ gchar *name;
+};
+
+/**
+ * GTypeModuleClass:
+ * @parent_class: the parent class
+ * @load: loads the module and registers one or more types using
+ * g_type_module_register_type().
+ * @unload: unloads the module
+ *
+ * In order to implement dynamic loading of types based on #GTypeModule,
+ * the @load and @unload functions in #GTypeModuleClass must be implemented.
+ */
+struct _GTypeModuleClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+ gboolean (* load) (GTypeModule *module);
+ void (* unload) (GTypeModule *module);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*reserved1) (void);
+ void (*reserved2) (void);
+ void (*reserved3) (void);
+ void (*reserved4) (void);
+};
+
+/**
+ * G_DEFINE_DYNAMIC_TYPE:
+ * @TN: The name of the new type, in Camel case.
+ * @t_n: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @T_P: The #GType of the parent type.
+ *
+ * A convenience macro for dynamic type implementations, which declares a
+ * class initialization function, an instance initialization function (see
+ * #GTypeInfo for information about these) and a static variable named
+ * `t_n`_parent_class pointing to the parent class. Furthermore,
+ * it defines a `*_get_type()` and a static `*_register_type()` functions
+ * for use in your `module_init()`.
+ *
+ * See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example.
+ *
+ * Since: 2.14
+ */
+#define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
+/**
+ * G_DEFINE_DYNAMIC_TYPE_EXTENDED:
+ * @TypeName: The name of the new type, in Camel case.
+ * @type_name: The name of the new type, in lowercase, with words
+ * separated by '_'.
+ * @TYPE_PARENT: The #GType of the parent type.
+ * @flags: #GTypeFlags to pass to g_type_module_register_type()
+ * @CODE: Custom code that gets inserted in the *_get_type() function.
+ *
+ * A more general version of G_DEFINE_DYNAMIC_TYPE() which
+ * allows to specify #GTypeFlags and custom code.
+ *
+ * |[
+ * G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkGadget,
+ * gtk_gadget,
+ * GTK_TYPE_THING,
+ * 0,
+ * G_IMPLEMENT_INTERFACE_DYNAMIC (TYPE_GIZMO,
+ * gtk_gadget_gizmo_init));
+ * ]|
+ * expands to
+ * |[
+ * static void gtk_gadget_init (GtkGadget *self);
+ * static void gtk_gadget_class_init (GtkGadgetClass *klass);
+ * static void gtk_gadget_class_finalize (GtkGadgetClass *klass);
+ *
+ * static gpointer gtk_gadget_parent_class = NULL;
+ * static GType gtk_gadget_type_id = 0;
+ *
+ * static void gtk_gadget_class_intern_init (gpointer klass)
+ * {
+ * gtk_gadget_parent_class = g_type_class_peek_parent (klass);
+ * gtk_gadget_class_init ((GtkGadgetClass*) klass);
+ * }
+ *
+ * GType
+ * gtk_gadget_get_type (void)
+ * {
+ * return gtk_gadget_type_id;
+ * }
+ *
+ * static void
+ * gtk_gadget_register_type (GTypeModule *type_module)
+ * {
+ * const GTypeInfo g_define_type_info = {
+ * sizeof (GtkGadgetClass),
+ * (GBaseInitFunc) NULL,
+ * (GBaseFinalizeFunc) NULL,
+ * (GClassInitFunc) gtk_gadget_class_intern_init,
+ * (GClassFinalizeFunc) gtk_gadget_class_finalize,
+ * NULL, // class_data
+ * sizeof (GtkGadget),
+ * 0, // n_preallocs
+ * (GInstanceInitFunc) gtk_gadget_init,
+ * NULL // value_table
+ * };
+ * gtk_gadget_type_id = g_type_module_register_type (type_module,
+ * GTK_TYPE_THING,
+ * "GtkGadget",
+ * &g_define_type_info,
+ * (GTypeFlags) flags);
+ * {
+ * const GInterfaceInfo g_implement_interface_info = {
+ * (GInterfaceInitFunc) gtk_gadget_gizmo_init
+ * };
+ * g_type_module_add_interface (type_module, g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
+ * }
+ * }
+ * ]|
+ *
+ * Since: 2.14
+ */
+#define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \
+static void type_name##_init (TypeName *self); \
+static void type_name##_class_init (TypeName##Class *klass); \
+static void type_name##_class_finalize (TypeName##Class *klass); \
+static gpointer type_name##_parent_class = NULL; \
+static GType type_name##_type_id = 0; \
+static gint TypeName##_private_offset; \
+\
+_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
+\
+G_GNUC_UNUSED \
+static inline gpointer \
+type_name##_get_instance_private (TypeName *self) \
+{ \
+ return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \
+} \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ return type_name##_type_id; \
+} \
+static void \
+type_name##_register_type (GTypeModule *type_module) \
+{ \
+ GType g_define_type_id G_GNUC_UNUSED; \
+ const GTypeInfo g_define_type_info = { \
+ sizeof (TypeName##Class), \
+ (GBaseInitFunc) NULL, \
+ (GBaseFinalizeFunc) NULL, \
+ (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \
+ (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \
+ NULL, /* class_data */ \
+ sizeof (TypeName), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc)(void (*)(void)) type_name##_init, \
+ NULL /* value_table */ \
+ }; \
+ type_name##_type_id = g_type_module_register_type (type_module, \
+ TYPE_PARENT, \
+ #TypeName, \
+ &g_define_type_info, \
+ (GTypeFlags) flags); \
+ g_define_type_id = type_name##_type_id; \
+ { CODE ; } \
+}
+
+/**
+ * G_IMPLEMENT_INTERFACE_DYNAMIC:
+ * @TYPE_IFACE: The #GType of the interface to add
+ * @iface_init: The interface init function
+ *
+ * A convenience macro to ease interface addition in the @_C_ section
+ * of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See G_DEFINE_DYNAMIC_TYPE_EXTENDED()
+ * for an example.
+ *
+ * Note that this macro can only be used together with the
+ * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable
+ * names from that macro.
+ *
+ * Since: 2.24
+ */
+#define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \
+ const GInterfaceInfo g_implement_interface_info = { \
+ (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \
+ }; \
+ g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
+}
+
+/**
+ * G_ADD_PRIVATE_DYNAMIC:
+ * @TypeName: the name of the type in CamelCase
+ *
+ * A convenience macro to ease adding private data to instances of a new dynamic
+ * type in the @_C_ section of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See
+ * G_ADD_PRIVATE() for details, it is similar but for static types.
+ *
+ * Note that this macro can only be used together with the
+ * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable
+ * names from that macro.
+ *
+ * Since: 2.38
+ */
+#define G_ADD_PRIVATE_DYNAMIC(TypeName) { \
+ TypeName##_private_offset = sizeof (TypeName##Private); \
+}
+
+GLIB_AVAILABLE_IN_ALL
+GType g_type_module_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_type_module_use (GTypeModule *module);
+GLIB_AVAILABLE_IN_ALL
+void g_type_module_unuse (GTypeModule *module);
+GLIB_AVAILABLE_IN_ALL
+void g_type_module_set_name (GTypeModule *module,
+ const gchar *name);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_module_register_type (GTypeModule *module,
+ GType parent_type,
+ const gchar *type_name,
+ const GTypeInfo *type_info,
+ GTypeFlags flags);
+GLIB_AVAILABLE_IN_ALL
+void g_type_module_add_interface (GTypeModule *module,
+ GType instance_type,
+ GType interface_type,
+ const GInterfaceInfo *interface_info);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_module_register_enum (GTypeModule *module,
+ const gchar *name,
+ const GEnumValue *const_static_values);
+GLIB_AVAILABLE_IN_ALL
+GType g_type_module_register_flags (GTypeModule *module,
+ const gchar *name,
+ const GFlagsValue *const_static_values);
+
+G_END_DECLS
+
+#endif /* __G_TYPE_MODULE_H__ */
diff --git a/include/glib/gobject/gtypeplugin.h b/include/glib/gobject/gtypeplugin.h
new file mode 100644
index 0000000000..482f55cae1
--- /dev/null
+++ b/include/glib/gobject/gtypeplugin.h
@@ -0,0 +1,134 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __G_TYPE_PLUGIN_H__
+#define __G_TYPE_PLUGIN_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+#define G_TYPE_TYPE_PLUGIN (g_type_plugin_get_type ())
+#define G_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TYPE_PLUGIN, GTypePlugin))
+#define G_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), G_TYPE_TYPE_PLUGIN, GTypePluginClass))
+#define G_IS_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TYPE_PLUGIN))
+#define G_IS_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), G_TYPE_TYPE_PLUGIN))
+#define G_TYPE_PLUGIN_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TYPE_PLUGIN, GTypePluginClass))
+
+
+/* --- typedefs & structures --- */
+typedef struct _GTypePluginClass GTypePluginClass;
+/**
+ * GTypePluginUse:
+ * @plugin: the #GTypePlugin whose use count should be increased
+ *
+ * The type of the @use_plugin function of #GTypePluginClass, which gets called
+ * to increase the use count of @plugin.
+ */
+typedef void (*GTypePluginUse) (GTypePlugin *plugin);
+/**
+ * GTypePluginUnuse:
+ * @plugin: the #GTypePlugin whose use count should be decreased
+ *
+ * The type of the @unuse_plugin function of #GTypePluginClass.
+ */
+typedef void (*GTypePluginUnuse) (GTypePlugin *plugin);
+/**
+ * GTypePluginCompleteTypeInfo:
+ * @plugin: the #GTypePlugin
+ * @g_type: the #GType whose info is completed
+ * @info: the #GTypeInfo struct to fill in
+ * @value_table: the #GTypeValueTable to fill in
+ *
+ * The type of the @complete_type_info function of #GTypePluginClass.
+ */
+typedef void (*GTypePluginCompleteTypeInfo) (GTypePlugin *plugin,
+ GType g_type,
+ GTypeInfo *info,
+ GTypeValueTable *value_table);
+/**
+ * GTypePluginCompleteInterfaceInfo:
+ * @plugin: the #GTypePlugin
+ * @instance_type: the #GType of an instantiable type to which the interface
+ * is added
+ * @interface_type: the #GType of the interface whose info is completed
+ * @info: the #GInterfaceInfo to fill in
+ *
+ * The type of the @complete_interface_info function of #GTypePluginClass.
+ */
+typedef void (*GTypePluginCompleteInterfaceInfo) (GTypePlugin *plugin,
+ GType instance_type,
+ GType interface_type,
+ GInterfaceInfo *info);
+/**
+ * GTypePlugin:
+ *
+ * The GTypePlugin typedef is used as a placeholder
+ * for objects that implement the GTypePlugin interface.
+ */
+/**
+ * GTypePluginClass:
+ * @use_plugin: Increases the use count of the plugin.
+ * @unuse_plugin: Decreases the use count of the plugin.
+ * @complete_type_info: Fills in the #GTypeInfo and
+ * #GTypeValueTable structs for the type. The structs are initialized
+ * with `memset(s, 0, sizeof (s))` before calling this function.
+ * @complete_interface_info: Fills in missing parts of the #GInterfaceInfo
+ * for the interface. The structs is initialized with
+ * `memset(s, 0, sizeof (s))` before calling this function.
+ *
+ * The #GTypePlugin interface is used by the type system in order to handle
+ * the lifecycle of dynamically loaded types.
+ */
+struct _GTypePluginClass
+{
+ /*< private >*/
+ GTypeInterface base_iface;
+
+ /*< public >*/
+ GTypePluginUse use_plugin;
+ GTypePluginUnuse unuse_plugin;
+ GTypePluginCompleteTypeInfo complete_type_info;
+ GTypePluginCompleteInterfaceInfo complete_interface_info;
+};
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GType g_type_plugin_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+void g_type_plugin_use (GTypePlugin *plugin);
+GLIB_AVAILABLE_IN_ALL
+void g_type_plugin_unuse (GTypePlugin *plugin);
+GLIB_AVAILABLE_IN_ALL
+void g_type_plugin_complete_type_info (GTypePlugin *plugin,
+ GType g_type,
+ GTypeInfo *info,
+ GTypeValueTable *value_table);
+GLIB_AVAILABLE_IN_ALL
+void g_type_plugin_complete_interface_info (GTypePlugin *plugin,
+ GType instance_type,
+ GType interface_type,
+ GInterfaceInfo *info);
+
+G_END_DECLS
+
+#endif /* __G_TYPE_PLUGIN_H__ */
diff --git a/include/glib/gobject/gvalue.h b/include/glib/gobject/gvalue.h
new file mode 100644
index 0000000000..9d8f03482a
--- /dev/null
+++ b/include/glib/gobject/gvalue.h
@@ -0,0 +1,196 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gvalue.h: generic GValue functions
+ */
+#ifndef __G_VALUE_H__
+#define __G_VALUE_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gtype.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+/**
+ * G_TYPE_IS_VALUE:
+ * @type: A #GType value.
+ *
+ * Checks whether the passed in type ID can be used for g_value_init().
+ * That is, this macro checks whether this type provides an implementation
+ * of the #GTypeValueTable functions required for a type to create a #GValue of.
+ *
+ * Returns: Whether @type is suitable as a #GValue type.
+ */
+#define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type))
+/**
+ * G_IS_VALUE:
+ * @value: A #GValue structure.
+ *
+ * Checks if @value is a valid and initialized #GValue structure.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value))
+/**
+ * G_VALUE_TYPE:
+ * @value: A #GValue structure.
+ *
+ * Get the type identifier of @value.
+ *
+ * Returns: the #GType.
+ */
+#define G_VALUE_TYPE(value) (((GValue*) (value))->g_type)
+/**
+ * G_VALUE_TYPE_NAME:
+ * @value: A #GValue structure.
+ *
+ * Gets the type name of @value.
+ *
+ * Returns: the type name.
+ */
+#define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value)))
+/**
+ * G_VALUE_HOLDS:
+ * @value: A #GValue structure.
+ * @type: A #GType value.
+ *
+ * Checks if @value holds (or contains) a value of @type.
+ * This macro will also check for @value != %NULL and issue a
+ * warning if the check fails.
+ *
+ * Returns: %TRUE if @value holds the @type.
+ */
+#define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type)))
+
+
+/* --- typedefs & structures --- */
+/**
+ * GValueTransform:
+ * @src_value: Source value.
+ * @dest_value: Target value.
+ *
+ * The type of value transformation functions which can be registered with
+ * g_value_register_transform_func().
+ *
+ * @dest_value will be initialized to the correct destination type.
+ */
+typedef void (*GValueTransform) (const GValue *src_value,
+ GValue *dest_value);
+/**
+ * GValue:
+ *
+ * An opaque structure used to hold different types of values.
+ * The data within the structure has protected scope: it is accessible only
+ * to functions within a #GTypeValueTable structure, or implementations of
+ * the g_value_*() API. That is, code portions which implement new fundamental
+ * types.
+ * #GValue users cannot make any assumptions about how data is stored
+ * within the 2 element @data union, and the @g_type member should
+ * only be accessed through the G_VALUE_TYPE() macro.
+ */
+struct _GValue
+{
+ /*< private >*/
+ GType g_type;
+
+ /* public for GTypeValueTable methods */
+ union {
+ gint v_int;
+ guint v_uint;
+ glong v_long;
+ gulong v_ulong;
+ gint64 v_int64;
+ guint64 v_uint64;
+ gfloat v_float;
+ gdouble v_double;
+ gpointer v_pointer;
+ } data[2];
+};
+
+
+/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
+GValue* g_value_init (GValue *value,
+ GType g_type);
+GLIB_AVAILABLE_IN_ALL
+void g_value_copy (const GValue *src_value,
+ GValue *dest_value);
+GLIB_AVAILABLE_IN_ALL
+GValue* g_value_reset (GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_unset (GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_instance (GValue *value,
+ gpointer instance);
+GLIB_AVAILABLE_IN_2_42
+void g_value_init_from_instance (GValue *value,
+ gpointer instance);
+
+
+/* --- private --- */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_value_fits_pointer (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_peek_pointer (const GValue *value);
+
+
+/* --- implementation details --- */
+GLIB_AVAILABLE_IN_ALL
+gboolean g_value_type_compatible (GType src_type,
+ GType dest_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_value_type_transformable (GType src_type,
+ GType dest_type);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_value_transform (const GValue *src_value,
+ GValue *dest_value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_register_transform_func (GType src_type,
+ GType dest_type,
+ GValueTransform transform_func);
+
+/**
+ * G_VALUE_NOCOPY_CONTENTS:
+ *
+ * If passed to G_VALUE_COLLECT(), allocated data won't be copied
+ * but used verbatim. This does not affect ref-counted types like
+ * objects.
+ */
+#define G_VALUE_NOCOPY_CONTENTS (1 << 27)
+
+/**
+ * G_VALUE_INIT:
+ *
+ * A #GValue must be initialized before it can be used. This macro can
+ * be used as initializer instead of an explicit `{ 0 }` when declaring
+ * a variable, but it cannot be assigned to a variable.
+ *
+ * |[
+ * GValue value = G_VALUE_INIT;
+ * ]|
+ *
+ * Since: 2.30
+ */
+#define G_VALUE_INIT { 0, { { 0 } } }
+
+
+G_END_DECLS
+
+#endif /* __G_VALUE_H__ */
diff --git a/include/glib/gobject/gvaluearray.h b/include/glib/gobject/gvaluearray.h
new file mode 100644
index 0000000000..dbc6be765d
--- /dev/null
+++ b/include/glib/gobject/gvaluearray.h
@@ -0,0 +1,104 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gvaluearray.h: GLib array type holding GValues
+ */
+#ifndef __G_VALUE_ARRAY_H__
+#define __G_VALUE_ARRAY_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gvalue.h>
+
+G_BEGIN_DECLS
+
+/**
+ * G_TYPE_VALUE_ARRAY:
+ *
+ * The type ID of the "GValueArray" type which is a boxed type,
+ * used to pass around pointers to GValueArrays.
+ *
+ * Deprecated: 2.32: Use #GArray instead of #GValueArray
+ */
+#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_TYPE_ARRAY)
+
+/* --- typedefs & structs --- */
+typedef struct _GValueArray GValueArray;
+/**
+ * GValueArray:
+ * @n_values: number of values contained in the array
+ * @values: array of values
+ *
+ * A #GValueArray contains an array of #GValue elements.
+ */
+struct _GValueArray
+{
+ guint n_values;
+ GValue *values;
+
+ /*< private >*/
+ guint n_prealloced;
+};
+
+/* --- prototypes --- */
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GType g_value_array_get_type (void) G_GNUC_CONST;
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValue* g_value_array_get_nth (GValueArray *value_array,
+ guint index_);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_new (guint n_prealloced);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+void g_value_array_free (GValueArray *value_array);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_copy (const GValueArray *value_array);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_prepend (GValueArray *value_array,
+ const GValue *value);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_append (GValueArray *value_array,
+ const GValue *value);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_insert (GValueArray *value_array,
+ guint index_,
+ const GValue *value);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_remove (GValueArray *value_array,
+ guint index_);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_sort (GValueArray *value_array,
+ GCompareFunc compare_func);
+
+GLIB_DEPRECATED_IN_2_32_FOR(GArray)
+GValueArray* g_value_array_sort_with_data (GValueArray *value_array,
+ GCompareDataFunc compare_func,
+ gpointer user_data);
+
+
+G_END_DECLS
+
+#endif /* __G_VALUE_ARRAY_H__ */
diff --git a/include/glib/gobject/gvaluecollector.h b/include/glib/gobject/gvaluecollector.h
new file mode 100644
index 0000000000..177aa3dfae
--- /dev/null
+++ b/include/glib/gobject/gvaluecollector.h
@@ -0,0 +1,261 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gvaluecollector.h: GValue varargs stubs
+ */
+/**
+ * SECTION:value_collection
+ * @Short_description: Converting varargs to generic values
+ * @Title: Varargs Value Collection
+ *
+ * The macros in this section provide the varargs parsing support needed
+ * in variadic GObject functions such as g_object_new() or g_object_set().
+ * They currently support the collection of integral types, floating point
+ * types and pointers.
+ */
+#ifndef __G_VALUE_COLLECTOR_H__
+#define __G_VALUE_COLLECTOR_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* we may want to add aggregate types here some day, if requested
+ * by users. the basic C types are covered already, everything
+ * smaller than an int is promoted to an integer and floats are
+ * always promoted to doubles for varargs call constructions.
+ */
+enum /*< skip >*/
+{
+ G_VALUE_COLLECT_INT = 'i',
+ G_VALUE_COLLECT_LONG = 'l',
+ G_VALUE_COLLECT_INT64 = 'q',
+ G_VALUE_COLLECT_DOUBLE = 'd',
+ G_VALUE_COLLECT_POINTER = 'p'
+};
+
+
+/* vararg union holding actual values collected
+ */
+/**
+ * GTypeCValue:
+ * @v_int: the field for holding integer values
+ * @v_long: the field for holding long integer values
+ * @v_int64: the field for holding 64 bit integer values
+ * @v_double: the field for holding floating point values
+ * @v_pointer: the field for holding pointers
+ *
+ * A union holding one collected value.
+ */
+union _GTypeCValue
+{
+ gint v_int;
+ glong v_long;
+ gint64 v_int64;
+ gdouble v_double;
+ gpointer v_pointer;
+};
+
+/**
+ * G_VALUE_COLLECT_INIT:
+ * @value: a #GValue return location. @value must contain only 0 bytes.
+ * @_value_type: the #GType to use for @value.
+ * @var_args: the va_list variable; it may be evaluated multiple times
+ * @flags: flags which are passed on to the collect_value() function of
+ * the #GTypeValueTable of @value.
+ * @__error: a #gchar** variable that will be modified to hold a g_new()
+ * allocated error messages if something fails
+ *
+ * Collects a variable argument value from a va_list. We have to
+ * implement the varargs collection as a macro, because on some systems
+ * va_list variables cannot be passed by reference.
+ *
+ * Since: 2.24
+ */
+#define G_VALUE_COLLECT_INIT(value, _value_type, var_args, flags, __error) \
+G_STMT_START { \
+ GValue *g_vci_val = (value); \
+ guint g_vci_flags = (flags); \
+ GTypeValueTable *g_vci_vtab = g_type_value_table_peek (_value_type); \
+ const gchar *g_vci_collect_format = g_vci_vtab->collect_format; \
+ GTypeCValue g_vci_cvalues[G_VALUE_COLLECT_FORMAT_MAX_LENGTH] = { { 0, }, }; \
+ guint g_vci_n_values = 0; \
+ \
+ g_vci_val->g_type = _value_type; /* value_meminit() from gvalue.c */ \
+ while (*g_vci_collect_format) \
+ { \
+ GTypeCValue *g_vci_cvalue = g_vci_cvalues + g_vci_n_values++; \
+ \
+ switch (*g_vci_collect_format++) \
+ { \
+ case G_VALUE_COLLECT_INT: \
+ g_vci_cvalue->v_int = va_arg ((var_args), gint); \
+ break; \
+ case G_VALUE_COLLECT_LONG: \
+ g_vci_cvalue->v_long = va_arg ((var_args), glong); \
+ break; \
+ case G_VALUE_COLLECT_INT64: \
+ g_vci_cvalue->v_int64 = va_arg ((var_args), gint64); \
+ break; \
+ case G_VALUE_COLLECT_DOUBLE: \
+ g_vci_cvalue->v_double = va_arg ((var_args), gdouble); \
+ break; \
+ case G_VALUE_COLLECT_POINTER: \
+ g_vci_cvalue->v_pointer = va_arg ((var_args), gpointer); \
+ break; \
+ default: \
+ g_assert_not_reached (); \
+ } \
+ } \
+ *(__error) = g_vci_vtab->collect_value (g_vci_val, \
+ g_vci_n_values, \
+ g_vci_cvalues, \
+ g_vci_flags); \
+} G_STMT_END
+
+/**
+ * G_VALUE_COLLECT:
+ * @value: a #GValue return location. @value is supposed to be initialized
+ * according to the value type to be collected
+ * @var_args: the va_list variable; it may be evaluated multiple times
+ * @flags: flags which are passed on to the collect_value() function of
+ * the #GTypeValueTable of @value.
+ * @__error: a #gchar** variable that will be modified to hold a g_new()
+ * allocated error messages if something fails
+ *
+ * Collects a variable argument value from a va_list. We have to
+ * implement the varargs collection as a macro, because on some systems
+ * va_list variables cannot be passed by reference.
+ *
+ * Note: If you are creating the @value argument just before calling this macro,
+ * you should use the #G_VALUE_COLLECT_INIT variant and pass the unitialized
+ * #GValue. That variant is faster than #G_VALUE_COLLECT.
+ */
+#define G_VALUE_COLLECT(value, var_args, flags, __error) G_STMT_START { \
+ GValue *g_vc_value = (value); \
+ GType g_vc_value_type = G_VALUE_TYPE (g_vc_value); \
+ GTypeValueTable *g_vc_vtable = g_type_value_table_peek (g_vc_value_type); \
+ \
+ if (g_vc_vtable->value_free) \
+ g_vc_vtable->value_free (g_vc_value); \
+ memset (g_vc_value->data, 0, sizeof (g_vc_value->data)); \
+ \
+ G_VALUE_COLLECT_INIT(value, g_vc_value_type, var_args, flags, __error); \
+} G_STMT_END
+
+/**
+ * G_VALUE_COLLECT_SKIP:
+ * @_value_type: the #GType of the value to skip
+ * @var_args: the va_list variable; it may be evaluated multiple times
+ *
+ * Skip an argument of type @_value_type from @var_args.
+ */
+#define G_VALUE_COLLECT_SKIP(_value_type, var_args) \
+G_STMT_START { \
+ GTypeValueTable *g_vcs_vtable = g_type_value_table_peek (_value_type); \
+ const gchar *g_vcs_collect_format = g_vcs_vtable->collect_format; \
+ \
+ while (*g_vcs_collect_format) \
+ { \
+ switch (*g_vcs_collect_format++) \
+ { \
+ case G_VALUE_COLLECT_INT: \
+ va_arg ((var_args), gint); \
+ break; \
+ case G_VALUE_COLLECT_LONG: \
+ va_arg ((var_args), glong); \
+ break; \
+ case G_VALUE_COLLECT_INT64: \
+ va_arg ((var_args), gint64); \
+ break; \
+ case G_VALUE_COLLECT_DOUBLE: \
+ va_arg ((var_args), gdouble); \
+ break; \
+ case G_VALUE_COLLECT_POINTER: \
+ va_arg ((var_args), gpointer); \
+ break; \
+ default: \
+ g_assert_not_reached (); \
+ } \
+ } \
+} G_STMT_END
+
+/**
+ * G_VALUE_LCOPY:
+ * @value: a #GValue to store into the @var_args; this must be initialized
+ * and set
+ * @var_args: the va_list variable; it may be evaluated multiple times
+ * @flags: flags which are passed on to the lcopy_value() function of
+ * the #GTypeValueTable of @value.
+ * @__error: a #gchar** variable that will be modified to hold a g_new()
+ * allocated error message if something fails
+ *
+ * Stores a value’s value into one or more argument locations from a va_list.
+ * This is the inverse of G_VALUE_COLLECT().
+ */
+#define G_VALUE_LCOPY(value, var_args, flags, __error) \
+G_STMT_START { \
+ const GValue *g_vl_value = (value); \
+ guint g_vl_flags = (flags); \
+ GType g_vl_value_type = G_VALUE_TYPE (g_vl_value); \
+ GTypeValueTable *g_vl_vtable = g_type_value_table_peek (g_vl_value_type); \
+ const gchar *g_vl_lcopy_format = g_vl_vtable->lcopy_format; \
+ GTypeCValue g_vl_cvalues[G_VALUE_COLLECT_FORMAT_MAX_LENGTH] = { { 0, }, }; \
+ guint g_vl_n_values = 0; \
+ \
+ while (*g_vl_lcopy_format) \
+ { \
+ GTypeCValue *g_vl_cvalue = g_vl_cvalues + g_vl_n_values++; \
+ \
+ switch (*g_vl_lcopy_format++) \
+ { \
+ case G_VALUE_COLLECT_INT: \
+ g_vl_cvalue->v_int = va_arg ((var_args), gint); \
+ break; \
+ case G_VALUE_COLLECT_LONG: \
+ g_vl_cvalue->v_long = va_arg ((var_args), glong); \
+ break; \
+ case G_VALUE_COLLECT_INT64: \
+ g_vl_cvalue->v_int64 = va_arg ((var_args), gint64); \
+ break; \
+ case G_VALUE_COLLECT_DOUBLE: \
+ g_vl_cvalue->v_double = va_arg ((var_args), gdouble); \
+ break; \
+ case G_VALUE_COLLECT_POINTER: \
+ g_vl_cvalue->v_pointer = va_arg ((var_args), gpointer); \
+ break; \
+ default: \
+ g_assert_not_reached (); \
+ } \
+ } \
+ *(__error) = g_vl_vtable->lcopy_value (g_vl_value, \
+ g_vl_n_values, \
+ g_vl_cvalues, \
+ g_vl_flags); \
+} G_STMT_END
+
+
+/**
+ * G_VALUE_COLLECT_FORMAT_MAX_LENGTH:
+ *
+ * The maximal number of #GTypeCValues which can be collected for a
+ * single #GValue.
+ */
+#define G_VALUE_COLLECT_FORMAT_MAX_LENGTH (8)
+
+G_END_DECLS
+
+#endif /* __G_VALUE_COLLECTOR_H__ */
diff --git a/include/glib/gobject/gvaluetypes.h b/include/glib/gobject/gvaluetypes.h
new file mode 100644
index 0000000000..9274435329
--- /dev/null
+++ b/include/glib/gobject/gvaluetypes.h
@@ -0,0 +1,300 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * gvaluetypes.h: GLib default values
+ */
+#ifndef __G_VALUETYPES_H__
+#define __G_VALUETYPES_H__
+
+#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
+#error "Only <glib-object.h> can be included directly."
+#endif
+
+#include <gobject/gvalue.h>
+
+G_BEGIN_DECLS
+
+/* --- type macros --- */
+/**
+ * G_VALUE_HOLDS_CHAR:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR))
+/**
+ * G_VALUE_HOLDS_UCHAR:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR))
+/**
+ * G_VALUE_HOLDS_BOOLEAN:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN))
+/**
+ * G_VALUE_HOLDS_INT:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_INT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT))
+/**
+ * G_VALUE_HOLDS_UINT:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_UINT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT))
+/**
+ * G_VALUE_HOLDS_LONG:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_LONG.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG))
+/**
+ * G_VALUE_HOLDS_ULONG:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG))
+/**
+ * G_VALUE_HOLDS_INT64:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_INT64.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64))
+/**
+ * G_VALUE_HOLDS_UINT64:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64))
+/**
+ * G_VALUE_HOLDS_FLOAT:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT))
+/**
+ * G_VALUE_HOLDS_DOUBLE:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE))
+/**
+ * G_VALUE_HOLDS_STRING:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_STRING.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING))
+/**
+ * G_VALUE_HOLDS_POINTER:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER.
+ *
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER))
+/**
+ * G_TYPE_GTYPE:
+ *
+ * The type for #GType.
+ */
+#define G_TYPE_GTYPE (g_gtype_get_type())
+/**
+ * G_VALUE_HOLDS_GTYPE:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE.
+ *
+ * Since: 2.12
+ * Returns: %TRUE on success.
+ */
+#define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE))
+/**
+ * G_VALUE_HOLDS_VARIANT:
+ * @value: a valid #GValue structure
+ *
+ * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 2.26
+ */
+#define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT))
+
+
+/* --- prototypes --- */
+GLIB_DEPRECATED_IN_2_32_FOR(g_value_set_schar)
+void g_value_set_char (GValue *value,
+ gchar v_char);
+GLIB_DEPRECATED_IN_2_32_FOR(g_value_get_schar)
+gchar g_value_get_char (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_schar (GValue *value,
+ gint8 v_char);
+GLIB_AVAILABLE_IN_ALL
+gint8 g_value_get_schar (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_uchar (GValue *value,
+ guchar v_uchar);
+GLIB_AVAILABLE_IN_ALL
+guchar g_value_get_uchar (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_boolean (GValue *value,
+ gboolean v_boolean);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_value_get_boolean (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_int (GValue *value,
+ gint v_int);
+GLIB_AVAILABLE_IN_ALL
+gint g_value_get_int (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_uint (GValue *value,
+ guint v_uint);
+GLIB_AVAILABLE_IN_ALL
+guint g_value_get_uint (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_long (GValue *value,
+ glong v_long);
+GLIB_AVAILABLE_IN_ALL
+glong g_value_get_long (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_ulong (GValue *value,
+ gulong v_ulong);
+GLIB_AVAILABLE_IN_ALL
+gulong g_value_get_ulong (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_int64 (GValue *value,
+ gint64 v_int64);
+GLIB_AVAILABLE_IN_ALL
+gint64 g_value_get_int64 (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_uint64 (GValue *value,
+ guint64 v_uint64);
+GLIB_AVAILABLE_IN_ALL
+guint64 g_value_get_uint64 (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_float (GValue *value,
+ gfloat v_float);
+GLIB_AVAILABLE_IN_ALL
+gfloat g_value_get_float (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_double (GValue *value,
+ gdouble v_double);
+GLIB_AVAILABLE_IN_ALL
+gdouble g_value_get_double (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_string (GValue *value,
+ const gchar *v_string);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_static_string (GValue *value,
+ const gchar *v_string);
+GLIB_AVAILABLE_IN_ALL
+const gchar * g_value_get_string (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+gchar* g_value_dup_string (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_pointer (GValue *value,
+ gpointer v_pointer);
+GLIB_AVAILABLE_IN_ALL
+gpointer g_value_get_pointer (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+GType g_gtype_get_type (void);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_gtype (GValue *value,
+ GType v_gtype);
+GLIB_AVAILABLE_IN_ALL
+GType g_value_get_gtype (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+void g_value_set_variant (GValue *value,
+ GVariant *variant);
+GLIB_AVAILABLE_IN_ALL
+void g_value_take_variant (GValue *value,
+ GVariant *variant);
+GLIB_AVAILABLE_IN_ALL
+GVariant* g_value_get_variant (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
+GVariant* g_value_dup_variant (const GValue *value);
+
+
+/* Convenience for registering new pointer types */
+GLIB_AVAILABLE_IN_ALL
+GType g_pointer_type_register_static (const gchar *name);
+
+/* debugging aid, describe value contents as string */
+GLIB_AVAILABLE_IN_ALL
+gchar* g_strdup_value_contents (const GValue *value);
+
+
+GLIB_AVAILABLE_IN_ALL
+void g_value_take_string (GValue *value,
+ gchar *v_string);
+GLIB_DEPRECATED_FOR(g_value_take_string)
+void g_value_set_string_take_ownership (GValue *value,
+ gchar *v_string);
+
+
+/* humpf, need a C representable type name for G_TYPE_STRING */
+/**
+ * gchararray:
+ *
+ * A C representable type name for #G_TYPE_STRING.
+ */
+typedef gchar* gchararray;
+
+
+G_END_DECLS
+
+#endif /* __G_VALUETYPES_H__ */
diff --git a/include/glib/msvc_recommended_pragmas.h b/include/glib/msvc_recommended_pragmas.h
new file mode 100644
index 0000000000..c0eb1d5edf
--- /dev/null
+++ b/include/glib/msvc_recommended_pragmas.h
@@ -0,0 +1,34 @@
+#ifndef _MSC_VER
+#pragma error "This header is for Microsoft VC only."
+#endif /* _MSC_VER */
+
+/* Make MSVC more pedantic, this is a recommended pragma list
+ * from _Win32_Programming_ by Rector and Newcomer.
+ */
+#pragma warning(error:4002) /* too many actual parameters for macro */
+#pragma warning(error:4003) /* not enough actual parameters for macro */
+#pragma warning(1:4010) /* single-line comment contains line-continuation character */
+#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
+#pragma warning(1:4016) /* no function return type; using int as default */
+#pragma warning(error:4020) /* too many actual parameters */
+#pragma warning(error:4021) /* too few actual parameters */
+#pragma warning(error:4027) /* function declared without formal parameter list */
+#pragma warning(error:4029) /* declared formal parameter list different from definition */
+#pragma warning(error:4033) /* 'function' must return a value */
+#pragma warning(error:4035) /* 'function' : no return value */
+#pragma warning(error:4045) /* array bounds overflow */
+#pragma warning(error:4047) /* different levels of indirection */
+#pragma warning(error:4049) /* terminating line number emission */
+#pragma warning(error:4053) /* An expression of type void was used as an operand */
+#pragma warning(error:4071) /* no function prototype given */
+#pragma warning(disable:4101) /* unreferenced local variable */
+#pragma warning(error:4150)
+
+#pragma warning(disable:4244) /* No possible loss of data warnings */
+#pragma warning(disable:4305) /* No truncation from int to char warnings */
+
+#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
+
+/* work around Microsoft's premature attempt to deprecate the C-Library */
+#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_NONSTDC_NO_WARNINGS
diff --git a/include/gst/allocators/allocators-prelude.h b/include/gst/allocators/allocators-prelude.h
new file mode 100644
index 0000000000..c18a815a8e
--- /dev/null
+++ b/include/gst/allocators/allocators-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer Allocators Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * allocators-prelude.h: prelude include header for gst-allocators library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ALLOCATORS_PRELUDE_H__
+#define __GST_ALLOCATORS_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_ALLOCATORS
+#define GST_ALLOCATORS_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_ALLOCATORS_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_ALLOCATORS_PRELUDE_H__ */
diff --git a/include/gst/allocators/allocators.h b/include/gst/allocators/allocators.h
new file mode 100644
index 0000000000..b616aa20e6
--- /dev/null
+++ b/include/gst/allocators/allocators.h
@@ -0,0 +1,32 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * allocators.h: single include header for gst-allocators library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ALLOCATORS_H__
+#define __GST_ALLOCATORS_H__
+
+#include <gst/allocators/allocators-prelude.h>
+
+#include <gst/allocators/gstdmabuf.h>
+#include <gst/allocators/gstfdmemory.h>
+#include <gst/allocators/gstphysmemory.h>
+
+#endif /* __GST_ALLOCATORS_H__ */
+
diff --git a/include/gst/allocators/gstdmabuf.h b/include/gst/allocators/gstdmabuf.h
new file mode 100644
index 0000000000..603331ae90
--- /dev/null
+++ b/include/gst/allocators/gstdmabuf.h
@@ -0,0 +1,120 @@
+/* GStreamer dmabuf allocator
+ * Copyright (C) 2013 Linaro SA
+ * Author: Benjamin Gaignard <benjamin.gaignard@linaro.org> for Linaro.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_DMABUF_H__
+#define __GST_DMABUF_H__
+
+#include <gst/gst.h>
+#include <gst/allocators/gstfdmemory.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_CAPS_FEATURE_MEMORY_DMABUF:
+ *
+ * Constant that defines the caps feature name for DMA buffer sharing.
+ *
+ * It has to be used for non-mappable dma-buf only, i.e. when the underlying
+ * memory is not mappable to user space. Or when the mapped memory contains
+ * non meaningful data. It can be the case for protected content or when the
+ * user wants explicitly avoid any software post processing.
+ *
+ * In these cases all elements between the exported and the importer has to work
+ * in passthrough mode. This is done by adding this caps feature.
+ *
+ * When the memory is mappable for read and write requests then it is assumes
+ * to be a fast path and so this caps feature should not be used. Though
+ * according to the dma-buf protocol, while it is mapped it prevents the
+ * exporter to migrate the buffer.
+ *
+ * This caps feature should not serve at all the purpose of selecting the
+ * @GST_ALLOCATOR_DMABUF allocator during caps negotiation.
+ * When the exporter is the upstream element from the importer point of view,
+ * the exporter should try to map the dma buffer at runtime (preferably during
+ * decide_allocation phase). When it succeeds for #GST_MAP_READWRITE this caps
+ * feature should not be used. This allows scalers, color converts and any image
+ * processing filters to work directly on the dma buffer.
+ * In this case the importer element should check all incoming memory using
+ * gst_is_dmabuf_memory().
+ *
+ * Since: 1.12
+ */
+#define GST_CAPS_FEATURE_MEMORY_DMABUF "memory:DMABuf"
+
+#define GST_ALLOCATOR_DMABUF "dmabuf"
+
+#define GST_TYPE_DMABUF_ALLOCATOR (gst_dmabuf_allocator_get_type())
+#define GST_IS_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DMABUF_ALLOCATOR))
+#define GST_IS_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DMABUF_ALLOCATOR))
+#define GST_DMABUF_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DMABUF_ALLOCATOR, GstDmaBufAllocatorClass))
+#define GST_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DMABUF_ALLOCATOR, GstDmaBufAllocator))
+#define GST_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DMABUF_ALLOCATOR, GstDmaBufAllocatorClass))
+#define GST_DMABUF_ALLOCATOR_CAST(obj) ((GstDmaBufAllocator *)(obj))
+
+typedef struct _GstDmaBufAllocator GstDmaBufAllocator;
+typedef struct _GstDmaBufAllocatorClass GstDmaBufAllocatorClass;
+
+/**
+ * GstDmaBufAllocator:
+ *
+ * Base class for allocators with dmabuf-backed memory
+ *
+ * Since: 1.12
+ */
+struct _GstDmaBufAllocator
+{
+ GstFdAllocator parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstDmaBufAllocatorClass
+{
+ GstFdAllocatorClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+
+GST_ALLOCATORS_API
+GType gst_dmabuf_allocator_get_type (void);
+
+GST_ALLOCATORS_API
+GstAllocator * gst_dmabuf_allocator_new (void);
+
+GST_ALLOCATORS_API
+GstMemory * gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size);
+
+GST_ALLOCATORS_API
+GstMemory * gst_dmabuf_allocator_alloc_with_flags (GstAllocator * allocator, gint fd, gsize size, GstFdMemoryFlags flags);
+
+GST_ALLOCATORS_API
+gint gst_dmabuf_memory_get_fd (GstMemory * mem);
+
+GST_ALLOCATORS_API
+gboolean gst_is_dmabuf_memory (GstMemory * mem);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDmaBufAllocator, gst_object_unref)
+
+G_END_DECLS
+#endif /* __GST_DMABUF_H__ */
diff --git a/include/gst/allocators/gstfdmemory.h b/include/gst/allocators/gstfdmemory.h
new file mode 100644
index 0000000000..43217b7033
--- /dev/null
+++ b/include/gst/allocators/gstfdmemory.h
@@ -0,0 +1,100 @@
+/* GStreamer fd memory
+ * Copyright (C) 2013 Linaro SA
+ * Author: Benjamin Gaignard <benjamin.gaignard@linaro.org> for Linaro.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_FD_ALLOCATOR_H__
+#define __GST_FD_ALLOCATOR_H__
+
+#include <gst/gst.h>
+#include <gst/allocators/allocators-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstFdAllocator GstFdAllocator;
+typedef struct _GstFdAllocatorClass GstFdAllocatorClass;
+
+#define GST_ALLOCATOR_FD "fd"
+
+#define GST_TYPE_FD_ALLOCATOR (gst_fd_allocator_get_type())
+#define GST_IS_FD_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_FD_ALLOCATOR))
+#define GST_IS_FD_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_FD_ALLOCATOR))
+#define GST_FD_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_FD_ALLOCATOR, GstFdAllocatorClass))
+#define GST_FD_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_FD_ALLOCATOR, GstFdAllocator))
+#define GST_FD_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_FD_ALLOCATOR, GstFdAllocatorClass))
+#define GST_FD_ALLOCATOR_CAST(obj) ((GstFdAllocator *)(obj))
+
+/**
+ * GstFdMemoryFlags:
+ * @GST_FD_MEMORY_FLAG_NONE: no flag
+ * @GST_FD_MEMORY_FLAG_KEEP_MAPPED: once the memory is mapped,
+ * keep it mapped until the memory is destroyed.
+ * @GST_FD_MEMORY_FLAG_MAP_PRIVATE: do a private mapping instead of
+ * the default shared mapping.
+ * @GST_FD_MEMORY_FLAG_DONT_CLOSE: don't close the file descriptor when
+ * the memory is freed. Since: 1.10
+ *
+ * Various flags to control the operation of the fd backed memory.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_FD_MEMORY_FLAG_NONE = 0,
+ GST_FD_MEMORY_FLAG_KEEP_MAPPED = (1 << 0),
+ GST_FD_MEMORY_FLAG_MAP_PRIVATE = (1 << 1),
+ GST_FD_MEMORY_FLAG_DONT_CLOSE = (1 << 2),
+} GstFdMemoryFlags;
+
+/**
+ * GstFdAllocator:
+ *
+ * Base class for allocators with fd-backed memory
+ *
+ * Since: 1.6
+ */
+struct _GstFdAllocator
+{
+ GstAllocator parent;
+};
+
+struct _GstFdAllocatorClass
+{
+ GstAllocatorClass parent_class;
+};
+
+GST_ALLOCATORS_API
+GType gst_fd_allocator_get_type (void);
+
+GST_ALLOCATORS_API
+GstAllocator * gst_fd_allocator_new (void);
+
+GST_ALLOCATORS_API
+GstMemory * gst_fd_allocator_alloc (GstAllocator * allocator, gint fd,
+ gsize size, GstFdMemoryFlags flags);
+
+GST_ALLOCATORS_API
+gboolean gst_is_fd_memory (GstMemory *mem);
+
+GST_ALLOCATORS_API
+gint gst_fd_memory_get_fd (GstMemory *mem);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstFdAllocator, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_FD_ALLOCATOR_H__ */
diff --git a/include/gst/allocators/gstphysmemory.h b/include/gst/allocators/gstphysmemory.h
new file mode 100644
index 0000000000..d0a9d07134
--- /dev/null
+++ b/include/gst/allocators/gstphysmemory.h
@@ -0,0 +1,62 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_PHYS_MEMORY_H__
+#define __GST_PHYS_MEMORY_H__
+
+#include <gst/gst.h>
+#include <gst/allocators/allocators-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PHYS_MEMORY_ALLOCATOR (gst_phys_memory_allocator_get_type())
+GST_ALLOCATORS_API
+G_DECLARE_INTERFACE (GstPhysMemoryAllocator, gst_phys_memory_allocator,
+ GST, PHYS_MEMORY_ALLOCATOR, GstAllocator)
+
+#define GST_PHYS_MEMORY_ALLOCATOR_GET_INTERFACE(obj) (GST_PHYS_MEMORY_ALLOCATOR_GET_IFACE(obj))
+#define GST_PHYS_MEMORY_ALLOCATOR_CAST(obj) ((GstPhysMemoryAllocator *)(obj))
+
+/**
+ * GstPhysMemoryAllocatorInterface:
+ * @get_phys_addr: Implementations shall return the physicall memory address
+ * that is backing the provided memory, or 0 if none.
+ *
+ * Marker interface for allocators with physical address backed memory
+ *
+ * Since: 1.14
+ */
+struct _GstPhysMemoryAllocatorInterface
+{
+ /*< private >*/
+ GTypeInterface parent_iface;
+
+ /*< public >*/
+ guintptr (*get_phys_addr) (GstPhysMemoryAllocator * allocator, GstMemory * mem);
+};
+
+GST_ALLOCATORS_API
+gboolean gst_is_phys_memory (GstMemory *mem);
+
+GST_ALLOCATORS_API
+guintptr gst_phys_memory_get_phys_addr (GstMemory * mem);
+
+G_END_DECLS
+
+#endif /* __GST_PHYS_MEMORY_H__ */
diff --git a/include/gst/app/app-enumtypes.h b/include/gst/app/app-enumtypes.h
new file mode 100644
index 0000000000..bc57942113
--- /dev/null
+++ b/include/gst/app/app-enumtypes.h
@@ -0,0 +1,24 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/app/app-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gstappsrc.h" */
+
+GST_APP_API
+GType gst_app_stream_type_get_type (void);
+#define GST_TYPE_APP_STREAM_TYPE (gst_app_stream_type_get_type())
+
+GST_APP_API
+GType gst_app_leaky_type_get_type (void);
+#define GST_TYPE_APP_LEAKY_TYPE (gst_app_leaky_type_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/app/app-prelude.h b/include/gst/app/app-prelude.h
new file mode 100644
index 0000000000..d3e71079d0
--- /dev/null
+++ b/include/gst/app/app-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer App Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * app-prelude.h: prelude include header for gst-app library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_APP_PRELUDE_H__
+#define __GST_APP_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_APP
+#define GST_APP_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_APP_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_APP_PRELUDE_H__ */
diff --git a/include/gst/app/app.h b/include/gst/app/app.h
new file mode 100644
index 0000000000..e83dfc7bfd
--- /dev/null
+++ b/include/gst/app/app.h
@@ -0,0 +1,28 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstapp.h: single include header for gst-app library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_APP_H__
+#define __GST_APP_H__
+
+#include <gst/app/gstappsrc.h>
+#include <gst/app/gstappsink.h>
+
+#endif /* __GST_APP_H__ */
diff --git a/include/gst/app/gstappsink.h b/include/gst/app/gstappsink.h
new file mode 100644
index 0000000000..90e678f53f
--- /dev/null
+++ b/include/gst/app/gstappsink.h
@@ -0,0 +1,194 @@
+/* GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_APP_SINK_H_
+#define _GST_APP_SINK_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstbasesink.h>
+#include <gst/app/app-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_APP_SINK \
+ (gst_app_sink_get_type())
+#define GST_APP_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
+#define GST_APP_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
+#define GST_IS_APP_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
+#define GST_IS_APP_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
+#define GST_APP_SINK_CAST(obj) \
+ ((GstAppSink*)(obj))
+
+typedef struct _GstAppSink GstAppSink;
+typedef struct _GstAppSinkClass GstAppSinkClass;
+typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
+
+/* FIXME 2.0: Make the instance/class struct private */
+
+/**
+ * GstAppSinkCallbacks: (skip)
+ * @eos: Called when the end-of-stream has been reached. This callback
+ * is called from the streaming thread.
+ * @new_preroll: Called when a new preroll sample is available.
+ * This callback is called from the streaming thread.
+ * The new preroll sample can be retrieved with
+ * gst_app_sink_pull_preroll() either from this callback
+ * or from any other thread.
+ * @new_sample: Called when a new sample is available.
+ * This callback is called from the streaming thread.
+ * The new sample can be retrieved with
+ * gst_app_sink_pull_sample() either from this callback
+ * or from any other thread.
+ * @new_event: Called when a new event is available.
+ * This callback is called from the streaming thread.
+ * The new event can be retrieved with
+ * gst_app_sink_pull_event() either from this callback
+ * or from any other thread.
+ * The callback should return %TRUE if the event has been handled,
+ * %FALSE otherwise.
+ * Since: 1.20
+ *
+ * A set of callbacks that can be installed on the appsink with
+ * gst_app_sink_set_callbacks().
+ */
+typedef struct {
+ void (*eos) (GstAppSink *appsink, gpointer user_data);
+ GstFlowReturn (*new_preroll) (GstAppSink *appsink, gpointer user_data);
+ GstFlowReturn (*new_sample) (GstAppSink *appsink, gpointer user_data);
+ gboolean (*new_event) (GstAppSink *appsink, gpointer user_data);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+} GstAppSinkCallbacks;
+
+struct _GstAppSink
+{
+ GstBaseSink basesink;
+
+ /*< private >*/
+ GstAppSinkPrivate *priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstAppSinkClass
+{
+ GstBaseSinkClass basesink_class;
+
+ /* signals */
+ void (*eos) (GstAppSink *appsink);
+ GstFlowReturn (*new_preroll) (GstAppSink *appsink);
+ GstFlowReturn (*new_sample) (GstAppSink *appsink);
+ /* new_event is missing as we ran out padding */
+
+ /* actions */
+ GstSample * (*pull_preroll) (GstAppSink *appsink);
+ GstSample * (*pull_sample) (GstAppSink *appsink);
+ GstSample * (*try_pull_preroll) (GstAppSink *appsink, GstClockTime timeout);
+ GstSample * (*try_pull_sample) (GstAppSink *appsink, GstClockTime timeout);
+ /**
+ * GstAppSinkClass::try_pull_object:
+ *
+ * See #GstAppSink::try-pull-object: signal.
+ *
+ * Since: 1.20
+ */
+ GstMiniObject * (*try_pull_object) (GstAppSink *appsink, GstClockTime timeout);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 3];
+};
+
+GST_APP_API
+GType gst_app_sink_get_type (void);
+
+GST_APP_API
+void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
+
+GST_APP_API
+GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
+
+GST_APP_API
+gboolean gst_app_sink_is_eos (GstAppSink *appsink);
+
+GST_APP_API
+void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
+
+GST_APP_API
+gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink);
+
+GST_APP_API
+void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max);
+
+GST_APP_API
+guint gst_app_sink_get_max_buffers (GstAppSink *appsink);
+
+GST_APP_API
+void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop);
+
+GST_APP_API
+gboolean gst_app_sink_get_drop (GstAppSink *appsink);
+
+GST_APP_API
+void gst_app_sink_set_buffer_list_support (GstAppSink *appsink, gboolean enable_lists);
+
+GST_APP_API
+gboolean gst_app_sink_get_buffer_list_support (GstAppSink *appsink);
+
+GST_APP_API
+void gst_app_sink_set_wait_on_eos (GstAppSink *appsink, gboolean wait);
+
+GST_APP_API
+gboolean gst_app_sink_get_wait_on_eos (GstAppSink *appsink);
+
+GST_APP_API
+GstSample * gst_app_sink_pull_preroll (GstAppSink *appsink);
+
+GST_APP_API
+GstSample * gst_app_sink_pull_sample (GstAppSink *appsink);
+
+GST_APP_API
+GstMiniObject * gst_app_sink_pull_object (GstAppSink *appsink);
+
+GST_APP_API
+GstSample * gst_app_sink_try_pull_preroll (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
+GstSample * gst_app_sink_try_pull_sample (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
+GstMiniObject * gst_app_sink_try_pull_object (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
+void gst_app_sink_set_callbacks (GstAppSink * appsink,
+ GstAppSinkCallbacks *callbacks,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAppSink, gst_object_unref)
+
+G_END_DECLS
+
+#endif
+
diff --git a/include/gst/app/gstappsrc.h b/include/gst/app/gstappsrc.h
new file mode 100644
index 0000000000..16180fd165
--- /dev/null
+++ b/include/gst/app/gstappsrc.h
@@ -0,0 +1,232 @@
+/* GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_APP_SRC_H_
+#define _GST_APP_SRC_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+#include <gst/app/app-prelude.h>
+#include <gst/app/app-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_APP_SRC \
+ (gst_app_src_get_type())
+#define GST_APP_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SRC,GstAppSrc))
+#define GST_APP_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SRC,GstAppSrcClass))
+#define GST_IS_APP_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SRC))
+#define GST_IS_APP_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SRC))
+#define GST_APP_SRC_CAST(obj) \
+ ((GstAppSrc*)(obj))
+
+typedef struct _GstAppSrc GstAppSrc;
+typedef struct _GstAppSrcClass GstAppSrcClass;
+typedef struct _GstAppSrcPrivate GstAppSrcPrivate;
+
+/* FIXME 2.0: Make the instance/class struct private */
+
+/**
+ * GstAppSrcCallbacks: (skip)
+ * @need_data: Called when the appsrc needs more data. A buffer or EOS should be
+ * pushed to appsrc from this thread or another thread. @length is just a hint
+ * and when it is set to -1, any number of bytes can be pushed into @appsrc.
+ * @enough_data: Called when appsrc has enough data. It is recommended that the
+ * application stops calling push-buffer until the need_data callback is
+ * emitted again to avoid excessive buffer queueing.
+ * @seek_data: Called when a seek should be performed to the offset.
+ * The next push-buffer should produce buffers from the new @offset.
+ * This callback is only called for seekable stream types.
+ *
+ * A set of callbacks that can be installed on the appsrc with
+ * gst_app_src_set_callbacks().
+ */
+typedef struct {
+ void (*need_data) (GstAppSrc *src, guint length, gpointer user_data);
+ void (*enough_data) (GstAppSrc *src, gpointer user_data);
+ gboolean (*seek_data) (GstAppSrc *src, guint64 offset, gpointer user_data);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+} GstAppSrcCallbacks;
+
+/**
+ * GstAppStreamType:
+ * @GST_APP_STREAM_TYPE_STREAM: No seeking is supported in the stream, such as a
+ * live stream.
+ * @GST_APP_STREAM_TYPE_SEEKABLE: The stream is seekable but seeking might not
+ * be very fast, such as data from a webserver.
+ * @GST_APP_STREAM_TYPE_RANDOM_ACCESS: The stream is seekable and seeking is fast,
+ * such as in a local file.
+ *
+ * The stream type.
+ */
+typedef enum
+{
+ GST_APP_STREAM_TYPE_STREAM,
+ GST_APP_STREAM_TYPE_SEEKABLE,
+ GST_APP_STREAM_TYPE_RANDOM_ACCESS
+} GstAppStreamType;
+
+/**
+ * GstAppLeakyType:
+ * @GST_APP_LEAKY_TYPE_NONE: Not Leaky
+ * @GST_APP_LEAKY_TYPE_UPSTREAM: Leaky on upstream (new buffers)
+ * @GST_APP_LEAKY_TYPE_DOWNSTREAM: Leaky on downstream (old buffers)
+ *
+ * Buffer dropping scheme to avoid the element's internal queue to block when
+ * full.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_APP_LEAKY_TYPE_NONE,
+ GST_APP_LEAKY_TYPE_UPSTREAM,
+ GST_APP_LEAKY_TYPE_DOWNSTREAM
+} GstAppLeakyType;
+
+struct _GstAppSrc
+{
+ GstBaseSrc basesrc;
+
+ /*< private >*/
+ GstAppSrcPrivate *priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstAppSrcClass
+{
+ GstBaseSrcClass basesrc_class;
+
+ /* signals */
+ void (*need_data) (GstAppSrc *appsrc, guint length);
+ void (*enough_data) (GstAppSrc *appsrc);
+ gboolean (*seek_data) (GstAppSrc *appsrc, guint64 offset);
+
+ /* actions */
+ GstFlowReturn (*push_buffer) (GstAppSrc *appsrc, GstBuffer *buffer);
+ GstFlowReturn (*end_of_stream) (GstAppSrc *appsrc);
+ GstFlowReturn (*push_sample) (GstAppSrc *appsrc, GstSample *sample);
+ GstFlowReturn (*push_buffer_list) (GstAppSrc *appsrc, GstBufferList *buffer_list);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING-2];
+};
+
+GST_APP_API
+GType gst_app_src_get_type (void);
+
+GST_APP_API
+void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
+
+GST_APP_API
+GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
+
+GST_APP_API
+gint64 gst_app_src_get_size (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_duration (GstAppSrc *appsrc, GstClockTime duration);
+
+GST_APP_API
+GstClockTime gst_app_src_get_duration (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_stream_type (GstAppSrc *appsrc, GstAppStreamType type);
+
+GST_APP_API
+GstAppStreamType gst_app_src_get_stream_type (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_max_bytes (GstAppSrc *appsrc, guint64 max);
+
+GST_APP_API
+guint64 gst_app_src_get_max_bytes (GstAppSrc *appsrc);
+
+GST_APP_API
+guint64 gst_app_src_get_current_level_bytes (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_max_buffers (GstAppSrc *appsrc, guint64 max);
+
+GST_APP_API
+guint64 gst_app_src_get_max_buffers (GstAppSrc *appsrc);
+
+GST_APP_API
+guint64 gst_app_src_get_current_level_buffers (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_max_time (GstAppSrc *appsrc, GstClockTime max);
+
+GST_APP_API
+GstClockTime gst_app_src_get_max_time (GstAppSrc *appsrc);
+
+GST_APP_API
+GstClockTime gst_app_src_get_current_level_time (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_leaky_type (GstAppSrc *appsrc, GstAppLeakyType leaky);
+
+GST_APP_API
+GstAppLeakyType gst_app_src_get_leaky_type (GstAppSrc *appsrc);
+
+GST_APP_API
+void gst_app_src_set_latency (GstAppSrc *appsrc, guint64 min, guint64 max);
+
+GST_APP_API
+void gst_app_src_get_latency (GstAppSrc *appsrc, guint64 *min, guint64 *max);
+
+GST_APP_API
+void gst_app_src_set_emit_signals (GstAppSrc *appsrc, gboolean emit);
+
+GST_APP_API
+gboolean gst_app_src_get_emit_signals (GstAppSrc *appsrc);
+
+GST_APP_API
+GstFlowReturn gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer);
+
+GST_APP_API
+GstFlowReturn gst_app_src_push_buffer_list (GstAppSrc * appsrc, GstBufferList * buffer_list);
+
+GST_APP_API
+GstFlowReturn gst_app_src_end_of_stream (GstAppSrc *appsrc);
+
+GST_APP_API
+GstFlowReturn gst_app_src_push_sample (GstAppSrc *appsrc, GstSample *sample);
+
+GST_APP_API
+void gst_app_src_set_callbacks (GstAppSrc * appsrc,
+ GstAppSrcCallbacks *callbacks,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAppSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/audio/audio-bad-prelude.h b/include/gst/audio/audio-bad-prelude.h
new file mode 100644
index 0000000000..ceb4d95150
--- /dev/null
+++ b/include/gst/audio/audio-bad-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Audio Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * audiobad-prelude.h: prelude include header for gst-audiobad library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_BAD_PRELUDE_H__
+#define __GST_AUDIO_BAD_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_AUDIO_BAD_API
+# ifdef BUILDING_GST_AUDIO_BAD
+# define GST_AUDIO_BAD_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_AUDIO_BAD_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_AUDIO_BAD_PRELUDE_H__ */
diff --git a/include/gst/audio/audio-buffer.h b/include/gst/audio/audio-buffer.h
new file mode 100644
index 0000000000..075b59d35e
--- /dev/null
+++ b/include/gst/audio/audio-buffer.h
@@ -0,0 +1,98 @@
+/* GStreamer
+ * Copyright (C) <2018> Collabora Ltd.
+ * @author George Kiagiadakis <george.kiagiadakis@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_BUFFER_H__
+#define __GST_AUDIO_BUFFER_H__
+
+G_BEGIN_DECLS
+
+/**
+ * GstAudioBuffer:
+ * @info: a #GstAudioInfo describing the audio properties of this buffer
+ * @n_samples: the size of the buffer in samples
+ * @n_planes: the number of planes available
+ * @planes: an array of @n_planes pointers pointing to the start of each
+ * plane in the mapped buffer
+ * @buffer: the mapped buffer
+ *
+ * A structure containing the result of an audio buffer map operation,
+ * which is executed with gst_audio_buffer_map(). For non-interleaved (planar)
+ * buffers, the beginning of each channel in the buffer has its own pointer in
+ * the @planes array. For interleaved buffers, the @planes array only contains
+ * one item, which is the pointer to the beginning of the buffer, and @n_planes
+ * equals 1.
+ *
+ * The different channels in @planes are always in the GStreamer channel order.
+ *
+ * Since: 1.16
+ */
+typedef struct {
+ GstAudioInfo info;
+
+ gsize n_samples;
+ gint n_planes;
+ gpointer *planes;
+
+ GstBuffer *buffer;
+
+ /*< private >*/
+ GstMapInfo *map_infos;
+ gpointer priv_planes_arr[8];
+ GstMapInfo priv_map_infos_arr[8];
+
+ gpointer _gst_reserved[GST_PADDING];
+} GstAudioBuffer;
+
+
+GST_AUDIO_API
+gboolean gst_audio_buffer_map (GstAudioBuffer *buffer, const GstAudioInfo *info,
+ GstBuffer *gstbuffer, GstMapFlags flags);
+
+GST_AUDIO_API
+void gst_audio_buffer_unmap (GstAudioBuffer *buffer);
+
+
+#define GST_AUDIO_BUFFER_FORMAT(b) (GST_AUDIO_INFO_FORMAT(&(b)->info))
+#define GST_AUDIO_BUFFER_CHANNELS(b) (GST_AUDIO_INFO_CHANNELS(&(b)->info))
+#define GST_AUDIO_BUFFER_LAYOUT(b) (GST_AUDIO_INFO_LAYOUT(&(b)->info))
+#define GST_AUDIO_BUFFER_RATE(b) (GST_AUDIO_INFO_RATE(&(b)->info))
+
+#define GST_AUDIO_BUFFER_WIDTH(b) (GST_AUDIO_INFO_WIDTH(&(b)->info))
+#define GST_AUDIO_BUFFER_DEPTH(b) (GST_AUDIO_INFO_DEPTH(&(b)->info))
+#define GST_AUDIO_BUFFER_SAMPLE_STRIDE(b) (GST_AUDIO_INFO_WIDTH(&(b)->info) >> 3)
+#define GST_AUDIO_BUFFER_BPS(b) (GST_AUDIO_INFO_DEPTH(&(b)->info) >> 3)
+#define GST_AUDIO_BUFFER_BPF(b) (GST_AUDIO_INFO_BPF(&(b)->info))
+
+#define GST_AUDIO_BUFFER_N_SAMPLES(b) ((b)->n_samples)
+#define GST_AUDIO_BUFFER_N_PLANES(b) ((b)->n_planes)
+#define GST_AUDIO_BUFFER_PLANE_DATA(b,p) ((b)->planes[p])
+
+/* the size of each plane in bytes */
+#define GST_AUDIO_BUFFER_PLANE_SIZE(b) \
+ (GST_AUDIO_BUFFER_N_SAMPLES(b) * GST_AUDIO_BUFFER_SAMPLE_STRIDE(b) * \
+ GST_AUDIO_BUFFER_CHANNELS(b) / GST_AUDIO_BUFFER_N_PLANES(b))
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_BUFFER_H__ */
diff --git a/include/gst/audio/audio-channel-mixer.h b/include/gst/audio/audio-channel-mixer.h
new file mode 100644
index 0000000000..35c2f6d83f
--- /dev/null
+++ b/include/gst/audio/audio-channel-mixer.h
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * (C) 2015 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * audio-channel-mixer.h: setup of channel conversion matrices
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_CHANNEL_MIXER_H__
+#define __GST_AUDIO_CHANNEL_MIXER_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+typedef struct _GstAudioChannelMixer GstAudioChannelMixer;
+
+/**
+ * GstAudioChannelMixerFlags:
+ * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE: no flag
+ * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN: input channels are not interleaved
+ * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT: output channels are not interleaved
+ * @GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN: input channels are explicitly unpositioned
+ * @GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT: output channels are explicitly unpositioned
+ *
+ * Flags passed to gst_audio_channel_mixer_new()
+ */
+typedef enum {
+ GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE = 0,
+ GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN = (1 << 0),
+ GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT = (1 << 1),
+ GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN = (1 << 2),
+ GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT = (1 << 3)
+} GstAudioChannelMixerFlags;
+
+GST_AUDIO_API
+GstAudioChannelMixer * gst_audio_channel_mixer_new (GstAudioChannelMixerFlags flags,
+ GstAudioFormat format,
+ gint in_channels,
+ GstAudioChannelPosition *in_position,
+ gint out_channels,
+ GstAudioChannelPosition *out_position);
+
+GST_AUDIO_API
+GstAudioChannelMixer * gst_audio_channel_mixer_new_with_matrix (GstAudioChannelMixerFlags flags,
+ GstAudioFormat format,
+ gint in_channels,
+ gint out_channels,
+ gfloat **matrix);
+
+GST_AUDIO_API
+void gst_audio_channel_mixer_free (GstAudioChannelMixer *mix);
+
+/*
+ * Checks for passthrough (= identity matrix).
+ */
+
+GST_AUDIO_API
+gboolean gst_audio_channel_mixer_is_passthrough (GstAudioChannelMixer *mix);
+
+/*
+ * Do actual mixing.
+ */
+
+GST_AUDIO_API
+void gst_audio_channel_mixer_samples (GstAudioChannelMixer * mix,
+ const gpointer in[],
+ gpointer out[],
+ gint samples);
+
+#endif /* __GST_AUDIO_CHANNEL_MIXER_H__ */
diff --git a/include/gst/audio/audio-channels.h b/include/gst/audio/audio-channels.h
new file mode 100644
index 0000000000..0089257b12
--- /dev/null
+++ b/include/gst/audio/audio-channels.h
@@ -0,0 +1,180 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
+ * <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_CHANNELS_H__
+#define __GST_AUDIO_CHANNELS_H__
+
+G_BEGIN_DECLS
+
+/**
+ * GstAudioChannelPosition:
+ * @GST_AUDIO_CHANNEL_POSITION_MONO: Mono without direction;
+ * can only be used with 1 channel
+ * @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT: Front left
+ * @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT: Front right
+ * @GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER: Front center
+ * @GST_AUDIO_CHANNEL_POSITION_LFE1: Low-frequency effects 1 (subwoofer)
+ * @GST_AUDIO_CHANNEL_POSITION_REAR_LEFT: Rear left
+ * @GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT: Rear right
+ * @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: Front left of center
+ * @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: Front right of center
+ * @GST_AUDIO_CHANNEL_POSITION_REAR_CENTER: Rear center
+ * @GST_AUDIO_CHANNEL_POSITION_LFE2: Low-frequency effects 2 (subwoofer)
+ * @GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT: Side left
+ * @GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT: Side right
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT: Top front left
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT: Top front right
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER: Top front center
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_CENTER: Top center
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT: Top rear left
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT: Top rear right
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT: Top side right
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT: Top rear right
+ * @GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER: Top rear center
+ * @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER: Bottom front center
+ * @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT: Bottom front left
+ * @GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT: Bottom front right
+ * @GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT: Wide left (between front left and side left)
+ * @GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT: Wide right (between front right and side right)
+ * @GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT: Surround left (between rear left and side left)
+ * @GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT: Surround right (between rear right and side right)
+ * @GST_AUDIO_CHANNEL_POSITION_NONE: used for position-less channels, e.g.
+ * from a sound card that records 1024 channels; mutually exclusive with
+ * any other channel position
+ * @GST_AUDIO_CHANNEL_POSITION_INVALID: invalid position
+ *
+ * Audio channel positions.
+ *
+ * These are the channels defined in SMPTE 2036-2-2008
+ * Table 1 for 22.2 audio systems with the Surround and Wide channels from
+ * DTS Coherent Acoustics (v.1.3.1) and 10.2 and 7.1 layouts. In the caps the
+ * actual channel layout is expressed with a channel count and a channel mask,
+ * which describes the existing channels. The positions in the bit mask correspond
+ * to the enum values.
+ * For negotiation it is allowed to have more bits set in the channel mask than
+ * the number of channels to specify the allowed channel positions but this is
+ * not allowed in negotiated caps. It is not allowed in any situation other
+ * than the one mentioned below to have less bits set in the channel mask than
+ * the number of channels.
+ *
+ * @GST_AUDIO_CHANNEL_POSITION_MONO can only be used with a single mono channel that
+ * has no direction information and would be mixed into all directional channels.
+ * This is expressed in caps by having a single channel and no channel mask.
+ *
+ * @GST_AUDIO_CHANNEL_POSITION_NONE can only be used if all channels have this position.
+ * This is expressed in caps by having a channel mask with no bits set.
+ *
+ * As another special case it is allowed to have two channels without a channel mask.
+ * This implicitly means that this is a stereo stream with a front left and front right
+ * channel.
+ */
+typedef enum {
+ /* These get negative indices to allow to use
+ * the enum values of the normal cases for the
+ * bit-mask position */
+ GST_AUDIO_CHANNEL_POSITION_NONE = -3,
+ GST_AUDIO_CHANNEL_POSITION_MONO = -2,
+ GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
+
+ /* Normal cases */
+ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT = 0,
+ GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_LFE1,
+ GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_LFE2,
+ GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT,
+ GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT,
+ GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT
+} GstAudioChannelPosition;
+
+#define GST_AUDIO_CHANNEL_POSITION_MASK(pos) (G_GUINT64_CONSTANT(1)<< GST_AUDIO_CHANNEL_POSITION_ ## pos)
+
+GST_AUDIO_API
+gboolean gst_audio_buffer_reorder_channels (GstBuffer * buffer,
+ GstAudioFormat format,
+ gint channels,
+ const GstAudioChannelPosition * from,
+ const GstAudioChannelPosition * to);
+
+GST_AUDIO_API
+gboolean gst_audio_reorder_channels (gpointer data, gsize size,
+ GstAudioFormat format,
+ gint channels,
+ const GstAudioChannelPosition * from,
+ const GstAudioChannelPosition * to);
+
+GST_AUDIO_API
+gboolean gst_audio_channel_positions_to_valid_order (GstAudioChannelPosition *position,
+ gint channels);
+
+GST_AUDIO_API
+gboolean gst_audio_check_valid_channel_positions (const GstAudioChannelPosition *position,
+ gint channels, gboolean force_order);
+
+GST_AUDIO_API
+gboolean gst_audio_channel_positions_to_mask (const GstAudioChannelPosition *position,
+ gint channels, gboolean force_order,
+ guint64 *channel_mask);
+
+GST_AUDIO_API
+gboolean gst_audio_channel_positions_from_mask (gint channels, guint64 channel_mask,
+ GstAudioChannelPosition * position);
+
+GST_AUDIO_API
+gboolean gst_audio_get_channel_reorder_map (gint channels,
+ const GstAudioChannelPosition * from,
+ const GstAudioChannelPosition * to,
+ gint *reorder_map);
+
+GST_AUDIO_API
+guint64 gst_audio_channel_get_fallback_mask (gint channels);
+
+GST_AUDIO_API
+gchar* gst_audio_channel_positions_to_string (const GstAudioChannelPosition * position,
+ gint channels);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_CHANNELS_H__ */
diff --git a/include/gst/audio/audio-converter.h b/include/gst/audio/audio-converter.h
new file mode 100644
index 0000000000..083bda4fa2
--- /dev/null
+++ b/include/gst/audio/audio-converter.h
@@ -0,0 +1,180 @@
+/* GStreamer
+ * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * (C) 2015 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * audioconverter.h: audio format conversion library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_CONVERTER_H__
+#define __GST_AUDIO_CONVERTER_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstAudioConverter:
+ *
+ * Opaque #GstAudioConverter struct.
+ *
+ * Since: 1.8
+ */
+typedef struct _GstAudioConverter GstAudioConverter;
+
+/**
+ * GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD:
+ *
+ * #GstAudioResamplerMethod, The resampler method to use when
+ * changing sample rates.
+ * Default is #GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL.
+ */
+#define GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD "GstAudioConverter.resampler-method"
+
+/**
+ * GST_AUDIO_CONVERTER_OPT_DITHER_METHOD:
+ *
+ * #GstAudioDitherMethod, The dither method to use when
+ * changing bit depth.
+ * Default is #GST_AUDIO_DITHER_NONE.
+ */
+#define GST_AUDIO_CONVERTER_OPT_DITHER_METHOD "GstAudioConverter.dither-method"
+
+/**
+ * GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD:
+ *
+ * #GstAudioNoiseShapingMethod, The noise shaping method to use
+ * to mask noise from quantization errors.
+ * Default is #GST_AUDIO_NOISE_SHAPING_NONE.
+ */
+#define GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD "GstAudioConverter.noise-shaping-method"
+
+/**
+ * GST_AUDIO_CONVERTER_OPT_QUANTIZATION:
+ *
+ * #G_TYPE_UINT, The quantization amount. Components will be
+ * quantized to multiples of this value.
+ * Default is 1
+ */
+#define GST_AUDIO_CONVERTER_OPT_QUANTIZATION "GstAudioConverter.quantization"
+
+/**
+ * GST_AUDIO_CONVERTER_OPT_MIX_MATRIX:
+ *
+ * #GST_TYPE_LIST, The channel mapping matrix.
+ *
+ * The matrix coefficients must be between -1 and 1: the number of rows is equal
+ * to the number of output channels and the number of columns is equal to the
+ * number of input channels.
+ *
+ * ## Example matrix generation code
+ * To generate the matrix using code:
+ *
+ * |[
+ * GValue v = G_VALUE_INIT;
+ * GValue v2 = G_VALUE_INIT;
+ * GValue v3 = G_VALUE_INIT;
+ *
+ * g_value_init (&v2, GST_TYPE_ARRAY);
+ * g_value_init (&v3, G_TYPE_DOUBLE);
+ * g_value_set_double (&v3, 1);
+ * gst_value_array_append_value (&v2, &v3);
+ * g_value_unset (&v3);
+ * [ Repeat for as many double as your input channels - unset and reinit v3 ]
+ * g_value_init (&v, GST_TYPE_ARRAY);
+ * gst_value_array_append_value (&v, &v2);
+ * g_value_unset (&v2);
+ * [ Repeat for as many v2's as your output channels - unset and reinit v2]
+ * g_object_set_property (G_OBJECT (audiomixmatrix), "matrix", &v);
+ * g_value_unset (&v);
+ * ]|
+ */
+#define GST_AUDIO_CONVERTER_OPT_MIX_MATRIX "GstAudioConverter.mix-matrix"
+
+/**
+ * GstAudioConverterFlags:
+ * @GST_AUDIO_CONVERTER_FLAG_NONE: no flag
+ * @GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE: the input sample arrays are writable and can be
+ * used as temporary storage during conversion.
+ * @GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE: allow arbitrary rate updates with
+ * gst_audio_converter_update_config().
+ *
+ * Extra flags passed to gst_audio_converter_new() and gst_audio_converter_samples().
+ */
+typedef enum {
+ GST_AUDIO_CONVERTER_FLAG_NONE = 0,
+ GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE = (1 << 0),
+ GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE = (1 << 1)
+} GstAudioConverterFlags;
+
+GST_AUDIO_API
+GstAudioConverter * gst_audio_converter_new (GstAudioConverterFlags flags,
+ GstAudioInfo *in_info,
+ GstAudioInfo *out_info,
+ GstStructure *config);
+
+GST_AUDIO_API
+GType gst_audio_converter_get_type (void);
+
+GST_AUDIO_API
+void gst_audio_converter_free (GstAudioConverter * convert);
+
+GST_AUDIO_API
+void gst_audio_converter_reset (GstAudioConverter * convert);
+
+GST_AUDIO_API
+gboolean gst_audio_converter_update_config (GstAudioConverter * convert,
+ gint in_rate, gint out_rate,
+ GstStructure *config);
+
+GST_AUDIO_API
+const GstStructure * gst_audio_converter_get_config (GstAudioConverter * convert,
+ gint *in_rate, gint *out_rate);
+
+GST_AUDIO_API
+gsize gst_audio_converter_get_out_frames (GstAudioConverter *convert,
+ gsize in_frames);
+
+GST_AUDIO_API
+gsize gst_audio_converter_get_in_frames (GstAudioConverter *convert,
+ gsize out_frames);
+
+GST_AUDIO_API
+gsize gst_audio_converter_get_max_latency (GstAudioConverter *convert);
+
+GST_AUDIO_API
+gboolean gst_audio_converter_samples (GstAudioConverter * convert,
+ GstAudioConverterFlags flags,
+ gpointer in[], gsize in_frames,
+ gpointer out[], gsize out_frames);
+
+GST_AUDIO_API
+gboolean gst_audio_converter_supports_inplace (GstAudioConverter *convert);
+
+GST_AUDIO_API
+gboolean gst_audio_converter_is_passthrough (GstAudioConverter *convert);
+
+GST_AUDIO_API
+gboolean gst_audio_converter_convert (GstAudioConverter * convert,
+ GstAudioConverterFlags flags,
+ gpointer in, gsize in_size,
+ gpointer *out, gsize *out_size);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_CONVERTER_H__ */
diff --git a/include/gst/audio/audio-enumtypes.h b/include/gst/audio/audio-enumtypes.h
new file mode 100644
index 0000000000..6a875e6bb7
--- /dev/null
+++ b/include/gst/audio/audio-enumtypes.h
@@ -0,0 +1,120 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/audio/audio-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "audio-channel-mixer.h" */
+
+GST_AUDIO_API
+GType gst_audio_channel_mixer_flags_get_type (void);
+#define GST_TYPE_AUDIO_CHANNEL_MIXER_FLAGS (gst_audio_channel_mixer_flags_get_type())
+
+/* enumerations from "audio-channels.h" */
+
+GST_AUDIO_API
+GType gst_audio_channel_position_get_type (void);
+#define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
+
+/* enumerations from "audio-converter.h" */
+
+GST_AUDIO_API
+GType gst_audio_converter_flags_get_type (void);
+#define GST_TYPE_AUDIO_CONVERTER_FLAGS (gst_audio_converter_flags_get_type())
+
+/* enumerations from "audio-format.h" */
+
+GST_AUDIO_API
+GType gst_audio_format_get_type (void);
+#define GST_TYPE_AUDIO_FORMAT (gst_audio_format_get_type())
+
+GST_AUDIO_API
+GType gst_audio_format_flags_get_type (void);
+#define GST_TYPE_AUDIO_FORMAT_FLAGS (gst_audio_format_flags_get_type())
+
+GST_AUDIO_API
+GType gst_audio_pack_flags_get_type (void);
+#define GST_TYPE_AUDIO_PACK_FLAGS (gst_audio_pack_flags_get_type())
+
+GST_AUDIO_API
+GType gst_audio_layout_get_type (void);
+#define GST_TYPE_AUDIO_LAYOUT (gst_audio_layout_get_type())
+
+/* enumerations from "audio-info.h" */
+
+GST_AUDIO_API
+GType gst_audio_flags_get_type (void);
+#define GST_TYPE_AUDIO_FLAGS (gst_audio_flags_get_type())
+
+/* enumerations from "audio-quantize.h" */
+
+GST_AUDIO_API
+GType gst_audio_dither_method_get_type (void);
+#define GST_TYPE_AUDIO_DITHER_METHOD (gst_audio_dither_method_get_type())
+
+GST_AUDIO_API
+GType gst_audio_noise_shaping_method_get_type (void);
+#define GST_TYPE_AUDIO_NOISE_SHAPING_METHOD (gst_audio_noise_shaping_method_get_type())
+
+GST_AUDIO_API
+GType gst_audio_quantize_flags_get_type (void);
+#define GST_TYPE_AUDIO_QUANTIZE_FLAGS (gst_audio_quantize_flags_get_type())
+
+/* enumerations from "audio-resampler.h" */
+
+GST_AUDIO_API
+GType gst_audio_resampler_filter_mode_get_type (void);
+#define GST_TYPE_AUDIO_RESAMPLER_FILTER_MODE (gst_audio_resampler_filter_mode_get_type())
+
+GST_AUDIO_API
+GType gst_audio_resampler_filter_interpolation_get_type (void);
+#define GST_TYPE_AUDIO_RESAMPLER_FILTER_INTERPOLATION (gst_audio_resampler_filter_interpolation_get_type())
+
+GST_AUDIO_API
+GType gst_audio_resampler_method_get_type (void);
+#define GST_TYPE_AUDIO_RESAMPLER_METHOD (gst_audio_resampler_method_get_type())
+
+GST_AUDIO_API
+GType gst_audio_resampler_flags_get_type (void);
+#define GST_TYPE_AUDIO_RESAMPLER_FLAGS (gst_audio_resampler_flags_get_type())
+
+/* enumerations from "gstaudiobasesink.h" */
+
+GST_AUDIO_API
+GType gst_audio_base_sink_slave_method_get_type (void);
+#define GST_TYPE_AUDIO_BASE_SINK_SLAVE_METHOD (gst_audio_base_sink_slave_method_get_type())
+
+GST_AUDIO_API
+GType gst_audio_base_sink_discont_reason_get_type (void);
+#define GST_TYPE_AUDIO_BASE_SINK_DISCONT_REASON (gst_audio_base_sink_discont_reason_get_type())
+
+/* enumerations from "gstaudiobasesrc.h" */
+
+GST_AUDIO_API
+GType gst_audio_base_src_slave_method_get_type (void);
+#define GST_TYPE_AUDIO_BASE_SRC_SLAVE_METHOD (gst_audio_base_src_slave_method_get_type())
+
+/* enumerations from "gstaudiocdsrc.h" */
+
+GST_AUDIO_API
+GType gst_audio_cd_src_mode_get_type (void);
+#define GST_TYPE_AUDIO_CD_SRC_MODE (gst_audio_cd_src_mode_get_type())
+
+/* enumerations from "gstaudioringbuffer.h" */
+
+GST_AUDIO_API
+GType gst_audio_ring_buffer_state_get_type (void);
+#define GST_TYPE_AUDIO_RING_BUFFER_STATE (gst_audio_ring_buffer_state_get_type())
+
+GST_AUDIO_API
+GType gst_audio_ring_buffer_format_type_get_type (void);
+#define GST_TYPE_AUDIO_RING_BUFFER_FORMAT_TYPE (gst_audio_ring_buffer_format_type_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/audio/audio-format.h b/include/gst/audio/audio-format.h
new file mode 100644
index 0000000000..15e970fd44
--- /dev/null
+++ b/include/gst/audio/audio-format.h
@@ -0,0 +1,412 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
+ * <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_FORMAT_H__
+#define __GST_AUDIO_FORMAT_H__
+
+G_BEGIN_DECLS
+
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define _GST_AUDIO_FORMAT_NE(fmt) GST_AUDIO_FORMAT_ ## fmt ## BE
+#define _GST_AUDIO_FORMAT_OE(fmt) GST_AUDIO_FORMAT_ ## fmt ## LE
+#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define _GST_AUDIO_FORMAT_NE(fmt) GST_AUDIO_FORMAT_ ## fmt ## LE
+#define _GST_AUDIO_FORMAT_OE(fmt) GST_AUDIO_FORMAT_ ## fmt ## BE
+#endif
+
+/**
+ * GstAudioFormat:
+ * @GST_AUDIO_FORMAT_UNKNOWN: unknown or unset audio format
+ * @GST_AUDIO_FORMAT_ENCODED: encoded audio format
+ * @GST_AUDIO_FORMAT_S8: 8 bits in 8 bits, signed
+ * @GST_AUDIO_FORMAT_U8: 8 bits in 8 bits, unsigned
+ * @GST_AUDIO_FORMAT_S16LE: 16 bits in 16 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S16BE: 16 bits in 16 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U16LE: 16 bits in 16 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U16BE: 16 bits in 16 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_S24_32LE: 24 bits in 32 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S24_32BE: 24 bits in 32 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U24_32LE: 24 bits in 32 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U24_32BE: 24 bits in 32 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_S32LE: 32 bits in 32 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S32BE: 32 bits in 32 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U32LE: 32 bits in 32 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U32BE: 32 bits in 32 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_S24LE: 24 bits in 24 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S24BE: 24 bits in 24 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U24LE: 24 bits in 24 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U24BE: 24 bits in 24 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_S20LE: 20 bits in 24 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S20BE: 20 bits in 24 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U20LE: 20 bits in 24 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U20BE: 20 bits in 24 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_S18LE: 18 bits in 24 bits, signed, little endian
+ * @GST_AUDIO_FORMAT_S18BE: 18 bits in 24 bits, signed, big endian
+ * @GST_AUDIO_FORMAT_U18LE: 18 bits in 24 bits, unsigned, little endian
+ * @GST_AUDIO_FORMAT_U18BE: 18 bits in 24 bits, unsigned, big endian
+ * @GST_AUDIO_FORMAT_F32LE: 32-bit floating point samples, little endian
+ * @GST_AUDIO_FORMAT_F32BE: 32-bit floating point samples, big endian
+ * @GST_AUDIO_FORMAT_F64LE: 64-bit floating point samples, little endian
+ * @GST_AUDIO_FORMAT_F64BE: 64-bit floating point samples, big endian
+ * @GST_AUDIO_FORMAT_S16: 16 bits in 16 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U16: 16 bits in 16 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_S24_32: 24 bits in 32 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U24_32: 24 bits in 32 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_S32: 32 bits in 32 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U32: 32 bits in 32 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_S24: 24 bits in 24 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U24: 24 bits in 24 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_S20: 20 bits in 24 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U20: 20 bits in 24 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_S18: 18 bits in 24 bits, signed, native endianness
+ * @GST_AUDIO_FORMAT_U18: 18 bits in 24 bits, unsigned, native endianness
+ * @GST_AUDIO_FORMAT_F32: 32-bit floating point samples, native endianness
+ * @GST_AUDIO_FORMAT_F64: 64-bit floating point samples, native endianness
+ *
+ * Enum value describing the most common audio formats.
+ */
+typedef enum {
+ GST_AUDIO_FORMAT_UNKNOWN,
+ GST_AUDIO_FORMAT_ENCODED,
+ /* 8 bit */
+ GST_AUDIO_FORMAT_S8,
+ GST_AUDIO_FORMAT_U8,
+ /* 16 bit */
+ GST_AUDIO_FORMAT_S16LE,
+ GST_AUDIO_FORMAT_S16BE,
+ GST_AUDIO_FORMAT_U16LE,
+ GST_AUDIO_FORMAT_U16BE,
+ /* 24 bit in low 3 bytes of 32 bits*/
+ GST_AUDIO_FORMAT_S24_32LE,
+ GST_AUDIO_FORMAT_S24_32BE,
+ GST_AUDIO_FORMAT_U24_32LE,
+ GST_AUDIO_FORMAT_U24_32BE,
+ /* 32 bit */
+ GST_AUDIO_FORMAT_S32LE,
+ GST_AUDIO_FORMAT_S32BE,
+ GST_AUDIO_FORMAT_U32LE,
+ GST_AUDIO_FORMAT_U32BE,
+ /* 24 bit in 3 bytes*/
+ GST_AUDIO_FORMAT_S24LE,
+ GST_AUDIO_FORMAT_S24BE,
+ GST_AUDIO_FORMAT_U24LE,
+ GST_AUDIO_FORMAT_U24BE,
+ /* 20 bit in 3 bytes*/
+ GST_AUDIO_FORMAT_S20LE,
+ GST_AUDIO_FORMAT_S20BE,
+ GST_AUDIO_FORMAT_U20LE,
+ GST_AUDIO_FORMAT_U20BE,
+ /* 18 bit in 3 bytes*/
+ GST_AUDIO_FORMAT_S18LE,
+ GST_AUDIO_FORMAT_S18BE,
+ GST_AUDIO_FORMAT_U18LE,
+ GST_AUDIO_FORMAT_U18BE,
+ /* float */
+ GST_AUDIO_FORMAT_F32LE,
+ GST_AUDIO_FORMAT_F32BE,
+ GST_AUDIO_FORMAT_F64LE,
+ GST_AUDIO_FORMAT_F64BE,
+ /* native endianness equivalents */
+ GST_AUDIO_FORMAT_S16 = _GST_AUDIO_FORMAT_NE(S16),
+ GST_AUDIO_FORMAT_U16 = _GST_AUDIO_FORMAT_NE(U16),
+ GST_AUDIO_FORMAT_S24_32 = _GST_AUDIO_FORMAT_NE(S24_32),
+ GST_AUDIO_FORMAT_U24_32 = _GST_AUDIO_FORMAT_NE(U24_32),
+ GST_AUDIO_FORMAT_S32 = _GST_AUDIO_FORMAT_NE(S32),
+ GST_AUDIO_FORMAT_U32 = _GST_AUDIO_FORMAT_NE(U32),
+ GST_AUDIO_FORMAT_S24 = _GST_AUDIO_FORMAT_NE(S24),
+ GST_AUDIO_FORMAT_U24 = _GST_AUDIO_FORMAT_NE(U24),
+ GST_AUDIO_FORMAT_S20 = _GST_AUDIO_FORMAT_NE(S20),
+ GST_AUDIO_FORMAT_U20 = _GST_AUDIO_FORMAT_NE(U20),
+ GST_AUDIO_FORMAT_S18 = _GST_AUDIO_FORMAT_NE(S18),
+ GST_AUDIO_FORMAT_U18 = _GST_AUDIO_FORMAT_NE(U18),
+ GST_AUDIO_FORMAT_F32 = _GST_AUDIO_FORMAT_NE(F32),
+ GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64)
+} GstAudioFormat;
+
+
+typedef struct _GstAudioFormatInfo GstAudioFormatInfo;
+
+/**
+ * GstAudioFormatFlags:
+ * @GST_AUDIO_FORMAT_FLAG_INTEGER: integer samples
+ * @GST_AUDIO_FORMAT_FLAG_FLOAT: float samples
+ * @GST_AUDIO_FORMAT_FLAG_SIGNED: signed samples
+ * @GST_AUDIO_FORMAT_FLAG_COMPLEX: complex layout
+ * @GST_AUDIO_FORMAT_FLAG_UNPACK: the format can be used in
+ * #GstAudioFormatUnpack and #GstAudioFormatPack functions
+ *
+ * The different audio flags that a format info can have.
+ */
+typedef enum
+{
+ GST_AUDIO_FORMAT_FLAG_INTEGER = (1 << 0),
+ GST_AUDIO_FORMAT_FLAG_FLOAT = (1 << 1),
+ GST_AUDIO_FORMAT_FLAG_SIGNED = (1 << 2),
+ GST_AUDIO_FORMAT_FLAG_COMPLEX = (1 << 4),
+ GST_AUDIO_FORMAT_FLAG_UNPACK = (1 << 5)
+} GstAudioFormatFlags;
+
+/**
+ * GstAudioPackFlags:
+ * @GST_AUDIO_PACK_FLAG_NONE: No flag
+ * @GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE: When the source has a smaller depth
+ * than the target format, set the least significant bits of the target
+ * to 0. This is likely slightly faster but less accurate. When this flag
+ * is not specified, the most significant bits of the source are duplicated
+ * in the least significant bits of the destination.
+ *
+ * The different flags that can be used when packing and unpacking.
+ */
+typedef enum
+{
+ GST_AUDIO_PACK_FLAG_NONE = 0,
+ GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE = (1 << 0)
+} GstAudioPackFlags;
+
+/**
+ * GstAudioFormatUnpack:
+ * @info: a #GstAudioFormatInfo
+ * @flags: #GstAudioPackFlags
+ * @dest: (array) (element-type guint8): a destination array
+ * @data: (array) (element-type guint8): pointer to the audio data
+ * @length: the amount of samples to unpack.
+ *
+ * Unpacks @length samples from the given data of format @info.
+ * The samples will be unpacked into @dest which each channel
+ * interleaved. @dest should at least be big enough to hold @length *
+ * channels * size(unpack_format) bytes.
+ */
+typedef void (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info,
+ GstAudioPackFlags flags, gpointer dest,
+ gconstpointer data, gint length);
+/**
+ * GstAudioFormatPack:
+ * @info: a #GstAudioFormatInfo
+ * @flags: #GstAudioPackFlags
+ * @src: (array) (element-type guint8): a source array
+ * @data: (array) (element-type guint8): pointer to the destination
+ * data
+ * @length: the amount of samples to pack.
+ *
+ * Packs @length samples from @src to the data array in format @info.
+ * The samples from source have each channel interleaved
+ * and will be packed into @data.
+ */
+typedef void (*GstAudioFormatPack) (const GstAudioFormatInfo *info,
+ GstAudioPackFlags flags, gconstpointer src,
+ gpointer data, gint length);
+
+/**
+ * GstAudioFormatInfo:
+ * @format: #GstAudioFormat
+ * @name: string representation of the format
+ * @description: user readable description of the format
+ * @flags: #GstAudioFormatFlags
+ * @endianness: the endianness
+ * @width: amount of bits used for one sample
+ * @depth: amount of valid bits in @width
+ * @silence: @width/8 bytes with 1 silent sample
+ * @unpack_format: the format of the unpacked samples
+ * @unpack_func: function to unpack samples
+ * @pack_func: function to pack samples
+ *
+ * Information for an audio format.
+ */
+struct _GstAudioFormatInfo {
+ /*< public >*/
+ GstAudioFormat format;
+ const gchar *name;
+ const gchar *description;
+ GstAudioFormatFlags flags;
+ gint endianness;
+ gint width;
+ gint depth;
+ guint8 silence[8];
+
+ GstAudioFormat unpack_format;
+ GstAudioFormatUnpack unpack_func;
+ GstAudioFormatPack pack_func;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_format_info_get_type (void);
+
+#define GST_AUDIO_FORMAT_INFO_FORMAT(info) ((info)->format)
+#define GST_AUDIO_FORMAT_INFO_NAME(info) ((info)->name)
+#define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags)
+
+#define GST_AUDIO_FORMAT_INFO_IS_INTEGER(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_INTEGER)
+#define GST_AUDIO_FORMAT_INFO_IS_FLOAT(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_FLOAT)
+#define GST_AUDIO_FORMAT_INFO_IS_SIGNED(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_SIGNED)
+
+#define GST_AUDIO_FORMAT_INFO_ENDIANNESS(info) ((info)->endianness)
+#define GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN(info) ((info)->endianness == G_LITTLE_ENDIAN)
+#define GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN(info) ((info)->endianness == G_BIG_ENDIAN)
+#define GST_AUDIO_FORMAT_INFO_WIDTH(info) ((info)->width)
+#define GST_AUDIO_FORMAT_INFO_DEPTH(info) ((info)->depth)
+
+
+GST_AUDIO_API
+GstAudioFormat gst_audio_format_build_integer (gboolean sign, gint endianness,
+ gint width, gint depth) G_GNUC_CONST;
+
+GST_AUDIO_API
+GstAudioFormat gst_audio_format_from_string (const gchar *format) G_GNUC_CONST;
+
+GST_AUDIO_API
+const gchar * gst_audio_format_to_string (GstAudioFormat format) G_GNUC_CONST;
+
+GST_AUDIO_API
+const GstAudioFormatInfo *
+ gst_audio_format_get_info (GstAudioFormat format) G_GNUC_CONST;
+
+GST_AUDIO_API
+void gst_audio_format_info_fill_silence (const GstAudioFormatInfo *info,
+ gpointer dest, gsize length);
+GST_AUDIO_API G_DEPRECATED_FOR(gst_audio_format_info_fill_silence)
+void gst_audio_format_fill_silence (const GstAudioFormatInfo *info,
+ gpointer dest, gsize length);
+
+/**
+ * GST_AUDIO_RATE_RANGE:
+ *
+ * Maximum range of allowed sample rates, for use in template caps strings.
+ */
+#define GST_AUDIO_RATE_RANGE "(int) [ 1, max ]"
+/**
+ * GST_AUDIO_CHANNELS_RANGE:
+ *
+ * Maximum range of allowed channels, for use in template caps strings.
+ */
+#define GST_AUDIO_CHANNELS_RANGE "(int) [ 1, max ]"
+
+/**
+ * GST_AUDIO_NE:
+ * @s: format string without endianness marker
+ *
+ * Turns audio format string @s into the format string for native endianness.
+ */
+/**
+ * GST_AUDIO_OE:
+ * @s: format string without endianness marker
+ *
+ * Turns audio format string @s into the format string for other endianness.
+ */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define GST_AUDIO_NE(s) G_STRINGIFY(s)"LE"
+# define GST_AUDIO_OE(s) G_STRINGIFY(s)"BE"
+#else
+# define GST_AUDIO_NE(s) G_STRINGIFY(s)"BE"
+# define GST_AUDIO_OE(s) G_STRINGIFY(s)"LE"
+#endif
+
+/**
+ * GST_AUDIO_FORMATS_ALL:
+ *
+ * List of all audio formats, for use in template caps strings.
+ *
+ * Formats are sorted by decreasing "quality", using these criteria by priority:
+ * - depth
+ * - width
+ * - Float > Signed > Unsigned
+ * - native endianness preferred
+ */
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define GST_AUDIO_FORMATS_ALL "{ F64BE, F64LE, " \
+ "F32BE, F32LE, S32BE, S32LE, U32BE, U32LE, " \
+ "S24_32BE, S24_32LE, U24_32BE, U24_32LE, " \
+ "S24BE, S24LE, U24BE, U24LE, " \
+ "S20BE, S20LE, U20BE, U20LE, " \
+ "S18BE, S18LE, U18BE, U18LE, " \
+ "S16BE, S16LE, U16BE, U16LE, " \
+ "S8, U8 }"
+#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_AUDIO_FORMATS_ALL "{ F64LE, F64BE, " \
+ "F32LE, F32BE, S32LE, S32BE, U32LE, U32BE, " \
+ "S24_32LE, S24_32BE, U24_32LE, U24_32BE, " \
+ "S24LE, S24BE, U24LE, U24BE, " \
+ "S20LE, S20BE, U20LE, U20BE, " \
+ "S18LE, S18BE, U18LE, U18BE, " \
+ "S16LE, S16BE, U16LE, U16BE, " \
+ "S8, U8 }"
+#endif
+
+GST_AUDIO_API
+const GstAudioFormat * gst_audio_formats_raw (guint * len);
+
+/**
+ * GST_AUDIO_CAPS_MAKE:
+ * @format: string format that describes the sample layout, as string
+ * (e.g. "S16LE", "S8", etc.)
+ *
+ * Generic caps string for audio, for use in pad templates.
+ */
+#define GST_AUDIO_CAPS_MAKE(format) \
+ "audio/x-raw, " \
+ "format = (string) " format ", " \
+ "rate = " GST_AUDIO_RATE_RANGE ", " \
+ "channels = " GST_AUDIO_CHANNELS_RANGE
+
+/**
+ * GST_AUDIO_DEF_RATE:
+ *
+ * Standard sampling rate used in consumer audio.
+ */
+#define GST_AUDIO_DEF_RATE 44100
+/**
+ * GST_AUDIO_DEF_CHANNELS:
+ *
+ * Standard number of channels used in consumer audio.
+ */
+#define GST_AUDIO_DEF_CHANNELS 2
+/**
+ * GST_AUDIO_DEF_FORMAT:
+ *
+ * Standard format used in consumer audio.
+ */
+#define GST_AUDIO_DEF_FORMAT "S16LE"
+
+/**
+ * GstAudioLayout:
+ * @GST_AUDIO_LAYOUT_INTERLEAVED: interleaved audio
+ * @GST_AUDIO_LAYOUT_NON_INTERLEAVED: non-interleaved audio
+ *
+ * Layout of the audio samples for the different channels.
+ */
+typedef enum {
+ GST_AUDIO_LAYOUT_INTERLEAVED = 0,
+ GST_AUDIO_LAYOUT_NON_INTERLEAVED
+} GstAudioLayout;
+
+GST_AUDIO_API
+GstCaps * gst_audio_make_raw_caps (const GstAudioFormat formats[], guint len,
+ GstAudioLayout layout);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_FORMAT_H__ */
diff --git a/include/gst/audio/audio-info.h b/include/gst/audio/audio-info.h
new file mode 100644
index 0000000000..51264b9304
--- /dev/null
+++ b/include/gst/audio/audio-info.h
@@ -0,0 +1,143 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
+ * <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_INFO_H__
+#define __GST_AUDIO_INFO_H__
+
+G_BEGIN_DECLS
+
+typedef struct _GstAudioInfo GstAudioInfo;
+
+/**
+ * GstAudioFlags:
+ * @GST_AUDIO_FLAG_NONE: no valid flag
+ * @GST_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
+ * contains unpositioned channels.
+ *
+ * Extra audio flags
+ */
+typedef enum {
+ GST_AUDIO_FLAG_NONE = 0,
+ GST_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
+} GstAudioFlags;
+
+/**
+ * GstAudioInfo:
+ * @finfo: the format info of the audio
+ * @flags: additional audio flags
+ * @layout: audio layout
+ * @rate: the audio sample rate
+ * @channels: the number of channels
+ * @bpf: the number of bytes for one frame, this is the size of one
+ * sample * @channels
+ * @position: the positions for each channel
+ *
+ * Information describing audio properties. This information can be filled
+ * in from GstCaps with gst_audio_info_from_caps().
+ *
+ * Use the provided macros to access the info in this structure.
+ */
+struct _GstAudioInfo {
+ const GstAudioFormatInfo *finfo;
+ GstAudioFlags flags;
+ GstAudioLayout layout;
+ gint rate;
+ gint channels;
+ gint bpf;
+ GstAudioChannelPosition position[64];
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_TYPE_AUDIO_INFO (gst_audio_info_get_type ())
+GST_AUDIO_API
+GType gst_audio_info_get_type (void);
+
+#define GST_AUDIO_INFO_IS_VALID(i) ((i)->finfo != NULL && (i)->rate > 0 && (i)->channels > 0 && (i)->bpf > 0)
+
+#define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
+#define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
+#define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
+#define GST_AUDIO_INFO_DEPTH(i) (GST_AUDIO_FORMAT_INFO_DEPTH((i)->finfo))
+#define GST_AUDIO_INFO_BPS(info) (GST_AUDIO_INFO_DEPTH(info) >> 3)
+
+#define GST_AUDIO_INFO_IS_INTEGER(i) (GST_AUDIO_FORMAT_INFO_IS_INTEGER((i)->finfo))
+#define GST_AUDIO_INFO_IS_FLOAT(i) (GST_AUDIO_FORMAT_INFO_IS_FLOAT((i)->finfo))
+#define GST_AUDIO_INFO_IS_SIGNED(i) (GST_AUDIO_FORMAT_INFO_IS_SIGNED((i)->finfo))
+
+#define GST_AUDIO_INFO_ENDIANNESS(i) (GST_AUDIO_FORMAT_INFO_ENDIANNESS((i)->finfo))
+#define GST_AUDIO_INFO_IS_LITTLE_ENDIAN(i) (GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN((i)->finfo))
+#define GST_AUDIO_INFO_IS_BIG_ENDIAN(i) (GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN((i)->finfo))
+
+#define GST_AUDIO_INFO_FLAGS(info) ((info)->flags)
+#define GST_AUDIO_INFO_IS_UNPOSITIONED(info) (((info)->flags & GST_AUDIO_FLAG_UNPOSITIONED) != 0)
+#define GST_AUDIO_INFO_LAYOUT(info) ((info)->layout)
+
+#define GST_AUDIO_INFO_RATE(info) ((info)->rate)
+#define GST_AUDIO_INFO_CHANNELS(info) ((info)->channels)
+#define GST_AUDIO_INFO_BPF(info) ((info)->bpf)
+#define GST_AUDIO_INFO_POSITION(info,c) ((info)->position[c])
+
+GST_AUDIO_API
+GstAudioInfo * gst_audio_info_new (void);
+
+GST_AUDIO_API
+GstAudioInfo * gst_audio_info_new_from_caps (const GstCaps * caps);
+
+GST_AUDIO_API
+void gst_audio_info_init (GstAudioInfo *info);
+
+GST_AUDIO_API
+GstAudioInfo * gst_audio_info_copy (const GstAudioInfo *info);
+
+GST_AUDIO_API
+void gst_audio_info_free (GstAudioInfo *info);
+
+GST_AUDIO_API
+void gst_audio_info_set_format (GstAudioInfo *info, GstAudioFormat format,
+ gint rate, gint channels,
+ const GstAudioChannelPosition *position);
+
+GST_AUDIO_API
+gboolean gst_audio_info_from_caps (GstAudioInfo *info, const GstCaps *caps);
+
+GST_AUDIO_API
+GstCaps * gst_audio_info_to_caps (const GstAudioInfo *info);
+
+GST_AUDIO_API
+gboolean gst_audio_info_convert (const GstAudioInfo * info,
+ GstFormat src_fmt, gint64 src_val,
+ GstFormat dest_fmt, gint64 * dest_val);
+
+GST_AUDIO_API
+gboolean gst_audio_info_is_equal (const GstAudioInfo *info,
+ const GstAudioInfo *other);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioInfo, gst_audio_info_free)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_INFO_H__ */
diff --git a/include/gst/audio/audio-prelude.h b/include/gst/audio/audio-prelude.h
new file mode 100644
index 0000000000..b006a06ced
--- /dev/null
+++ b/include/gst/audio/audio-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer Audio Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * audio-prelude.h: prelude include header for gst-audio library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_PRELUDE_H__
+#define __GST_AUDIO_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_AUDIO
+#define GST_AUDIO_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_AUDIO_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_AUDIO_PRELUDE_H__ */
diff --git a/include/gst/audio/audio-quantize.h b/include/gst/audio/audio-quantize.h
new file mode 100644
index 0000000000..2944b4b918
--- /dev/null
+++ b/include/gst/audio/audio-quantize.h
@@ -0,0 +1,103 @@
+/* GStreamer
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ * (C) 2015 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstaudioquantize.h: quantizes audio to the target format and optionally
+ * applies dithering and noise shaping.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include <gst/audio/audio.h>
+
+
+#ifndef __GST_AUDIO_QUANTIZE_H__
+#define __GST_AUDIO_QUANTIZE_H__
+
+/**
+ * GstAudioDitherMethod:
+ * @GST_AUDIO_DITHER_NONE: No dithering
+ * @GST_AUDIO_DITHER_RPDF: Rectangular dithering
+ * @GST_AUDIO_DITHER_TPDF: Triangular dithering (default)
+ * @GST_AUDIO_DITHER_TPDF_HF: High frequency triangular dithering
+ *
+ * Set of available dithering methods.
+ */
+typedef enum
+{
+ GST_AUDIO_DITHER_NONE = 0,
+ GST_AUDIO_DITHER_RPDF,
+ GST_AUDIO_DITHER_TPDF,
+ GST_AUDIO_DITHER_TPDF_HF
+} GstAudioDitherMethod;
+
+/**
+ * GstAudioNoiseShapingMethod:
+ * @GST_AUDIO_NOISE_SHAPING_NONE: No noise shaping (default)
+ * @GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK: Error feedback
+ * @GST_AUDIO_NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping
+ * @GST_AUDIO_NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping
+ * @GST_AUDIO_NOISE_SHAPING_HIGH: High 8-pole noise shaping
+ *
+ * Set of available noise shaping methods
+ */
+typedef enum
+{
+ GST_AUDIO_NOISE_SHAPING_NONE = 0,
+ GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK,
+ GST_AUDIO_NOISE_SHAPING_SIMPLE,
+ GST_AUDIO_NOISE_SHAPING_MEDIUM,
+ GST_AUDIO_NOISE_SHAPING_HIGH
+} GstAudioNoiseShapingMethod;
+
+/**
+ * GstAudioQuantizeFlags:
+ * @GST_AUDIO_QUANTIZE_FLAG_NONE: no flags
+ * @GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED: samples are non-interleaved
+ *
+ * Extra flags that can be passed to gst_audio_quantize_new()
+ */
+typedef enum
+{
+ GST_AUDIO_QUANTIZE_FLAG_NONE = 0,
+ GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED = (1 << 0)
+} GstAudioQuantizeFlags;
+
+
+typedef struct _GstAudioQuantize GstAudioQuantize;
+
+GST_AUDIO_API
+GstAudioQuantize * gst_audio_quantize_new (GstAudioDitherMethod dither,
+ GstAudioNoiseShapingMethod ns,
+ GstAudioQuantizeFlags flags,
+ GstAudioFormat format,
+ guint channels,
+ guint quantizer);
+
+GST_AUDIO_API
+void gst_audio_quantize_free (GstAudioQuantize * quant);
+
+GST_AUDIO_API
+void gst_audio_quantize_reset (GstAudioQuantize * quant);
+
+GST_AUDIO_API
+void gst_audio_quantize_samples (GstAudioQuantize * quant,
+ const gpointer in[],
+ gpointer out[], guint samples);
+
+#endif /* __GST_AUDIO_QUANTIZE_H__ */
diff --git a/include/gst/audio/audio-resampler.h b/include/gst/audio/audio-resampler.h
new file mode 100644
index 0000000000..3fa3d7bc08
--- /dev/null
+++ b/include/gst/audio/audio-resampler.h
@@ -0,0 +1,259 @@
+/* GStreamer
+ * Copyright (C) <2015> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_RESAMPLER_H__
+#define __GST_AUDIO_RESAMPLER_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstAudioResampler:
+ *
+ * Opaque #GstAudioResampler struct.
+ *
+ * Since: 1.10
+ */
+typedef struct _GstAudioResampler GstAudioResampler;
+
+/**
+ * GST_AUDIO_RESAMPLER_OPT_CUTOFF:
+ *
+ * G_TYPE_DOUBLE, Cutoff parameter for the filter. 0.940 is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_CUTOFF "GstAudioResampler.cutoff"
+/**
+ * GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION:
+ *
+ * G_TYPE_DOUBLE, stopband attenuation in decibels. The attenuation
+ * after the stopband for the kaiser window. 85 dB is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION "GstAudioResampler.stop-attenutation"
+/**
+ * GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH:
+ *
+ * G_TYPE_DOUBLE, transition bandwidth. The width of the
+ * transition band for the kaiser window. 0.087 is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH "GstAudioResampler.transition-bandwidth"
+
+/**
+ * GST_AUDIO_RESAMPLER_OPT_CUBIC_B:
+ *
+ * G_TYPE_DOUBLE, B parameter of the cubic filter.
+ * Values between 0.0 and 2.0 are accepted. 1.0 is the default.
+ *
+ * Below are some values of popular filters:
+ * B C
+ * Hermite 0.0 0.0
+ * Spline 1.0 0.0
+ * Catmull-Rom 0.0 1/2
+ */
+#define GST_AUDIO_RESAMPLER_OPT_CUBIC_B "GstAudioResampler.cubic-b"
+/**
+ * GST_AUDIO_RESAMPLER_OPT_CUBIC_C:
+ *
+ * G_TYPE_DOUBLE, C parameter of the cubic filter.
+ * Values between 0.0 and 2.0 are accepted. 0.0 is the default.
+ *
+ * See #GST_AUDIO_RESAMPLER_OPT_CUBIC_B for some more common values
+ */
+#define GST_AUDIO_RESAMPLER_OPT_CUBIC_C "GstAudioResampler.cubic-c"
+
+/**
+ * GST_AUDIO_RESAMPLER_OPT_N_TAPS:
+ *
+ * G_TYPE_INT: the number of taps to use for the filter.
+ * 0 is the default and selects the taps automatically.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_N_TAPS "GstAudioResampler.n-taps"
+
+/**
+ * GstAudioResamplerFilterMode:
+ * @GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED: Use interpolated filter tables. This
+ * uses less memory but more CPU and is slightly less accurate but it allows for more
+ * efficient variable rate resampling with gst_audio_resampler_update().
+ * @GST_AUDIO_RESAMPLER_FILTER_MODE_FULL: Use full filter table. This uses more memory
+ * but less CPU.
+ * @GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO: Automatically choose between interpolated
+ * and full filter tables.
+ *
+ * Select for the filter tables should be set up.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED = (0),
+ GST_AUDIO_RESAMPLER_FILTER_MODE_FULL,
+ GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO,
+} GstAudioResamplerFilterMode;
+/**
+ * GST_AUDIO_RESAMPLER_OPT_FILTER_MODE:
+ *
+ * GST_TYPE_AUDIO_RESAMPLER_FILTER_MODE: how the filter tables should be
+ * constructed.
+ * GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_FILTER_MODE "GstAudioResampler.filter-mode"
+/**
+ * GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD:
+ *
+ * G_TYPE_UINT: the amount of memory to use for full filter tables before
+ * switching to interpolated filter tables.
+ * 1048576 is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD "GstAudioResampler.filter-mode-threshold"
+
+/**
+ * GstAudioResamplerFilterInterpolation:
+ * @GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE: no interpolation
+ * @GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR: linear interpolation of the
+ * filter coefficients.
+ * @GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC: cubic interpolation of the
+ * filter coefficients.
+ *
+ * The different filter interpolation methods.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE = (0),
+ GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR,
+ GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC,
+} GstAudioResamplerFilterInterpolation;
+/**
+ * GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION:
+ *
+ * GST_TYPE_AUDIO_RESAMPLER_INTERPOLATION: how the filter coefficients should be
+ * interpolated.
+ * GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC is default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION "GstAudioResampler.filter-interpolation"
+/**
+ * GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE:
+ *
+ * G_TYPE_UINT, oversampling to use when interpolating filters
+ * 8 is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE "GstAudioResampler.filter-oversample"
+
+/**
+ * GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR:
+ *
+ * G_TYPE_DOUBLE: The maximum allowed phase error when switching sample
+ * rates.
+ * 0.1 is the default.
+ */
+#define GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR "GstAudioResampler.max-phase-error"
+
+/**
+ * GstAudioResamplerMethod:
+ * @GST_AUDIO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
+ * upsampling and drops when downsampling
+ * @GST_AUDIO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
+ * missing samples and averaging to downsample
+ * @GST_AUDIO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
+ * @GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL: Uses Blackman-Nuttall windowed sinc interpolation
+ * @GST_AUDIO_RESAMPLER_METHOD_KAISER: Uses Kaiser windowed sinc interpolation
+ *
+ * Different subsampling and upsampling methods
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_AUDIO_RESAMPLER_METHOD_NEAREST,
+ GST_AUDIO_RESAMPLER_METHOD_LINEAR,
+ GST_AUDIO_RESAMPLER_METHOD_CUBIC,
+ GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL,
+ GST_AUDIO_RESAMPLER_METHOD_KAISER
+} GstAudioResamplerMethod;
+
+/**
+ * GstAudioResamplerFlags:
+ * @GST_AUDIO_RESAMPLER_FLAG_NONE: no flags
+ * @GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN: input samples are non-interleaved.
+ * an array of blocks of samples, one for each channel, should be passed to the
+ * resample function.
+ * @GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT: output samples are non-interleaved.
+ * an array of blocks of samples, one for each channel, should be passed to the
+ * resample function.
+ * @GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE: optimize for dynamic updates of the sample
+ * rates with gst_audio_resampler_update(). This will select an interpolating filter
+ * when #GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is configured.
+ *
+ * Different resampler flags.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_AUDIO_RESAMPLER_FLAG_NONE = (0),
+ GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN = (1 << 0),
+ GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT = (1 << 1),
+ GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE = (1 << 2),
+} GstAudioResamplerFlags;
+
+#define GST_AUDIO_RESAMPLER_QUALITY_MIN 0
+#define GST_AUDIO_RESAMPLER_QUALITY_MAX 10
+#define GST_AUDIO_RESAMPLER_QUALITY_DEFAULT 4
+
+GST_AUDIO_API
+void gst_audio_resampler_options_set_quality (GstAudioResamplerMethod method,
+ guint quality,
+ gint in_rate, gint out_rate,
+ GstStructure *options);
+
+GST_AUDIO_API
+GstAudioResampler * gst_audio_resampler_new (GstAudioResamplerMethod method,
+ GstAudioResamplerFlags flags,
+ GstAudioFormat format, gint channels,
+ gint in_rate, gint out_rate,
+ GstStructure *options);
+
+GST_AUDIO_API
+void gst_audio_resampler_free (GstAudioResampler *resampler);
+
+GST_AUDIO_API
+void gst_audio_resampler_reset (GstAudioResampler *resampler);
+
+GST_AUDIO_API
+gboolean gst_audio_resampler_update (GstAudioResampler *resampler,
+ gint in_rate, gint out_rate,
+ GstStructure *options);
+
+GST_AUDIO_API
+gsize gst_audio_resampler_get_out_frames (GstAudioResampler *resampler,
+ gsize in_frames);
+
+GST_AUDIO_API
+gsize gst_audio_resampler_get_in_frames (GstAudioResampler *resampler,
+ gsize out_frames);
+
+GST_AUDIO_API
+gsize gst_audio_resampler_get_max_latency (GstAudioResampler *resampler);
+
+GST_AUDIO_API
+void gst_audio_resampler_resample (GstAudioResampler * resampler,
+ gpointer in[], gsize in_frames,
+ gpointer out[], gsize out_frames);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_RESAMPLER_H__ */
diff --git a/include/gst/audio/audio.h b/include/gst/audio/audio.h
new file mode 100644
index 0000000000..a0aa8a6031
--- /dev/null
+++ b/include/gst/audio/audio.h
@@ -0,0 +1,120 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
+ * <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#define __GST_AUDIO_AUDIO_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio-prelude.h>
+#include <gst/audio/audio-enumtypes.h>
+#include <gst/audio/audio-format.h>
+#include <gst/audio/audio-channels.h>
+#include <gst/audio/audio-channel-mixer.h>
+#include <gst/audio/audio-info.h>
+#include <gst/audio/audio-buffer.h>
+#include <gst/audio/audio-quantize.h>
+#include <gst/audio/audio-converter.h>
+#include <gst/audio/audio-resampler.h>
+#include <gst/audio/gstaudiostreamalign.h>
+#include <gst/audio/gstaudioaggregator.h>
+
+G_BEGIN_DECLS
+
+/* conversion macros */
+/**
+ * GST_FRAMES_TO_CLOCK_TIME:
+ * @frames: sample frames
+ * @rate: sampling rate
+ *
+ * Calculate clocktime from sample @frames and @rate.
+ */
+#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
+ ((GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate))
+
+/**
+ * GST_CLOCK_TIME_TO_FRAMES:
+ * @clocktime: clock time
+ * @rate: sampling rate
+ *
+ * Calculate frames from @clocktime and sample @rate.
+ */
+#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
+ gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
+
+/* metadata macros */
+
+/**
+ * GST_META_TAG_AUDIO_STR:
+ *
+ * This metadata is relevant for audio streams.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_AUDIO_STR "audio"
+/**
+ * GST_META_TAG_AUDIO_CHANNELS_STR:
+ *
+ * This metadata stays relevant as long as channels are unchanged.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_AUDIO_CHANNELS_STR "channels"
+
+/**
+ * GST_META_TAG_AUDIO_RATE_STR:
+ *
+ * This metadata stays relevant as long as sample rate is unchanged.
+ *
+ * Since: 1.8
+ */
+#define GST_META_TAG_AUDIO_RATE_STR "rate"
+
+/*
+ * this library defines and implements some helper functions for audio
+ * handling
+ */
+
+GST_AUDIO_API
+GstBuffer * gst_audio_buffer_clip (GstBuffer *buffer,
+ const GstSegment *segment,
+ gint rate, gint bpf);
+
+GST_AUDIO_API
+GstBuffer * gst_audio_buffer_truncate (GstBuffer *buffer,
+ gint bpf, gsize trim, gsize samples);
+
+G_END_DECLS
+
+#include <gst/audio/gstaudioringbuffer.h>
+#include <gst/audio/gstaudioclock.h>
+#include <gst/audio/gstaudiofilter.h>
+#include <gst/audio/gstaudiocdsrc.h>
+#include <gst/audio/gstaudiodecoder.h>
+#include <gst/audio/gstaudioencoder.h>
+#include <gst/audio/gstaudiobasesink.h>
+#include <gst/audio/gstaudiobasesrc.h>
+#include <gst/audio/gstaudiometa.h>
+#include <gst/audio/gstaudiosink.h>
+#include <gst/audio/gstaudiosrc.h>
+#include <gst/audio/streamvolume.h>
+#include <gst/audio/gstaudioiec61937.h>
+
+#endif /* __GST_AUDIO_AUDIO_H__ */
diff --git a/include/gst/audio/gstaudioaggregator.h b/include/gst/audio/gstaudioaggregator.h
new file mode 100644
index 0000000000..2184f54b4c
--- /dev/null
+++ b/include/gst/audio/gstaudioaggregator.h
@@ -0,0 +1,232 @@
+/* GStreamer
+ * Copyright (C) 2014 Collabora
+ * Author: Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstaudioaggregator.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AGGREGATOR_H__
+#define __GST_AUDIO_AGGREGATOR_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstaggregator.h>
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+/*******************************
+ * GstAudioAggregator Structs *
+ *******************************/
+
+typedef struct _GstAudioAggregator GstAudioAggregator;
+typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
+typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
+
+
+/************************
+ * GstAudioAggregatorPad API *
+ ***********************/
+
+#define GST_TYPE_AUDIO_AGGREGATOR_PAD (gst_audio_aggregator_pad_get_type())
+#define GST_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPad))
+#define GST_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
+#define GST_AUDIO_AGGREGATOR_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
+#define GST_IS_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD))
+#define GST_IS_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD))
+
+/****************************
+ * GstAudioAggregatorPad Structs *
+ ***************************/
+
+typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
+typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
+typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
+
+/**
+ * GstAudioAggregatorPad:
+ * @info: The audio info for this pad set from the incoming caps
+ *
+ * The default implementation of GstPad used with #GstAudioAggregator
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregatorPad
+{
+ GstAggregatorPad parent;
+
+ /*< public >*/
+ /* read-only, with OBJECT_LOCK */
+ GstAudioInfo info;
+
+ /*< private >*/
+ GstAudioAggregatorPadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioAggregatorPadClass:
+ * @convert_buffer: Convert a buffer from one format to another.
+ * @update_conversion_info: Called when either the input or output
+ * formats have changed.
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregatorPadClass
+ {
+ GstAggregatorPadClass parent_class;
+
+ GstBuffer * (* convert_buffer) (GstAudioAggregatorPad * pad,
+ GstAudioInfo *in_info,
+ GstAudioInfo *out_info,
+ GstBuffer * buffer);
+
+ void (* update_conversion_info) (GstAudioAggregatorPad *pad);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_AUDIO_API
+GType gst_audio_aggregator_pad_get_type (void);
+
+#define GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD (gst_audio_aggregator_convert_pad_get_type())
+#define GST_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPad))
+#define GST_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
+#define GST_AUDIO_AGGREGATOR_CONVERT_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
+#define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
+#define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
+
+/****************************
+ * GstAudioAggregatorPad Structs *
+ ***************************/
+
+typedef struct _GstAudioAggregatorConvertPad GstAudioAggregatorConvertPad;
+typedef struct _GstAudioAggregatorConvertPadClass GstAudioAggregatorConvertPadClass;
+typedef struct _GstAudioAggregatorConvertPadPrivate GstAudioAggregatorConvertPadPrivate;
+
+/**
+ * GstAudioAggregatorConvertPad:
+ *
+ * An implementation of GstPad that can be used with #GstAudioAggregator.
+ *
+ * See #GstAudioAggregator for more details.
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregatorConvertPad
+{
+ /*< private >*/
+ GstAudioAggregatorPad parent;
+
+ GstAudioAggregatorConvertPadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioAggregatorConvertPadClass:
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregatorConvertPadClass
+{
+ GstAudioAggregatorPadClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_aggregator_convert_pad_get_type (void);
+
+/**************************
+ * GstAudioAggregator API *
+ **************************/
+
+#define GST_TYPE_AUDIO_AGGREGATOR (gst_audio_aggregator_get_type())
+#define GST_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregator))
+#define GST_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
+#define GST_AUDIO_AGGREGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
+#define GST_IS_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR))
+#define GST_IS_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR))
+
+/**
+ * GstAudioAggregator:
+ * @current_caps: The caps set by the subclass
+ *
+ * GstAudioAggregator object
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregator
+{
+ GstAggregator parent;
+
+ /*< public >*/
+ GstCaps *current_caps;
+
+ /*< private >*/
+ GstAudioAggregatorPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioAggregatorClass:
+ * @create_output_buffer: Create a new output buffer contains num_frames frames.
+ * @aggregate_one_buffer: Aggregates one input buffer to the output
+ * buffer. The in_offset and out_offset are in "frames", which is
+ * the size of a sample times the number of channels. Returns TRUE if
+ * any non-silence was added to the buffer
+ *
+ * Since: 1.14
+ */
+struct _GstAudioAggregatorClass {
+ GstAggregatorClass parent_class;
+
+ /*< public >*/
+ GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
+ guint num_frames);
+ gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
+ GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
+ GstBuffer * outbuf, guint out_offset, guint num_frames);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/*************************
+ * GstAggregator methods *
+ ************************/
+
+GST_AUDIO_API
+GType gst_audio_aggregator_get_type(void);
+
+GST_AUDIO_API
+void gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
+ GstAudioAggregatorPad * pad,
+ GstCaps * caps);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioAggregator, gst_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioAggregatorPad, gst_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioAggregatorConvertPad, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_AGGREGATOR_H__ */
diff --git a/include/gst/audio/gstaudiobasesink.h b/include/gst/audio/gstaudiobasesink.h
new file mode 100644
index 0000000000..883ed6ecef
--- /dev/null
+++ b/include/gst/audio/gstaudiobasesink.h
@@ -0,0 +1,277 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudiobasesink.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* a base class for audio sinks.
+ *
+ * It uses a ringbuffer to schedule playback of samples. This makes
+ * it very easy to drop or insert samples to align incoming
+ * buffers to the exact playback timestamp.
+ *
+ * Subclasses must provide a ringbuffer pointing to either DMA
+ * memory or regular memory. A subclass should also call a callback
+ * function when it has played N segments in the buffer. The subclass
+ * is free to use a thread to signal this callback, use EIO or any
+ * other mechanism.
+ *
+ * The base class is able to operate in push or pull mode. The chain
+ * mode will queue the samples in the ringbuffer as much as possible.
+ * The available space is calculated in the callback function.
+ *
+ * The pull mode will pull_range() a new buffer of N samples with a
+ * configurable latency. This allows for high-end real time
+ * audio processing pipelines driven by the audiosink. The callback
+ * function will be used to perform a pull_range() on the sinkpad.
+ * The thread scheduling the callback can be a real-time thread.
+ *
+ * Subclasses must implement a GstAudioRingBuffer in addition to overriding
+ * the methods in GstBaseSink and this class.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_BASE_SINK_H__
+#define __GST_AUDIO_BASE_SINK_H__
+
+#include <gst/base/gstbasesink.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_BASE_SINK (gst_audio_base_sink_get_type())
+#define GST_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSink))
+#define GST_AUDIO_BASE_SINK_CAST(obj) ((GstAudioBaseSink*)obj)
+#define GST_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSinkClass))
+#define GST_AUDIO_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SINK, GstAudioBaseSinkClass))
+#define GST_IS_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SINK))
+#define GST_IS_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SINK))
+
+/**
+ * GST_AUDIO_BASE_SINK_CLOCK:
+ * @obj: a #GstAudioBaseSink
+ *
+ * Get the #GstClock of @obj.
+ */
+#define GST_AUDIO_BASE_SINK_CLOCK(obj) (GST_AUDIO_BASE_SINK (obj)->clock)
+/**
+ * GST_AUDIO_BASE_SINK_PAD:
+ * @obj: a #GstAudioBaseSink
+ *
+ * Get the sink #GstPad of @obj.
+ */
+#define GST_AUDIO_BASE_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
+
+/**
+ * GstAudioBaseSinkSlaveMethod:
+ * @GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE: Resample to match the master clock
+ * @GST_AUDIO_BASE_SINK_SLAVE_SKEW: Adjust playout pointer when master clock
+ * drifts too much.
+ * @GST_AUDIO_BASE_SINK_SLAVE_NONE: No adjustment is done.
+ * @GST_AUDIO_BASE_SINK_SLAVE_CUSTOM: Use custom clock slaving algorithm (Since: 1.6)
+ *
+ * Different possible clock slaving algorithms used when the internal audio
+ * clock is not selected as the pipeline master clock.
+ */
+typedef enum
+{
+ GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE,
+ GST_AUDIO_BASE_SINK_SLAVE_SKEW,
+ GST_AUDIO_BASE_SINK_SLAVE_NONE,
+ GST_AUDIO_BASE_SINK_SLAVE_CUSTOM
+} GstAudioBaseSinkSlaveMethod;
+
+typedef struct _GstAudioBaseSink GstAudioBaseSink;
+typedef struct _GstAudioBaseSinkClass GstAudioBaseSinkClass;
+typedef struct _GstAudioBaseSinkPrivate GstAudioBaseSinkPrivate;
+
+/**
+ * GstAudioBaseSinkDiscontReason:
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT: No discontinuity occurred
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS: New caps are set, causing renegotiotion
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_FLUSH: Samples have been flushed
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY: Sink was synchronized to the estimated latency (occurs during initialization)
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT: Aligning buffers failed because the timestamps are too discontinuous
+ * @GST_AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE: Audio output device experienced and recovered from an error but introduced latency in the process (see also gst_audio_base_sink_report_device_failure())
+ *
+ * Different possible reasons for discontinuities. This enum is useful for the custom
+ * slave method.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT,
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS,
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_FLUSH,
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY,
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT,
+ GST_AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE
+} GstAudioBaseSinkDiscontReason;
+
+/**
+ * GstAudioBaseSinkCustomSlavingCallback:
+ * @sink: a #GstAudioBaseSink
+ * @etime: external clock time
+ * @itime: internal clock time
+ * @requested_skew: skew amount requested by the callback
+ * @discont_reason: reason for discontinuity (if any)
+ * @user_data: user data
+ *
+ * This function is set with gst_audio_base_sink_set_custom_slaving_callback()
+ * and is called during playback. It receives the current time of external and
+ * internal clocks, which the callback can then use to apply any custom
+ * slaving/synchronization schemes.
+ *
+ * The external clock is the sink's element clock, the internal one is the
+ * internal audio clock. The internal audio clock's calibration is applied to
+ * the timestamps before they are passed to the callback. The difference between
+ * etime and itime is the skew; how much internal and external clock lie apart
+ * from each other. A skew of 0 means both clocks are perfectly in sync.
+ * itime > etime means the external clock is going slower, while itime < etime
+ * means it is going faster than the internal clock. etime and itime are always
+ * valid timestamps, except for when a discontinuity happens.
+ *
+ * requested_skew is an output value the callback can write to. It informs the
+ * sink of whether or not it should move the playout pointer, and if so, by how
+ * much. This pointer is only NULL if a discontinuity occurs; otherwise, it is
+ * safe to write to *requested_skew. The default skew is 0.
+ *
+ * The sink may experience discontinuities. If one happens, discont is TRUE,
+ * itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL.
+ * This makes it possible to reset custom clock slaving algorithms when a
+ * discontinuity happens.
+ *
+ * Since: 1.6
+ */
+typedef void (*GstAudioBaseSinkCustomSlavingCallback) (GstAudioBaseSink *sink, GstClockTime etime, GstClockTime itime, GstClockTimeDiff *requested_skew, GstAudioBaseSinkDiscontReason discont_reason, gpointer user_data);
+
+/**
+ * GstAudioBaseSink:
+ *
+ * Opaque #GstAudioBaseSink.
+ */
+struct _GstAudioBaseSink {
+ GstBaseSink element;
+
+ /*< protected >*/ /* with LOCK */
+ /* our ringbuffer */
+ GstAudioRingBuffer *ringbuffer;
+
+ /* required buffer and latency in microseconds */
+ guint64 buffer_time;
+ guint64 latency_time;
+
+ /* the next sample to write */
+ guint64 next_sample;
+
+ /* clock */
+ GstClock *provided_clock;
+
+ /* with g_atomic_; currently rendering eos */
+ gboolean eos_rendering;
+
+ /*< private >*/
+ GstAudioBaseSinkPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioBaseSinkClass:
+ * @parent_class: the parent class.
+ * @create_ringbuffer: create and return a #GstAudioRingBuffer to write to.
+ * @payload: payload data in a format suitable to write to the sink. If no
+ * payloading is required, returns a reffed copy of the original
+ * buffer, else returns the payloaded buffer with all other metadata
+ * copied.
+ *
+ * #GstAudioBaseSink class. Override the vmethod to implement
+ * functionality.
+ */
+struct _GstAudioBaseSinkClass {
+ GstBaseSinkClass parent_class;
+
+ /* subclass ringbuffer allocation */
+ GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSink *sink);
+
+ /* subclass payloader */
+ GstBuffer* (*payload) (GstAudioBaseSink *sink,
+ GstBuffer *buffer);
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_base_sink_get_type(void);
+
+GST_AUDIO_API
+GstAudioRingBuffer *
+ gst_audio_base_sink_create_ringbuffer (GstAudioBaseSink *sink);
+
+GST_AUDIO_API
+void gst_audio_base_sink_set_provide_clock (GstAudioBaseSink *sink, gboolean provide);
+
+GST_AUDIO_API
+gboolean gst_audio_base_sink_get_provide_clock (GstAudioBaseSink *sink);
+
+GST_AUDIO_API
+void gst_audio_base_sink_set_slave_method (GstAudioBaseSink *sink,
+ GstAudioBaseSinkSlaveMethod method);
+GST_AUDIO_API
+GstAudioBaseSinkSlaveMethod
+ gst_audio_base_sink_get_slave_method (GstAudioBaseSink *sink);
+
+GST_AUDIO_API
+void gst_audio_base_sink_set_drift_tolerance (GstAudioBaseSink *sink,
+ gint64 drift_tolerance);
+GST_AUDIO_API
+gint64 gst_audio_base_sink_get_drift_tolerance (GstAudioBaseSink *sink);
+
+GST_AUDIO_API
+void gst_audio_base_sink_set_alignment_threshold (GstAudioBaseSink * sink,
+ GstClockTime alignment_threshold);
+GST_AUDIO_API
+GstClockTime
+ gst_audio_base_sink_get_alignment_threshold (GstAudioBaseSink * sink);
+
+GST_AUDIO_API
+void gst_audio_base_sink_set_discont_wait (GstAudioBaseSink * sink,
+ GstClockTime discont_wait);
+GST_AUDIO_API
+GstClockTime
+ gst_audio_base_sink_get_discont_wait (GstAudioBaseSink * sink);
+
+GST_AUDIO_API
+void
+gst_audio_base_sink_set_custom_slaving_callback (GstAudioBaseSink * sink,
+ GstAudioBaseSinkCustomSlavingCallback callback,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_AUDIO_API
+void gst_audio_base_sink_report_device_failure (GstAudioBaseSink * sink);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioBaseSink, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_BASE_SINK_H__ */
diff --git a/include/gst/audio/gstaudiobasesrc.h b/include/gst/audio/gstaudiobasesrc.h
new file mode 100644
index 0000000000..67eb829914
--- /dev/null
+++ b/include/gst/audio/gstaudiobasesrc.h
@@ -0,0 +1,160 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudiobasesrc.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* a base class for audio sources.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_BASE_SRC_H__
+#define __GST_AUDIO_BASE_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_BASE_SRC (gst_audio_base_src_get_type())
+#define GST_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrc))
+#define GST_AUDIO_BASE_SRC_CAST(obj) ((GstAudioBaseSrc*)obj)
+#define GST_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrcClass))
+#define GST_AUDIO_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SRC, GstAudioBaseSrcClass))
+#define GST_IS_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SRC))
+#define GST_IS_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SRC))
+
+/**
+ * GST_AUDIO_BASE_SRC_CLOCK:
+ * @obj: a #GstAudioBaseSrc
+ *
+ * Get the #GstClock of @obj.
+ */
+#define GST_AUDIO_BASE_SRC_CLOCK(obj) (GST_AUDIO_BASE_SRC (obj)->clock)
+/**
+ * GST_AUDIO_BASE_SRC_PAD:
+ * @obj: a #GstAudioBaseSrc
+ *
+ * Get the source #GstPad of @obj.
+ */
+#define GST_AUDIO_BASE_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
+
+typedef struct _GstAudioBaseSrc GstAudioBaseSrc;
+typedef struct _GstAudioBaseSrcClass GstAudioBaseSrcClass;
+typedef struct _GstAudioBaseSrcPrivate GstAudioBaseSrcPrivate;
+
+/* FIXME 2.0: Should be "retimestamp" not "re-timestamp" */
+
+/**
+ * GstAudioBaseSrcSlaveMethod:
+ * @GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE: Resample to match the master clock.
+ * @GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP: Retimestamp output buffers with master
+ * clock time.
+ * @GST_AUDIO_BASE_SRC_SLAVE_SKEW: Adjust capture pointer when master clock
+ * drifts too much.
+ * @GST_AUDIO_BASE_SRC_SLAVE_NONE: No adjustment is done.
+ *
+ * Different possible clock slaving algorithms when the internal audio clock was
+ * not selected as the pipeline clock.
+ */
+typedef enum
+{
+ GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE,
+ GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP,
+ GST_AUDIO_BASE_SRC_SLAVE_SKEW,
+ GST_AUDIO_BASE_SRC_SLAVE_NONE
+} GstAudioBaseSrcSlaveMethod;
+
+#define GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP
+
+/**
+ * GstAudioBaseSrc:
+ *
+ * Opaque #GstAudioBaseSrc.
+ */
+struct _GstAudioBaseSrc {
+ GstPushSrc element;
+
+ /*< protected >*/ /* with LOCK */
+ /* our ringbuffer */
+ GstAudioRingBuffer *ringbuffer;
+
+ /* required buffer and latency */
+ GstClockTime buffer_time;
+ GstClockTime latency_time;
+
+ /* the next sample to write */
+ guint64 next_sample;
+
+ /* clock */
+ GstClock *clock;
+
+ /*< private >*/
+ GstAudioBaseSrcPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioBaseSrcClass:
+ * @parent_class: the parent class.
+ * @create_ringbuffer: create and return a #GstAudioRingBuffer to read from.
+ *
+ * #GstAudioBaseSrc class. Override the vmethod to implement
+ * functionality.
+ */
+struct _GstAudioBaseSrcClass {
+ GstPushSrcClass parent_class;
+
+ /* subclass ringbuffer allocation */
+ GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSrc *src);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_base_src_get_type(void);
+
+GST_AUDIO_API
+GstAudioRingBuffer *
+ gst_audio_base_src_create_ringbuffer (GstAudioBaseSrc *src);
+
+GST_AUDIO_API
+void gst_audio_base_src_set_provide_clock (GstAudioBaseSrc *src, gboolean provide);
+
+GST_AUDIO_API
+gboolean gst_audio_base_src_get_provide_clock (GstAudioBaseSrc *src);
+
+GST_AUDIO_API
+void gst_audio_base_src_set_slave_method (GstAudioBaseSrc *src,
+ GstAudioBaseSrcSlaveMethod method);
+GST_AUDIO_API
+GstAudioBaseSrcSlaveMethod
+ gst_audio_base_src_get_slave_method (GstAudioBaseSrc *src);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioBaseSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_BASE_SRC_H__ */
diff --git a/include/gst/audio/gstaudiocdsrc.h b/include/gst/audio/gstaudiocdsrc.h
new file mode 100644
index 0000000000..65dd173179
--- /dev/null
+++ b/include/gst/audio/gstaudiocdsrc.h
@@ -0,0 +1,145 @@
+/* GStreamer Audio CD Source Base Class
+ * Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_CD_SRC_H__
+#define __GST_AUDIO_CD_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_CD_SRC (gst_audio_cd_src_get_type())
+#define GST_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrc))
+#define GST_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
+#define GST_IS_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AUDIO_CD_SRC))
+#define GST_IS_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AUDIO_CD_SRC))
+#define GST_AUDIO_CD_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
+
+typedef struct _GstAudioCdSrc GstAudioCdSrc;
+typedef struct _GstAudioCdSrcClass GstAudioCdSrcClass;
+typedef struct _GstAudioCdSrcTrack GstAudioCdSrcTrack;
+typedef struct _GstAudioCdSrcPrivate GstAudioCdSrcPrivate;
+
+/**
+ * GstAudioCdSrcMode:
+ * @GST_AUDIO_CD_SRC_MODE_NORMAL : each single track is a stream
+ * @GST_AUDIO_CD_SRC_MODE_CONTINUOUS : the entire disc is a single stream
+ *
+ * Mode in which the CD audio source operates. Influences timestamping,
+ * EOS handling and seeking.
+ */
+typedef enum {
+ GST_AUDIO_CD_SRC_MODE_NORMAL, /* stream = one track */
+ GST_AUDIO_CD_SRC_MODE_CONTINUOUS /* stream = whole disc */
+} GstAudioCdSrcMode;
+
+/**
+ * GstAudioCdSrcTrack:
+ * @is_audio: Whether this is an audio track
+ * @num: Track number in TOC (usually starts from 1, but not always)
+ * @start: The first sector of this track (LBA)
+ * @end: The last sector of this track (LBA)
+ * @tags: Track-specific tags (e.g. from cd-text information), or NULL
+ *
+ * CD track abstraction to communicate TOC entries to the base class.
+ *
+ * This structure is only for use by sub-classed in connection with
+ * gst_audio_cd_src_add_track().
+ *
+ * Applications will be informed of the available tracks via a TOC message
+ * on the pipeline's #GstBus instead.
+ */
+/* FIXME 2.0: remove this struct and pass values directly to _add_track() */
+struct _GstAudioCdSrcTrack {
+ gboolean is_audio; /* TRUE if this is an audio track */
+ guint num; /* real track number (usually starts from 1) */
+ guint start; /* first sector of track (LBA, not LSN!) */
+ guint end; /* last sector of track (LBA, not LSN!) */
+ GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */
+
+ /*< private >*/
+ guint _gst_reserved1[GST_PADDING/2];
+ gpointer _gst_reserved2[GST_PADDING/2];
+};
+
+struct _GstAudioCdSrc {
+ GstPushSrc pushsrc;
+
+ /*< protected >*/ /* for use by sub-classes only */
+ GstTagList *tags; /* tags that apply to all tracks */
+
+ /*< private >*/
+ GstAudioCdSrcPrivate *priv;
+
+ /*< private >*/
+ guint _gst_reserved1[GST_PADDING/2];
+ gpointer _gst_reserved2[GST_PADDING/2];
+};
+
+/**
+ * GstAudioCdSrcClass:
+ * @pushsrc_class: the parent class
+ * @open: opening the device
+ * @close: closing the device
+ * @read_sector: reading a sector
+ * @get_default_device: getting the default device
+ * @probe_devices: probing possible devices
+ *
+ * Audio CD source base class.
+ */
+struct _GstAudioCdSrcClass {
+ GstPushSrcClass pushsrc_class;
+
+ /* open/close the CD device */
+ gboolean (*open) (GstAudioCdSrc *src, const gchar *device);
+ void (*close) (GstAudioCdSrc *src);
+
+ /* read one sector (LBA) */
+ GstBuffer * (*read_sector) (GstAudioCdSrc *src, gint sector);
+
+#if 0
+ /* return default device or NULL (optional) */
+ gchar * (*get_default_device) (GstAudioCdSrc *src);
+
+ /* return NULL-terminated string array of CD devices, or NULL (optional) */
+ /* FIXME 0.11: reconsider for new probing/device discovery API, remove if in doubt */
+ gchar ** (*probe_devices) (GstAudioCdSrc *src);
+#endif
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_AUDIO_API
+GType gst_audio_cd_src_get_type (void);
+
+GST_AUDIO_API
+gboolean gst_audio_cd_src_add_track (GstAudioCdSrc * src,
+ GstAudioCdSrcTrack * track);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioCdSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_CD_SRC_H__ */
diff --git a/include/gst/audio/gstaudioclock.h b/include/gst/audio/gstaudioclock.h
new file mode 100644
index 0000000000..f4bd47ff2e
--- /dev/null
+++ b/include/gst/audio/gstaudioclock.h
@@ -0,0 +1,115 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudioclock.h: Clock for use by audio plugins
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_CLOCK_H__
+#define __GST_AUDIO_CLOCK_H__
+
+#include <gst/gst.h>
+#include <gst/gstsystemclock.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_CLOCK \
+ (gst_audio_clock_get_type())
+#define GST_AUDIO_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CLOCK,GstAudioClock))
+#define GST_AUDIO_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CLOCK,GstAudioClockClass))
+#define GST_IS_AUDIO_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK))
+#define GST_IS_AUDIO_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
+#define GST_AUDIO_CLOCK_CAST(obj) \
+ ((GstAudioClock*)(obj))
+
+typedef struct _GstAudioClock GstAudioClock;
+typedef struct _GstAudioClockClass GstAudioClockClass;
+
+/**
+ * GstAudioClockGetTimeFunc:
+ * @clock: the #GstAudioClock
+ * @user_data: user data
+ *
+ * This function will be called whenever the current clock time needs to be
+ * calculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported
+ * time will be returned by the clock.
+ *
+ * Returns: the current time or #GST_CLOCK_TIME_NONE if the previous time should
+ * be used.
+ */
+typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
+
+/**
+ * GstAudioClock:
+ *
+ * Opaque #GstAudioClock.
+ */
+struct _GstAudioClock {
+ GstSystemClock clock;
+
+ /*< protected >*/
+ GstAudioClockGetTimeFunc func;
+ gpointer user_data;
+ GDestroyNotify destroy_notify;
+
+ /*< private >*/
+ GstClockTime last_time;
+ GstClockTimeDiff time_offset;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstAudioClockClass {
+ GstSystemClockClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_clock_get_type (void);
+
+GST_AUDIO_API
+GstClock* gst_audio_clock_new (const gchar *name, GstAudioClockGetTimeFunc func,
+ gpointer user_data, GDestroyNotify destroy_notify);
+
+GST_AUDIO_API
+void gst_audio_clock_reset (GstAudioClock *clock, GstClockTime time);
+
+GST_AUDIO_API
+GstClockTime gst_audio_clock_get_time (GstAudioClock * clock);
+
+GST_AUDIO_API
+GstClockTime gst_audio_clock_adjust (GstAudioClock * clock, GstClockTime time);
+
+GST_AUDIO_API
+void gst_audio_clock_invalidate (GstAudioClock * clock);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioClock, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_CLOCK_H__ */
diff --git a/include/gst/audio/gstaudiodecoder.h b/include/gst/audio/gstaudiodecoder.h
new file mode 100644
index 0000000000..b2f36648a7
--- /dev/null
+++ b/include/gst/audio/gstaudiodecoder.h
@@ -0,0 +1,449 @@
+/* GStreamer
+ * Copyright (C) 2009 Igalia S.L.
+ * Author: Iago Toral Quiroga <itoral@igalia.com>
+ * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
+ * Copyright (C) 2011 Nokia Corporation. All rights reserved.
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef _GST_AUDIO_DECODER_H_
+#define _GST_AUDIO_DECODER_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_DECODER \
+ (gst_audio_decoder_get_type())
+#define GST_AUDIO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoder))
+#define GST_AUDIO_DECODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
+#define GST_AUDIO_DECODER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_DECODER,GstAudioDecoderClass))
+#define GST_IS_AUDIO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_DECODER))
+#define GST_IS_AUDIO_DECODER_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_DECODER))
+#define GST_AUDIO_DECODER_CAST(obj) \
+ ((GstAudioDecoder *)(obj))
+
+/**
+ * GST_AUDIO_DECODER_SINK_NAME:
+ *
+ * The name of the templates for the sink pad.
+ */
+#define GST_AUDIO_DECODER_SINK_NAME "sink"
+/**
+ * GST_AUDIO_DECODER_SRC_NAME:
+ *
+ * The name of the templates for the source pad.
+ */
+#define GST_AUDIO_DECODER_SRC_NAME "src"
+
+/**
+ * GST_AUDIO_DECODER_SRC_PAD:
+ * @obj: base audio codec instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_AUDIO_DECODER_SRC_PAD(obj) (((GstAudioDecoder *) (obj))->srcpad)
+
+/**
+ * GST_AUDIO_DECODER_SINK_PAD:
+ * @obj: base audio codec instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_AUDIO_DECODER_SINK_PAD(obj) (((GstAudioDecoder *) (obj))->sinkpad)
+
+#define GST_AUDIO_DECODER_STREAM_LOCK(dec) g_rec_mutex_lock (&GST_AUDIO_DECODER (dec)->stream_lock)
+#define GST_AUDIO_DECODER_STREAM_UNLOCK(dec) g_rec_mutex_unlock (&GST_AUDIO_DECODER (dec)->stream_lock)
+
+/**
+ * GST_AUDIO_DECODER_INPUT_SEGMENT:
+ * @obj: audio decoder instance
+ *
+ * Gives the input segment of the element.
+ */
+#define GST_AUDIO_DECODER_INPUT_SEGMENT(obj) (GST_AUDIO_DECODER_CAST (obj)->input_segment)
+
+/**
+ * GST_AUDIO_DECODER_OUTPUT_SEGMENT:
+ * @obj: audio decoder instance
+ *
+ * Gives the output segment of the element.
+ */
+#define GST_AUDIO_DECODER_OUTPUT_SEGMENT(obj) (GST_AUDIO_DECODER_CAST (obj)->output_segment)
+
+typedef struct _GstAudioDecoder GstAudioDecoder;
+typedef struct _GstAudioDecoderClass GstAudioDecoderClass;
+
+typedef struct _GstAudioDecoderPrivate GstAudioDecoderPrivate;
+
+/* do not use this one, use macro below */
+
+GST_AUDIO_API
+GstFlowReturn _gst_audio_decoder_error (GstAudioDecoder *dec, gint weight,
+ GQuark domain, gint code,
+ gchar *txt, gchar *debug,
+ const gchar *file, const gchar *function,
+ gint line);
+
+/**
+ * GST_AUDIO_DECODER_ERROR:
+ * @el: the base audio decoder element that generates the error
+ * @weight: element defined weight of the error, added to error count
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
+ * @code: error code defined for that domain (see #gstreamer-GstGError)
+ * @text: the message to display (format string and args enclosed in
+ * parentheses)
+ * @debug: debugging information for the message (format string and args
+ * enclosed in parentheses)
+ * @ret: variable to receive return value
+ *
+ * Utility function that audio decoder elements can use in case they encountered
+ * a data processing error that may be fatal for the current "data unit" but
+ * need not prevent subsequent decoding. Such errors are counted and if there
+ * are too many, as configured in the context's max_errors, the pipeline will
+ * post an error message and the application will be requested to stop further
+ * media processing. Otherwise, it is considered a "glitch" and only a warning
+ * is logged. In either case, @ret is set to the proper value to
+ * return to upstream/caller (indicating either GST_FLOW_ERROR or GST_FLOW_OK).
+ */
+#define GST_AUDIO_DECODER_ERROR(el, weight, domain, code, text, debug, ret) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ GstAudioDecoder *__dec = GST_AUDIO_DECODER (el); \
+ ret = _gst_audio_decoder_error (__dec, weight, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__); \
+} G_STMT_END
+
+
+/**
+ * GST_AUDIO_DECODER_MAX_ERRORS:
+ *
+ * Default maximum number of errors tolerated before signaling error.
+ */
+#define GST_AUDIO_DECODER_MAX_ERRORS 10
+
+/**
+ * GstAudioDecoder:
+ *
+ * The opaque #GstAudioDecoder data structure.
+ */
+struct _GstAudioDecoder
+{
+ GstElement element;
+
+ /*< protected >*/
+ /* source and sink pads */
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* protects all data processing, i.e. is locked
+ * in the chain function, finish_frame and when
+ * processing serialized events */
+ GRecMutex stream_lock;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment input_segment;
+ GstSegment output_segment;
+
+ /*< private >*/
+ GstAudioDecoderPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstAudioDecoderClass:
+ * @element_class: The parent class structure
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_format: Notifies subclass of incoming data format (caps).
+ * @parse: Optional.
+ * Allows chopping incoming data into manageable units (frames)
+ * for subsequent decoding. This division is at subclass
+ * discretion and may or may not correspond to 1 (or more)
+ * frames as defined by audio format.
+ * @handle_frame: Provides input data (or NULL to clear any remaining data)
+ * to subclass. Input data ref management is performed by
+ * base class, subclass should not care or intervene,
+ * and input data is only valid until next call to base class,
+ * most notably a call to gst_audio_decoder_finish_frame().
+ * @flush: Optional.
+ * Instructs subclass to clear any codec caches and discard
+ * any pending samples and not yet returned decoded data.
+ * @hard indicates whether a FLUSH is being processed,
+ * or otherwise a DISCONT (or conceptually similar).
+ * @sink_event: Optional.
+ * Event handler on the sink pad. Subclasses should chain up to
+ * the parent implementation to invoke the default handler.
+ * @src_event: Optional.
+ * Event handler on the src pad. Subclasses should chain up to
+ * the parent implementation to invoke the default handler.
+ * @pre_push: Optional.
+ * Called just prior to pushing (encoded data) buffer downstream.
+ * Subclass has full discretionary access to buffer,
+ * and a not OK flow return will abort downstream pushing.
+ * @open: Optional.
+ * Called when the element changes to GST_STATE_READY.
+ * Allows opening external resources.
+ * @close: Optional.
+ * Called when the element changes to GST_STATE_NULL.
+ * Allows closing external resources.
+ * @negotiate: Optional.
+ * Negotiate with downstream and configure buffer pools, etc.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @decide_allocation: Optional.
+ * Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @propose_allocation: Optional.
+ * Propose buffer allocation parameters for upstream elements.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.6
+ * @src_query: Optional.
+ * Query handler on the source pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.6
+ * @getcaps: Optional.
+ * Allows for a custom sink getcaps implementation.
+ * If not implemented,
+ * default returns gst_audio_decoder_proxy_getcaps
+ * applied to sink template caps.
+ * @transform_meta: Optional. Transform the metadata on the input buffer to the
+ * output buffer. By default this method copies all meta without
+ * tags and meta with only the "audio" tag. subclasses can
+ * implement this method and return %TRUE if the metadata is to be
+ * copied. Since: 1.6
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @handle_frame (and likely @set_format) needs to be
+ * overridden.
+ */
+struct _GstAudioDecoderClass
+{
+ GstElementClass element_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ gboolean (*start) (GstAudioDecoder *dec);
+
+ gboolean (*stop) (GstAudioDecoder *dec);
+
+ gboolean (*set_format) (GstAudioDecoder *dec,
+ GstCaps *caps);
+
+ GstFlowReturn (*parse) (GstAudioDecoder *dec,
+ GstAdapter *adapter,
+ gint *offset, gint *length);
+
+ GstFlowReturn (*handle_frame) (GstAudioDecoder *dec,
+ GstBuffer *buffer);
+
+ void (*flush) (GstAudioDecoder *dec, gboolean hard);
+
+ GstFlowReturn (*pre_push) (GstAudioDecoder *dec,
+ GstBuffer **buffer);
+
+ gboolean (*sink_event) (GstAudioDecoder *dec,
+ GstEvent *event);
+ gboolean (*src_event) (GstAudioDecoder *dec,
+ GstEvent *event);
+
+ gboolean (*open) (GstAudioDecoder *dec);
+
+ gboolean (*close) (GstAudioDecoder *dec);
+
+ gboolean (*negotiate) (GstAudioDecoder *dec);
+
+ gboolean (*decide_allocation) (GstAudioDecoder *dec, GstQuery *query);
+
+ gboolean (*propose_allocation) (GstAudioDecoder *dec,
+ GstQuery * query);
+
+ gboolean (*sink_query) (GstAudioDecoder *dec, GstQuery *query);
+
+ gboolean (*src_query) (GstAudioDecoder *dec, GstQuery *query);
+
+ GstCaps * (*getcaps) (GstAudioDecoder * dec,
+ GstCaps * filter);
+
+ gboolean (*transform_meta) (GstAudioDecoder *enc, GstBuffer *outbuf,
+ GstMeta *meta, GstBuffer *inbuf);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE - 4];
+};
+
+GST_AUDIO_API
+GType gst_audio_decoder_get_type (void);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
+ const GstAudioInfo * info);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_set_output_caps (GstAudioDecoder * dec,
+ GstCaps * caps);
+GST_AUDIO_API
+GstCaps * gst_audio_decoder_proxy_getcaps (GstAudioDecoder * decoder,
+ GstCaps * caps,
+ GstCaps * filter);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_negotiate (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+GstFlowReturn gst_audio_decoder_finish_subframe (GstAudioDecoder * dec,
+ GstBuffer * buf);
+
+GST_AUDIO_API
+GstFlowReturn gst_audio_decoder_finish_frame (GstAudioDecoder * dec,
+ GstBuffer * buf, gint frames);
+
+GST_AUDIO_API
+GstBuffer * gst_audio_decoder_allocate_output_buffer (GstAudioDecoder * dec,
+ gsize size);
+
+/* context parameters */
+
+GST_AUDIO_API
+GstAudioInfo * gst_audio_decoder_get_audio_info (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_plc_aware (GstAudioDecoder * dec,
+ gboolean plc);
+
+GST_AUDIO_API
+gint gst_audio_decoder_get_plc_aware (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_estimate_rate (GstAudioDecoder * dec,
+ gboolean enabled);
+
+GST_AUDIO_API
+gint gst_audio_decoder_get_estimate_rate (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+gint gst_audio_decoder_get_delay (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_max_errors (GstAudioDecoder * dec,
+ gint num);
+
+GST_AUDIO_API
+gint gst_audio_decoder_get_max_errors (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_latency (GstAudioDecoder * dec,
+ GstClockTime min,
+ GstClockTime max);
+
+GST_AUDIO_API
+void gst_audio_decoder_get_latency (GstAudioDecoder * dec,
+ GstClockTime * min,
+ GstClockTime * max);
+
+GST_AUDIO_API
+void gst_audio_decoder_get_parse_state (GstAudioDecoder * dec,
+ gboolean * sync,
+ gboolean * eos);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_allocation_caps (GstAudioDecoder * dec,
+ GstCaps * allocation_caps);
+
+/* object properties */
+
+GST_AUDIO_API
+void gst_audio_decoder_set_plc (GstAudioDecoder * dec,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_get_plc (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_min_latency (GstAudioDecoder * dec,
+ GstClockTime num);
+
+GST_AUDIO_API
+GstClockTime gst_audio_decoder_get_min_latency (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_tolerance (GstAudioDecoder * dec,
+ GstClockTime tolerance);
+
+GST_AUDIO_API
+GstClockTime gst_audio_decoder_get_tolerance (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_drainable (GstAudioDecoder * dec,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_get_drainable (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_needs_format (GstAudioDecoder * dec,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_decoder_get_needs_format (GstAudioDecoder * dec);
+
+GST_AUDIO_API
+void gst_audio_decoder_get_allocator (GstAudioDecoder * dec,
+ GstAllocator ** allocator,
+ GstAllocationParams * params);
+
+GST_AUDIO_API
+void gst_audio_decoder_merge_tags (GstAudioDecoder * dec,
+ const GstTagList * tags, GstTagMergeMode mode);
+
+GST_AUDIO_API
+void gst_audio_decoder_set_use_default_pad_acceptcaps (GstAudioDecoder * decoder,
+ gboolean use);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioDecoder, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* _GST_AUDIO_DECODER_H_ */
diff --git a/include/gst/audio/gstaudioencoder.h b/include/gst/audio/gstaudioencoder.h
new file mode 100644
index 0000000000..e95938b5d5
--- /dev/null
+++ b/include/gst/audio/gstaudioencoder.h
@@ -0,0 +1,378 @@
+/* GStreamer
+ * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
+ * Copyright (C) 2011 Nokia Corporation. All rights reserved.
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_ENCODER_H__
+#define __GST_AUDIO_ENCODER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_ENCODER (gst_audio_encoder_get_type())
+#define GST_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoder))
+#define GST_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
+#define GST_AUDIO_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_ENCODER,GstAudioEncoderClass))
+#define GST_IS_AUDIO_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_ENCODER))
+#define GST_IS_AUDIO_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_ENCODER))
+#define GST_AUDIO_ENCODER_CAST(obj) ((GstAudioEncoder *)(obj))
+
+/**
+ * GST_AUDIO_ENCODER_SINK_NAME:
+ *
+ * the name of the templates for the sink pad
+ */
+#define GST_AUDIO_ENCODER_SINK_NAME "sink"
+/**
+ * GST_AUDIO_ENCODER_SRC_NAME:
+ *
+ * the name of the templates for the source pad
+ */
+#define GST_AUDIO_ENCODER_SRC_NAME "src"
+
+/**
+ * GST_AUDIO_ENCODER_SRC_PAD:
+ * @obj: audio encoder instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_AUDIO_ENCODER_SRC_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->srcpad)
+
+/**
+ * GST_AUDIO_ENCODER_SINK_PAD:
+ * @obj: audio encoder instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_AUDIO_ENCODER_SINK_PAD(obj) (GST_AUDIO_ENCODER_CAST (obj)->sinkpad)
+
+/**
+ * GST_AUDIO_ENCODER_INPUT_SEGMENT:
+ * @obj: base parse instance
+ *
+ * Gives the input segment of the element.
+ */
+#define GST_AUDIO_ENCODER_INPUT_SEGMENT(obj) (GST_AUDIO_ENCODER_CAST (obj)->input_segment)
+
+/**
+ * GST_AUDIO_ENCODER_OUTPUT_SEGMENT:
+ * @obj: base parse instance
+ *
+ * Gives the output segment of the element.
+ */
+#define GST_AUDIO_ENCODER_OUTPUT_SEGMENT(obj) (GST_AUDIO_ENCODER_CAST (obj)->output_segment)
+
+#define GST_AUDIO_ENCODER_STREAM_LOCK(enc) g_rec_mutex_lock (&GST_AUDIO_ENCODER (enc)->stream_lock)
+#define GST_AUDIO_ENCODER_STREAM_UNLOCK(enc) g_rec_mutex_unlock (&GST_AUDIO_ENCODER (enc)->stream_lock)
+
+typedef struct _GstAudioEncoder GstAudioEncoder;
+typedef struct _GstAudioEncoderClass GstAudioEncoderClass;
+
+typedef struct _GstAudioEncoderPrivate GstAudioEncoderPrivate;
+
+/**
+ * GstAudioEncoder:
+ *
+ * The opaque #GstAudioEncoder data structure.
+ */
+struct _GstAudioEncoder {
+ GstElement element;
+
+ /*< protected >*/
+ /* source and sink pads */
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* protects all data processing, i.e. is locked
+ * in the chain function, finish_frame and when
+ * processing serialized events */
+ GRecMutex stream_lock;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment input_segment;
+ GstSegment output_segment;
+
+ /*< private >*/
+ GstAudioEncoderPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstAudioEncoderClass:
+ * @element_class: The parent class structure
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_format: Notifies subclass of incoming data format.
+ * GstAudioInfo contains the format according to provided caps.
+ * @handle_frame: Provides input samples (or NULL to clear any remaining data)
+ * according to directions as configured by the subclass
+ * using the API. Input data ref management is performed
+ * by base class, subclass should not care or intervene,
+ * and input data is only valid until next call to base class,
+ * most notably a call to gst_audio_encoder_finish_frame().
+ * @flush: Optional.
+ * Instructs subclass to clear any codec caches and discard
+ * any pending samples and not yet returned encoded data.
+ * @sink_event: Optional.
+ * Event handler on the sink pad. Subclasses should chain up to
+ * the parent implementation to invoke the default handler.
+ * @src_event: Optional.
+ * Event handler on the src pad. Subclasses should chain up to
+ * the parent implementation to invoke the default handler.
+ * @pre_push: Optional.
+ * Called just prior to pushing (encoded data) buffer downstream.
+ * Subclass has full discretionary access to buffer,
+ * and a not OK flow return will abort downstream pushing.
+ * @getcaps: Optional.
+ * Allows for a custom sink getcaps implementation (e.g.
+ * for multichannel input specification). If not implemented,
+ * default returns gst_audio_encoder_proxy_getcaps
+ * applied to sink template caps.
+ * @open: Optional.
+ * Called when the element changes to GST_STATE_READY.
+ * Allows opening external resources.
+ * @close: Optional.
+ * Called when the element changes to GST_STATE_NULL.
+ * Allows closing external resources.
+ * @negotiate: Optional.
+ * Negotiate with downstream and configure buffer pools, etc.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @decide_allocation: Optional.
+ * Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @propose_allocation: Optional.
+ * Propose buffer allocation parameters for upstream elements.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @transform_meta: Optional. Transform the metadata on the input buffer to the
+ * output buffer. By default this method copies all meta without
+ * tags and meta with only the "audio" tag. subclasses can
+ * implement this method and return %TRUE if the metadata is to be
+ * copied. Since: 1.6
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.6
+ * @src_query: Optional.
+ * Query handler on the source pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.6
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @set_format and @handle_frame needs to be overridden.
+ */
+struct _GstAudioEncoderClass {
+ GstElementClass element_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ gboolean (*start) (GstAudioEncoder *enc);
+
+ gboolean (*stop) (GstAudioEncoder *enc);
+
+ gboolean (*set_format) (GstAudioEncoder *enc,
+ GstAudioInfo *info);
+
+ GstFlowReturn (*handle_frame) (GstAudioEncoder *enc,
+ GstBuffer *buffer);
+
+ void (*flush) (GstAudioEncoder *enc);
+
+ GstFlowReturn (*pre_push) (GstAudioEncoder *enc,
+ GstBuffer **buffer);
+
+ gboolean (*sink_event) (GstAudioEncoder *enc,
+ GstEvent *event);
+
+ gboolean (*src_event) (GstAudioEncoder *enc,
+ GstEvent *event);
+
+ GstCaps * (*getcaps) (GstAudioEncoder *enc, GstCaps *filter);
+
+ gboolean (*open) (GstAudioEncoder *enc);
+
+ gboolean (*close) (GstAudioEncoder *enc);
+
+ gboolean (*negotiate) (GstAudioEncoder *enc);
+
+ gboolean (*decide_allocation) (GstAudioEncoder *enc, GstQuery *query);
+
+ gboolean (*propose_allocation) (GstAudioEncoder * enc,
+ GstQuery * query);
+
+ gboolean (*transform_meta) (GstAudioEncoder *enc, GstBuffer *outbuf,
+ GstMeta *meta, GstBuffer *inbuf);
+
+ gboolean (*sink_query) (GstAudioEncoder *encoder,
+ GstQuery *query);
+
+ gboolean (*src_query) (GstAudioEncoder *encoder,
+ GstQuery *query);
+
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-3];
+};
+
+GST_AUDIO_API
+GType gst_audio_encoder_get_type (void);
+
+GST_AUDIO_API
+GstFlowReturn gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
+ GstBuffer * buffer,
+ gint samples);
+
+GST_AUDIO_API
+GstCaps * gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
+ GstCaps * caps,
+ GstCaps * filter);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_set_output_format (GstAudioEncoder * enc,
+ GstCaps * caps);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_negotiate (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+GstBuffer * gst_audio_encoder_allocate_output_buffer (GstAudioEncoder * enc,
+ gsize size);
+
+/* context parameters */
+
+GST_AUDIO_API
+GstAudioInfo * gst_audio_encoder_get_audio_info (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+gint gst_audio_encoder_get_frame_samples_min (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_frame_samples_min (GstAudioEncoder * enc, gint num);
+
+GST_AUDIO_API
+gint gst_audio_encoder_get_frame_samples_max (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_frame_samples_max (GstAudioEncoder * enc, gint num);
+
+GST_AUDIO_API
+gint gst_audio_encoder_get_frame_max (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_frame_max (GstAudioEncoder * enc, gint num);
+
+GST_AUDIO_API
+gint gst_audio_encoder_get_lookahead (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_lookahead (GstAudioEncoder * enc, gint num);
+
+GST_AUDIO_API
+void gst_audio_encoder_get_latency (GstAudioEncoder * enc,
+ GstClockTime * min,
+ GstClockTime * max);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_latency (GstAudioEncoder * enc,
+ GstClockTime min,
+ GstClockTime max);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_headers (GstAudioEncoder * enc,
+ GList * headers);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_allocation_caps (GstAudioEncoder * enc,
+ GstCaps * allocation_caps);
+
+/* object properties */
+
+GST_AUDIO_API
+void gst_audio_encoder_set_mark_granule (GstAudioEncoder * enc,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_get_mark_granule (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_perfect_timestamp (GstAudioEncoder * enc,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_get_perfect_timestamp (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_hard_resync (GstAudioEncoder * enc,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_get_hard_resync (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_tolerance (GstAudioEncoder * enc,
+ GstClockTime tolerance);
+
+GST_AUDIO_API
+GstClockTime gst_audio_encoder_get_tolerance (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_hard_min (GstAudioEncoder * enc,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_get_hard_min (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_set_drainable (GstAudioEncoder * enc,
+ gboolean enabled);
+
+GST_AUDIO_API
+gboolean gst_audio_encoder_get_drainable (GstAudioEncoder * enc);
+
+GST_AUDIO_API
+void gst_audio_encoder_get_allocator (GstAudioEncoder * enc,
+ GstAllocator ** allocator,
+ GstAllocationParams * params);
+
+GST_AUDIO_API
+void gst_audio_encoder_merge_tags (GstAudioEncoder * enc,
+ const GstTagList * tags, GstTagMergeMode mode);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioEncoder, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_ENCODER_H__ */
diff --git a/include/gst/audio/gstaudiofilter.h b/include/gst/audio/gstaudiofilter.h
new file mode 100644
index 0000000000..6108e79f10
--- /dev/null
+++ b/include/gst/audio/gstaudiofilter.h
@@ -0,0 +1,107 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_FILTER_H__
+#define __GST_AUDIO_FILTER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstAudioFilter GstAudioFilter;
+typedef struct _GstAudioFilterClass GstAudioFilterClass;
+
+#define GST_TYPE_AUDIO_FILTER \
+ (gst_audio_filter_get_type())
+#define GST_AUDIO_FILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilter))
+#define GST_AUDIO_FILTER_CAST(obj) \
+ ((GstAudioFilter *) (obj))
+#define GST_AUDIO_FILTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass))
+#define GST_AUDIO_FILTER_CLASS_CAST(klass) \
+ ((GstAudioFilterClass *) (klass))
+#define GST_AUDIO_FILTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass))
+#define GST_IS_AUDIO_FILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_FILTER))
+#define GST_IS_AUDIO_FILTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FILTER))
+
+/**
+ * GstAudioFilter:
+ *
+ * Base class for audio filters with the same format for input and output.
+ */
+struct _GstAudioFilter {
+ GstBaseTransform basetransform;
+
+ /*< protected >*/
+ GstAudioInfo info; /* currently configured format */
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_AUDIO_FILTER_INFO(filter) (&GST_AUDIO_FILTER_CAST(filter)->info)
+
+#define GST_AUDIO_FILTER_FORMAT(filter) (GST_AUDIO_INFO_FORMAT(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_RATE(filter) (GST_AUDIO_INFO_RATE(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_CHANNELS(filter) (GST_AUDIO_INFO_CHANNELS(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_BPF(filter) (GST_AUDIO_INFO_BPF(GST_AUDIO_FILTER_INFO(filter)))
+#define GST_AUDIO_FILTER_BPS(filter) (GST_AUDIO_INFO_BPS(GST_AUDIO_FILTER_INFO(filter)))
+
+/**
+ * GstAudioFilterClass:
+ * @basetransformclass: parent class
+ * @setup: virtual function called whenever the format changes
+ *
+ * In addition to the @setup virtual function, you should also override the
+ * GstBaseTransform::transform and/or GstBaseTransform::transform_ip virtual
+ * function.
+ */
+
+struct _GstAudioFilterClass {
+ GstBaseTransformClass basetransformclass;
+
+ /* virtual function, called whenever the format changes */
+ gboolean (*setup) (GstAudioFilter * filter, const GstAudioInfo * info);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_filter_get_type (void);
+
+GST_AUDIO_API
+void gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
+ GstCaps * allowed_caps);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioFilter, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_FILTER_H__ */
+
diff --git a/include/gst/audio/gstaudioiec61937.h b/include/gst/audio/gstaudioiec61937.h
new file mode 100644
index 0000000000..1885a921dd
--- /dev/null
+++ b/include/gst/audio/gstaudioiec61937.h
@@ -0,0 +1,36 @@
+/* GStreamer audio helper functions for IEC 61937 payloading
+ * (c) 2011 Intel Corporation
+ * 2011 Collabora Multimedia
+ * 2011 Arun Raghavan <arun.raghavan@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_IEC61937_H__
+#define __GST_AUDIO_IEC61937_H__
+
+#include <gst/audio/gstaudioringbuffer.h>
+
+GST_AUDIO_API
+guint gst_audio_iec61937_frame_size (const GstAudioRingBufferSpec * spec);
+
+GST_AUDIO_API
+gboolean gst_audio_iec61937_payload (const guint8 * src, guint src_n,
+ guint8 * dst, guint dst_n,
+ const GstAudioRingBufferSpec * spec,
+ gint endianness);
+
+#endif /* __GST_AUDIO_IEC61937_H__ */
diff --git a/include/gst/audio/gstaudiometa.h b/include/gst/audio/gstaudiometa.h
new file mode 100644
index 0000000000..94954d1940
--- /dev/null
+++ b/include/gst/audio/gstaudiometa.h
@@ -0,0 +1,252 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_META_H__
+#define __GST_AUDIO_META_H__
+
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+#define GST_AUDIO_DOWNMIX_META_API_TYPE (gst_audio_downmix_meta_api_get_type())
+#define GST_AUDIO_DOWNMIX_META_INFO (gst_audio_downmix_meta_get_info())
+
+typedef struct _GstAudioDownmixMeta GstAudioDownmixMeta;
+
+/**
+ * GstAudioDownmixMeta:
+ * @meta: parent #GstMeta
+ * @from_position: the channel positions of the source
+ * @to_position: the channel positions of the destination
+ * @from_channels: the number of channels of the source
+ * @to_channels: the number of channels of the destination
+ * @matrix: the matrix coefficients.
+ *
+ * Extra buffer metadata describing audio downmixing matrix. This metadata is
+ * attached to audio buffers and contains a matrix to downmix the buffer number
+ * of channels to @channels.
+ *
+ * @matrix is an two-dimensional array of @to_channels times @from_channels
+ * coefficients, i.e. the i-th output channels is constructed by multiplicating
+ * the input channels with the coefficients in @matrix[i] and taking the sum
+ * of the results.
+ */
+struct _GstAudioDownmixMeta {
+ GstMeta meta;
+
+ GstAudioChannelPosition *from_position;
+ GstAudioChannelPosition *to_position;
+ gint from_channels, to_channels;
+ gfloat **matrix;
+};
+
+GST_AUDIO_API
+GType gst_audio_downmix_meta_api_get_type (void);
+
+GST_AUDIO_API
+const GstMetaInfo * gst_audio_downmix_meta_get_info (void);
+
+#define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b), GST_AUDIO_DOWNMIX_META_API_TYPE))
+GST_AUDIO_API
+GstAudioDownmixMeta * gst_buffer_get_audio_downmix_meta_for_channels (GstBuffer *buffer,
+ const GstAudioChannelPosition *to_position,
+ gint to_channels);
+
+GST_AUDIO_API
+GstAudioDownmixMeta * gst_buffer_add_audio_downmix_meta (GstBuffer *buffer,
+ const GstAudioChannelPosition *from_position,
+ gint from_channels,
+ const GstAudioChannelPosition *to_position,
+ gint to_channels,
+ const gfloat **matrix);
+
+
+#define GST_AUDIO_CLIPPING_META_API_TYPE (gst_audio_clipping_meta_api_get_type())
+#define GST_AUDIO_CLIPPING_META_INFO (gst_audio_clipping_meta_get_info())
+
+typedef struct _GstAudioClippingMeta GstAudioClippingMeta;
+
+/**
+ * GstAudioClippingMeta:
+ * @meta: parent #GstMeta
+ * @format: GstFormat of @start and @stop, GST_FORMAT_DEFAULT is samples
+ * @start: Amount of audio to clip from start of buffer
+ * @end: Amount of to clip from end of buffer
+ *
+ * Extra buffer metadata describing how much audio has to be clipped from
+ * the start or end of a buffer. This is used for compressed formats, where
+ * the first frame usually has some additional samples due to encoder and
+ * decoder delays, and the last frame usually has some additional samples to
+ * be able to fill the complete last frame.
+ *
+ * This is used to ensure that decoded data in the end has the same amount of
+ * samples, and multiply decoded streams can be gaplessly concatenated.
+ *
+ * Note: If clipping of the start is done by adjusting the segment, this meta
+ * has to be dropped from buffers as otherwise clipping could happen twice.
+ *
+ * Since: 1.8
+ */
+struct _GstAudioClippingMeta {
+ GstMeta meta;
+
+ GstFormat format;
+ guint64 start;
+ guint64 end;
+};
+
+GST_AUDIO_API
+GType gst_audio_clipping_meta_api_get_type (void);
+
+GST_AUDIO_API
+const GstMetaInfo * gst_audio_clipping_meta_get_info (void);
+
+#define gst_buffer_get_audio_clipping_meta(b) ((GstAudioClippingMeta*)gst_buffer_get_meta((b), GST_AUDIO_CLIPPING_META_API_TYPE))
+
+GST_AUDIO_API
+GstAudioClippingMeta * gst_buffer_add_audio_clipping_meta (GstBuffer *buffer,
+ GstFormat format,
+ guint64 start,
+ guint64 end);
+
+
+#define GST_AUDIO_META_API_TYPE (gst_audio_meta_api_get_type())
+#define GST_AUDIO_META_INFO (gst_audio_meta_get_info())
+
+typedef struct _GstAudioMeta GstAudioMeta;
+
+/**
+ * GstAudioMeta:
+ * @meta: parent #GstMeta
+ * @info: the audio properties of the buffer
+ * @samples: the number of valid samples in the buffer
+ * @offsets: the offsets (in bytes) where each channel plane starts in the
+ * buffer or %NULL if the buffer has interleaved layout; if not %NULL, this
+ * is guaranteed to be an array of @info.channels elements
+ *
+ * Buffer metadata describing how data is laid out inside the buffer. This
+ * is useful for non-interleaved (planar) buffers, where it is necessary to
+ * have a place to store where each plane starts and how long each plane is.
+ *
+ * It is a requirement for non-interleaved buffers to have this metadata
+ * attached and to be mapped with gst_audio_buffer_map() in order to ensure
+ * correct handling of clipping and channel reordering.
+ *
+ * The different channels in @offsets are always in the GStreamer channel order.
+ * Zero-copy channel reordering can be implemented by swapping the values in
+ * @offsets.
+ *
+ * It is not allowed for channels to overlap in memory,
+ * i.e. for each i in [0, channels), the range
+ * [@offsets[i], @offsets[i] + @samples * sample_stride) must not overlap
+ * with any other such range.
+ *
+ * It is, however, allowed to have parts of the buffer memory unused,
+ * by using @offsets and @samples in such a way that leave gaps on it.
+ * This is used to implement zero-copy clipping in non-interleaved buffers.
+ *
+ * Obviously, due to the above, it is not safe to infer the
+ * number of valid samples from the size of the buffer. You should always
+ * use the @samples variable of this metadata.
+ *
+ * Note that for interleaved audio it is not a requirement to have this
+ * metadata attached and at the moment of writing, there is actually no use
+ * case to do so. It is, however, allowed to attach it, for some potential
+ * future use case.
+ *
+ * Since: 1.16
+ */
+struct _GstAudioMeta {
+ GstMeta meta;
+
+ GstAudioInfo info;
+ gsize samples;
+ gsize *offsets;
+
+ /*< private >*/
+ gsize priv_offsets_arr[8];
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_meta_api_get_type (void);
+
+GST_AUDIO_API
+const GstMetaInfo * gst_audio_meta_get_info (void);
+
+#define gst_buffer_get_audio_meta(b) \
+ ((GstAudioMeta*)gst_buffer_get_meta((b), GST_AUDIO_META_API_TYPE))
+
+GST_AUDIO_API
+GstAudioMeta * gst_buffer_add_audio_meta (GstBuffer *buffer,
+ const GstAudioInfo *info,
+ gsize samples, gsize offsets[]);
+
+/**
+ * GST_AUDIO_LEVEL_META_API_TYPE:
+ *
+ * The #GType associated with #GstAudioLevelMeta.
+ *
+ * Since: 1.20
+ */
+#define GST_AUDIO_LEVEL_META_API_TYPE (gst_audio_level_meta_api_get_type())
+/**
+ * GST_AUDIO_LEVEL_META_INFO:
+ *
+ * The #GstMetaInfo associated with #GstAudioLevelMeta.
+ *
+ * Since: 1.20
+ */
+#define GST_AUDIO_LEVEL_META_INFO (gst_audio_level_meta_get_info())
+typedef struct _GstAudioLevelMeta GstAudioLevelMeta;
+
+/**
+ * GstAudioLevelMeta:
+ * @meta: parent #GstMeta
+ * @level: the -dBov from 0-127 (127 is silence).
+ * @voice_activity: whether the buffer contains voice activity
+ *
+ * Meta containing Audio Level Indication: https://tools.ietf.org/html/rfc6464
+ *
+ * Since: 1.20
+ */
+struct _GstAudioLevelMeta
+{
+ GstMeta meta;
+
+ guint8 level;
+ gboolean voice_activity;
+};
+
+GST_AUDIO_API
+GType gst_audio_level_meta_api_get_type (void);
+
+GST_AUDIO_API
+const GstMetaInfo * gst_audio_level_meta_get_info (void);
+
+GST_AUDIO_API
+GstAudioLevelMeta * gst_buffer_add_audio_level_meta (GstBuffer * buffer,
+ guint8 level,
+ gboolean voice_activity);
+GST_AUDIO_API
+GstAudioLevelMeta * gst_buffer_get_audio_level_meta (GstBuffer * buffer);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_META_H__ */
diff --git a/include/gst/audio/gstaudioringbuffer.h b/include/gst/audio/gstaudioringbuffer.h
new file mode 100644
index 0000000000..615041f71d
--- /dev/null
+++ b/include/gst/audio/gstaudioringbuffer.h
@@ -0,0 +1,414 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudioringbuffer.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_RING_BUFFER_H__
+#define __GST_AUDIO_RING_BUFFER_H__
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_RING_BUFFER (gst_audio_ring_buffer_get_type())
+#define GST_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBuffer))
+#define GST_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBufferClass))
+#define GST_AUDIO_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_RING_BUFFER, GstAudioRingBufferClass))
+#define GST_AUDIO_RING_BUFFER_CAST(obj) ((GstAudioRingBuffer *)obj)
+#define GST_IS_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RING_BUFFER))
+#define GST_IS_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RING_BUFFER))
+
+typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
+typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
+typedef struct _GstAudioRingBufferSpec GstAudioRingBufferSpec;
+
+/**
+ * GstAudioRingBufferCallback:
+ * @rbuf: a #GstAudioRingBuffer
+ * @data: (array length=len): target to fill
+ * @len: amount to fill
+ * @user_data: user data
+ *
+ * This function is set with gst_audio_ring_buffer_set_callback() and is
+ * called to fill the memory at @data with @len bytes of samples.
+ */
+typedef void (*GstAudioRingBufferCallback) (GstAudioRingBuffer *rbuf, guint8* data, guint len, gpointer user_data);
+
+/**
+ * GstAudioRingBufferState:
+ * @GST_AUDIO_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped
+ * @GST_AUDIO_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused
+ * @GST_AUDIO_RING_BUFFER_STATE_STARTED: The ringbuffer is started
+ * @GST_AUDIO_RING_BUFFER_STATE_ERROR: The ringbuffer has encountered an
+ * error after it has been started, e.g. because the device was
+ * disconnected (Since: 1.2)
+ *
+ * The state of the ringbuffer.
+ */
+typedef enum {
+ GST_AUDIO_RING_BUFFER_STATE_STOPPED,
+ GST_AUDIO_RING_BUFFER_STATE_PAUSED,
+ GST_AUDIO_RING_BUFFER_STATE_STARTED,
+ GST_AUDIO_RING_BUFFER_STATE_ERROR
+} GstAudioRingBufferState;
+
+/**
+ * GstAudioRingBufferFormatType:
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW: samples in linear or float
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW: samples in mulaw
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW: samples in alaw
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM: samples in ima adpcm
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG: samples in mpeg audio (but not AAC) format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM: samples in gsm format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958: samples in IEC958 frames (e.g. AC3)
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3: samples in AC3 format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3: samples in EAC3 format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS: samples in DTS format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC: samples in MPEG-2 AAC ADTS format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC: samples in MPEG-4 AAC ADTS format
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW: samples in MPEG-2 AAC raw format (Since: 1.12)
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW: samples in MPEG-4 AAC raw format (Since: 1.12)
+ * @GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC: samples in FLAC format (Since: 1.12)
+ *
+ * The format of the samples in the ringbuffer.
+ */
+typedef enum
+{
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW,
+ GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC
+} GstAudioRingBufferFormatType;
+
+/**
+ * GstAudioRingBufferSpec:
+ * @caps: The caps that generated the Spec.
+ * @type: the sample type
+ * @info: the #GstAudioInfo
+ * @latency_time: the latency in microseconds
+ * @buffer_time: the total buffer size in microseconds
+ * @segsize: the size of one segment in bytes
+ * @segtotal: the total number of segments
+ * @seglatency: number of segments queued in the lower level device,
+ * defaults to segtotal
+ *
+ * The structure containing the format specification of the ringbuffer.
+ */
+struct _GstAudioRingBufferSpec
+{
+ /*< public >*/
+ /* in */
+ GstCaps *caps; /* the caps of the buffer */
+
+ /* in/out */
+ GstAudioRingBufferFormatType type;
+ GstAudioInfo info;
+
+
+ guint64 latency_time; /* the required/actual latency time, this is the
+ * actual the size of one segment and the
+ * minimum possible latency we can achieve. */
+ guint64 buffer_time; /* the required/actual time of the buffer, this is
+ * the total size of the buffer and maximum
+ * latency we can compensate for. */
+ gint segsize; /* size of one buffer segment in bytes, this value
+ * should be chosen to match latency_time as
+ * well as possible. */
+ gint segtotal; /* total number of segments, this value is the
+ * number of segments of @segsize and should be
+ * chosen so that it matches buffer_time as
+ * close as possible. */
+ /* ABI added 0.10.20 */
+ gint seglatency; /* number of segments queued in the lower
+ * level device, defaults to segtotal. */
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_AUDIO_RING_BUFFER_GET_COND(buf) (&(((GstAudioRingBuffer *)buf)->cond))
+#define GST_AUDIO_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
+#define GST_AUDIO_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
+#define GST_AUDIO_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
+
+/**
+ * GstAudioRingBuffer:
+ * @cond: used to signal start/stop/pause/resume actions
+ * @open: boolean indicating that the ringbuffer is open
+ * @acquired: boolean indicating that the ringbuffer is acquired
+ * @memory: data in the ringbuffer
+ * @size: size of data in the ringbuffer
+ * @spec: format and layout of the ringbuffer data
+ * @samples_per_seg: number of samples in one segment
+ * @empty_seg: pointer to memory holding one segment of silence samples
+ * @state: state of the buffer
+ * @segdone: readpointer in the ringbuffer
+ * @segbase: segment corresponding to segment 0 (unused)
+ * @waiting: is a reader or writer waiting for a free segment
+ *
+ * The ringbuffer base class structure.
+ */
+struct _GstAudioRingBuffer {
+ GstObject object;
+
+ /*< public >*/ /* with LOCK */
+ GCond cond;
+ gboolean open;
+ gboolean acquired;
+ guint8 *memory;
+ gsize size;
+ /*< private >*/
+ GstClockTime *timestamps;
+ /*< public >*/ /* with LOCK */
+ GstAudioRingBufferSpec spec;
+ gint samples_per_seg;
+ guint8 *empty_seg;
+
+ /*< public >*/ /* ATOMIC */
+ gint state;
+ gint segdone;
+ gint segbase;
+ gint waiting;
+
+ /*< private >*/
+ GstAudioRingBufferCallback callback;
+ gpointer cb_data;
+
+ gboolean need_reorder;
+ /* gst[channel_reorder_map[i]] = device[i] */
+ gint channel_reorder_map[64];
+
+ gboolean flushing;
+ /* ATOMIC */
+ gint may_start;
+ gboolean active;
+
+ GDestroyNotify cb_data_notify;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+};
+
+/**
+ * GstAudioRingBufferClass:
+ * @parent_class: parent class
+ * @open_device: open the device, don't set any params or allocate anything
+ * @acquire: allocate the resources for the ringbuffer using the given spec
+ * @release: free resources of the ringbuffer
+ * @close_device: close the device
+ * @start: start processing of samples
+ * @pause: pause processing of samples
+ * @resume: resume processing of samples after pause
+ * @stop: stop processing of samples
+ * @delay: get number of frames queued in device
+ * @activate: activate the thread that starts pulling and monitoring the
+ * consumed segments in the device.
+ * @commit: write samples into the ringbuffer
+ * @clear_all: Optional.
+ * Clear the entire ringbuffer.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ *
+ * The vmethods that subclasses can override to implement the ringbuffer.
+ */
+struct _GstAudioRingBufferClass {
+ GstObjectClass parent_class;
+
+ /*< public >*/
+ gboolean (*open_device) (GstAudioRingBuffer *buf);
+ gboolean (*acquire) (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec);
+ gboolean (*release) (GstAudioRingBuffer *buf);
+ gboolean (*close_device) (GstAudioRingBuffer *buf);
+
+ gboolean (*start) (GstAudioRingBuffer *buf);
+ gboolean (*pause) (GstAudioRingBuffer *buf);
+ gboolean (*resume) (GstAudioRingBuffer *buf);
+ gboolean (*stop) (GstAudioRingBuffer *buf);
+
+ guint (*delay) (GstAudioRingBuffer *buf);
+
+ /* ABI added */
+ gboolean (*activate) (GstAudioRingBuffer *buf, gboolean active);
+
+ guint (*commit) (GstAudioRingBuffer * buf, guint64 *sample,
+ guint8 * data, gint in_samples,
+ gint out_samples, gint * accum);
+
+ void (*clear_all) (GstAudioRingBuffer * buf);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_ring_buffer_get_type(void);
+
+/* callback stuff */
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_callback (GstAudioRingBuffer *buf,
+ GstAudioRingBufferCallback cb,
+ gpointer user_data);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_callback_full (GstAudioRingBuffer *buf,
+ GstAudioRingBufferCallback cb,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec *spec, GstCaps *caps);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_debug_spec_caps (GstAudioRingBufferSpec *spec);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_debug_spec_buff (GstAudioRingBufferSpec *spec);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_convert (GstAudioRingBuffer * buf, GstFormat src_fmt,
+ gint64 src_val, GstFormat dest_fmt,
+ gint64 * dest_val);
+
+/* device state */
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_open_device (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_close_device (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_device_is_open (GstAudioRingBuffer *buf);
+
+/* allocate resources */
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, GstAudioRingBufferSpec *spec);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_release (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_is_acquired (GstAudioRingBuffer *buf);
+
+/* set the device channel positions */
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_channel_positions (GstAudioRingBuffer *buf, const GstAudioChannelPosition *position);
+
+/* activating */
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_activate (GstAudioRingBuffer *buf, gboolean active);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_is_active (GstAudioRingBuffer *buf);
+
+/* flushing */
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_flushing (GstAudioRingBuffer *buf, gboolean flushing);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_is_flushing (GstAudioRingBuffer *buf);
+
+/* playback/pause */
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_start (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_pause (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_stop (GstAudioRingBuffer *buf);
+
+/* get status */
+
+GST_AUDIO_API
+guint gst_audio_ring_buffer_delay (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+guint64 gst_audio_ring_buffer_samples_done (GstAudioRingBuffer *buf);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_sample (GstAudioRingBuffer *buf, guint64 sample);
+
+/* clear all segments */
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_clear_all (GstAudioRingBuffer *buf);
+
+/* commit samples */
+
+GST_AUDIO_API
+guint gst_audio_ring_buffer_commit (GstAudioRingBuffer * buf, guint64 *sample,
+ guint8 * data, gint in_samples,
+ gint out_samples, gint * accum);
+
+/* read samples */
+
+GST_AUDIO_API
+guint gst_audio_ring_buffer_read (GstAudioRingBuffer *buf, guint64 sample,
+ guint8 *data, guint len, GstClockTime *timestamp);
+
+/* Set timestamp on buffer */
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_set_timestamp (GstAudioRingBuffer * buf, gint readseg, GstClockTime
+ timestamp);
+
+/* mostly protected */
+/* not yet implemented
+gboolean gst_audio_ring_buffer_prepare_write (GstAudioRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len);
+*/
+
+GST_AUDIO_API
+gboolean gst_audio_ring_buffer_prepare_read (GstAudioRingBuffer *buf, gint *segment,
+ guint8 **readptr, gint *len);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_clear (GstAudioRingBuffer *buf, gint segment);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_advance (GstAudioRingBuffer *buf, guint advance);
+
+GST_AUDIO_API
+void gst_audio_ring_buffer_may_start (GstAudioRingBuffer *buf, gboolean allowed);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioRingBuffer, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_RING_BUFFER_H__ */
diff --git a/include/gst/audio/gstaudiosink.h b/include/gst/audio/gstaudiosink.h
new file mode 100644
index 0000000000..06f65ffa33
--- /dev/null
+++ b/include/gst/audio/gstaudiosink.h
@@ -0,0 +1,136 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudiosink.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_SINK_H__
+#define __GST_AUDIO_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiobasesink.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_SINK (gst_audio_sink_get_type())
+#define GST_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SINK,GstAudioSink))
+#define GST_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
+#define GST_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
+#define GST_IS_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SINK))
+#define GST_IS_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SINK))
+
+typedef struct _GstAudioSink GstAudioSink;
+typedef struct _GstAudioSinkClass GstAudioSinkClass;
+typedef struct _GstAudioSinkClassExtension GstAudioSinkClassExtension;
+
+/**
+ * GstAudioSink:
+ *
+ * Opaque #GstAudioSink.
+ */
+struct _GstAudioSink {
+ GstAudioBaseSink element;
+
+ /*< private >*/ /* with LOCK */
+ GThread *thread;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioSinkClass:
+ * @parent_class: the parent class structure.
+ * @open: Open the device. No configuration needs to be done at this point.
+ * This function is also used to check if the device is available.
+ * @prepare: Prepare the device to operate with the specified parameters.
+ * @unprepare: Undo operations done in prepare.
+ * @close: Close the device.
+ * @write: Write data to the device.
+ * This vmethod is allowed to block until all the data is written.
+ * If such is the case then it is expected that pause, stop and
+ * reset will unblock the write when called.
+ * @delay: Return how many frames are still in the device. Participates in
+ * computing the time for audio clocks and drives the synchronisation.
+ * @reset: Returns as quickly as possible from a write and flush any pending
+ * samples from the device.
+ * This vmethod is deprecated. Please provide pause and stop instead.
+ * @pause: Pause the device and unblock write as fast as possible.
+ * For retro compatibility, the audio sink will fallback
+ * to calling reset if this vmethod is not provided. Since: 1.18
+ * @resume: Resume the device. Since: 1.18
+ * @stop: Stop the device and unblock write as fast as possible.
+ * Pending samples are flushed from the device.
+ * For retro compatibility, the audio sink will fallback
+ * to calling reset if this vmethod is not provided. Since: 1.18
+ * @extension: class extension structure. Since: 1.18
+ */
+struct _GstAudioSinkClass {
+ GstAudioBaseSinkClass parent_class;
+
+ /* vtable */
+
+ /* open the device with given specs */
+ gboolean (*open) (GstAudioSink *sink);
+ /* prepare resources and state to operate with the given specs */
+ gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec);
+ /* undo anything that was done in prepare() */
+ gboolean (*unprepare) (GstAudioSink *sink);
+ /* close the device */
+ gboolean (*close) (GstAudioSink *sink);
+ /* write samples to the device */
+ gint (*write) (GstAudioSink *sink, gpointer data, guint length);
+ /* get number of frames queued in the device */
+ guint (*delay) (GstAudioSink *sink);
+ /* deprecated: reset the audio device, unblock from a write */
+ void (*reset) (GstAudioSink *sink);
+ /* pause the audio device, unblock from a write */
+ void (*pause) (GstAudioSink *sink);
+ /* resume the audio device */
+ void (*resume) (GstAudioSink *sink);
+ /* stop the audio device, unblock from a write */
+ void (*stop) (GstAudioSink *sink);
+
+ GstAudioSinkClassExtension *extension;
+};
+
+/**
+ * GstAudioSinkClassExtension:
+ * @clear-all: Clear the device. Since: 1.18
+ */
+struct _GstAudioSinkClassExtension
+{
+ /* clear the audio device */
+ void (*clear_all) (GstAudioSink *sink);
+
+ /* no padding needed */
+};
+
+GST_AUDIO_API
+GType gst_audio_sink_get_type(void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSink, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_SINK_H__ */
diff --git a/include/gst/audio/gstaudiosrc.h b/include/gst/audio/gstaudiosrc.h
new file mode 100644
index 0000000000..93cb5d06eb
--- /dev/null
+++ b/include/gst/audio/gstaudiosrc.h
@@ -0,0 +1,106 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstaudiosrc.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AUDIO_H__
+#include <gst/audio/audio.h>
+#endif
+
+#ifndef __GST_AUDIO_SRC_H__
+#define __GST_AUDIO_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiobasesrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_SRC (gst_audio_src_get_type())
+#define GST_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc))
+#define GST_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
+#define GST_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
+#define GST_IS_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC))
+#define GST_IS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
+
+typedef struct _GstAudioSrc GstAudioSrc;
+typedef struct _GstAudioSrcClass GstAudioSrcClass;
+
+/**
+ * GstAudioSrc:
+ *
+ * Base class for simple audio sources.
+ */
+struct _GstAudioSrc {
+ GstAudioBaseSrc element;
+
+ /*< private >*/ /* with LOCK */
+ GThread *thread;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioSrcClass:
+ * @parent_class: the parent class.
+ * @open: open the device with the specified caps
+ * @prepare: configure device with format
+ * @unprepare: undo the configuration
+ * @close: close the device
+ * @read: read samples from the audio device
+ * @delay: the number of frames queued in the device
+ * @reset: unblock a read to the device and reset.
+ *
+ * #GstAudioSrc class. Override the vmethod to implement
+ * functionality.
+ */
+struct _GstAudioSrcClass {
+ GstAudioBaseSrcClass parent_class;
+
+ /* vtable */
+
+ /* open the device with given specs */
+ gboolean (*open) (GstAudioSrc *src);
+ /* prepare resources and state to operate with the given specs */
+ gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec);
+ /* undo anything that was done in prepare() */
+ gboolean (*unprepare) (GstAudioSrc *src);
+ /* close the device */
+ gboolean (*close) (GstAudioSrc *src);
+ /* read samples from the device */
+ guint (*read) (GstAudioSrc *src, gpointer data, guint length,
+ GstClockTime *timestamp);
+ /* get number of frames queued in the device */
+ guint (*delay) (GstAudioSrc *src);
+ /* reset the audio device, unblock from a write */
+ void (*reset) (GstAudioSrc *src);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_AUDIO_API
+GType gst_audio_src_get_type(void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_SRC_H__ */
diff --git a/include/gst/audio/gstaudiostreamalign.h b/include/gst/audio/gstaudiostreamalign.h
new file mode 100644
index 0000000000..080e9ea44b
--- /dev/null
+++ b/include/gst/audio/gstaudiostreamalign.h
@@ -0,0 +1,92 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * gstaudiostreamalign.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_STREAM_ALIGN_H__
+#define __GST_AUDIO_STREAM_ALIGN_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_INFO_STREAM_ALIGN (gst_audio_stream_align_get_type ())
+
+/**
+ * GstAudioStreamAlign:
+ *
+ * The opaque #GstAudioStreamAlign data structure.
+ *
+ * Since: 1.14
+ */
+typedef struct _GstAudioStreamAlign GstAudioStreamAlign;
+
+GST_AUDIO_API
+GType gst_audio_stream_align_get_type (void);
+
+GST_AUDIO_API
+GstAudioStreamAlign * gst_audio_stream_align_new (gint rate,
+ GstClockTime alignment_threshold,
+ GstClockTime discont_wait);
+GST_AUDIO_API
+GstAudioStreamAlign * gst_audio_stream_align_copy (const GstAudioStreamAlign * align);
+GST_AUDIO_API
+void gst_audio_stream_align_free (GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+void gst_audio_stream_align_set_rate (GstAudioStreamAlign * align,
+ gint rate);
+GST_AUDIO_API
+gint gst_audio_stream_align_get_rate (const GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+void gst_audio_stream_align_set_alignment_threshold (GstAudioStreamAlign * align,
+ GstClockTime alignment_threshold);
+GST_AUDIO_API
+GstClockTime gst_audio_stream_align_get_alignment_threshold (const GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+void gst_audio_stream_align_set_discont_wait (GstAudioStreamAlign * align,
+ GstClockTime discont_wait);
+GST_AUDIO_API
+GstClockTime gst_audio_stream_align_get_discont_wait (const GstAudioStreamAlign * align);
+
+
+GST_AUDIO_API
+void gst_audio_stream_align_mark_discont (GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+GstClockTime gst_audio_stream_align_get_timestamp_at_discont (const GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+guint64 gst_audio_stream_align_get_samples_since_discont (const GstAudioStreamAlign * align);
+
+GST_AUDIO_API
+gboolean gst_audio_stream_align_process (GstAudioStreamAlign * align,
+ gboolean discont,
+ GstClockTime timestamp,
+ guint n_samples,
+ GstClockTime *out_timestamp,
+ GstClockTime *out_duration,
+ guint64 *out_sample_position);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_STREAM_ALIGN_H__ */
diff --git a/include/gst/audio/gstnonstreamaudiodecoder.h b/include/gst/audio/gstnonstreamaudiodecoder.h
new file mode 100644
index 0000000000..4de1fc7ee9
--- /dev/null
+++ b/include/gst/audio/gstnonstreamaudiodecoder.h
@@ -0,0 +1,412 @@
+/* GStreamer
+ * Copyright (C) <2017> Carlos Rafael Giani <dv at pseudoterminal dot org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NONSTREAM_AUDIO_DECODER_H__
+#define __GST_NONSTREAM_AUDIO_DECODER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/audio-bad-prelude.h>
+
+G_BEGIN_DECLS
+
+
+typedef struct _GstNonstreamAudioDecoder GstNonstreamAudioDecoder;
+typedef struct _GstNonstreamAudioDecoderClass GstNonstreamAudioDecoderClass;
+
+
+/**
+ * GstNonstreamAudioOutputMode:
+ * @GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING: Playback position is moved back to the beginning of the loop
+ * @GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY: Playback position increases steadily, even when looping
+ *
+ * The output mode defines how the output behaves with regards to looping. Either the playback position is
+ * moved back to the beginning of the loop, acting like a backwards seek, or it increases steadily, as if
+ * loop were "unrolled".
+ */
+typedef enum
+{
+ GST_NONSTREAM_AUDIO_OUTPUT_MODE_LOOPING,
+ GST_NONSTREAM_AUDIO_OUTPUT_MODE_STEADY
+} GstNonstreamAudioOutputMode;
+
+
+/**
+ * GstNonstreamAudioSubsongMode:
+ * @GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE: Only the current subsong is played
+ * @GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL: All subsongs are played (current subsong index is ignored)
+ * @GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT: Use decoder specific default behavior
+ *
+ * The subsong mode defines how the decoder shall handle subsongs.
+ */
+typedef enum
+{
+ GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE,
+ GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL,
+ GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT
+} GstNonstreamAudioSubsongMode;
+
+
+#define GST_TYPE_NONSTREAM_AUDIO_DECODER (gst_nonstream_audio_decoder_get_type())
+#define GST_NONSTREAM_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_NONSTREAM_AUDIO_DECODER, GstNonstreamAudioDecoder))
+#define GST_NONSTREAM_AUDIO_DECODER_CAST(obj) ((GstNonstreamAudioDecoder *)(obj))
+#define GST_NONSTREAM_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_NONSTREAM_AUDIO_DECODER, GstNonstreamAudioDecoderClass))
+#define GST_NONSTREAM_AUDIO_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_NONSTREAM_AUDIO_DECODER, GstNonstreamAudioDecoderClass))
+#define GST_IS_NONSTREAM_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_NONSTREAM_AUDIO_DECODER))
+#define GST_IS_NONSTREAM_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_NONSTREAM_AUDIO_DECODER))
+
+/**
+ * GST_NONSTREAM_AUDIO_DECODER_SINK_NAME:
+ *
+ * The name of the template for the sink pad.
+ */
+#define GST_NONSTREAM_AUDIO_DECODER_SINK_NAME "sink"
+/**
+ * GST_NONSTREAM_AUDIO_DECODER_SRC_NAME:
+ *
+ * The name of the template for the source pad.
+ */
+#define GST_NONSTREAM_AUDIO_DECODER_SRC_NAME "src"
+
+/**
+ * GST_NONSTREAM_AUDIO_DECODER_SINK_PAD:
+ * @obj: base nonstream audio codec instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_NONSTREAM_AUDIO_DECODER_SINK_PAD(obj) (((GstNonstreamAudioDecoder *) (obj))->sinkpad)
+/**
+ * GST_NONSTREAM_AUDIO_DECODER_SRC_PAD:
+ * @obj: base nonstream audio codec instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_NONSTREAM_AUDIO_DECODER_SRC_PAD(obj) (((GstNonstreamAudioDecoder *) (obj))->srcpad)
+
+
+/**
+ * GST_NONSTREAM_AUDIO_DECODER_LOCK_MUTEX:
+ * @obj: base nonstream audio codec instance
+ *
+ * Locks the decoder mutex.
+ *
+ * Internally, the mutex is locked before one of the class vfuncs are
+ * called, when position and duration queries are handled, and when
+ * properties are set/retrieved.
+ *
+ * Derived classes should call lock during decoder related modifications
+ * (for example, setting/clearing filter banks), when at the same time
+ * audio might get decoded. An example are configuration changes that
+ * happen when properties are set. Properties might be set from another
+ * thread, so while the derived decoder is reconfigured, the mutex
+ * should be locked.
+ */
+#define GST_NONSTREAM_AUDIO_DECODER_LOCK_MUTEX(obj) g_mutex_lock(&(((GstNonstreamAudioDecoder *)(obj))->mutex))
+#define GST_NONSTREAM_AUDIO_DECODER_UNLOCK_MUTEX(obj) g_mutex_unlock(&(((GstNonstreamAudioDecoder *)(obj))->mutex))
+
+
+/**
+ * GstNonstreamAudioDecoder:
+ *
+ * The opaque #GstNonstreamAudioDecoder data structure.
+ */
+struct _GstNonstreamAudioDecoder
+{
+ GstElement element;
+
+ /*< protected > */
+
+ /* source and sink pads */
+ GstPad *sinkpad, *srcpad;
+
+ /* loading information */
+ gint64 upstream_size;
+ gboolean loaded_mode;
+ GstAdapter *input_data_adapter;
+
+ /* subsong states */
+ guint current_subsong;
+ GstNonstreamAudioSubsongMode subsong_mode;
+ GstClockTime subsong_duration;
+
+ /* output states */
+ GstNonstreamAudioOutputMode output_mode;
+ gint num_loops;
+ gboolean output_format_changed;
+ GstAudioInfo output_audio_info;
+ /* The difference between these two values is: cur_pos_in_samples is
+ * used for the GstBuffer offsets, while num_decoded_samples is used
+ * for the segment base time values.
+ * cur_pos_in_samples is reset after seeking, looping (when output mode
+ * is LOOPING) and switching subsongs, while num_decoded is only reset
+ * to 0 after a flushing seek (because flushing seeks alter the
+ * pipeline's base_time). */
+ guint64 cur_pos_in_samples, num_decoded_samples;
+ GstSegment cur_segment;
+ gboolean discont;
+
+ /* metadata */
+ GstToc *toc;
+
+ /* allocation */
+ GstAllocator *allocator;
+ GstAllocationParams allocation_params;
+
+ /* thread safety */
+ GMutex mutex;
+};
+
+
+/**
+ * GstNonstreamAudioDecoderClass:
+ * @element_class: The parent class structure
+ * @seek: Optional.
+ * Called when a seek event is received by the parent class.
+ * new_position is a pointer to a GstClockTime integer which
+ * contains a position relative to the current subsong.
+ * Minimum is 0, maximum is the subsong length.
+ * After this function finishes, new_position is set to the
+ * actual new position (which may differ from the request
+ * position, depending on the decoder).
+ * @tell: Optional.
+ * Called when a position query is received by the parent class.
+ * The position that this function returns must be relative to
+ * the current subsong. Thus, the minimum is 0, and the maximum
+ * is the subsong length.
+ * @load_from_buffer: Required if loads_from_sinkpad is set to TRUE (the default value).
+ * Loads the media from the given buffer. The entire media is supplied at once,
+ * so after this call, loading should be finished. This function
+ * can also make use of a suggested initial subsong & subsong mode and initial
+ * playback position (but isn't required to). In case it chooses a different starting
+ * position, the function must pass this position to *initial_position.
+ * The subclass does not have to unref the input buffer; the base class does that
+ * already.
+ * @load_from_custom: Required if loads_from_sinkpad is set to FALSE.
+ * Loads the media in a way defined by the custom sink. Data is not supplied;
+ * the derived class has to handle this on its own. Otherwise, this function is
+ * identical to @load_from_buffer.
+ * @get_main_tags: Optional.
+ * Returns a tag list containing the main song tags, or NULL if there are
+ * no such tags. Returned tags will be unref'd. Use this vfunc instead of
+ * manually pushing a tag event downstream to avoid edge cases where not yet
+ * pushed sticky tag events get overwritten before they are pushed (can for
+ * example happen with decodebin if tags are pushed downstream before the
+ * decodebin pads are linked).
+ * @set_current_subsong: Optional.
+ * Sets the current subsong. This function is allowed to switch to a different
+ * subsong than the required one, and can optionally make use of the suggested initial
+ * position. In case it chooses a different starting position, the function must pass
+ * this position to *initial_position.
+ * This function switches the subsong mode to GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE
+ * automatically.
+ * If this function is implemented by the subclass, @get_current_subsong and
+ * @get_num_subsongs should be implemented as well.
+ * @get_current_subsong: Optional.
+ * Returns the current subsong.
+ * If the current subsong mode is not GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, this
+ * function's return value is undefined.
+ * If this function is implemented by the subclass,
+ * @get_num_subsongs should be implemented as well.
+ * @get_num_subsongs: Optional.
+ * Returns the number of subsongs available.
+ * The return values 0 and 1 have a similar, but distinct, meaning.
+ * If this function returns 0, then this decoder does not support subsongs at all.
+ * @get_current_subsong must then also always return 0. In other words, this function
+ * either never returns 0, or never returns anything else than 0.
+ * A return value of 1 means that the media contains either only one or no subsongs
+ * (the entire song is then considered to be one single subsong). 1 also means that only
+ * this very media has no or just one subsong, and the decoder itself can
+ * support multiple subsongs.
+ * @get_subsong_duration: Optional.
+ * Returns the duration of a subsong. Returns GST_CLOCK_TIME_NONE if duration is unknown.
+ * @get_subsong_tags: Optional.
+ * Returns tags for a subsong, or NULL if there are no tags.
+ * Returned tags will be unref'd.
+ * @set_subsong_mode: Optional.
+ * Sets the current subsong mode. Since this might influence the current playback position,
+ * this function must set the initial_position integer argument to a defined value.
+ * If the playback position is not affected at all, it must be set to GST_CLOCK_TIME_NONE.
+ * If the subsong is restarted after the mode switch, it is recommended to set the value
+ * to the position in the playback right after the switch (or 0 if the subsongs are always
+ * reset back to the beginning).
+ * @set_num_loops: Optional.
+ * Sets the number of loops for playback. If this is called during playback,
+ * the subclass must set any internal loop counters to zero. A loop value of -1
+ * means infinite looping; 0 means no looping; and when the num_loops is greater than 0,
+ * playback should loop exactly num_loops times. If this function is implemented,
+ * @get_num_loops should be implemented as well. The function can ignore the given values
+ * and choose another; however, @get_num_loops should return this other value afterwards.
+ * It is up to the subclass to define where the loop starts and ends. It can mean that only
+ * a subset at the end or in the middle of a song is repeated, for example.
+ * If the current subsong mode is GST_NONSTREAM_AUDIO_SUBSONG_MODE_SINGLE, then the subsong
+ * is repeated this many times. If it is GST_NONSTREAM_AUDIO_SUBSONG_MODE_ALL, then all
+ * subsongs are repeated this many times. With GST_NONSTREAM_AUDIO_SUBSONG_MODE_DECODER_DEFAULT,
+ * the behavior is decoder specific.
+ * @get_num_loops: Optional.
+ * Returns the number of loops for playback.
+ * @get_supported_output_modes: Always required.
+ * Returns a bitmask containing the output modes the subclass supports.
+ * The mask is formed by a bitwise OR combination of integers, which can be calculated
+ * this way: 1 << GST_NONSTREAM_AUDIO_OUTPUT_MODE_<mode> , where mode is either STEADY or LOOPING
+ * @set_output_mode: Optional.
+ * Sets the output mode the subclass has to use. Unlike with most other functions, the subclass
+ * cannot choose a different mode; it must use the requested one.
+ * If the output mode is set to LOOPING, @gst_nonstream_audio_decoder_handle_loop
+ * must be called after playback moved back to the start of a loop.
+ * @decode: Always required.
+ * Allocates an output buffer, fills it with decoded audio samples, and must be passed on to
+ * *buffer . The number of decoded samples must be passed on to *num_samples.
+ * If decoding finishes or the decoding is no longer possible (for example, due to an
+ * unrecoverable error), this function returns FALSE, otherwise TRUE.
+ * @decide_allocation: Optional.
+ * Sets up the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @propose_allocation: Optional.
+ * Proposes buffer allocation parameters for upstream elements.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ *
+ * Subclasses can override any of the available optional virtual methods or not, as
+ * needed. At minimum, @load_from_buffer (or @load_from_custom), @get_supported_output_modes,
+ * and @decode need to be overridden.
+ *
+ * All functions are called with a locked decoder mutex.
+ *
+ * > If GST_ELEMENT_ERROR, GST_ELEMENT_WARNING, or GST_ELEMENT_INFO are called from
+ * > inside one of these functions, it is strongly recommended to unlock the decoder mutex
+ * > before and re-lock it after these macros to prevent potential deadlocks in case the
+ * > application does something with the element when it receives an ERROR/WARNING/INFO
+ * > message. Same goes for gst_element_post_message() calls and non-serialized events.
+ *
+ * By default, this class works by reading media data from the sinkpad, and then commencing
+ * playback. Some decoders cannot be given data from a memory block, so the usual way of
+ * reading all upstream data and passing it to @load_from_buffer doesn't work then. In this case,
+ * set the value of loads_from_sinkpad to FALSE. This changes the way this class operates;
+ * it does not require a sinkpad to exist anymore, and will call @load_from_custom instead.
+ * One example of a decoder where this makes sense is UADE (Unix Amiga Delitracker Emulator).
+ * For some formats (such as TFMX), it needs to do the file loading by itself.
+ * Since most decoders can read input data from a memory block, the default value of
+ * loads_from_sinkpad is TRUE.
+ */
+struct _GstNonstreamAudioDecoderClass
+{
+ GstElementClass element_class;
+
+ gboolean loads_from_sinkpad;
+
+ /*< public > */
+ /* virtual methods for subclasses */
+
+ gboolean (*seek) (GstNonstreamAudioDecoder * dec,
+ GstClockTime * new_position);
+ GstClockTime (*tell) (GstNonstreamAudioDecoder * dec);
+
+ gboolean (*load_from_buffer) (GstNonstreamAudioDecoder * dec,
+ GstBuffer * source_data,
+ guint initial_subsong,
+ GstNonstreamAudioSubsongMode initial_subsong_mode,
+ GstClockTime * initial_position,
+ GstNonstreamAudioOutputMode * initial_output_mode,
+ gint * initial_num_loops);
+ gboolean (*load_from_custom) (GstNonstreamAudioDecoder * dec,
+ guint initial_subsong,
+ GstNonstreamAudioSubsongMode initial_subsong_mode,
+ GstClockTime * initial_position,
+ GstNonstreamAudioOutputMode * initial_output_mode,
+ gint * initial_num_loops);
+
+ GstTagList * (*get_main_tags) (GstNonstreamAudioDecoder * dec);
+
+ gboolean (*set_current_subsong) (GstNonstreamAudioDecoder * dec,
+ guint subsong,
+ GstClockTime * initial_position);
+ guint (*get_current_subsong) (GstNonstreamAudioDecoder * dec);
+
+ guint (*get_num_subsongs) (GstNonstreamAudioDecoder * dec);
+ GstClockTime (*get_subsong_duration) (GstNonstreamAudioDecoder * dec,
+ guint subsong);
+ GstTagList * (*get_subsong_tags) (GstNonstreamAudioDecoder * dec,
+ guint subsong);
+ gboolean (*set_subsong_mode) (GstNonstreamAudioDecoder * dec,
+ GstNonstreamAudioSubsongMode mode,
+ GstClockTime * initial_position);
+
+ gboolean (*set_num_loops) (GstNonstreamAudioDecoder * dec,
+ gint num_loops);
+ gint (*get_num_loops) (GstNonstreamAudioDecoder * dec);
+
+ guint (*get_supported_output_modes) (GstNonstreamAudioDecoder * dec);
+ gboolean (*set_output_mode) (GstNonstreamAudioDecoder * dec,
+ GstNonstreamAudioOutputMode mode,
+ GstClockTime * current_position);
+
+ gboolean (*decode) (GstNonstreamAudioDecoder * dec,
+ GstBuffer ** buffer,
+ guint * num_samples);
+
+ gboolean (*negotiate) (GstNonstreamAudioDecoder * dec);
+
+ gboolean (*decide_allocation) (GstNonstreamAudioDecoder * dec,
+ GstQuery * query);
+ gboolean (*propose_allocation) (GstNonstreamAudioDecoder * dec,
+ GstQuery * query);
+
+ /*< private > */
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+
+GST_AUDIO_BAD_API
+GType gst_nonstream_audio_decoder_get_type (void);
+
+
+GST_AUDIO_BAD_API
+void gst_nonstream_audio_decoder_handle_loop (GstNonstreamAudioDecoder * dec,
+ GstClockTime new_position);
+
+GST_AUDIO_BAD_API
+gboolean gst_nonstream_audio_decoder_set_output_format (GstNonstreamAudioDecoder * dec,
+ GstAudioInfo const *audio_info);
+
+GST_AUDIO_BAD_API
+gboolean gst_nonstream_audio_decoder_set_output_format_simple (GstNonstreamAudioDecoder * dec,
+ guint sample_rate,
+ GstAudioFormat sample_format,
+ guint num_channels);
+
+GST_AUDIO_BAD_API
+void gst_nonstream_audio_decoder_get_downstream_info (GstNonstreamAudioDecoder * dec,
+ GstAudioFormat * format,
+ gint * sample_rate,
+ gint * num_channels);
+
+GST_AUDIO_BAD_API
+GstBuffer *gst_nonstream_audio_decoder_allocate_output_buffer (GstNonstreamAudioDecoder * dec,
+ gsize size);
+
+
+G_END_DECLS
+
+
+#endif /* __GST_NONSTREAM_AUDIO_DECODER_H__ */
diff --git a/include/gst/audio/gstplanaraudioadapter.h b/include/gst/audio/gstplanaraudioadapter.h
new file mode 100644
index 0000000000..0b97b5508d
--- /dev/null
+++ b/include/gst/audio/gstplanaraudioadapter.h
@@ -0,0 +1,116 @@
+/* GStreamer
+ * Copyright (C) 2018 Collabora Ltd.
+ * @author George Kiagiadakis <george.kiagiadakis@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLANAR_AUDIO_ADAPTER_H__
+#define __GST_PLANAR_AUDIO_ADAPTER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Base library from gst-plugins-bad is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/audio-info.h>
+#include <gst/audio/audio-bad-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PLANAR_AUDIO_ADAPTER \
+ (gst_planar_audio_adapter_get_type())
+#define GST_PLANAR_AUDIO_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PLANAR_AUDIO_ADAPTER, GstPlanarAudioAdapter))
+#define GST_PLANAR_AUDIO_ADAPTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PLANAR_AUDIO_ADAPTER, GstPlanarAudioAdapterClass))
+#define GST_PLANAR_AUDIO_ADAPTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLANAR_AUDIO_ADAPTER, GstPlanarAudioAdapterClass))
+#define GST_IS_PLANAR_AUDIO_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PLANAR_AUDIO_ADAPTER))
+#define GST_IS_PLANAR_AUDIO_ADAPTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PLANAR_AUDIO_ADAPTER))
+
+/**
+ * GstPlanarAudioAdapter:
+ *
+ * The opaque #GstPlanarAudioAdapter data structure.
+ */
+typedef struct _GstPlanarAudioAdapter GstPlanarAudioAdapter;
+typedef struct _GstPlanarAudioAdapterClass GstPlanarAudioAdapterClass;
+
+GST_AUDIO_BAD_API
+GType gst_planar_audio_adapter_get_type (void);
+
+GST_AUDIO_BAD_API
+GstPlanarAudioAdapter * gst_planar_audio_adapter_new (void) G_GNUC_MALLOC;
+
+GST_AUDIO_BAD_API
+void gst_planar_audio_adapter_configure (GstPlanarAudioAdapter * adapter,
+ const GstAudioInfo * info);
+
+GST_AUDIO_BAD_API
+void gst_planar_audio_adapter_clear (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+void gst_planar_audio_adapter_push (GstPlanarAudioAdapter * adapter,
+ GstBuffer * buf);
+
+GST_AUDIO_BAD_API
+void gst_planar_audio_adapter_flush (GstPlanarAudioAdapter * adapter,
+ gsize to_flush);
+
+GST_AUDIO_BAD_API
+GstBuffer * gst_planar_audio_adapter_get_buffer (GstPlanarAudioAdapter * adapter,
+ gsize nsamples, GstMapFlags flags);
+
+GST_AUDIO_BAD_API
+GstBuffer * gst_planar_audio_adapter_take_buffer (GstPlanarAudioAdapter * adapter,
+ gsize nsamples, GstMapFlags flags);
+
+GST_AUDIO_BAD_API
+gsize gst_planar_audio_adapter_available (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+guint64 gst_planar_audio_adapter_distance_from_discont (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+guint64 gst_planar_audio_adapter_offset_at_discont (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+GstClockTime gst_planar_audio_adapter_pts_at_discont (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+GstClockTime gst_planar_audio_adapter_dts_at_discont (GstPlanarAudioAdapter * adapter);
+
+GST_AUDIO_BAD_API
+guint64 gst_planar_audio_adapter_prev_offset (GstPlanarAudioAdapter * adapter,
+ guint64 * distance);
+
+GST_AUDIO_BAD_API
+GstClockTime gst_planar_audio_adapter_prev_pts (GstPlanarAudioAdapter * adapter,
+ guint64 * distance);
+
+GST_AUDIO_BAD_API
+GstClockTime gst_planar_audio_adapter_prev_dts (GstPlanarAudioAdapter * adapter,
+ guint64 * distance);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlanarAudioAdapter, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PLANAR_AUDIO_ADAPTER_H__ */
diff --git a/include/gst/audio/streamvolume.h b/include/gst/audio/streamvolume.h
new file mode 100644
index 0000000000..2af4291aad
--- /dev/null
+++ b/include/gst/audio/streamvolume.h
@@ -0,0 +1,80 @@
+/* GStreamer StreamVolume
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_STREAM_VOLUME_H__
+#define __GST_STREAM_VOLUME_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_STREAM_VOLUME (gst_stream_volume_get_type ())
+GST_AUDIO_API
+G_DECLARE_INTERFACE (GstStreamVolume, gst_stream_volume, GST, STREAM_VOLUME,
+ GObject)
+
+#define GST_STREAM_VOLUME_GET_INTERFACE(obj) GST_STREAM_VOLUME_GET_IFACE(obj)
+
+struct _GstStreamVolumeInterface {
+ GTypeInterface iface;
+};
+
+/**
+ * GstStreamVolumeFormat:
+ * @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100%
+ * @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale
+ * @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power)
+ *
+ * Different representations of a stream volume. gst_stream_volume_convert_volume()
+ * allows to convert between the different representations.
+ *
+ * Formulas to convert from a linear to a cubic or dB volume are
+ * cbrt(val) and 20 * log10 (val).
+ */
+typedef enum {
+ GST_STREAM_VOLUME_FORMAT_LINEAR = 0,
+ GST_STREAM_VOLUME_FORMAT_CUBIC,
+ GST_STREAM_VOLUME_FORMAT_DB
+} GstStreamVolumeFormat;
+
+GST_AUDIO_API
+void gst_stream_volume_set_volume (GstStreamVolume *volume,
+ GstStreamVolumeFormat format,
+ gdouble val);
+
+GST_AUDIO_API
+gdouble gst_stream_volume_get_volume (GstStreamVolume *volume,
+ GstStreamVolumeFormat format);
+
+GST_AUDIO_API
+void gst_stream_volume_set_mute (GstStreamVolume *volume,
+ gboolean mute);
+
+GST_AUDIO_API
+gboolean gst_stream_volume_get_mute (GstStreamVolume *volume);
+
+GST_AUDIO_API
+gdouble gst_stream_volume_convert_volume (GstStreamVolumeFormat from,
+ GstStreamVolumeFormat to,
+ gdouble val) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GST_STREAM_VOLUME_H__ */
diff --git a/include/gst/base/base-prelude.h b/include/gst/base/base-prelude.h
new file mode 100644
index 0000000000..87defde34e
--- /dev/null
+++ b/include/gst/base/base-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Base Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * base-prelude.h: prelude include header for gst-base library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_PRELUDE_H__
+#define __GST_BASE_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_BASE_API
+#ifdef BUILDING_GST_BASE
+#define GST_BASE_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_BASE_API GST_API_IMPORT
+#endif
+#endif
+
+#endif /* __GST_BASE_PRELUDE_H__ */
diff --git a/include/gst/base/base.h b/include/gst/base/base.h
new file mode 100644
index 0000000000..5ad42c11b2
--- /dev/null
+++ b/include/gst/base/base.h
@@ -0,0 +1,44 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * base.h: single include header for gst-base library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_H__
+#define __GST_BASE_H__
+
+#include <gst/base/base-prelude.h>
+
+#include <gst/base/gstadapter.h>
+#include <gst/base/gstaggregator.h>
+#include <gst/base/gstbaseparse.h>
+#include <gst/base/gstbasesink.h>
+#include <gst/base/gstbasesrc.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/base/gstbitreader.h>
+#include <gst/base/gstbitwriter.h>
+#include <gst/base/gstbytereader.h>
+#include <gst/base/gstbytewriter.h>
+#include <gst/base/gstcollectpads.h>
+#include <gst/base/gstdataqueue.h>
+#include <gst/base/gstflowcombiner.h>
+#include <gst/base/gstpushsrc.h>
+#include <gst/base/gstqueuearray.h>
+#include <gst/base/gsttypefindhelper.h>
+
+#endif /* __GST_BASE_H__ */
diff --git a/include/gst/base/gstadapter.h b/include/gst/base/gstadapter.h
new file mode 100644
index 0000000000..3945085a49
--- /dev/null
+++ b/include/gst/base/gstadapter.h
@@ -0,0 +1,149 @@
+/* GStreamer
+ * Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_ADAPTER_H__
+#define __GST_ADAPTER_H__
+
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+
+#define GST_TYPE_ADAPTER \
+ (gst_adapter_get_type())
+#define GST_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ADAPTER, GstAdapter))
+#define GST_ADAPTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ADAPTER, GstAdapterClass))
+#define GST_ADAPTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ADAPTER, GstAdapterClass))
+#define GST_IS_ADAPTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ADAPTER))
+#define GST_IS_ADAPTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ADAPTER))
+
+/**
+ * GstAdapter:
+ *
+ * The opaque #GstAdapter data structure.
+ */
+typedef struct _GstAdapter GstAdapter;
+typedef struct _GstAdapterClass GstAdapterClass;
+
+GST_BASE_API
+GType gst_adapter_get_type (void);
+
+GST_BASE_API
+GstAdapter * gst_adapter_new (void) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_adapter_clear (GstAdapter *adapter);
+
+GST_BASE_API
+void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
+
+GST_BASE_API
+gconstpointer gst_adapter_map (GstAdapter *adapter, gsize size);
+
+GST_BASE_API
+void gst_adapter_unmap (GstAdapter *adapter);
+
+GST_BASE_API
+void gst_adapter_copy (GstAdapter *adapter, gpointer dest,
+ gsize offset, gsize size);
+GST_BASE_API
+GBytes * gst_adapter_copy_bytes (GstAdapter *adapter,
+ gsize offset, gsize size);
+GST_BASE_API
+void gst_adapter_flush (GstAdapter *adapter, gsize flush);
+
+GST_BASE_API
+gpointer gst_adapter_take (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBuffer* gst_adapter_take_buffer (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GList* gst_adapter_take_list (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBuffer * gst_adapter_take_buffer_fast (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBufferList * gst_adapter_take_buffer_list (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBuffer* gst_adapter_get_buffer (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GList* gst_adapter_get_list (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBuffer * gst_adapter_get_buffer_fast (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+GstBufferList * gst_adapter_get_buffer_list (GstAdapter *adapter, gsize nbytes);
+
+GST_BASE_API
+gsize gst_adapter_available (GstAdapter *adapter);
+
+GST_BASE_API
+gsize gst_adapter_available_fast (GstAdapter *adapter);
+
+GST_BASE_API
+GstClockTime gst_adapter_prev_pts (GstAdapter *adapter, guint64 *distance);
+
+GST_BASE_API
+GstClockTime gst_adapter_prev_dts (GstAdapter *adapter, guint64 *distance);
+
+GST_BASE_API
+GstClockTime gst_adapter_prev_pts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance);
+
+GST_BASE_API
+GstClockTime gst_adapter_prev_dts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance);
+
+GST_BASE_API
+guint64 gst_adapter_prev_offset (GstAdapter *adapter, guint64 *distance);
+
+GST_BASE_API
+GstClockTime gst_adapter_pts_at_discont (GstAdapter *adapter);
+
+GST_BASE_API
+GstClockTime gst_adapter_dts_at_discont (GstAdapter *adapter);
+
+GST_BASE_API
+guint64 gst_adapter_offset_at_discont (GstAdapter *adapter);
+
+GST_BASE_API
+guint64 gst_adapter_distance_from_discont (GstAdapter *adapter);
+
+GST_BASE_API
+gssize gst_adapter_masked_scan_uint32 (GstAdapter * adapter, guint32 mask,
+ guint32 pattern, gsize offset, gsize size);
+GST_BASE_API
+gssize gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
+ guint32 pattern, gsize offset, gsize size, guint32 * value);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAdapter, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_ADAPTER_H__ */
diff --git a/include/gst/base/gstaggregator.h b/include/gst/base/gstaggregator.h
new file mode 100644
index 0000000000..45ced12d39
--- /dev/null
+++ b/include/gst/base/gstaggregator.h
@@ -0,0 +1,462 @@
+/* GStreamer aggregator base class
+ * Copyright (C) 2014 Mathieu Duponchelle <mathieu.duponchelle@oencreed.com>
+ * Copyright (C) 2014 Thibault Saunier <tsaunier@gnome.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AGGREGATOR_H__
+#define __GST_AGGREGATOR_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+/**************************
+ * GstAggregator Structs *
+ *************************/
+
+typedef struct _GstAggregator GstAggregator;
+typedef struct _GstAggregatorPrivate GstAggregatorPrivate;
+typedef struct _GstAggregatorClass GstAggregatorClass;
+
+/************************
+ * GstAggregatorPad API *
+ ***********************/
+
+#define GST_TYPE_AGGREGATOR_PAD (gst_aggregator_pad_get_type())
+#define GST_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPad))
+#define GST_AGGREGATOR_PAD_CAST(obj) ((GstAggregatorPad *)(obj))
+#define GST_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPadClass))
+#define GST_AGGREGATOR_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPadClass))
+#define GST_IS_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR_PAD))
+#define GST_IS_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR_PAD))
+
+/****************************
+ * GstAggregatorPad Structs *
+ ***************************/
+
+typedef struct _GstAggregatorPad GstAggregatorPad;
+typedef struct _GstAggregatorPadClass GstAggregatorPadClass;
+typedef struct _GstAggregatorPadPrivate GstAggregatorPadPrivate;
+
+/**
+ * GstAggregatorPad:
+ * @segment: last segment received.
+ *
+ * The implementation the GstPad to use with #GstAggregator
+ *
+ * Since: 1.14
+ */
+struct _GstAggregatorPad
+{
+ GstPad parent;
+
+ /*< public >*/
+ /* Protected by the OBJECT_LOCK */
+ GstSegment segment;
+
+ /* < private > */
+ GstAggregatorPadPrivate * priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAggregatorPadClass:
+ * @flush: Optional
+ * Called when the pad has received a flush stop, this is the place
+ * to flush any information specific to the pad, it allows for individual
+ * pads to be flushed while others might not be.
+ * @skip_buffer: Optional
+ * Called before input buffers are queued in the pad, return %TRUE
+ * if the buffer should be skipped.
+ *
+ * Since: 1.14
+ */
+struct _GstAggregatorPadClass
+{
+ GstPadClass parent_class;
+
+ GstFlowReturn (*flush) (GstAggregatorPad * aggpad, GstAggregator * aggregator);
+ gboolean (*skip_buffer) (GstAggregatorPad * aggpad, GstAggregator * aggregator, GstBuffer * buffer);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_BASE_API
+GType gst_aggregator_pad_get_type (void);
+
+/****************************
+ * GstAggregatorPad methods *
+ ***************************/
+
+GST_BASE_API
+GstBuffer * gst_aggregator_pad_pop_buffer (GstAggregatorPad * pad);
+
+GST_BASE_API
+GstBuffer * gst_aggregator_pad_peek_buffer (GstAggregatorPad * pad);
+
+GST_BASE_API
+gboolean gst_aggregator_pad_drop_buffer (GstAggregatorPad * pad);
+
+GST_BASE_API
+gboolean gst_aggregator_pad_has_buffer (GstAggregatorPad * pad);
+
+GST_BASE_API
+gboolean gst_aggregator_pad_is_eos (GstAggregatorPad * pad);
+
+GST_BASE_API
+gboolean gst_aggregator_pad_is_inactive (GstAggregatorPad * pad);
+
+/*********************
+ * GstAggregator API *
+ ********************/
+
+#define GST_TYPE_AGGREGATOR (gst_aggregator_get_type())
+#define GST_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR,GstAggregator))
+#define GST_AGGREGATOR_CAST(obj) ((GstAggregator *)(obj))
+#define GST_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR,GstAggregatorClass))
+#define GST_AGGREGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AGGREGATOR,GstAggregatorClass))
+#define GST_IS_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR))
+#define GST_IS_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR))
+
+#define GST_AGGREGATOR_FLOW_NEED_DATA GST_FLOW_CUSTOM_ERROR
+
+/**
+ * GstAggregator:
+ * @srcpad: the aggregator's source pad
+ *
+ * Aggregator base class object structure.
+ *
+ * Since: 1.14
+ */
+struct _GstAggregator
+{
+ GstElement parent;
+
+ /*< public >*/
+ GstPad * srcpad;
+
+ /*< private >*/
+ GstAggregatorPrivate * priv;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstAggregatorClass:
+ * @flush: Optional.
+ * Called after a successful flushing seek, once all the flush
+ * stops have been received. Flush pad-specific data in
+ * #GstAggregatorPad->flush.
+ * @clip: Optional.
+ * Called when a buffer is received on a sink pad, the task of
+ * clipping it and translating it to the current segment falls
+ * on the subclass. The function should use the segment of data
+ * and the negotiated media type on the pad to perform
+ * clipping of input buffer. This function takes ownership of
+ * buf and should output a buffer or return NULL in
+ * if the buffer should be dropped.
+ * @finish_buffer: Optional.
+ * Called when a subclass calls gst_aggregator_finish_buffer()
+ * from their aggregate function to push out a buffer.
+ * Subclasses can override this to modify or decorate buffers
+ * before they get pushed out. This function takes ownership
+ * of the buffer passed. Subclasses that override this method
+ * should always chain up to the parent class virtual method.
+ * @sink_event: Optional.
+ * Called when an event is received on a sink pad, the subclass
+ * should always chain up.
+ * @sink_query: Optional.
+ * Called when a query is received on a sink pad, the subclass
+ * should always chain up.
+ * @src_event: Optional.
+ * Called when an event is received on the src pad, the subclass
+ * should always chain up.
+ * @src_query: Optional.
+ * Called when a query is received on the src pad, the subclass
+ * should always chain up.
+ * @src_activate: Optional.
+ * Called when the src pad is activated, it will start/stop its
+ * pad task right after that call.
+ * @aggregate: Mandatory.
+ * Called when buffers are queued on all sinkpads. Classes
+ * should iterate the GstElement->sinkpads and peek or steal
+ * buffers from the #GstAggregatorPads. If the subclass returns
+ * GST_FLOW_EOS, sending of the eos event will be taken care
+ * of. Once / if a buffer has been constructed from the
+ * aggregated buffers, the subclass should call _finish_buffer.
+ * @stop: Optional.
+ * Called when the element goes from PAUSED to READY.
+ * The subclass should free all resources and reset its state.
+ * @start: Optional.
+ * Called when the element goes from READY to PAUSED.
+ * The subclass should get ready to process
+ * aggregated buffers.
+ * @get_next_time: Optional.
+ * Called when the element needs to know the running time of the next
+ * rendered buffer for live pipelines. This causes deadline
+ * based aggregation to occur. Defaults to returning
+ * GST_CLOCK_TIME_NONE causing the element to wait for buffers
+ * on all sink pads before aggregating.
+ * @create_new_pad: Optional.
+ * Called when a new pad needs to be created. Allows subclass that
+ * don't have a single sink pad template to provide a pad based
+ * on the provided information.
+ * @update_src_caps: Lets subclasses update the #GstCaps representing
+ * the src pad caps before usage. The result should end up
+ * in @ret. Return %GST_AGGREGATOR_FLOW_NEED_DATA to indicate that the
+ * element needs more information (caps, a buffer, etc) to
+ * choose the correct caps. Should return ANY caps if the
+ * stream has not caps at all.
+ * @fixate_src_caps: Optional.
+ * Fixate and return the src pad caps provided. The function takes
+ * ownership of @caps and returns a fixated version of
+ * @caps. @caps is not guaranteed to be writable.
+ * @negotiated_src_caps: Optional.
+ * Notifies subclasses what caps format has been negotiated
+ * @decide_allocation: Optional.
+ * Allows the subclass to influence the allocation choices.
+ * Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * @propose_allocation: Optional.
+ * Allows the subclass to handle the allocation query from upstream.
+ * @negotiate: Optional.
+ * Negotiate the caps with the peer (Since: 1.18).
+ * @sink_event_pre_queue: Optional.
+ * Called when an event is received on a sink pad before queueing up
+ * serialized events. The subclass should always chain up (Since: 1.18).
+ * @sink_query_pre_queue: Optional.
+ * Called when a query is received on a sink pad before queueing up
+ * serialized queries. The subclass should always chain up (Since: 1.18).
+ *
+ * The aggregator base class will handle in a thread-safe way all manners of
+ * concurrent flushes, seeks, pad additions and removals, leaving to the
+ * subclass the responsibility of clipping buffers, and aggregating buffers in
+ * the way the implementor sees fit.
+ *
+ * It will also take care of event ordering (stream-start, segment, eos).
+ *
+ * Basically, a simple implementation will override @aggregate, and call
+ * _finish_buffer from inside that function.
+ *
+ * Since: 1.14
+ */
+struct _GstAggregatorClass {
+ GstElementClass parent_class;
+
+ GstFlowReturn (*flush) (GstAggregator * aggregator);
+
+ GstBuffer * (*clip) (GstAggregator * aggregator,
+ GstAggregatorPad * aggregator_pad,
+ GstBuffer * buf);
+
+ GstFlowReturn (*finish_buffer) (GstAggregator * aggregator,
+ GstBuffer * buffer);
+
+ /* sinkpads virtual methods */
+ gboolean (*sink_event) (GstAggregator * aggregator,
+ GstAggregatorPad * aggregator_pad,
+ GstEvent * event);
+
+ gboolean (*sink_query) (GstAggregator * aggregator,
+ GstAggregatorPad * aggregator_pad,
+ GstQuery * query);
+
+ /* srcpad virtual methods */
+ gboolean (*src_event) (GstAggregator * aggregator,
+ GstEvent * event);
+
+ gboolean (*src_query) (GstAggregator * aggregator,
+ GstQuery * query);
+
+ gboolean (*src_activate) (GstAggregator * aggregator,
+ GstPadMode mode,
+ gboolean active);
+
+ GstFlowReturn (*aggregate) (GstAggregator * aggregator,
+ gboolean timeout);
+
+ gboolean (*stop) (GstAggregator * aggregator);
+
+ gboolean (*start) (GstAggregator * aggregator);
+
+ GstClockTime (*get_next_time) (GstAggregator * aggregator);
+
+ GstAggregatorPad * (*create_new_pad) (GstAggregator * self,
+ GstPadTemplate * templ,
+ const gchar * req_name,
+ const GstCaps * caps);
+
+ /**
+ * GstAggregatorClass::update_src_caps:
+ * @ret: (out) (allow-none):
+ */
+ GstFlowReturn (*update_src_caps) (GstAggregator * self,
+ GstCaps * caps,
+ GstCaps ** ret);
+ GstCaps * (*fixate_src_caps) (GstAggregator * self,
+ GstCaps * caps);
+ gboolean (*negotiated_src_caps) (GstAggregator * self,
+ GstCaps * caps);
+ gboolean (*decide_allocation) (GstAggregator * self,
+ GstQuery * query);
+ gboolean (*propose_allocation) (GstAggregator * self,
+ GstAggregatorPad * pad,
+ GstQuery * decide_query,
+ GstQuery * query);
+
+ gboolean (*negotiate) (GstAggregator * self);
+
+ GstFlowReturn (*sink_event_pre_queue) (GstAggregator * aggregator,
+ GstAggregatorPad * aggregator_pad,
+ GstEvent * event);
+
+ gboolean (*sink_query_pre_queue) (GstAggregator * aggregator,
+ GstAggregatorPad * aggregator_pad,
+ GstQuery * query);
+
+ /**
+ * GstAggregatorClass::finish_buffer_list:
+ *
+ * Optional. Equivalent of #GstAggregatorClass::finish_buffer for
+ * buffer lists.
+ *
+ * Since: 1.18
+ */
+ GstFlowReturn (*finish_buffer_list) (GstAggregator * aggregator,
+ GstBufferList * bufferlist);
+ /**
+ * GstAggregatorClass::peek_next_sample:
+ *
+ * See gst_aggregator_peek_next_sample().
+ *
+ * Since: 1.18
+ */
+ GstSample * (*peek_next_sample) (GstAggregator *aggregator,
+ GstAggregatorPad * aggregator_pad);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-5];
+};
+
+/************************************
+ * GstAggregator convenience macros *
+ ***********************************/
+
+/**
+ * GST_AGGREGATOR_SRC_PAD:
+ * @agg: a #GstAggregator
+ *
+ * Convenience macro to access the source pad of #GstAggregator
+ *
+ * Since: 1.6
+ */
+#define GST_AGGREGATOR_SRC_PAD(agg) (((GstAggregator *)(agg))->srcpad)
+
+/*************************
+ * GstAggregator methods *
+ ************************/
+
+GST_BASE_API
+GstFlowReturn gst_aggregator_finish_buffer (GstAggregator * aggregator,
+ GstBuffer * buffer);
+
+GST_BASE_API
+GstFlowReturn gst_aggregator_finish_buffer_list (GstAggregator * aggregator,
+ GstBufferList * bufferlist);
+
+GST_BASE_API
+void gst_aggregator_set_src_caps (GstAggregator * self,
+ GstCaps * caps);
+
+GST_BASE_API
+gboolean gst_aggregator_negotiate (GstAggregator * self);
+
+GST_BASE_API
+void gst_aggregator_set_latency (GstAggregator * self,
+ GstClockTime min_latency,
+ GstClockTime max_latency);
+
+GST_BASE_API
+GType gst_aggregator_get_type(void);
+
+GST_BASE_API
+GstClockTime gst_aggregator_get_latency (GstAggregator * self);
+
+GST_BASE_API
+GstBufferPool * gst_aggregator_get_buffer_pool (GstAggregator * self);
+
+GST_BASE_API
+void gst_aggregator_get_allocator (GstAggregator * self,
+ GstAllocator ** allocator,
+ GstAllocationParams * params);
+
+GST_BASE_API
+GstClockTime gst_aggregator_simple_get_next_time (GstAggregator * self);
+
+GST_BASE_API
+void gst_aggregator_update_segment (GstAggregator * self,
+ const GstSegment * segment);
+
+GST_BASE_API
+GstSample * gst_aggregator_peek_next_sample (GstAggregator *self,
+ GstAggregatorPad * pad);
+
+GST_BASE_API
+void gst_aggregator_selected_samples (GstAggregator * self,
+ GstClockTime pts,
+ GstClockTime dts,
+ GstClockTime duration,
+ GstStructure * info);
+
+GST_BASE_API
+void gst_aggregator_set_ignore_inactive_pads (GstAggregator * self,
+ gboolean ignore);
+
+GST_BASE_API
+gboolean gst_aggregator_get_ignore_inactive_pads (GstAggregator * self);
+
+/**
+ * GstAggregatorStartTimeSelection:
+ * @GST_AGGREGATOR_START_TIME_SELECTION_ZERO: Start at running time 0.
+ * @GST_AGGREGATOR_START_TIME_SELECTION_FIRST: Start at the running time of
+ * the first buffer that is received.
+ * @GST_AGGREGATOR_START_TIME_SELECTION_SET: Start at the running time
+ * selected by the `start-time` property.
+ *
+ * Since: 1.18
+ */
+typedef enum
+{
+ GST_AGGREGATOR_START_TIME_SELECTION_ZERO,
+ GST_AGGREGATOR_START_TIME_SELECTION_FIRST,
+ GST_AGGREGATOR_START_TIME_SELECTION_SET
+} GstAggregatorStartTimeSelection;
+
+GST_BASE_API
+GType gst_aggregator_start_time_selection_get_type (void);
+
+G_END_DECLS
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAggregator, gst_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAggregatorPad, gst_object_unref)
+
+#endif /* __GST_AGGREGATOR_H__ */
diff --git a/include/gst/base/gstbaseparse.h b/include/gst/base/gstbaseparse.h
new file mode 100644
index 0000000000..06e4409505
--- /dev/null
+++ b/include/gst/base/gstbaseparse.h
@@ -0,0 +1,385 @@
+/* GStreamer
+ * Copyright (C) 2008 Nokia Corporation. All rights reserved.
+ *
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_PARSE_H__
+#define __GST_BASE_PARSE_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BASE_PARSE (gst_base_parse_get_type())
+#define GST_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_PARSE,GstBaseParse))
+#define GST_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_PARSE,GstBaseParseClass))
+#define GST_BASE_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_PARSE,GstBaseParseClass))
+#define GST_IS_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_PARSE))
+#define GST_IS_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_PARSE))
+#define GST_BASE_PARSE_CAST(obj) ((GstBaseParse *)(obj))
+
+/**
+ * GST_BASE_PARSE_SRC_PAD:
+ * @obj: base parse instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_BASE_PARSE_SRC_PAD(obj) (GST_BASE_PARSE_CAST (obj)->srcpad)
+
+/**
+ * GST_BASE_PARSE_SINK_PAD:
+ * @obj: base parse instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_BASE_PARSE_SINK_PAD(obj) (GST_BASE_PARSE_CAST (obj)->sinkpad)
+
+/**
+ * GST_BASE_PARSE_FLOW_DROPPED:
+ *
+ * A #GstFlowReturn that can be returned from
+ * #GstBaseParseClass::handle_frame to indicate that no output buffer was
+ * generated, or from #GstBaseParseClass::pre_push_frame to to forego
+ * pushing buffer.
+ */
+#define GST_BASE_PARSE_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
+
+/* not public API, use accessor macros below */
+#define GST_BASE_PARSE_FLAG_LOST_SYNC (1 << 0)
+#define GST_BASE_PARSE_FLAG_DRAINING (1 << 1)
+
+/**
+ * GST_BASE_PARSE_LOST_SYNC:
+ * @parse: base parse instance
+ *
+ * Obtains current sync status.
+ */
+#define GST_BASE_PARSE_LOST_SYNC(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_LOST_SYNC))
+
+/**
+ * GST_BASE_PARSE_DRAINING:
+ * @parse: base parse instance
+ *
+ * Obtains current drain status (ie. whether EOS has been received and
+ * the parser is now processing the frames at the end of the stream)
+ */
+#define GST_BASE_PARSE_DRAINING(parse) (!!(GST_BASE_PARSE_CAST(parse)->flags & GST_BASE_PARSE_FLAG_DRAINING))
+
+/**
+ * GstBaseParseFrameFlags:
+ * @GST_BASE_PARSE_FRAME_FLAG_NONE: no flag
+ * @GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME: set by baseclass if current frame
+ * is passed for processing to the subclass for the first time
+ * (and not set on subsequent calls with same data).
+ * @GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: set to indicate this buffer should not be
+ * counted as frame, e.g. if this frame is dependent on a previous one.
+ * As it is not counted as a frame, bitrate increases but frame to time
+ * conversions are maintained.
+ * @GST_BASE_PARSE_FRAME_FLAG_CLIP: @pre_push_frame can set this to indicate
+ * that regular segment clipping can still be performed (as opposed to
+ * any custom one having been done).
+ * @GST_BASE_PARSE_FRAME_FLAG_DROP: indicates to @finish_frame that the
+ * the frame should be dropped (and might be handled internally by subclass)
+ * @GST_BASE_PARSE_FRAME_FLAG_QUEUE: indicates to @finish_frame that the
+ * the frame should be queued for now and processed fully later
+ * when the first non-queued frame is finished
+ *
+ * Flags to be used in a #GstBaseParseFrame.
+ */
+typedef enum {
+ GST_BASE_PARSE_FRAME_FLAG_NONE = 0,
+ GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME = (1 << 0),
+ GST_BASE_PARSE_FRAME_FLAG_NO_FRAME = (1 << 1),
+ GST_BASE_PARSE_FRAME_FLAG_CLIP = (1 << 2),
+ GST_BASE_PARSE_FRAME_FLAG_DROP = (1 << 3),
+ GST_BASE_PARSE_FRAME_FLAG_QUEUE = (1 << 4)
+} GstBaseParseFrameFlags;
+
+/**
+ * GstBaseParseFrame:
+ * @buffer: input data to be parsed for frames.
+ * @out_buffer: output data.
+ * @offset: media specific offset of input frame
+ * Note that a converter may have a different one on the frame's buffer.
+ * @overhead: subclass can set this to indicates the metadata overhead
+ * for the given frame, which is then used to enable more accurate bitrate
+ * computations. If this is -1, it is assumed that this frame should be
+ * skipped in bitrate calculation.
+ * @flags: a combination of input and output #GstBaseParseFrameFlags that
+ * convey additional context to subclass or allow subclass to tune
+ * subsequent #GstBaseParse actions.
+ *
+ * Frame (context) data passed to each frame parsing virtual methods. In
+ * addition to providing the data to be checked for a valid frame or an already
+ * identified frame, it conveys additional metadata or control information
+ * from and to the subclass w.r.t. the particular frame in question (rather
+ * than global parameters). Some of these may apply to each parsing stage, others
+ * only to some a particular one. These parameters are effectively zeroed at start
+ * of each frame's processing, i.e. parsing virtual method invocation sequence.
+ */
+typedef struct {
+ GstBuffer * buffer;
+ GstBuffer * out_buffer;
+ guint flags;
+ guint64 offset;
+ gint overhead;
+ /*< private >*/
+ gint size;
+ guint _gst_reserved_i[2];
+ gpointer _gst_reserved_p[2];
+ guint _private_flags;
+} GstBaseParseFrame;
+
+typedef struct _GstBaseParse GstBaseParse;
+typedef struct _GstBaseParseClass GstBaseParseClass;
+typedef struct _GstBaseParsePrivate GstBaseParsePrivate;
+
+/**
+ * GstBaseParse:
+ * @element: the parent element.
+ *
+ * The opaque #GstBaseParse data structure.
+ */
+struct _GstBaseParse {
+ /*< public >*/
+ GstElement element;
+
+ /*< protected >*/
+ /* source and sink pads */
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ guint flags;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment segment;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+ GstBaseParsePrivate *priv;
+};
+
+/**
+ * GstBaseParseClass:
+ * @parent_class: the parent class
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_sink_caps: Optional.
+ * Allows the subclass to be notified of the actual caps set.
+ * @get_sink_caps: Optional.
+ * Allows the subclass to do its own sink get caps if needed.
+ * @handle_frame: Parses the input data into valid frames as defined by subclass
+ * which should be passed to gst_base_parse_finish_frame().
+ * The frame's input buffer is guaranteed writable,
+ * whereas the input frame ownership is held by caller
+ * (so subclass should make a copy if it needs to hang on).
+ * Input buffer (data) is provided by baseclass with as much
+ * metadata set as possible by baseclass according to upstream
+ * information and/or subclass settings,
+ * though subclass may still set buffer timestamp and duration
+ * if desired.
+ * @convert: Optional.
+ * Convert between formats.
+ * @sink_event: Optional.
+ * Event handler on the sink pad. This function should chain
+ * up to the parent implementation to let the default handler
+ * run.
+ * @src_event: Optional.
+ * Event handler on the source pad. Should chain up to the
+ * parent to let the default handler run.
+ * @pre_push_frame: Optional.
+ * Called just prior to pushing a frame (after any pending
+ * events have been sent) to give subclass a chance to perform
+ * additional actions at this time (e.g. tag sending) or to
+ * decide whether this buffer should be dropped or not
+ * (e.g. custom segment clipping).
+ * @detect: Optional.
+ * Called until it doesn't return GST_FLOW_OK anymore for
+ * the first buffers. Can be used by the subclass to detect
+ * the stream format.
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should chain
+ * up to the parent implementation to let the default handler
+ * run (Since: 1.2)
+ * @src_query: Optional.
+ * Query handler on the source pad. Should chain up to the
+ * parent to let the default handler run (Since: 1.2)
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @handle_frame needs to be overridden.
+ */
+struct _GstBaseParseClass {
+ GstElementClass parent_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ gboolean (*start) (GstBaseParse * parse);
+
+ gboolean (*stop) (GstBaseParse * parse);
+
+ gboolean (*set_sink_caps) (GstBaseParse * parse,
+ GstCaps * caps);
+
+ /**
+ * GstBaseParseClass::handle_frame:
+ * @skipsize: (out):
+ *
+ * Parses the input data into valid frames as defined by subclass
+ * which should be passed to gst_base_parse_finish_frame().
+ * The frame's input buffer is guaranteed writable,
+ * whereas the input frame ownership is held by caller
+ * (so subclass should make a copy if it needs to hang on).
+ * Input buffer (data) is provided by baseclass with as much
+ * metadata set as possible by baseclass according to upstream
+ * information and/or subclass settings,
+ * though subclass may still set buffer timestamp and duration
+ * if desired.
+ */
+ GstFlowReturn (*handle_frame) (GstBaseParse * parse,
+ GstBaseParseFrame * frame,
+ gint * skipsize);
+
+ GstFlowReturn (*pre_push_frame) (GstBaseParse * parse,
+ GstBaseParseFrame * frame);
+
+ gboolean (*convert) (GstBaseParse * parse,
+ GstFormat src_format,
+ gint64 src_value,
+ GstFormat dest_format,
+ gint64 * dest_value);
+
+ gboolean (*sink_event) (GstBaseParse * parse,
+ GstEvent * event);
+
+ gboolean (*src_event) (GstBaseParse * parse,
+ GstEvent * event);
+
+ GstCaps * (*get_sink_caps) (GstBaseParse * parse,
+ GstCaps * filter);
+
+ GstFlowReturn (*detect) (GstBaseParse * parse,
+ GstBuffer * buffer);
+
+ gboolean (*sink_query) (GstBaseParse * parse,
+ GstQuery * query);
+
+ gboolean (*src_query) (GstBaseParse * parse,
+ GstQuery * query);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE - 2];
+};
+
+GST_BASE_API
+GType gst_base_parse_get_type (void);
+
+GST_BASE_API
+GType gst_base_parse_frame_get_type (void);
+
+GST_BASE_API
+GstBaseParseFrame * gst_base_parse_frame_new (GstBuffer * buffer,
+ GstBaseParseFrameFlags flags,
+ gint overhead);
+GST_BASE_API
+void gst_base_parse_frame_init (GstBaseParseFrame * frame);
+
+GST_BASE_API
+GstBaseParseFrame * gst_base_parse_frame_copy (GstBaseParseFrame * frame);
+GST_BASE_API
+void gst_base_parse_frame_free (GstBaseParseFrame * frame);
+
+GST_BASE_API
+GstFlowReturn gst_base_parse_push_frame (GstBaseParse * parse,
+ GstBaseParseFrame * frame);
+GST_BASE_API
+GstFlowReturn gst_base_parse_finish_frame (GstBaseParse * parse,
+ GstBaseParseFrame * frame,
+ gint size);
+GST_BASE_API
+void gst_base_parse_set_duration (GstBaseParse * parse,
+ GstFormat fmt,
+ gint64 duration,
+ gint interval);
+GST_BASE_API
+void gst_base_parse_set_average_bitrate (GstBaseParse * parse,
+ guint bitrate);
+GST_BASE_API
+void gst_base_parse_set_min_frame_size (GstBaseParse * parse,
+ guint min_size);
+GST_BASE_API
+void gst_base_parse_set_has_timing_info (GstBaseParse * parse,
+ gboolean has_timing);
+GST_BASE_API
+void gst_base_parse_drain (GstBaseParse * parse);
+
+GST_BASE_API
+void gst_base_parse_set_syncable (GstBaseParse * parse,
+ gboolean syncable);
+GST_BASE_API
+void gst_base_parse_set_passthrough (GstBaseParse * parse,
+ gboolean passthrough);
+GST_BASE_API
+void gst_base_parse_set_pts_interpolation (GstBaseParse * parse,
+ gboolean pts_interpolate);
+GST_BASE_API
+void gst_base_parse_set_infer_ts (GstBaseParse * parse,
+ gboolean infer_ts);
+GST_BASE_API
+void gst_base_parse_set_frame_rate (GstBaseParse * parse,
+ guint fps_num,
+ guint fps_den,
+ guint lead_in,
+ guint lead_out);
+GST_BASE_API
+void gst_base_parse_set_latency (GstBaseParse * parse,
+ GstClockTime min_latency,
+ GstClockTime max_latency);
+GST_BASE_API
+gboolean gst_base_parse_convert_default (GstBaseParse * parse,
+ GstFormat src_format,
+ gint64 src_value,
+ GstFormat dest_format,
+ gint64 * dest_value);
+GST_BASE_API
+gboolean gst_base_parse_add_index_entry (GstBaseParse * parse,
+ guint64 offset,
+ GstClockTime ts,
+ gboolean key,
+ gboolean force);
+GST_BASE_API
+void gst_base_parse_set_ts_at_offset (GstBaseParse *parse,
+ gsize offset);
+GST_BASE_API
+void gst_base_parse_merge_tags (GstBaseParse * parse,
+ GstTagList * tags,
+ GstTagMergeMode mode);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseParseFrame, gst_base_parse_frame_free)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseParse, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BASE_PARSE_H__ */
diff --git a/include/gst/base/gstbasesink.h b/include/gst/base/gstbasesink.h
new file mode 100644
index 0000000000..e68560c6f5
--- /dev/null
+++ b/include/gst/base/gstbasesink.h
@@ -0,0 +1,345 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstbasesink.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_SINK_H__
+#define __GST_BASE_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+
+#define GST_TYPE_BASE_SINK (gst_base_sink_get_type())
+#define GST_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SINK,GstBaseSink))
+#define GST_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SINK,GstBaseSinkClass))
+#define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
+#define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
+#define GST_IS_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
+#define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
+
+/**
+ * GST_BASE_SINK_PAD:
+ * @obj: base sink instance
+ *
+ * Gives the pointer to the #GstPad object of the element.
+ */
+#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
+
+#define GST_BASE_SINK_GET_PREROLL_LOCK(obj) (&GST_BASE_SINK_CAST(obj)->preroll_lock)
+#define GST_BASE_SINK_PREROLL_LOCK(obj) (g_mutex_lock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
+#define GST_BASE_SINK_PREROLL_TRYLOCK(obj) (g_mutex_trylock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
+#define GST_BASE_SINK_PREROLL_UNLOCK(obj) (g_mutex_unlock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
+
+#define GST_BASE_SINK_GET_PREROLL_COND(obj) (&GST_BASE_SINK_CAST(obj)->preroll_cond)
+#define GST_BASE_SINK_PREROLL_WAIT(obj) \
+ g_cond_wait (GST_BASE_SINK_GET_PREROLL_COND (obj), GST_BASE_SINK_GET_PREROLL_LOCK (obj))
+#define GST_BASE_SINK_PREROLL_WAIT_UNTIL(obj, end_time) \
+ g_cond_wait_until (GST_BASE_SINK_GET_PREROLL_COND (obj), GST_BASE_SINK_GET_PREROLL_LOCK (obj), end_time)
+#define GST_BASE_SINK_PREROLL_SIGNAL(obj) g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (obj));
+#define GST_BASE_SINK_PREROLL_BROADCAST(obj) g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (obj));
+
+typedef struct _GstBaseSink GstBaseSink;
+typedef struct _GstBaseSinkClass GstBaseSinkClass;
+typedef struct _GstBaseSinkPrivate GstBaseSinkPrivate;
+
+/**
+ * GstBaseSink:
+ *
+ * The opaque #GstBaseSink data structure.
+ */
+struct _GstBaseSink {
+ GstElement element;
+
+ /*< protected >*/
+ GstPad *sinkpad;
+ GstPadMode pad_mode;
+
+ /*< protected >*/ /* with LOCK */
+ guint64 offset;
+ gboolean can_activate_pull;
+ gboolean can_activate_push;
+
+ /*< protected >*/ /* with PREROLL_LOCK */
+ GMutex preroll_lock;
+ GCond preroll_cond;
+ gboolean eos;
+ gboolean need_preroll;
+ gboolean have_preroll;
+ gboolean playing_async;
+
+ /*< protected >*/ /* with STREAM_LOCK */
+ gboolean have_newsegment;
+ GstSegment segment;
+
+ /*< private >*/ /* with LOCK */
+ GstClockID clock_id;
+ gboolean sync;
+ gboolean flushing;
+ gboolean running;
+
+ gint64 max_lateness;
+
+ /*< private >*/
+ GstBaseSinkPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstBaseSinkClass:
+ * @parent_class: Element parent class
+ * @get_caps: Called to get sink pad caps from the subclass
+ * @set_caps: Notify subclass of changed caps
+ * @fixate: Only useful in pull mode. Implement if you have
+ * ideas about what should be the default values for the caps you support.
+ * @activate_pull: Subclasses should override this when they can provide an
+ * alternate method of spawning a thread to drive the pipeline in pull mode.
+ * Should start or stop the pulling thread, depending on the value of the
+ * "active" argument. Called after actually activating the sink pad in pull
+ * mode. The default implementation starts a task on the sink pad.
+ * @get_times: Called to get the start and end times for synchronising
+ * the passed buffer to the clock
+ * @propose_allocation: configure the allocation query
+ * @start: Start processing. Ideal for opening resources in the subclass
+ * @stop: Stop processing. Subclasses should use this to close resources.
+ * @unlock: Unlock any pending access to the resource. Subclasses should
+ * unblock any blocked function ASAP and call gst_base_sink_wait_preroll()
+ * @unlock_stop: Clear the previous unlock request. Subclasses should clear
+ * any state they set during #GstBaseSinkClass::unlock, and be ready to
+ * continue where they left off after gst_base_sink_wait_preroll(),
+ * gst_base_sink_wait() or gst_wait_sink_wait_clock() return or
+ * #GstBaseSinkClass::render is called again.
+ * @query: perform a #GstQuery on the element.
+ * @event: Override this to handle events arriving on the sink pad
+ * @wait_event: Override this to implement custom logic to wait for the event
+ * time (for events like EOS and GAP). Subclasses should always first
+ * chain up to the default implementation.
+ * @prepare: Called to prepare the buffer for @render and @preroll. This
+ * function is called before synchronisation is performed.
+ * @prepare_list: Called to prepare the buffer list for @render_list. This
+ * function is called before synchronisation is performed.
+ * @preroll: Called to present the preroll buffer if desired.
+ * @render: Called when a buffer should be presented or output, at the
+ * correct moment if the #GstBaseSink has been set to sync to the clock.
+ * @render_list: Same as @render but used with buffer lists instead of
+ * buffers.
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At the minimum, the @render method should be overridden to
+ * output/present buffers.
+ */
+struct _GstBaseSinkClass {
+ GstElementClass parent_class;
+
+ /**
+ * GstBaseSink::get_caps:
+ * @filter: (in) (nullable):
+ *
+ * Called to get sink pad caps from the subclass.
+ */
+ GstCaps* (*get_caps) (GstBaseSink *sink, GstCaps *filter);
+ /* notify subclass of new caps */
+ gboolean (*set_caps) (GstBaseSink *sink, GstCaps *caps);
+
+ /* fixate sink caps during pull-mode negotiation */
+ GstCaps * (*fixate) (GstBaseSink *sink, GstCaps *caps);
+ /* start or stop a pulling thread */
+ gboolean (*activate_pull)(GstBaseSink *sink, gboolean active);
+
+ /**
+ * GstBaseSink::get_times:
+ * @start: (out): the start #GstClockTime
+ * @end: (out): the end #GstClockTime
+ *
+ * Get the start and end times for syncing on this buffer.
+ */
+ void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
+ GstClockTime *start, GstClockTime *end);
+
+ /* propose allocation parameters for upstream */
+ gboolean (*propose_allocation) (GstBaseSink *sink, GstQuery *query);
+
+ /* start and stop processing, ideal for opening/closing the resource */
+ gboolean (*start) (GstBaseSink *sink);
+ gboolean (*stop) (GstBaseSink *sink);
+
+ /* unlock any pending access to the resource. subclasses should unlock
+ * any function ASAP. */
+ gboolean (*unlock) (GstBaseSink *sink);
+ /* Clear a previously indicated unlock request not that unlocking is
+ * complete. Sub-classes should clear any command queue or indicator they
+ * set during unlock */
+ gboolean (*unlock_stop) (GstBaseSink *sink);
+
+ /* notify subclass of query */
+ gboolean (*query) (GstBaseSink *sink, GstQuery *query);
+
+ /* notify subclass of event */
+ gboolean (*event) (GstBaseSink *sink, GstEvent *event);
+ /* wait for eos or gap, subclasses should chain up to parent first */
+ GstFlowReturn (*wait_event) (GstBaseSink *sink, GstEvent *event);
+
+ /* notify subclass of buffer or list before doing sync */
+ GstFlowReturn (*prepare) (GstBaseSink *sink, GstBuffer *buffer);
+ GstFlowReturn (*prepare_list) (GstBaseSink *sink, GstBufferList *buffer_list);
+
+ /* notify subclass of preroll buffer or real buffer */
+ GstFlowReturn (*preroll) (GstBaseSink *sink, GstBuffer *buffer);
+ GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
+ /* Render a BufferList */
+ GstFlowReturn (*render_list) (GstBaseSink *sink, GstBufferList *buffer_list);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_BASE_API
+GType gst_base_sink_get_type (void);
+
+GST_BASE_API
+GstFlowReturn gst_base_sink_do_preroll (GstBaseSink *sink, GstMiniObject *obj);
+
+GST_BASE_API
+GstFlowReturn gst_base_sink_wait_preroll (GstBaseSink *sink);
+
+/* synchronizing against the clock */
+
+GST_BASE_API
+void gst_base_sink_set_sync (GstBaseSink *sink, gboolean sync);
+
+GST_BASE_API
+gboolean gst_base_sink_get_sync (GstBaseSink *sink);
+
+/* Drop buffers which are out of segment */
+
+GST_BASE_API
+void gst_base_sink_set_drop_out_of_segment (GstBaseSink *sink, gboolean drop_out_of_segment);
+
+GST_BASE_API
+gboolean gst_base_sink_get_drop_out_of_segment (GstBaseSink *sink);
+
+/* dropping late buffers */
+
+GST_BASE_API
+void gst_base_sink_set_max_lateness (GstBaseSink *sink, gint64 max_lateness);
+
+GST_BASE_API
+gint64 gst_base_sink_get_max_lateness (GstBaseSink *sink);
+
+/* performing QoS */
+
+GST_BASE_API
+void gst_base_sink_set_qos_enabled (GstBaseSink *sink, gboolean enabled);
+
+GST_BASE_API
+gboolean gst_base_sink_is_qos_enabled (GstBaseSink *sink);
+
+/* doing async state changes */
+
+GST_BASE_API
+void gst_base_sink_set_async_enabled (GstBaseSink *sink, gboolean enabled);
+
+GST_BASE_API
+gboolean gst_base_sink_is_async_enabled (GstBaseSink *sink);
+
+/* tuning synchronisation */
+
+GST_BASE_API
+void gst_base_sink_set_ts_offset (GstBaseSink *sink, GstClockTimeDiff offset);
+
+GST_BASE_API
+GstClockTimeDiff gst_base_sink_get_ts_offset (GstBaseSink *sink);
+
+/* last sample */
+
+GST_BASE_API
+GstSample * gst_base_sink_get_last_sample (GstBaseSink *sink);
+
+GST_BASE_API
+void gst_base_sink_set_last_sample_enabled (GstBaseSink *sink, gboolean enabled);
+
+GST_BASE_API
+gboolean gst_base_sink_is_last_sample_enabled (GstBaseSink *sink);
+
+/* latency */
+
+GST_BASE_API
+gboolean gst_base_sink_query_latency (GstBaseSink *sink, gboolean *live, gboolean *upstream_live,
+ GstClockTime *min_latency, GstClockTime *max_latency);
+GST_BASE_API
+GstClockTime gst_base_sink_get_latency (GstBaseSink *sink);
+
+/* render delay */
+
+GST_BASE_API
+void gst_base_sink_set_render_delay (GstBaseSink *sink, GstClockTime delay);
+
+GST_BASE_API
+GstClockTime gst_base_sink_get_render_delay (GstBaseSink *sink);
+
+/* blocksize */
+
+GST_BASE_API
+void gst_base_sink_set_blocksize (GstBaseSink *sink, guint blocksize);
+
+GST_BASE_API
+guint gst_base_sink_get_blocksize (GstBaseSink *sink);
+
+/* throttle-time */
+
+GST_BASE_API
+void gst_base_sink_set_throttle_time (GstBaseSink *sink, guint64 throttle);
+
+GST_BASE_API
+guint64 gst_base_sink_get_throttle_time (GstBaseSink *sink);
+
+/* max-bitrate */
+
+GST_BASE_API
+void gst_base_sink_set_max_bitrate (GstBaseSink *sink, guint64 max_bitrate);
+
+GST_BASE_API
+guint64 gst_base_sink_get_max_bitrate (GstBaseSink *sink);
+
+/* processing deadline */
+GST_BASE_API
+void gst_base_sink_set_processing_deadline (GstBaseSink *sink, GstClockTime processing_deadline);
+
+GST_BASE_API
+GstClockTime gst_base_sink_get_processing_deadline (GstBaseSink *sink);
+
+GST_BASE_API
+GstClockReturn gst_base_sink_wait_clock (GstBaseSink *sink, GstClockTime time,
+ GstClockTimeDiff * jitter);
+GST_BASE_API
+GstFlowReturn gst_base_sink_wait (GstBaseSink *sink, GstClockTime time,
+ GstClockTimeDiff *jitter);
+
+GST_BASE_API
+GstStructure *gst_base_sink_get_stats (GstBaseSink * sink);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseSink, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BASE_SINK_H__ */
diff --git a/include/gst/base/gstbasesrc.h b/include/gst/base/gstbasesrc.h
new file mode 100644
index 0000000000..38c3ef3d8e
--- /dev/null
+++ b/include/gst/base/gstbasesrc.h
@@ -0,0 +1,346 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstbasesrc.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_SRC_H__
+#define __GST_BASE_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BASE_SRC (gst_base_src_get_type())
+#define GST_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SRC,GstBaseSrc))
+#define GST_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SRC,GstBaseSrcClass))
+#define GST_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SRC, GstBaseSrcClass))
+#define GST_IS_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SRC))
+#define GST_IS_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SRC))
+#define GST_BASE_SRC_CAST(obj) ((GstBaseSrc *)(obj))
+
+/**
+ * GstBaseSrcFlags:
+ * @GST_BASE_SRC_FLAG_STARTING: has source is starting
+ * @GST_BASE_SRC_FLAG_STARTED: has source been started
+ * @GST_BASE_SRC_FLAG_LAST: offset to define more flags
+ *
+ * The #GstElement flags that a basesrc element may have.
+ */
+typedef enum {
+ GST_BASE_SRC_FLAG_STARTING = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_BASE_SRC_FLAG_STARTED = (GST_ELEMENT_FLAG_LAST << 1),
+ /* padding */
+ GST_BASE_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 6)
+} GstBaseSrcFlags;
+
+#define GST_BASE_SRC_IS_STARTING(obj) GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTING)
+#define GST_BASE_SRC_IS_STARTED(obj) GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTED)
+
+typedef struct _GstBaseSrc GstBaseSrc;
+typedef struct _GstBaseSrcClass GstBaseSrcClass;
+typedef struct _GstBaseSrcPrivate GstBaseSrcPrivate;
+
+/**
+ * GST_BASE_SRC_PAD:
+ * @obj: base source instance
+ *
+ * Gives the pointer to the #GstPad object of the element.
+ */
+#define GST_BASE_SRC_PAD(obj) (GST_BASE_SRC_CAST (obj)->srcpad)
+
+
+/**
+ * GstBaseSrc:
+ *
+ * The opaque #GstBaseSrc data structure.
+ */
+struct _GstBaseSrc {
+ GstElement element;
+
+ /*< protected >*/
+ GstPad *srcpad;
+
+ /* available to subclass implementations */
+ /* MT-protected (with LIVE_LOCK) */
+ GMutex live_lock;
+ GCond live_cond;
+ gboolean is_live;
+ gboolean live_running;
+
+ /* MT-protected (with LOCK) */
+ guint blocksize; /* size of buffers when operating push based */
+ gboolean can_activate_push; /* some scheduling properties */
+ gboolean random_access;
+
+ GstClockID clock_id; /* for syncing */
+
+ /* MT-protected (with STREAM_LOCK *and* OBJECT_LOCK) */
+ GstSegment segment;
+ /* MT-protected (with STREAM_LOCK) */
+ gboolean need_newsegment;
+
+ gint num_buffers;
+ gint num_buffers_left;
+
+#ifndef GST_REMOVE_DEPRECATED
+ gboolean typefind; /* unused */
+#endif
+
+ gboolean running;
+ GstEvent *pending_seek;
+
+ GstBaseSrcPrivate *priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstBaseSrcClass:
+ * @parent_class: Element parent class
+ * @get_caps: Called to get the caps to report
+ * @negotiate: Negotiated the caps with the peer.
+ * @fixate: Called during negotiation if caps need fixating. Implement instead of
+ * setting a fixate function on the source pad.
+ * @set_caps: Notify subclass of changed output caps
+ * @decide_allocation: configure the allocation query
+ * @start: Start processing. Subclasses should open resources and prepare
+ * to produce data. Implementation should call gst_base_src_start_complete()
+ * when the operation completes, either from the current thread or any other
+ * thread that finishes the start operation asynchronously.
+ * @stop: Stop processing. Subclasses should use this to close resources.
+ * @get_times: Given a buffer, return the start and stop time when it
+ * should be pushed out. The base class will sync on the clock using
+ * these times.
+ * @get_size: Return the total size of the resource, in the format set by
+ * gst_base_src_set_format().
+ * @is_seekable: Check if the source can seek
+ * @prepare_seek_segment: Prepare the #GstSegment that will be passed to the
+ * #GstBaseSrcClass::do_seek vmethod for executing a seek
+ * request. Sub-classes should override this if they support seeking in
+ * formats other than the configured native format. By default, it tries to
+ * convert the seek arguments to the configured native format and prepare a
+ * segment in that format.
+ * @do_seek: Perform seeking on the resource to the indicated segment.
+ * @unlock: Unlock any pending access to the resource. Subclasses should unblock
+ * any blocked function ASAP. In particular, any `create()` function in
+ * progress should be unblocked and should return GST_FLOW_FLUSHING. Any
+ * future #GstBaseSrcClass::create function call should also return
+ * GST_FLOW_FLUSHING until the #GstBaseSrcClass::unlock_stop function has
+ * been called.
+ * @unlock_stop: Clear the previous unlock request. Subclasses should clear any
+ * state they set during #GstBaseSrcClass::unlock, such as clearing command
+ * queues.
+ * @query: Handle a requested query.
+ * @event: Override this to implement custom event handling.
+ * @create: Ask the subclass to create a buffer with offset and size. When the
+ * subclass returns GST_FLOW_OK, it MUST return a buffer of the requested size
+ * unless fewer bytes are available because an EOS condition is near. No
+ * buffer should be returned when the return value is different from
+ * GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the end of
+ * stream is reached. The default implementation will call
+ * #GstBaseSrcClass::alloc and then call #GstBaseSrcClass::fill.
+ * @alloc: Ask the subclass to allocate a buffer with for offset and size. The
+ * default implementation will create a new buffer from the negotiated allocator.
+ * @fill: Ask the subclass to fill the buffer with data for offset and size. The
+ * passed buffer is guaranteed to hold the requested amount of bytes.
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At the minimum, the @create method should be overridden to produce
+ * buffers.
+ */
+struct _GstBaseSrcClass {
+ GstElementClass parent_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ /**
+ * GstBaseSrcClass::get_caps:
+ * @filter: (in) (nullable):
+ *
+ * Called to get the caps to report.
+ */
+ GstCaps* (*get_caps) (GstBaseSrc *src, GstCaps *filter);
+ /* decide on caps */
+ gboolean (*negotiate) (GstBaseSrc *src);
+ /* called if, in negotiation, caps need fixating */
+ GstCaps * (*fixate) (GstBaseSrc *src, GstCaps *caps);
+ /* notify the subclass of new caps */
+ gboolean (*set_caps) (GstBaseSrc *src, GstCaps *caps);
+
+ /* setup allocation query */
+ gboolean (*decide_allocation) (GstBaseSrc *src, GstQuery *query);
+
+ /* start and stop processing, ideal for opening/closing the resource */
+ gboolean (*start) (GstBaseSrc *src);
+ gboolean (*stop) (GstBaseSrc *src);
+
+ /**
+ * GstBaseSrcClass::get_times:
+ * @start: (out):
+ * @end: (out):
+ *
+ * Given @buffer, return @start and @end time when it should be pushed
+ * out. The base class will sync on the clock using these times.
+ */
+ void (*get_times) (GstBaseSrc *src, GstBuffer *buffer,
+ GstClockTime *start, GstClockTime *end);
+
+ /**
+ * GstBaseSrcClass::get_size:
+ * @size: (out):
+ *
+ * Get the total size of the resource in the format set by
+ * gst_base_src_set_format().
+ *
+ * Returns: %TRUE if the size is available and has been set.
+ */
+ gboolean (*get_size) (GstBaseSrc *src, guint64 *size);
+
+ /* check if the resource is seekable */
+ gboolean (*is_seekable) (GstBaseSrc *src);
+
+ /* Prepare the segment on which to perform do_seek(), converting to the
+ * current basesrc format. */
+ gboolean (*prepare_seek_segment) (GstBaseSrc *src, GstEvent *seek,
+ GstSegment *segment);
+ /* notify subclasses of a seek */
+ gboolean (*do_seek) (GstBaseSrc *src, GstSegment *segment);
+
+ /* unlock any pending access to the resource. subclasses should unlock
+ * any function ASAP. */
+ gboolean (*unlock) (GstBaseSrc *src);
+ /* Clear any pending unlock request, as we succeeded in unlocking */
+ gboolean (*unlock_stop) (GstBaseSrc *src);
+
+ /* notify subclasses of a query */
+ gboolean (*query) (GstBaseSrc *src, GstQuery *query);
+
+ /* notify subclasses of an event */
+ gboolean (*event) (GstBaseSrc *src, GstEvent *event);
+
+ /**
+ * GstBaseSrcClass::create:
+ * @buf: (inout):
+ *
+ * Ask the subclass to create a buffer with @offset and @size, the default
+ * implementation will call alloc if no allocated @buf is provided and then call fill.
+ */
+ GstFlowReturn (*create) (GstBaseSrc *src, guint64 offset, guint size,
+ GstBuffer **buf);
+ /**
+ * GstBaseSrcClass::alloc:
+ * @buf: (out):
+ *
+ * Ask the subclass to allocate an output buffer with @offset and @size, the default
+ * implementation will use the negotiated allocator.
+ */
+ GstFlowReturn (*alloc) (GstBaseSrc *src, guint64 offset, guint size,
+ GstBuffer **buf);
+ /* ask the subclass to fill the buffer with data from offset and size */
+ GstFlowReturn (*fill) (GstBaseSrc *src, guint64 offset, guint size,
+ GstBuffer *buf);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_BASE_API
+GType gst_base_src_get_type (void);
+
+GST_BASE_API
+GstFlowReturn gst_base_src_wait_playing (GstBaseSrc *src);
+
+GST_BASE_API
+void gst_base_src_set_live (GstBaseSrc *src, gboolean live);
+
+GST_BASE_API
+gboolean gst_base_src_is_live (GstBaseSrc *src);
+
+GST_BASE_API
+void gst_base_src_set_format (GstBaseSrc *src, GstFormat format);
+
+GST_BASE_API
+void gst_base_src_set_dynamic_size (GstBaseSrc * src, gboolean dynamic);
+
+GST_BASE_API
+void gst_base_src_set_automatic_eos (GstBaseSrc * src, gboolean automatic_eos);
+
+GST_BASE_API
+void gst_base_src_set_async (GstBaseSrc *src, gboolean async);
+
+GST_BASE_API
+gboolean gst_base_src_is_async (GstBaseSrc *src);
+
+GST_BASE_API
+gboolean gst_base_src_negotiate (GstBaseSrc *src);
+
+GST_BASE_API
+void gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret);
+
+GST_BASE_API
+GstFlowReturn gst_base_src_start_wait (GstBaseSrc * basesrc);
+
+GST_BASE_API
+gboolean gst_base_src_query_latency (GstBaseSrc *src, gboolean * live,
+ GstClockTime * min_latency,
+ GstClockTime * max_latency);
+GST_BASE_API
+void gst_base_src_set_blocksize (GstBaseSrc *src, guint blocksize);
+
+GST_BASE_API
+guint gst_base_src_get_blocksize (GstBaseSrc *src);
+
+GST_BASE_API
+void gst_base_src_set_do_timestamp (GstBaseSrc *src, gboolean timestamp);
+
+GST_BASE_API
+gboolean gst_base_src_get_do_timestamp (GstBaseSrc *src);
+
+GST_BASE_API
+gboolean gst_base_src_new_seamless_segment (GstBaseSrc *src, gint64 start, gint64 stop, gint64 time);
+
+GST_BASE_API
+gboolean gst_base_src_new_segment (GstBaseSrc *src,
+ const GstSegment * segment);
+
+GST_BASE_API
+gboolean gst_base_src_set_caps (GstBaseSrc *src, GstCaps *caps);
+
+GST_BASE_API
+GstBufferPool * gst_base_src_get_buffer_pool (GstBaseSrc *src);
+
+GST_BASE_API
+void gst_base_src_get_allocator (GstBaseSrc *src,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+
+GST_BASE_API
+void gst_base_src_submit_buffer_list (GstBaseSrc * src,
+ GstBufferList * buffer_list);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BASE_SRC_H__ */
diff --git a/include/gst/base/gstbasetransform.h b/include/gst/base/gstbasetransform.h
new file mode 100644
index 0000000000..0457b89bb2
--- /dev/null
+++ b/include/gst/base/gstbasetransform.h
@@ -0,0 +1,372 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_TRANSFORM_H__
+#define __GST_BASE_TRANSFORM_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BASE_TRANSFORM (gst_base_transform_get_type())
+#define GST_BASE_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransform))
+#define GST_BASE_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass))
+#define GST_BASE_TRANSFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass))
+#define GST_IS_BASE_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM))
+#define GST_IS_BASE_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM))
+#define GST_BASE_TRANSFORM_CAST(obj) ((GstBaseTransform *)(obj))
+
+/**
+ * GST_BASE_TRANSFORM_SINK_NAME:
+ *
+ * The name of the templates for the sink pad.
+ */
+#define GST_BASE_TRANSFORM_SINK_NAME "sink"
+/**
+ * GST_BASE_TRANSFORM_SRC_NAME:
+ *
+ * The name of the templates for the source pad.
+ */
+#define GST_BASE_TRANSFORM_SRC_NAME "src"
+
+/**
+ * GST_BASE_TRANSFORM_SRC_PAD:
+ * @obj: base transform instance
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_BASE_TRANSFORM_SRC_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->srcpad)
+
+/**
+ * GST_BASE_TRANSFORM_SINK_PAD:
+ * @obj: base transform instance
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_BASE_TRANSFORM_SINK_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->sinkpad)
+
+/**
+ * GST_BASE_TRANSFORM_FLOW_DROPPED:
+ *
+ * A #GstFlowReturn that can be returned from transform and transform_ip to
+ * indicate that no output buffer was generated.
+ */
+#define GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
+
+typedef struct _GstBaseTransform GstBaseTransform;
+typedef struct _GstBaseTransformClass GstBaseTransformClass;
+typedef struct _GstBaseTransformPrivate GstBaseTransformPrivate;
+
+/**
+ * GstBaseTransform:
+ *
+ * The opaque #GstBaseTransform data structure.
+ */
+struct _GstBaseTransform {
+ GstElement element;
+
+ /*< protected >*/
+ /* source and sink pads */
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* MT-protected (with STREAM_LOCK) */
+ gboolean have_segment;
+ GstSegment segment;
+ /* Default submit_input_buffer places the buffer here,
+ * for consumption by the generate_output method: */
+ GstBuffer *queued_buf;
+
+ /*< private >*/
+ GstBaseTransformPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE-1];
+};
+
+/**
+ * GstBaseTransformClass:
+ * @parent_class: Element parent class
+ * @passthrough_on_same_caps: If set to %TRUE, passthrough mode will be
+ * automatically enabled if the caps are the same.
+ * Set to %FALSE by default.
+ * @transform_ip_on_passthrough: If set to %TRUE, @transform_ip will be called in
+ * passthrough mode. The passed buffer might not be
+ * writable. When %FALSE, neither @transform nor
+ * @transform_ip will be called in passthrough mode.
+ * Set to %TRUE by default.
+ * @transform_caps: Optional. Given the pad in this direction and the given
+ * caps, what caps are allowed on the other pad in this
+ * element ?
+ * @fixate_caps: Optional. Given the pad in this direction and the given
+ * caps, fixate the caps on the other pad. The function takes
+ * ownership of @othercaps and returns a fixated version of
+ * @othercaps. @othercaps is not guaranteed to be writable.
+ * @accept_caps: Optional.
+ * Subclasses can override this method to check if @caps can be
+ * handled by the element. The default implementation might not be
+ * the most optimal way to check this in all cases.
+ * @set_caps: Allows the subclass to be notified of the actual caps set.
+ * @query: Optional.
+ * Handle a requested query. Subclasses that implement this
+ * must chain up to the parent if they didn't handle the
+ * query
+ * @decide_allocation: Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query. This function is only called
+ * when not operating in passthrough mode. The default
+ * implementation will remove all memory dependent metadata.
+ * If there is a @filter_meta method implementation, it will
+ * be called for all metadata API in the downstream query,
+ * otherwise the metadata API is removed.
+ * @filter_meta: Return %TRUE if the metadata API should be proposed in the
+ * upstream allocation query. The default implementation is %NULL
+ * and will cause all metadata to be removed.
+ * @propose_allocation: Propose buffer allocation parameters for upstream elements.
+ * This function must be implemented if the element reads or
+ * writes the buffer content. The query that was passed to
+ * the decide_allocation is passed in this method (or %NULL
+ * when the element is in passthrough mode). The default
+ * implementation will pass the query downstream when in
+ * passthrough mode and will copy all the filtered metadata
+ * API in non-passthrough mode.
+ * @transform_size: Optional. Given the size of a buffer in the given direction
+ * with the given caps, calculate the size in bytes of a buffer
+ * on the other pad with the given other caps.
+ * The default implementation uses get_unit_size and keeps
+ * the number of units the same.
+ * @get_unit_size: Required if the transform is not in-place.
+ * Get the size in bytes of one unit for the given caps.
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @sink_event: Optional.
+ * Event handler on the sink pad. The default implementation
+ * handles the event and forwards it downstream.
+ * @src_event: Optional.
+ * Event handler on the source pad. The default implementation
+ * handles the event and forwards it upstream.
+ * @prepare_output_buffer: Optional.
+ * Subclasses can override this to do their own
+ * allocation of output buffers. Elements that only do
+ * analysis can return a subbuffer or even just
+ * return a reference to the input buffer (if in
+ * passthrough mode). The default implementation will
+ * use the negotiated allocator or bufferpool and
+ * transform_size to allocate an output buffer or it
+ * will return the input buffer in passthrough mode.
+ * @copy_metadata: Optional.
+ * Copy the metadata from the input buffer to the output buffer.
+ * The default implementation will copy the flags, timestamps and
+ * offsets of the buffer.
+ * @transform_meta: Optional. Transform the metadata on the input buffer to the
+ * output buffer. By default this method copies all meta without
+ * tags. Subclasses can implement this method and return %TRUE if
+ * the metadata is to be copied.
+ * @before_transform: Optional.
+ * This method is called right before the base class will
+ * start processing. Dynamic properties or other delayed
+ * configuration could be performed in this method.
+ * @transform: Required if the element does not operate in-place.
+ * Transforms one incoming buffer to one outgoing buffer.
+ * The function is allowed to change size/timestamp/duration
+ * of the outgoing buffer.
+ * @transform_ip: Required if the element operates in-place.
+ * Transform the incoming buffer in-place.
+ * @submit_input_buffer: Function which accepts a new input buffer and pre-processes it.
+ * The default implementation performs caps (re)negotiation, then
+ * QoS if needed, and places the input buffer into the @queued_buf
+ * member variable. If the buffer is dropped due to QoS, it returns
+ * GST_BASE_TRANSFORM_FLOW_DROPPED. If this input buffer is not
+ * contiguous with any previous input buffer, then @is_discont
+ * is set to %TRUE. (Since: 1.6)
+ * @generate_output: Called after each new input buffer is submitted repeatedly
+ * until it either generates an error or fails to generate an output
+ * buffer. The default implementation takes the contents of the
+ * @queued_buf variable, generates an output buffer if needed
+ * by calling the class @prepare_output_buffer, and then
+ * calls either @transform or @transform_ip. Elements that don't
+ * do 1-to-1 transformations of input to output buffers can either
+ * return GST_BASE_TRANSFORM_FLOW_DROPPED or simply not generate
+ * an output buffer until they are ready to do so. (Since: 1.6)
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum either @transform or @transform_ip need to be overridden.
+ * If the element can overwrite the input data with the results (data is of the
+ * same type and quantity) it should provide @transform_ip.
+ */
+struct _GstBaseTransformClass {
+ GstElementClass parent_class;
+
+ /*< public >*/
+ gboolean passthrough_on_same_caps;
+ gboolean transform_ip_on_passthrough;
+
+ /* virtual methods for subclasses */
+ GstCaps* (*transform_caps) (GstBaseTransform *trans,
+ GstPadDirection direction,
+ GstCaps *caps, GstCaps *filter);
+ /**
+ * GstBaseTransformClass::fixate_caps:
+ * @othercaps: (transfer full):
+ */
+ GstCaps* (*fixate_caps) (GstBaseTransform *trans,
+ GstPadDirection direction, GstCaps *caps,
+ GstCaps *othercaps);
+ gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
+ GstCaps *caps);
+ gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
+ GstCaps *outcaps);
+ gboolean (*query) (GstBaseTransform *trans, GstPadDirection direction,
+ GstQuery *query);
+
+ /* decide allocation query for output buffers */
+ gboolean (*decide_allocation) (GstBaseTransform *trans, GstQuery *query);
+ gboolean (*filter_meta) (GstBaseTransform *trans, GstQuery *query,
+ GType api, const GstStructure *params);
+
+ /* propose allocation query parameters for input buffers */
+ gboolean (*propose_allocation) (GstBaseTransform *trans, GstQuery *decide_query,
+ GstQuery *query);
+
+ /**
+ * GstBaseTransformClass::transform_size:
+ * @othersize: (out):
+ */
+ gboolean (*transform_size) (GstBaseTransform *trans,
+ GstPadDirection direction,
+ GstCaps *caps, gsize size,
+ GstCaps *othercaps, gsize *othersize);
+
+ /**
+ * GstBaseTransformClass::get_unit_size:
+ * @size: (out):
+ */
+ gboolean (*get_unit_size) (GstBaseTransform *trans, GstCaps *caps,
+ gsize *size);
+
+ /* states */
+ gboolean (*start) (GstBaseTransform *trans);
+ gboolean (*stop) (GstBaseTransform *trans);
+
+ /* sink and src pad event handlers */
+ /**
+ * GstBaseTransformClass::sink_event:
+ * @event: (transfer full):
+ */
+ gboolean (*sink_event) (GstBaseTransform *trans, GstEvent *event);
+ /**
+ * GstBaseTransformClass::src_event:
+ * @event: (transfer full):
+ */
+ gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
+
+ /**
+ * GstBaseTransformClass::prepare_output_buffer:
+ * @outbuf: (out):
+ */
+ GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
+ GstBuffer *input, GstBuffer **outbuf);
+
+ /* metadata */
+ gboolean (*copy_metadata) (GstBaseTransform *trans, GstBuffer *input,
+ GstBuffer *outbuf);
+ gboolean (*transform_meta) (GstBaseTransform *trans, GstBuffer *outbuf,
+ GstMeta *meta, GstBuffer *inbuf);
+
+ void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);
+
+ /* transform */
+ GstFlowReturn (*transform) (GstBaseTransform *trans, GstBuffer *inbuf,
+ GstBuffer *outbuf);
+ GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
+
+ GstFlowReturn (*submit_input_buffer) (GstBaseTransform *trans, gboolean is_discont, GstBuffer *input);
+
+ /**
+ * GstBaseTransformClass::generate_output:
+ * @outbuf: (out):
+ */
+ GstFlowReturn (*generate_output) (GstBaseTransform *trans, GstBuffer **outbuf);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE - 2];
+};
+
+GST_BASE_API
+GType gst_base_transform_get_type (void);
+
+GST_BASE_API
+void gst_base_transform_set_passthrough (GstBaseTransform *trans,
+ gboolean passthrough);
+GST_BASE_API
+gboolean gst_base_transform_is_passthrough (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_set_in_place (GstBaseTransform *trans,
+ gboolean in_place);
+GST_BASE_API
+gboolean gst_base_transform_is_in_place (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_update_qos (GstBaseTransform *trans,
+ gdouble proportion,
+ GstClockTimeDiff diff,
+ GstClockTime timestamp);
+GST_BASE_API
+void gst_base_transform_set_qos_enabled (GstBaseTransform *trans,
+ gboolean enabled);
+GST_BASE_API
+gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
+ gboolean gap_aware);
+GST_BASE_API
+void gst_base_transform_set_prefer_passthrough (GstBaseTransform *trans,
+ gboolean prefer_passthrough);
+GST_BASE_API
+GstBufferPool * gst_base_transform_get_buffer_pool (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_get_allocator (GstBaseTransform *trans,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+GST_BASE_API
+void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
+
+GST_BASE_API
+gboolean gst_base_transform_update_src_caps (GstBaseTransform *trans,
+ GstCaps *updated_caps);
+
+GST_BASE_API
+gboolean gst_base_transform_reconfigure (GstBaseTransform * trans);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseTransform, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BASE_TRANSFORM_H__ */
diff --git a/include/gst/base/gstbitreader.h b/include/gst/base/gstbitreader.h
new file mode 100644
index 0000000000..380edd3fe6
--- /dev/null
+++ b/include/gst/base/gstbitreader.h
@@ -0,0 +1,328 @@
+/* GStreamer
+ *
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BIT_READER_H__
+#define __GST_BIT_READER_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+/* FIXME: inline functions */
+
+G_BEGIN_DECLS
+
+#define GST_BIT_READER(reader) ((GstBitReader *) (reader))
+
+/**
+ * GstBitReader:
+ * @data: (array length=size): Data from which the bit reader will
+ * read
+ * @size: Size of @data in bytes
+ * @byte: Current byte position
+ * @bit: Bit position in the current byte
+ *
+ * A bit reader instance.
+ */
+typedef struct {
+ const guint8 *data;
+ guint size;
+
+ guint byte; /* Byte position */
+ guint bit; /* Bit position in the current byte */
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING];
+} GstBitReader;
+
+GST_BASE_API
+GstBitReader * gst_bit_reader_new (const guint8 *data, guint size) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_bit_reader_free (GstBitReader *reader);
+
+GST_BASE_API
+void gst_bit_reader_init (GstBitReader *reader, const guint8 *data, guint size);
+
+GST_BASE_API
+gboolean gst_bit_reader_set_pos (GstBitReader *reader, guint pos);
+
+GST_BASE_API
+guint gst_bit_reader_get_pos (const GstBitReader *reader);
+
+GST_BASE_API
+guint gst_bit_reader_get_remaining (const GstBitReader *reader);
+
+GST_BASE_API
+guint gst_bit_reader_get_size (const GstBitReader *reader);
+
+GST_BASE_API
+gboolean gst_bit_reader_skip (GstBitReader *reader, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_skip_to_byte (GstBitReader *reader);
+
+GST_BASE_API
+gboolean gst_bit_reader_get_bits_uint8 (GstBitReader *reader, guint8 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_get_bits_uint16 (GstBitReader *reader, guint16 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_get_bits_uint32 (GstBitReader *reader, guint32 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_get_bits_uint64 (GstBitReader *reader, guint64 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_peek_bits_uint8 (const GstBitReader *reader, guint8 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_peek_bits_uint16 (const GstBitReader *reader, guint16 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_peek_bits_uint32 (const GstBitReader *reader, guint32 *val, guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_reader_peek_bits_uint64 (const GstBitReader *reader, guint64 *val, guint nbits);
+
+/**
+ * GST_BIT_READER_INIT:
+ * @data: Data from which the #GstBitReader should read
+ * @size: Size of @data in bytes
+ *
+ * A #GstBitReader must be initialized with this macro, before it can be
+ * used. This macro can used be to initialize a variable, but it cannot
+ * be assigned to a variable. In that case you have to use
+ * gst_bit_reader_init().
+ */
+#define GST_BIT_READER_INIT(data, size) {data, size, 0, 0}
+
+/* Unchecked variants */
+
+static inline void
+gst_bit_reader_skip_unchecked (GstBitReader * reader, guint nbits)
+{
+ reader->bit += nbits;
+ reader->byte += reader->bit / 8;
+ reader->bit = reader->bit % 8;
+}
+
+static inline void
+gst_bit_reader_skip_to_byte_unchecked (GstBitReader * reader)
+{
+ if (reader->bit) {
+ reader->bit = 0;
+ reader->byte++;
+ }
+}
+
+#define __GST_BIT_READER_READ_BITS_UNCHECKED(bits) \
+static inline guint##bits \
+gst_bit_reader_peek_bits_uint##bits##_unchecked (const GstBitReader *reader, guint nbits) \
+{ \
+ guint##bits ret = 0; \
+ const guint8 *data; \
+ guint byte, bit; \
+ \
+ data = reader->data; \
+ byte = reader->byte; \
+ bit = reader->bit; \
+ \
+ while (nbits > 0) { \
+ guint toread = MIN (nbits, 8 - bit); \
+ \
+ ret <<= toread; \
+ ret |= (data[byte] & (0xff >> bit)) >> (8 - toread - bit); \
+ \
+ bit += toread; \
+ if (bit >= 8) { \
+ byte++; \
+ bit = 0; \
+ } \
+ nbits -= toread; \
+ } \
+ \
+ return ret; \
+} \
+\
+static inline guint##bits \
+gst_bit_reader_get_bits_uint##bits##_unchecked (GstBitReader *reader, guint nbits) \
+{ \
+ guint##bits ret; \
+ \
+ ret = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
+ \
+ gst_bit_reader_skip_unchecked (reader, nbits); \
+ \
+ return ret; \
+}
+
+__GST_BIT_READER_READ_BITS_UNCHECKED (8)
+__GST_BIT_READER_READ_BITS_UNCHECKED (16)
+__GST_BIT_READER_READ_BITS_UNCHECKED (32)
+__GST_BIT_READER_READ_BITS_UNCHECKED (64)
+
+#undef __GST_BIT_READER_READ_BITS_UNCHECKED
+
+/* unchecked variants -- do not use */
+
+static inline guint
+_gst_bit_reader_get_size_unchecked (const GstBitReader * reader)
+{
+ return reader->size * 8;
+}
+
+static inline guint
+_gst_bit_reader_get_pos_unchecked (const GstBitReader * reader)
+{
+ return reader->byte * 8 + reader->bit;
+}
+
+static inline guint
+_gst_bit_reader_get_remaining_unchecked (const GstBitReader * reader)
+{
+ return reader->size * 8 - (reader->byte * 8 + reader->bit);
+}
+
+/* inlined variants -- do not use directly */
+static inline guint
+_gst_bit_reader_get_size_inline (const GstBitReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_bit_reader_get_size_unchecked (reader);
+}
+
+static inline guint
+_gst_bit_reader_get_pos_inline (const GstBitReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_bit_reader_get_pos_unchecked (reader);
+}
+
+static inline guint
+_gst_bit_reader_get_remaining_inline (const GstBitReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_bit_reader_get_remaining_unchecked (reader);
+}
+
+static inline gboolean
+_gst_bit_reader_skip_inline (GstBitReader * reader, guint nbits)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+
+ if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits)
+ return FALSE;
+
+ gst_bit_reader_skip_unchecked (reader, nbits);
+
+ return TRUE;
+}
+
+static inline gboolean
+_gst_bit_reader_skip_to_byte_inline (GstBitReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+
+ if (reader->byte > reader->size)
+ return FALSE;
+
+ gst_bit_reader_skip_to_byte_unchecked (reader);
+
+ return TRUE;
+}
+
+#define __GST_BIT_READER_READ_BITS_INLINE(bits) \
+static inline gboolean \
+_gst_bit_reader_get_bits_uint##bits##_inline (GstBitReader *reader, guint##bits *val, guint nbits) \
+{ \
+ g_return_val_if_fail (reader != NULL, FALSE); \
+ g_return_val_if_fail (val != NULL, FALSE); \
+ g_return_val_if_fail (nbits <= bits, FALSE); \
+ \
+ if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
+ return FALSE; \
+\
+ *val = gst_bit_reader_get_bits_uint##bits##_unchecked (reader, nbits); \
+ return TRUE; \
+} \
+\
+static inline gboolean \
+_gst_bit_reader_peek_bits_uint##bits##_inline (const GstBitReader *reader, guint##bits *val, guint nbits) \
+{ \
+ g_return_val_if_fail (reader != NULL, FALSE); \
+ g_return_val_if_fail (val != NULL, FALSE); \
+ g_return_val_if_fail (nbits <= bits, FALSE); \
+ \
+ if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
+ return FALSE; \
+\
+ *val = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
+ return TRUE; \
+}
+
+__GST_BIT_READER_READ_BITS_INLINE (8)
+__GST_BIT_READER_READ_BITS_INLINE (16)
+__GST_BIT_READER_READ_BITS_INLINE (32)
+__GST_BIT_READER_READ_BITS_INLINE (64)
+
+#undef __GST_BIT_READER_READ_BITS_INLINE
+
+#ifndef GST_BIT_READER_DISABLE_INLINES
+
+#define gst_bit_reader_get_size(reader) \
+ _gst_bit_reader_get_size_inline (reader)
+#define gst_bit_reader_get_pos(reader) \
+ _gst_bit_reader_get_pos_inline (reader)
+#define gst_bit_reader_get_remaining(reader) \
+ _gst_bit_reader_get_remaining_inline (reader)
+
+/* we use defines here so we can add the G_LIKELY() */
+
+#define gst_bit_reader_skip(reader, nbits)\
+ G_LIKELY (_gst_bit_reader_skip_inline(reader, nbits))
+#define gst_bit_reader_skip_to_byte(reader)\
+ G_LIKELY (_gst_bit_reader_skip_to_byte_inline(reader))
+
+#define gst_bit_reader_get_bits_uint8(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_get_bits_uint8_inline (reader, val, nbits))
+#define gst_bit_reader_get_bits_uint16(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_get_bits_uint16_inline (reader, val, nbits))
+#define gst_bit_reader_get_bits_uint32(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_get_bits_uint32_inline (reader, val, nbits))
+#define gst_bit_reader_get_bits_uint64(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_get_bits_uint64_inline (reader, val, nbits))
+
+#define gst_bit_reader_peek_bits_uint8(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_peek_bits_uint8_inline (reader, val, nbits))
+#define gst_bit_reader_peek_bits_uint16(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_peek_bits_uint16_inline (reader, val, nbits))
+#define gst_bit_reader_peek_bits_uint32(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_peek_bits_uint32_inline (reader, val, nbits))
+#define gst_bit_reader_peek_bits_uint64(reader, val, nbits) \
+ G_LIKELY (_gst_bit_reader_peek_bits_uint64_inline (reader, val, nbits))
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_BIT_READER_H__ */
diff --git a/include/gst/base/gstbitwriter.h b/include/gst/base/gstbitwriter.h
new file mode 100644
index 0000000000..8a860e8e08
--- /dev/null
+++ b/include/gst/base/gstbitwriter.h
@@ -0,0 +1,384 @@
+/*
+ * gstbitwriter.h - bitstream writer
+ *
+ * Copyright (C) 2013 Intel Corporation
+ * Copyright (C) 2018 Igalia, S. L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GST_BIT_WRITER_H
+#define GST_BIT_WRITER_H
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+#include <string.h>
+
+G_BEGIN_DECLS
+
+#define GST_BIT_WRITER_DATA(writer) ((writer)->data)
+#define GST_BIT_WRITER_BIT_SIZE(writer) ((writer)->bit_size)
+#define GST_BIT_WRITER(writer) ((GstBitWriter *) (writer))
+
+typedef struct _GstBitWriter GstBitWriter;
+
+/**
+ * GstBitWriter:
+ * @data: Allocated @data for bit writer to write
+ * @bit_size: Size of written @data in bits
+ *
+ * A bit writer instance.
+ *
+ * Since: 1.16
+ */
+struct _GstBitWriter
+{
+ guint8 *data;
+ guint bit_size;
+
+ /*< private >*/
+ guint bit_capacity; /* Capacity of the allocated data */
+ gboolean auto_grow; /* Whether space can auto grow */
+ gboolean owned;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_BASE_API
+GstBitWriter * gst_bit_writer_new (void) G_GNUC_MALLOC;
+
+GST_BASE_API
+GstBitWriter * gst_bit_writer_new_with_size (guint32 size, gboolean fixed) G_GNUC_MALLOC;
+
+GST_BASE_API
+GstBitWriter * gst_bit_writer_new_with_data (guint8 *data, guint size,
+ gboolean initialized) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_bit_writer_free (GstBitWriter *bitwriter);
+
+GST_BASE_API
+guint8 * gst_bit_writer_free_and_get_data (GstBitWriter *bitwriter);
+
+GST_BASE_API
+GstBuffer * gst_bit_writer_free_and_get_buffer (GstBitWriter *bitwriter);
+
+GST_BASE_API
+void gst_bit_writer_init (GstBitWriter *bitwriter);
+
+GST_BASE_API
+void gst_bit_writer_init_with_size (GstBitWriter *bitwriter,
+ guint32 size, gboolean fixed);
+
+GST_BASE_API
+void gst_bit_writer_init_with_data (GstBitWriter *bitwriter, guint8 *data,
+ guint size, gboolean initialized);
+
+GST_BASE_API
+void gst_bit_writer_reset (GstBitWriter *bitwriter);
+
+GST_BASE_API
+guint8 * gst_bit_writer_reset_and_get_data (GstBitWriter *bitwriter);
+
+GST_BASE_API
+GstBuffer * gst_bit_writer_reset_and_get_buffer (GstBitWriter *bitwriter);
+
+GST_BASE_API
+guint gst_bit_writer_get_size (const GstBitWriter *bitwriter);
+
+GST_BASE_API
+guint8 * gst_bit_writer_get_data (const GstBitWriter *bitwriter);
+
+GST_BASE_API
+gboolean gst_bit_writer_set_pos (GstBitWriter *bitwriter, guint pos);
+
+GST_BASE_API
+guint gst_bit_writer_get_remaining (const GstBitWriter *bitwriter);
+
+GST_BASE_API
+gboolean gst_bit_writer_put_bits_uint8 (GstBitWriter *bitwriter, guint8 value,
+ guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_writer_put_bits_uint16 (GstBitWriter *bitwriter, guint16 value,
+ guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_writer_put_bits_uint32 (GstBitWriter *bitwriter, guint32 value,
+ guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_writer_put_bits_uint64 (GstBitWriter *bitwriter, guint64 value,
+ guint nbits);
+
+GST_BASE_API
+gboolean gst_bit_writer_put_bytes (GstBitWriter *bitwriter, const guint8 *data,
+ guint nbytes);
+
+GST_BASE_API
+gboolean gst_bit_writer_align_bytes (GstBitWriter *bitwriter, guint8 trailing_bit);
+
+static const guint8 _gst_bit_writer_bit_filling_mask[9] = {
+ 0x00, 0x01, 0x03, 0x07,
+ 0x0F, 0x1F, 0x3F, 0x7F,
+ 0xFF
+};
+
+/* Aligned to 256 bytes */
+#define __GST_BITS_WRITER_ALIGNMENT_MASK 2047
+#define __GST_BITS_WRITER_ALIGNED(bitsize) \
+ (((bitsize) + __GST_BITS_WRITER_ALIGNMENT_MASK)&(~__GST_BITS_WRITER_ALIGNMENT_MASK))
+
+static inline gboolean
+_gst_bit_writer_check_remaining (GstBitWriter * bitwriter, guint32 bits)
+{
+ guint32 new_bit_size = bits + bitwriter->bit_size;
+ guint32 clear_pos;
+
+ g_assert (bitwriter->bit_size <= bitwriter->bit_capacity);
+ if (new_bit_size <= bitwriter->bit_capacity)
+ return TRUE;
+
+ if (!bitwriter->auto_grow)
+ return FALSE;
+
+ /* auto grow space */
+ new_bit_size = __GST_BITS_WRITER_ALIGNED (new_bit_size);
+ g_assert (new_bit_size
+ && ((new_bit_size & __GST_BITS_WRITER_ALIGNMENT_MASK) == 0));
+ clear_pos = ((bitwriter->bit_size + 7) >> 3);
+ bitwriter->data = (guint8 *) g_realloc (bitwriter->data, (new_bit_size >> 3));
+ memset (bitwriter->data + clear_pos, 0, (new_bit_size >> 3) - clear_pos);
+ bitwriter->bit_capacity = new_bit_size;
+ return TRUE;
+}
+
+#undef __GST_BITS_WRITER_ALIGNMENT_MASK
+#undef __GST_BITS_WRITER_ALIGNED
+
+#define __GST_BIT_WRITER_WRITE_BITS_UNCHECKED(bits) \
+static inline void \
+gst_bit_writer_put_bits_uint##bits##_unchecked( \
+ GstBitWriter *bitwriter, \
+ guint##bits value, \
+ guint nbits \
+) \
+{ \
+ guint byte_pos, bit_offset; \
+ guint8 *cur_byte; \
+ guint fill_bits; \
+ \
+ byte_pos = (bitwriter->bit_size >> 3); \
+ bit_offset = (bitwriter->bit_size & 0x07); \
+ cur_byte = bitwriter->data + byte_pos; \
+ g_assert (nbits <= bits); \
+ g_assert( bit_offset < 8 && \
+ bitwriter->bit_size <= bitwriter->bit_capacity); \
+ \
+ while (nbits) { \
+ fill_bits = ((8 - bit_offset) < nbits ? (8 - bit_offset) : nbits); \
+ nbits -= fill_bits; \
+ bitwriter->bit_size += fill_bits; \
+ \
+ *cur_byte |= (((value >> nbits) & _gst_bit_writer_bit_filling_mask[fill_bits]) \
+ << (8 - bit_offset - fill_bits)); \
+ ++cur_byte; \
+ bit_offset = 0; \
+ } \
+ g_assert(cur_byte <= \
+ (bitwriter->data + (bitwriter->bit_capacity >> 3))); \
+}
+
+__GST_BIT_WRITER_WRITE_BITS_UNCHECKED (8)
+__GST_BIT_WRITER_WRITE_BITS_UNCHECKED (16)
+__GST_BIT_WRITER_WRITE_BITS_UNCHECKED (32)
+__GST_BIT_WRITER_WRITE_BITS_UNCHECKED (64)
+#undef __GST_BIT_WRITER_WRITE_BITS_UNCHECKED
+
+static inline guint
+gst_bit_writer_get_size_unchecked (const GstBitWriter * bitwriter)
+{
+ return GST_BIT_WRITER_BIT_SIZE (bitwriter);
+}
+
+static inline guint8 *
+gst_bit_writer_get_data_unchecked (const GstBitWriter * bitwriter)
+{
+ return GST_BIT_WRITER_DATA (bitwriter);
+}
+
+static inline gboolean
+gst_bit_writer_set_pos_unchecked (GstBitWriter * bitwriter, guint pos)
+{
+ GST_BIT_WRITER_BIT_SIZE (bitwriter) = pos;
+ return TRUE;
+}
+
+static inline guint
+gst_bit_writer_get_remaining_unchecked (const GstBitWriter * bitwriter)
+{
+ return bitwriter->bit_capacity - bitwriter->bit_size;
+}
+
+static inline void
+gst_bit_writer_put_bytes_unchecked (GstBitWriter * bitwriter,
+ const guint8 * data, guint nbytes)
+{
+ if ((bitwriter->bit_size & 0x07) == 0) {
+ memcpy (&bitwriter->data[bitwriter->bit_size >> 3], data, nbytes);
+ bitwriter->bit_size += (nbytes << 3);
+ } else {
+ g_assert (0);
+ while (nbytes) {
+ gst_bit_writer_put_bits_uint8_unchecked (bitwriter, *data, 8);
+ --nbytes;
+ ++data;
+ }
+ }
+}
+
+static inline void
+gst_bit_writer_align_bytes_unchecked (GstBitWriter * bitwriter,
+ guint8 trailing_bit)
+{
+ guint32 bit_offset, bit_left;
+ guint8 value = 0;
+
+ bit_offset = (bitwriter->bit_size & 0x07);
+ if (!bit_offset)
+ return;
+
+ bit_left = 8 - bit_offset;
+ if (trailing_bit)
+ value = _gst_bit_writer_bit_filling_mask[bit_left];
+ gst_bit_writer_put_bits_uint8_unchecked (bitwriter, value, bit_left);
+}
+
+#define __GST_BIT_WRITER_WRITE_BITS_INLINE(bits) \
+static inline gboolean \
+_gst_bit_writer_put_bits_uint##bits##_inline( \
+ GstBitWriter *bitwriter, \
+ guint##bits value, \
+ guint nbits \
+) \
+{ \
+ g_return_val_if_fail(bitwriter != NULL, FALSE); \
+ g_return_val_if_fail(nbits != 0, FALSE); \
+ g_return_val_if_fail(nbits <= bits, FALSE); \
+ \
+ if (!_gst_bit_writer_check_remaining(bitwriter, nbits)) \
+ return FALSE; \
+ gst_bit_writer_put_bits_uint##bits##_unchecked(bitwriter, value, nbits); \
+ return TRUE; \
+}
+
+__GST_BIT_WRITER_WRITE_BITS_INLINE (8)
+__GST_BIT_WRITER_WRITE_BITS_INLINE (16)
+__GST_BIT_WRITER_WRITE_BITS_INLINE (32)
+__GST_BIT_WRITER_WRITE_BITS_INLINE (64)
+#undef __GST_BIT_WRITER_WRITE_BITS_INLINE
+
+static inline guint
+_gst_bit_writer_get_size_inline (const GstBitWriter * bitwriter)
+{
+ g_return_val_if_fail (bitwriter != NULL, 0);
+
+ return gst_bit_writer_get_size_unchecked (bitwriter);
+}
+
+static inline guint8 *
+_gst_bit_writer_get_data_inline (const GstBitWriter * bitwriter)
+{
+ g_return_val_if_fail (bitwriter != NULL, NULL);
+
+ return gst_bit_writer_get_data_unchecked (bitwriter);
+}
+
+static inline gboolean
+_gst_bit_writer_set_pos_inline (GstBitWriter * bitwriter, guint pos)
+{
+ g_return_val_if_fail (bitwriter != NULL, FALSE);
+ g_return_val_if_fail (pos <= bitwriter->bit_capacity, FALSE);
+
+ return gst_bit_writer_set_pos_unchecked (bitwriter, pos);
+}
+
+static inline guint
+_gst_bit_writer_get_remaining_inline (const GstBitWriter * bitwriter)
+{
+ g_return_val_if_fail (bitwriter != NULL, 0);
+ g_return_val_if_fail (bitwriter->bit_size < bitwriter->bit_capacity, 0);
+
+ return gst_bit_writer_get_remaining_unchecked (bitwriter);
+}
+
+static inline gboolean
+_gst_bit_writer_put_bytes_inline (GstBitWriter * bitwriter,
+ const guint8 * data, guint nbytes)
+{
+ g_return_val_if_fail (bitwriter != NULL, FALSE);
+ g_return_val_if_fail (data != NULL, FALSE);
+ g_return_val_if_fail (nbytes, FALSE);
+
+ if (!_gst_bit_writer_check_remaining (bitwriter, nbytes * 8))
+ return FALSE;
+
+ gst_bit_writer_put_bytes_unchecked (bitwriter, data, nbytes);
+ return TRUE;
+}
+
+static inline gboolean
+_gst_bit_writer_align_bytes_inline (GstBitWriter * bitwriter,
+ guint8 trailing_bit)
+{
+ g_return_val_if_fail (bitwriter != NULL, FALSE);
+ g_return_val_if_fail ((trailing_bit == 0 || trailing_bit == 1), FALSE);
+ g_return_val_if_fail (((bitwriter->bit_size + 7) & (~7)) <=
+ bitwriter->bit_capacity, FALSE);
+
+ gst_bit_writer_align_bytes_unchecked (bitwriter, trailing_bit);
+ return TRUE;
+}
+
+#ifndef GST_BIT_WRITER_DISABLE_INLINES
+#define gst_bit_writer_get_size(bitwriter) \
+ _gst_bit_writer_get_size_inline(bitwriter)
+#define gst_bit_writer_get_data(bitwriter) \
+ _gst_bit_writer_get_data_inline(bitwriter)
+#define gst_bit_writer_set_pos(bitwriter, pos) \
+ G_LIKELY (_gst_bit_writer_set_pos_inline (bitwriter, pos))
+#define gst_bit_writer_get_remaining(bitwriter) \
+ _gst_bit_writer_get_remaining_inline(bitwriter)
+
+#define gst_bit_writer_put_bits_uint8(bitwriter, value, nbits) \
+ G_LIKELY (_gst_bit_writer_put_bits_uint8_inline (bitwriter, value, nbits))
+#define gst_bit_writer_put_bits_uint16(bitwriter, value, nbits) \
+ G_LIKELY (_gst_bit_writer_put_bits_uint16_inline (bitwriter, value, nbits))
+#define gst_bit_writer_put_bits_uint32(bitwriter, value, nbits) \
+ G_LIKELY (_gst_bit_writer_put_bits_uint32_inline (bitwriter, value, nbits))
+#define gst_bit_writer_put_bits_uint64(bitwriter, value, nbits) \
+ G_LIKELY (_gst_bit_writer_put_bits_uint64_inline (bitwriter, value, nbits))
+
+#define gst_bit_writer_put_bytes(bitwriter, data, nbytes) \
+ G_LIKELY (_gst_bit_writer_put_bytes_inline (bitwriter, data, nbytes))
+
+#define gst_bit_writer_align_bytes(bitwriter, trailing_bit) \
+ G_LIKELY (_gst_bit_writer_align_bytes_inline(bitwriter, trailing_bit))
+#endif
+
+G_END_DECLS
+
+#endif /* GST_BIT_WRITER_H */
diff --git a/include/gst/base/gstbytereader.h b/include/gst/base/gstbytereader.h
new file mode 100644
index 0000000000..2130a8a008
--- /dev/null
+++ b/include/gst/base/gstbytereader.h
@@ -0,0 +1,684 @@
+/* GStreamer byte reader
+ *
+ * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
+ * Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BYTE_READER_H__
+#define __GST_BYTE_READER_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_BYTE_READER(reader) ((GstByteReader *) (reader))
+
+/**
+ * GstByteReader:
+ * @data: (array length=size): Data from which the bit reader will
+ * read
+ * @size: Size of @data in bytes
+ * @byte: Current byte position
+ *
+ * A byte reader instance.
+ */
+typedef struct {
+ const guint8 *data;
+ guint size;
+
+ guint byte; /* Byte position */
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING];
+} GstByteReader;
+
+GST_BASE_API
+GstByteReader * gst_byte_reader_new (const guint8 *data, guint size) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_byte_reader_free (GstByteReader *reader);
+
+GST_BASE_API
+void gst_byte_reader_init (GstByteReader *reader, const guint8 *data, guint size);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_sub_reader (GstByteReader * reader,
+ GstByteReader * sub_reader,
+ guint size);
+GST_BASE_API
+gboolean gst_byte_reader_get_sub_reader (GstByteReader * reader,
+ GstByteReader * sub_reader,
+ guint size);
+GST_BASE_API
+gboolean gst_byte_reader_set_pos (GstByteReader *reader, guint pos);
+
+GST_BASE_API
+guint gst_byte_reader_get_pos (const GstByteReader *reader);
+
+GST_BASE_API
+guint gst_byte_reader_get_remaining (const GstByteReader *reader);
+
+GST_BASE_API
+guint gst_byte_reader_get_size (const GstByteReader *reader);
+
+GST_BASE_API
+gboolean gst_byte_reader_skip (GstByteReader *reader, guint nbytes);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint8 (GstByteReader *reader, guint8 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int8 (GstByteReader *reader, gint8 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint16_le (GstByteReader *reader, guint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int16_le (GstByteReader *reader, gint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint16_be (GstByteReader *reader, guint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int16_be (GstByteReader *reader, gint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint24_le (GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int24_le (GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint24_be (GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int24_be (GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint32_le (GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int32_le (GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint32_be (GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int32_be (GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint64_le (GstByteReader *reader, guint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int64_le (GstByteReader *reader, gint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_uint64_be (GstByteReader *reader, guint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_int64_be (GstByteReader *reader, gint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint8 (const GstByteReader *reader, guint8 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int8 (const GstByteReader *reader, gint8 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint16_le (const GstByteReader *reader, guint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int16_le (const GstByteReader *reader, gint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint16_be (const GstByteReader *reader, guint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int16_be (const GstByteReader *reader, gint16 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint24_le (const GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int24_le (const GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint24_be (const GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int24_be (const GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint32_le (const GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int32_le (const GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint32_be (const GstByteReader *reader, guint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int32_be (const GstByteReader *reader, gint32 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint64_le (const GstByteReader *reader, guint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int64_le (const GstByteReader *reader, gint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_uint64_be (const GstByteReader *reader, guint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_int64_be (const GstByteReader *reader, gint64 *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_float32_le (GstByteReader *reader, gfloat *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_float32_be (GstByteReader *reader, gfloat *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_float64_le (GstByteReader *reader, gdouble *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_float64_be (GstByteReader *reader, gdouble *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_float32_le (const GstByteReader *reader, gfloat *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_float32_be (const GstByteReader *reader, gfloat *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_float64_le (const GstByteReader *reader, gdouble *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_float64_be (const GstByteReader *reader, gdouble *val);
+
+GST_BASE_API
+gboolean gst_byte_reader_dup_data (GstByteReader * reader, guint size, guint8 ** val);
+
+GST_BASE_API
+gboolean gst_byte_reader_get_data (GstByteReader * reader, guint size, const guint8 ** val);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_data (const GstByteReader * reader, guint size, const guint8 ** val);
+
+#define gst_byte_reader_dup_string(reader,str) \
+ gst_byte_reader_dup_string_utf8(reader,str)
+
+GST_BASE_API
+gboolean gst_byte_reader_dup_string_utf8 (GstByteReader * reader, gchar ** str);
+
+GST_BASE_API
+gboolean gst_byte_reader_dup_string_utf16 (GstByteReader * reader, guint16 ** str);
+
+GST_BASE_API
+gboolean gst_byte_reader_dup_string_utf32 (GstByteReader * reader, guint32 ** str);
+
+#define gst_byte_reader_skip_string(reader) \
+ gst_byte_reader_skip_string_utf8(reader)
+
+GST_BASE_API
+gboolean gst_byte_reader_skip_string_utf8 (GstByteReader * reader);
+
+GST_BASE_API
+gboolean gst_byte_reader_skip_string_utf16 (GstByteReader * reader);
+
+GST_BASE_API
+gboolean gst_byte_reader_skip_string_utf32 (GstByteReader * reader);
+
+#define gst_byte_reader_get_string(reader,str) \
+ gst_byte_reader_get_string_utf8(reader,str)
+
+#define gst_byte_reader_peek_string(reader,str) \
+ gst_byte_reader_peek_string_utf8(reader,str)
+
+GST_BASE_API
+gboolean gst_byte_reader_get_string_utf8 (GstByteReader * reader, const gchar ** str);
+
+GST_BASE_API
+gboolean gst_byte_reader_peek_string_utf8 (const GstByteReader * reader, const gchar ** str);
+
+GST_BASE_API
+guint gst_byte_reader_masked_scan_uint32 (const GstByteReader * reader,
+ guint32 mask,
+ guint32 pattern,
+ guint offset,
+ guint size);
+GST_BASE_API
+guint gst_byte_reader_masked_scan_uint32_peek (const GstByteReader * reader,
+ guint32 mask,
+ guint32 pattern,
+ guint offset,
+ guint size,
+ guint32 * value);
+
+/**
+ * GST_BYTE_READER_INIT:
+ * @data: Data from which the #GstByteReader should read
+ * @size: Size of @data in bytes
+ *
+ * A #GstByteReader must be initialized with this macro, before it can be
+ * used. This macro can used be to initialize a variable, but it cannot
+ * be assigned to a variable. In that case you have to use
+ * gst_byte_reader_init().
+ */
+#define GST_BYTE_READER_INIT(data, size) {data, size, 0}
+
+/* unchecked variants */
+static inline void
+gst_byte_reader_skip_unchecked (GstByteReader * reader, guint nbytes)
+{
+ reader->byte += nbytes;
+}
+
+#define __GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(bits,type,lower,upper,adj) \
+\
+static inline type \
+gst_byte_reader_peek_##lower##_unchecked (const GstByteReader * reader) \
+{ \
+ type val = (type) GST_READ_##upper (reader->data + reader->byte); \
+ adj \
+ return val; \
+} \
+\
+static inline type \
+gst_byte_reader_get_##lower##_unchecked (GstByteReader * reader) \
+{ \
+ type val = gst_byte_reader_peek_##lower##_unchecked (reader); \
+ reader->byte += bits / 8; \
+ return val; \
+}
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,guint8,uint8,UINT8,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(8,gint8,int8,UINT8,/* */)
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_le,UINT16_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,guint16,uint16_be,UINT16_BE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_le,UINT16_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(16,gint16,int16_be,UINT16_BE,/* */)
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_le,UINT32_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,guint32,uint32_be,UINT32_BE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_le,UINT32_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gint32,int32_be,UINT32_BE,/* */)
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_le,UINT24_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,guint32,uint24_be,UINT24_BE,/* */)
+
+/* fix up the sign for 24-bit signed ints stored in 32-bit signed ints */
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_le,UINT24_LE,
+ if (val & 0x00800000) val |= 0xff000000;)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(24,gint32,int24_be,UINT24_BE,
+ if (val & 0x00800000) val |= 0xff000000;)
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_le,UINT64_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,guint64,uint64_be,UINT64_BE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_le,UINT64_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gint64,int64_be,UINT64_BE,/* */)
+
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gfloat,float32_le,FLOAT_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(32,gfloat,float32_be,FLOAT_BE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gdouble,float64_le,DOUBLE_LE,/* */)
+__GST_BYTE_READER_GET_PEEK_BITS_UNCHECKED(64,gdouble,float64_be,DOUBLE_BE,/* */)
+
+#undef __GET_PEEK_BITS_UNCHECKED
+
+static inline const guint8 *
+gst_byte_reader_peek_data_unchecked (const GstByteReader * reader)
+{
+ return (const guint8 *) (reader->data + reader->byte);
+}
+
+static inline const guint8 *
+gst_byte_reader_get_data_unchecked (GstByteReader * reader, guint size)
+{
+ const guint8 *data;
+
+ data = gst_byte_reader_peek_data_unchecked (reader);
+ gst_byte_reader_skip_unchecked (reader, size);
+ return data;
+}
+
+static inline guint8 *
+gst_byte_reader_dup_data_unchecked (GstByteReader * reader, guint size)
+{
+ gconstpointer data = gst_byte_reader_get_data_unchecked (reader, size);
+ guint8 *dup_data = (guint8 *) g_malloc (size);
+
+ memcpy (dup_data, data, size);
+ return dup_data;
+}
+
+/* Unchecked variants that should not be used */
+static inline guint
+_gst_byte_reader_get_pos_unchecked (const GstByteReader * reader)
+{
+ return reader->byte;
+}
+
+static inline guint
+_gst_byte_reader_get_remaining_unchecked (const GstByteReader * reader)
+{
+ return reader->size - reader->byte;
+}
+
+static inline guint
+_gst_byte_reader_get_size_unchecked (const GstByteReader * reader)
+{
+ return reader->size;
+}
+
+/* inlined variants (do not use directly) */
+
+static inline guint
+_gst_byte_reader_get_remaining_inline (const GstByteReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_byte_reader_get_remaining_unchecked (reader);
+}
+
+static inline guint
+_gst_byte_reader_get_size_inline (const GstByteReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_byte_reader_get_size_unchecked (reader);
+}
+
+#define __GST_BYTE_READER_GET_PEEK_BITS_INLINE(bits,type,name) \
+\
+static inline gboolean \
+_gst_byte_reader_peek_##name##_inline (const GstByteReader * reader, type * val) \
+{ \
+ g_return_val_if_fail (reader != NULL, FALSE); \
+ g_return_val_if_fail (val != NULL, FALSE); \
+ \
+ if (_gst_byte_reader_get_remaining_unchecked (reader) < (bits / 8)) \
+ return FALSE; \
+\
+ *val = gst_byte_reader_peek_##name##_unchecked (reader); \
+ return TRUE; \
+} \
+\
+static inline gboolean \
+_gst_byte_reader_get_##name##_inline (GstByteReader * reader, type * val) \
+{ \
+ g_return_val_if_fail (reader != NULL, FALSE); \
+ g_return_val_if_fail (val != NULL, FALSE); \
+ \
+ if (_gst_byte_reader_get_remaining_unchecked (reader) < (bits / 8)) \
+ return FALSE; \
+\
+ *val = gst_byte_reader_get_##name##_unchecked (reader); \
+ return TRUE; \
+}
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(8,guint8,uint8)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(8,gint8,int8)
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,guint16,uint16_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,guint16,uint16_be)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,gint16,int16_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(16,gint16,int16_be)
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,guint32,uint32_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,guint32,uint32_be)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gint32,int32_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gint32,int32_be)
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,guint32,uint24_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,guint32,uint24_be)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,gint32,int24_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(24,gint32,int24_be)
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,guint64,uint64_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,guint64,uint64_be)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gint64,int64_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gint64,int64_be)
+
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gfloat,float32_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(32,gfloat,float32_be)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gdouble,float64_le)
+__GST_BYTE_READER_GET_PEEK_BITS_INLINE(64,gdouble,float64_be)
+
+#undef __GST_BYTE_READER_GET_PEEK_BITS_INLINE
+
+#ifndef GST_BYTE_READER_DISABLE_INLINES
+
+#define gst_byte_reader_init(reader,data,size) \
+ _gst_byte_reader_init_inline(reader,data,size)
+
+#define gst_byte_reader_get_remaining(reader) \
+ _gst_byte_reader_get_remaining_inline(reader)
+
+#define gst_byte_reader_get_size(reader) \
+ _gst_byte_reader_get_size_inline(reader)
+
+#define gst_byte_reader_get_pos(reader) \
+ _gst_byte_reader_get_pos_inline(reader)
+
+/* we use defines here so we can add the G_LIKELY() */
+#define gst_byte_reader_get_uint8(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint8_inline(reader,val))
+#define gst_byte_reader_get_int8(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int8_inline(reader,val))
+#define gst_byte_reader_get_uint16_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint16_le_inline(reader,val))
+#define gst_byte_reader_get_int16_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int16_le_inline(reader,val))
+#define gst_byte_reader_get_uint16_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint16_be_inline(reader,val))
+#define gst_byte_reader_get_int16_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int16_be_inline(reader,val))
+#define gst_byte_reader_get_uint24_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint24_le_inline(reader,val))
+#define gst_byte_reader_get_int24_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int24_le_inline(reader,val))
+#define gst_byte_reader_get_uint24_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint24_be_inline(reader,val))
+#define gst_byte_reader_get_int24_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int24_be_inline(reader,val))
+#define gst_byte_reader_get_uint32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint32_le_inline(reader,val))
+#define gst_byte_reader_get_int32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int32_le_inline(reader,val))
+#define gst_byte_reader_get_uint32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint32_be_inline(reader,val))
+#define gst_byte_reader_get_int32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int32_be_inline(reader,val))
+#define gst_byte_reader_get_uint64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint64_le_inline(reader,val))
+#define gst_byte_reader_get_int64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int64_le_inline(reader,val))
+#define gst_byte_reader_get_uint64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_uint64_be_inline(reader,val))
+#define gst_byte_reader_get_int64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_int64_be_inline(reader,val))
+
+#define gst_byte_reader_peek_uint8(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint8_inline(reader,val))
+#define gst_byte_reader_peek_int8(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int8_inline(reader,val))
+#define gst_byte_reader_peek_uint16_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint16_le_inline(reader,val))
+#define gst_byte_reader_peek_int16_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int16_le_inline(reader,val))
+#define gst_byte_reader_peek_uint16_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint16_be_inline(reader,val))
+#define gst_byte_reader_peek_int16_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int16_be_inline(reader,val))
+#define gst_byte_reader_peek_uint24_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint24_le_inline(reader,val))
+#define gst_byte_reader_peek_int24_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int24_le_inline(reader,val))
+#define gst_byte_reader_peek_uint24_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint24_be_inline(reader,val))
+#define gst_byte_reader_peek_int24_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int24_be_inline(reader,val))
+#define gst_byte_reader_peek_uint32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint32_le_inline(reader,val))
+#define gst_byte_reader_peek_int32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int32_le_inline(reader,val))
+#define gst_byte_reader_peek_uint32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint32_be_inline(reader,val))
+#define gst_byte_reader_peek_int32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int32_be_inline(reader,val))
+#define gst_byte_reader_peek_uint64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint64_le_inline(reader,val))
+#define gst_byte_reader_peek_int64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int64_le_inline(reader,val))
+#define gst_byte_reader_peek_uint64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_uint64_be_inline(reader,val))
+#define gst_byte_reader_peek_int64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_int64_be_inline(reader,val))
+
+#define gst_byte_reader_get_float32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_float32_le_inline(reader,val))
+#define gst_byte_reader_get_float32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_float32_be_inline(reader,val))
+#define gst_byte_reader_get_float64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_float64_le_inline(reader,val))
+#define gst_byte_reader_get_float64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_get_float64_be_inline(reader,val))
+#define gst_byte_reader_peek_float32_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_float32_le_inline(reader,val))
+#define gst_byte_reader_peek_float32_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_float32_be_inline(reader,val))
+#define gst_byte_reader_peek_float64_le(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_float64_le_inline(reader,val))
+#define gst_byte_reader_peek_float64_be(reader,val) \
+ G_LIKELY(_gst_byte_reader_peek_float64_be_inline(reader,val))
+
+#endif /* GST_BYTE_READER_DISABLE_INLINES */
+
+static inline void
+_gst_byte_reader_init_inline (GstByteReader * reader, const guint8 * data, guint size)
+{
+ g_return_if_fail (reader != NULL);
+
+ reader->data = data;
+ reader->size = size;
+ reader->byte = 0;
+}
+
+static inline gboolean
+_gst_byte_reader_peek_sub_reader_inline (GstByteReader * reader,
+ GstByteReader * sub_reader, guint size)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+ g_return_val_if_fail (sub_reader != NULL, FALSE);
+
+ if (_gst_byte_reader_get_remaining_unchecked (reader) < size)
+ return FALSE;
+
+ sub_reader->data = reader->data + reader->byte;
+ sub_reader->byte = 0;
+ sub_reader->size = size;
+ return TRUE;
+}
+
+static inline gboolean
+_gst_byte_reader_get_sub_reader_inline (GstByteReader * reader,
+ GstByteReader * sub_reader, guint size)
+{
+ if (!_gst_byte_reader_peek_sub_reader_inline (reader, sub_reader, size))
+ return FALSE;
+ gst_byte_reader_skip_unchecked (reader, size);
+ return TRUE;
+}
+
+static inline gboolean
+_gst_byte_reader_dup_data_inline (GstByteReader * reader, guint size, guint8 ** val)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+ g_return_val_if_fail (val != NULL, FALSE);
+
+ if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_unchecked (reader) < size))
+ return FALSE;
+
+ *val = gst_byte_reader_dup_data_unchecked (reader, size);
+ return TRUE;
+}
+
+static inline gboolean
+_gst_byte_reader_get_data_inline (GstByteReader * reader, guint size, const guint8 ** val)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+ g_return_val_if_fail (val != NULL, FALSE);
+
+ if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_unchecked (reader) < size))
+ return FALSE;
+
+ *val = gst_byte_reader_get_data_unchecked (reader, size);
+ return TRUE;
+}
+
+static inline gboolean
+_gst_byte_reader_peek_data_inline (const GstByteReader * reader, guint size, const guint8 ** val)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+ g_return_val_if_fail (val != NULL, FALSE);
+
+ if (G_UNLIKELY (size > reader->size || _gst_byte_reader_get_remaining_unchecked (reader) < size))
+ return FALSE;
+
+ *val = gst_byte_reader_peek_data_unchecked (reader);
+ return TRUE;
+}
+
+static inline guint
+_gst_byte_reader_get_pos_inline (const GstByteReader * reader)
+{
+ g_return_val_if_fail (reader != NULL, 0);
+
+ return _gst_byte_reader_get_pos_unchecked (reader);
+}
+
+static inline gboolean
+_gst_byte_reader_skip_inline (GstByteReader * reader, guint nbytes)
+{
+ g_return_val_if_fail (reader != NULL, FALSE);
+
+ if (G_UNLIKELY (_gst_byte_reader_get_remaining_unchecked (reader) < nbytes))
+ return FALSE;
+
+ reader->byte += nbytes;
+ return TRUE;
+}
+
+#ifndef GST_BYTE_READER_DISABLE_INLINES
+
+#define gst_byte_reader_dup_data(reader,size,val) \
+ G_LIKELY(_gst_byte_reader_dup_data_inline(reader,size,val))
+#define gst_byte_reader_get_data(reader,size,val) \
+ G_LIKELY(_gst_byte_reader_get_data_inline(reader,size,val))
+#define gst_byte_reader_peek_data(reader,size,val) \
+ G_LIKELY(_gst_byte_reader_peek_data_inline(reader,size,val))
+#define gst_byte_reader_skip(reader,nbytes) \
+ G_LIKELY(_gst_byte_reader_skip_inline(reader,nbytes))
+
+#endif /* GST_BYTE_READER_DISABLE_INLINES */
+
+G_END_DECLS
+
+#endif /* __GST_BYTE_READER_H__ */
diff --git a/include/gst/base/gstbytewriter.h b/include/gst/base/gstbytewriter.h
new file mode 100644
index 0000000000..365c7742d7
--- /dev/null
+++ b/include/gst/base/gstbytewriter.h
@@ -0,0 +1,468 @@
+/* GStreamer byte writer
+ *
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BYTE_WRITER_H__
+#define __GST_BYTE_WRITER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbytereader.h>
+
+#include <string.h>
+
+G_BEGIN_DECLS
+
+#define GST_BYTE_WRITER(writer) ((GstByteWriter *) (writer))
+
+/**
+ * GstByteWriter:
+ * @parent: #GstByteReader parent
+ * @alloc_size: Allocation size of the data
+ * @fixed: If %TRUE no reallocations are allowed
+ * @owned: If %FALSE no reallocations are allowed and copies of data are returned
+ *
+ * A byte writer instance.
+ */
+typedef struct {
+ GstByteReader parent;
+
+ guint alloc_size;
+
+ gboolean fixed;
+ gboolean owned;
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING];
+} GstByteWriter;
+
+GST_BASE_API
+GstByteWriter * gst_byte_writer_new (void) G_GNUC_MALLOC;
+
+GST_BASE_API
+GstByteWriter * gst_byte_writer_new_with_size (guint size, gboolean fixed) G_GNUC_MALLOC;
+
+GST_BASE_API
+GstByteWriter * gst_byte_writer_new_with_data (guint8 *data, guint size, gboolean initialized) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_byte_writer_init (GstByteWriter *writer);
+
+GST_BASE_API
+void gst_byte_writer_init_with_size (GstByteWriter *writer, guint size, gboolean fixed);
+
+GST_BASE_API
+void gst_byte_writer_init_with_data (GstByteWriter *writer, guint8 *data,
+ guint size, gboolean initialized);
+GST_BASE_API
+void gst_byte_writer_free (GstByteWriter *writer);
+
+GST_BASE_API
+guint8 * gst_byte_writer_free_and_get_data (GstByteWriter *writer);
+
+GST_BASE_API
+GstBuffer * gst_byte_writer_free_and_get_buffer (GstByteWriter *writer) G_GNUC_MALLOC;
+
+GST_BASE_API
+void gst_byte_writer_reset (GstByteWriter *writer);
+
+GST_BASE_API
+guint8 * gst_byte_writer_reset_and_get_data (GstByteWriter *writer);
+
+GST_BASE_API
+GstBuffer * gst_byte_writer_reset_and_get_buffer (GstByteWriter *writer) G_GNUC_MALLOC;
+
+/**
+ * gst_byte_writer_get_pos:
+ * @writer: #GstByteWriter instance
+ *
+ * Returns: The current position of the read/write cursor
+ */
+/**
+ * gst_byte_writer_set_pos:
+ * @writer: #GstByteWriter instance
+ * @pos: new position
+ *
+ * Sets the current read/write cursor of @writer. The new position
+ * can only be between 0 and the current size.
+ *
+ * Returns: %TRUE if the new position could be set
+ */
+/**
+ * gst_byte_writer_get_size:
+ * @writer: #GstByteWriter instance
+ *
+ * Returns: The current, initialized size of the data
+ */
+static inline guint
+gst_byte_writer_get_pos (const GstByteWriter *writer)
+{
+ return gst_byte_reader_get_pos ((const GstByteReader *) writer);
+}
+
+static inline gboolean
+gst_byte_writer_set_pos (GstByteWriter *writer, guint pos)
+{
+ return gst_byte_reader_set_pos (GST_BYTE_READER (writer), pos);
+}
+
+static inline guint
+gst_byte_writer_get_size (const GstByteWriter *writer)
+{
+ return gst_byte_reader_get_size ((const GstByteReader *) writer);
+}
+
+GST_BASE_API
+guint gst_byte_writer_get_remaining (const GstByteWriter *writer);
+
+GST_BASE_API
+gboolean gst_byte_writer_ensure_free_space (GstByteWriter *writer, guint size);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint8 (GstByteWriter *writer, guint8 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int8 (GstByteWriter *writer, gint8 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint16_be (GstByteWriter *writer, guint16 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint16_le (GstByteWriter *writer, guint16 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int16_be (GstByteWriter *writer, gint16 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int16_le (GstByteWriter *writer, gint16 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint24_be (GstByteWriter *writer, guint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint24_le (GstByteWriter *writer, guint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int24_be (GstByteWriter *writer, gint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int24_le (GstByteWriter *writer, gint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint32_be (GstByteWriter *writer, guint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint32_le (GstByteWriter *writer, guint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int32_be (GstByteWriter *writer, gint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int32_le (GstByteWriter *writer, gint32 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint64_be (GstByteWriter *writer, guint64 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_uint64_le (GstByteWriter *writer, guint64 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int64_be (GstByteWriter *writer, gint64 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_int64_le (GstByteWriter *writer, gint64 val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_float32_be (GstByteWriter *writer, gfloat val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_float32_le (GstByteWriter *writer, gfloat val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_float64_be (GstByteWriter *writer, gdouble val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_float64_le (GstByteWriter *writer, gdouble val);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_data (GstByteWriter *writer, const guint8 *data, guint size);
+
+GST_BASE_API
+gboolean gst_byte_writer_fill (GstByteWriter *writer, guint8 value, guint size);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_string_utf8 (GstByteWriter *writer, const gchar *data);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_string_utf16 (GstByteWriter *writer, const guint16 *data);
+
+GST_BASE_API
+gboolean gst_byte_writer_put_string_utf32 (GstByteWriter *writer, const guint32 *data);
+gboolean gst_byte_writer_put_buffer (GstByteWriter *writer, GstBuffer * buffer, gsize offset, gssize size);
+
+/**
+ * gst_byte_writer_put_string:
+ * @writer: #GstByteWriter instance
+ * @data: (in) (array zero-terminated=1): Null terminated string
+ *
+ * Write a NUL-terminated string to @writer (including the terminator). The
+ * string is assumed to be in an 8-bit encoding (e.g. ASCII,UTF-8 or
+ * ISO-8859-1).
+ *
+ * Returns: %TRUE if the string could be written
+ */
+#define gst_byte_writer_put_string(writer, data) \
+ gst_byte_writer_put_string_utf8(writer, data)
+
+static inline guint
+_gst_byte_writer_next_pow2 (guint n)
+{
+ guint ret = 16;
+
+ /* We start with 16, smaller allocations make no sense */
+
+ while (ret < n && ret > 0)
+ ret <<= 1;
+
+ return ret ? ret : n;
+}
+
+static inline gboolean
+_gst_byte_writer_ensure_free_space_inline (GstByteWriter * writer, guint size)
+{
+ gpointer data;
+
+ if (G_LIKELY (size <= writer->alloc_size - writer->parent.byte))
+ return TRUE;
+ if (G_UNLIKELY (writer->fixed || !writer->owned))
+ return FALSE;
+ if (G_UNLIKELY (writer->parent.byte > G_MAXUINT - size))
+ return FALSE;
+
+ writer->alloc_size = _gst_byte_writer_next_pow2 (writer->parent.byte + size);
+ data = g_try_realloc ((guint8 *) writer->parent.data, writer->alloc_size);
+ if (G_UNLIKELY (data == NULL))
+ return FALSE;
+
+ writer->parent.data = (guint8 *) data;
+
+ return TRUE;
+}
+
+#define __GST_BYTE_WRITER_CREATE_WRITE_FUNC(bits,type,name,write_func) \
+static inline void \
+gst_byte_writer_put_##name##_unchecked (GstByteWriter *writer, type val) \
+{ \
+ guint8 *write_data; \
+ \
+ write_data = (guint8 *) writer->parent.data + writer->parent.byte; \
+ write_func (write_data, val); \
+ writer->parent.byte += bits/8; \
+ writer->parent.size = MAX (writer->parent.size, writer->parent.byte); \
+} \
+\
+static inline gboolean \
+_gst_byte_writer_put_##name##_inline (GstByteWriter *writer, type val) \
+{ \
+ g_return_val_if_fail (writer != NULL, FALSE); \
+ \
+ if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline(writer, bits/8))) \
+ return FALSE; \
+ \
+ gst_byte_writer_put_##name##_unchecked (writer, val); \
+ \
+ return TRUE; \
+}
+
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (8, guint8, uint8, GST_WRITE_UINT8)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (8, gint8, int8, GST_WRITE_UINT8)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, guint16, uint16_le, GST_WRITE_UINT16_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, guint16, uint16_be, GST_WRITE_UINT16_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, gint16, int16_le, GST_WRITE_UINT16_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (16, gint16, int16_be, GST_WRITE_UINT16_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, guint32, uint24_le, GST_WRITE_UINT24_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, guint32, uint24_be, GST_WRITE_UINT24_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, gint32, int24_le, GST_WRITE_UINT24_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (24, gint32, int24_be, GST_WRITE_UINT24_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, guint32, uint32_le, GST_WRITE_UINT32_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, guint32, uint32_be, GST_WRITE_UINT32_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gint32, int32_le, GST_WRITE_UINT32_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gint32, int32_be, GST_WRITE_UINT32_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, guint64, uint64_le, GST_WRITE_UINT64_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, guint64, uint64_be, GST_WRITE_UINT64_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gint64, int64_le, GST_WRITE_UINT64_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gint64, int64_be, GST_WRITE_UINT64_BE)
+
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gfloat, float32_be, GST_WRITE_FLOAT_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (32, gfloat, float32_le, GST_WRITE_FLOAT_LE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gdouble, float64_be, GST_WRITE_DOUBLE_BE)
+__GST_BYTE_WRITER_CREATE_WRITE_FUNC (64, gdouble, float64_le, GST_WRITE_DOUBLE_LE)
+
+#undef __GST_BYTE_WRITER_CREATE_WRITE_FUNC
+
+static inline void
+gst_byte_writer_put_data_unchecked (GstByteWriter * writer, const guint8 * data,
+ guint size)
+{
+ memcpy ((guint8 *) & writer->parent.data[writer->parent.byte], data, size);
+ writer->parent.byte += size;
+ writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
+}
+
+static inline gboolean
+_gst_byte_writer_put_data_inline (GstByteWriter * writer, const guint8 * data,
+ guint size)
+{
+ g_return_val_if_fail (writer != NULL, FALSE);
+
+ if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
+ return FALSE;
+
+ gst_byte_writer_put_data_unchecked (writer, data, size);
+
+ return TRUE;
+}
+
+static inline void
+gst_byte_writer_fill_unchecked (GstByteWriter * writer, guint8 value, guint size)
+{
+ memset ((guint8 *) & writer->parent.data[writer->parent.byte], value, size);
+ writer->parent.byte += size;
+ writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
+}
+
+static inline gboolean
+_gst_byte_writer_fill_inline (GstByteWriter * writer, guint8 value, guint size)
+{
+ g_return_val_if_fail (writer != NULL, FALSE);
+
+ if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
+ return FALSE;
+
+ gst_byte_writer_fill_unchecked (writer, value, size);
+
+ return TRUE;
+}
+
+static inline void
+gst_byte_writer_put_buffer_unchecked (GstByteWriter * writer, GstBuffer * buffer,
+ gsize offset, gssize size)
+{
+ if (size == -1) {
+ size = gst_buffer_get_size (buffer);
+
+ if (offset >= (gsize) size)
+ return;
+
+ size -= offset;
+ }
+
+ gst_buffer_extract (buffer, offset,
+ (guint8 *) & writer->parent.data[writer->parent.byte], size);
+ writer->parent.byte += size;
+ writer->parent.size = MAX (writer->parent.size, writer->parent.byte);
+}
+
+static inline gboolean
+_gst_byte_writer_put_buffer_inline (GstByteWriter * writer, GstBuffer * buffer,
+ gsize offset, gssize size)
+{
+ g_return_val_if_fail (writer != NULL, FALSE);
+ g_return_val_if_fail (size >= -1, FALSE);
+
+ if (size == -1) {
+ size = gst_buffer_get_size (buffer);
+
+ if (offset >= (gsize) size)
+ return TRUE;
+
+ size -= offset;
+ }
+
+ if (G_UNLIKELY (!_gst_byte_writer_ensure_free_space_inline (writer, size)))
+ return FALSE;
+
+ gst_byte_writer_put_buffer_unchecked (writer, buffer, offset, size);
+
+ return TRUE;
+}
+
+#ifndef GST_BYTE_WRITER_DISABLE_INLINES
+
+/* we use defines here so we can add the G_LIKELY() */
+
+#define gst_byte_writer_ensure_free_space(writer, size) \
+ G_LIKELY (_gst_byte_writer_ensure_free_space_inline (writer, size))
+#define gst_byte_writer_put_uint8(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint8_inline (writer, val))
+#define gst_byte_writer_put_int8(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int8_inline (writer, val))
+#define gst_byte_writer_put_uint16_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint16_be_inline (writer, val))
+#define gst_byte_writer_put_uint16_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint16_le_inline (writer, val))
+#define gst_byte_writer_put_int16_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int16_be_inline (writer, val))
+#define gst_byte_writer_put_int16_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int16_le_inline (writer, val))
+#define gst_byte_writer_put_uint24_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint24_be_inline (writer, val))
+#define gst_byte_writer_put_uint24_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint24_le_inline (writer, val))
+#define gst_byte_writer_put_int24_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int24_be_inline (writer, val))
+#define gst_byte_writer_put_int24_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int24_le_inline (writer, val))
+#define gst_byte_writer_put_uint32_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint32_be_inline (writer, val))
+#define gst_byte_writer_put_uint32_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint32_le_inline (writer, val))
+#define gst_byte_writer_put_int32_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int32_be_inline (writer, val))
+#define gst_byte_writer_put_int32_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int32_le_inline (writer, val))
+#define gst_byte_writer_put_uint64_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint64_be_inline (writer, val))
+#define gst_byte_writer_put_uint64_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_uint64_le_inline (writer, val))
+#define gst_byte_writer_put_int64_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int64_be_inline (writer, val))
+#define gst_byte_writer_put_int64_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_int64_le_inline (writer, val))
+
+#define gst_byte_writer_put_float32_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_float32_be_inline (writer, val))
+#define gst_byte_writer_put_float32_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_float32_le_inline (writer, val))
+#define gst_byte_writer_put_float64_be(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_float64_be_inline (writer, val))
+#define gst_byte_writer_put_float64_le(writer, val) \
+ G_LIKELY (_gst_byte_writer_put_float64_le_inline (writer, val))
+
+#define gst_byte_writer_put_data(writer, data, size) \
+ G_LIKELY (_gst_byte_writer_put_data_inline (writer, data, size))
+#define gst_byte_writer_fill(writer, val, size) \
+ G_LIKELY (_gst_byte_writer_fill_inline (writer, val, size))
+#define gst_byte_writer_put_buffer(writer, buffer, offset, size) \
+ G_LIKELY (_gst_byte_writer_put_buffer_inline (writer, buffer, offset, size))
+
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_BYTE_WRITER_H__ */
diff --git a/include/gst/base/gstcollectpads.h b/include/gst/base/gstcollectpads.h
new file mode 100644
index 0000000000..13d60a17d9
--- /dev/null
+++ b/include/gst/base/gstcollectpads.h
@@ -0,0 +1,456 @@
+/* GStreamer
+ * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
+ *
+ * gstcollectpads.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_COLLECT_PADS_H__
+#define __GST_COLLECT_PADS_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_COLLECT_PADS (gst_collect_pads_get_type())
+#define GST_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COLLECT_PADS,GstCollectPads))
+#define GST_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
+#define GST_COLLECT_PADS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_COLLECT_PADS,GstCollectPadsClass))
+#define GST_IS_COLLECT_PADS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLLECT_PADS))
+#define GST_IS_COLLECT_PADS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLLECT_PADS))
+
+typedef struct _GstCollectData GstCollectData;
+typedef struct _GstCollectDataPrivate GstCollectDataPrivate;
+typedef struct _GstCollectPads GstCollectPads;
+typedef struct _GstCollectPadsPrivate GstCollectPadsPrivate;
+typedef struct _GstCollectPadsClass GstCollectPadsClass;
+
+/**
+ * GstCollectDataDestroyNotify:
+ * @data: the #GstCollectData that will be freed
+ *
+ * A function that will be called when the #GstCollectData will be freed.
+ * It is passed the pointer to the structure and should free any custom
+ * memory and resources allocated for it.
+ */
+typedef void (*GstCollectDataDestroyNotify) (GstCollectData *data);
+
+/**
+ * GstCollectPadsStateFlags:
+ * @GST_COLLECT_PADS_STATE_EOS: Set if collectdata's pad is EOS.
+ * @GST_COLLECT_PADS_STATE_FLUSHING: Set if collectdata's pad is flushing.
+ * @GST_COLLECT_PADS_STATE_NEW_SEGMENT: Set if collectdata's pad received a
+ * new_segment event.
+ * @GST_COLLECT_PADS_STATE_WAITING: Set if collectdata's pad must be waited
+ * for when collecting.
+ * @GST_COLLECT_PADS_STATE_LOCKED: Set collectdata's pad WAITING state must
+ * not be changed.
+ * #GstCollectPadsStateFlags indicate private state of a collectdata('s pad).
+ */
+typedef enum {
+ GST_COLLECT_PADS_STATE_EOS = 1 << 0,
+ GST_COLLECT_PADS_STATE_FLUSHING = 1 << 1,
+ GST_COLLECT_PADS_STATE_NEW_SEGMENT = 1 << 2,
+ GST_COLLECT_PADS_STATE_WAITING = 1 << 3,
+ GST_COLLECT_PADS_STATE_LOCKED = 1 << 4
+} GstCollectPadsStateFlags;
+
+/**
+ * GST_COLLECT_PADS_STATE:
+ * @data: a #GstCollectData.
+ *
+ * A flags word containing #GstCollectPadsStateFlags flags set
+ * on this collected pad.
+ */
+#define GST_COLLECT_PADS_STATE(data) (((GstCollectData *) data)->state)
+/**
+ * GST_COLLECT_PADS_STATE_IS_SET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to check.
+ *
+ * Gives the status of a specific flag on a collected pad.
+ */
+#define GST_COLLECT_PADS_STATE_IS_SET(data,flag) !!(GST_COLLECT_PADS_STATE (data) & flag)
+/**
+ * GST_COLLECT_PADS_STATE_SET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to set.
+ *
+ * Sets a state flag on a collected pad.
+ */
+#define GST_COLLECT_PADS_STATE_SET(data,flag) (GST_COLLECT_PADS_STATE (data) |= flag)
+/**
+ * GST_COLLECT_PADS_STATE_UNSET:
+ * @data: a #GstCollectData.
+ * @flag: the #GstCollectPadsStateFlags to clear.
+ *
+ * Clears a state flag on a collected pad.
+ */
+#define GST_COLLECT_PADS_STATE_UNSET(data,flag) (GST_COLLECT_PADS_STATE (data) &= ~(flag))
+
+/**
+ * GST_COLLECT_PADS_DTS:
+ * @data: A #GstCollectData.
+ *
+ * Returns the DTS that has been converted to running time when using
+ * gst_collect_pads_clip_running_time(). Unlike the value saved into
+ * the buffer, this value is of type gint64 and may be negative. This allow
+ * properly handling streams with frame reordering where the first DTS may
+ * be negative. If the initial DTS was not set, this value will be
+ * set to %G_MININT64.
+ *
+ * Since: 1.6
+ */
+#define GST_COLLECT_PADS_DTS(data) (((GstCollectData *) data)->ABI.abi.dts)
+
+/**
+ * GST_COLLECT_PADS_DTS_IS_VALID:
+ * @data: A #GstCollectData.
+ *
+ * Check if running DTS value store is valid.
+ *
+ * Since: 1.6
+ */
+#define GST_COLLECT_PADS_DTS_IS_VALID(data) (GST_CLOCK_STIME_IS_VALID (GST_COLLECT_PADS_DTS (data)))
+
+/**
+ * GstCollectData:
+ * @collect: owner #GstCollectPads
+ * @pad: #GstPad managed by this data
+ * @buffer: currently queued buffer.
+ * @pos: position in the buffer
+ * @segment: last segment received.
+ * @dts: the signed version of the DTS converted to running time. To access
+ * this member, use %GST_COLLECT_PADS_DTS macro. (Since: 1.6)
+ *
+ * Structure used by the collect_pads.
+ */
+struct _GstCollectData
+{
+ /* with STREAM_LOCK of @collect */
+ GstCollectPads *collect;
+ GstPad *pad;
+ GstBuffer *buffer;
+ guint pos;
+ GstSegment segment;
+
+ /*< private >*/
+ /* state: bitfield for easier extension;
+ * eos, flushing, new_segment, waiting */
+ GstCollectPadsStateFlags state;
+
+ GstCollectDataPrivate *priv;
+
+ union {
+ struct {
+ /*< public >*/
+ gint64 dts;
+ /*< private >*/
+ } abi;
+ gpointer _gst_reserved[GST_PADDING];
+ } ABI;
+};
+
+/**
+ * GstCollectPadsFunction:
+ * @pads: the #GstCollectPads that triggered the callback
+ * @user_data: user data passed to gst_collect_pads_set_function()
+ *
+ * A function that will be called when all pads have received data.
+ *
+ * Returns: %GST_FLOW_OK for success
+ */
+typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
+
+/**
+ * GstCollectPadsBufferFunction:
+ * @pads: the #GstCollectPads that triggered the callback
+ * @data: the #GstCollectData of pad that has received the buffer
+ * @buffer: (transfer full): the #GstBuffer
+ * @user_data: user data passed to gst_collect_pads_set_buffer_function()
+ *
+ * A function that will be called when a (considered oldest) buffer can be muxed.
+ * If all pads have reached EOS, this function is called with %NULL @buffer
+ * and %NULL @data.
+ *
+ * Returns: %GST_FLOW_OK for success
+ */
+typedef GstFlowReturn (*GstCollectPadsBufferFunction) (GstCollectPads *pads, GstCollectData *data,
+ GstBuffer *buffer, gpointer user_data);
+
+/**
+ * GstCollectPadsCompareFunction:
+ * @pads: the #GstCollectPads that is comparing the timestamps
+ * @data1: the first #GstCollectData
+ * @timestamp1: the first timestamp
+ * @data2: the second #GstCollectData
+ * @timestamp2: the second timestamp
+ * @user_data: user data passed to gst_collect_pads_set_compare_function()
+ *
+ * A function for comparing two timestamps of buffers or newsegments collected on one pad.
+ *
+ * Returns: Integer less than zero when first timestamp is deemed older than the second one.
+ * Zero if the timestamps are deemed equally old.
+ * Integer greater than zero when second timestamp is deemed older than the first one.
+ */
+typedef gint (*GstCollectPadsCompareFunction) (GstCollectPads *pads,
+ GstCollectData * data1, GstClockTime timestamp1,
+ GstCollectData * data2, GstClockTime timestamp2,
+ gpointer user_data);
+
+/**
+ * GstCollectPadsEventFunction:
+ * @pads: the #GstCollectPads that triggered the callback
+ * @pad: the #GstPad that received an event
+ * @event: the #GstEvent received
+ * @user_data: user data passed to gst_collect_pads_set_event_function()
+ *
+ * A function that will be called while processing an event. It takes
+ * ownership of the event and is responsible for chaining up (to
+ * gst_collect_pads_event_default()) or dropping events (such typical cases
+ * being handled by the default handler).
+ *
+ * Returns: %TRUE if the pad could handle the event
+ */
+typedef gboolean (*GstCollectPadsEventFunction) (GstCollectPads *pads, GstCollectData * pad,
+ GstEvent * event, gpointer user_data);
+
+
+/**
+ * GstCollectPadsQueryFunction:
+ * @pads: the #GstCollectPads that triggered the callback
+ * @pad: the #GstPad that received an event
+ * @query: the #GstEvent received
+ * @user_data: user data passed to gst_collect_pads_set_query_function()
+ *
+ * A function that will be called while processing a query. It takes
+ * ownership of the query and is responsible for chaining up (to
+ * events downstream (with gst_pad_event_default()).
+ *
+ * Returns: %TRUE if the pad could handle the event
+ */
+typedef gboolean (*GstCollectPadsQueryFunction) (GstCollectPads *pads, GstCollectData * pad,
+ GstQuery * query, gpointer user_data);
+
+/**
+ * GstCollectPadsClipFunction:
+ * @pads: a #GstCollectPads
+ * @data: a #GstCollectData
+ * @inbuffer: (transfer full): the input #GstBuffer
+ * @outbuffer: (out): the output #GstBuffer
+ * @user_data: user data
+ *
+ * A function that will be called when @inbuffer is received on the pad managed
+ * by @data in the collectpad object @pads.
+ *
+ * The function should use the segment of @data and the negotiated media type on
+ * the pad to perform clipping of @inbuffer.
+ *
+ * This function takes ownership of @inbuffer and should output a buffer in
+ * @outbuffer or return %NULL in @outbuffer if the buffer should be dropped.
+ *
+ * Returns: a #GstFlowReturn that corresponds to the result of clipping.
+ */
+typedef GstFlowReturn (*GstCollectPadsClipFunction) (GstCollectPads *pads, GstCollectData *data,
+ GstBuffer *inbuffer, GstBuffer **outbuffer,
+ gpointer user_data);
+
+
+/**
+ * GstCollectPadsFlushFunction:
+ * @pads: a #GstCollectPads
+ * @user_data: user data
+ *
+ * A function that will be called while processing a flushing seek event.
+ *
+ * The function should flush any internal state of the element and the state of
+ * all the pads. It should clear only the state not directly managed by the
+ * @pads object. It is therefore not necessary to call
+ * gst_collect_pads_set_flushing nor gst_collect_pads_clear from this function.
+ *
+ * Since: 1.4
+ */
+typedef void (*GstCollectPadsFlushFunction) (GstCollectPads *pads, gpointer user_data);
+
+/**
+ * GST_COLLECT_PADS_GET_STREAM_LOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Get the stream lock of @pads. The stream lock is used to coordinate and
+ * serialize execution among the various streams being collected, and in
+ * protecting the resources used to accomplish this.
+ */
+#define GST_COLLECT_PADS_GET_STREAM_LOCK(pads) (&((GstCollectPads *)pads)->stream_lock)
+/**
+ * GST_COLLECT_PADS_STREAM_LOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Lock the stream lock of @pads.
+ */
+#define GST_COLLECT_PADS_STREAM_LOCK(pads) g_rec_mutex_lock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
+/**
+ * GST_COLLECT_PADS_STREAM_UNLOCK:
+ * @pads: a #GstCollectPads
+ *
+ * Unlock the stream lock of @pads.
+ */
+#define GST_COLLECT_PADS_STREAM_UNLOCK(pads) g_rec_mutex_unlock(GST_COLLECT_PADS_GET_STREAM_LOCK (pads))
+
+/**
+ * GstCollectPads:
+ * @data: (element-type GstBase.CollectData): #GList of #GstCollectData managed
+ * by this #GstCollectPads.
+ *
+ * Collectpads object.
+ */
+struct _GstCollectPads {
+ GstObject object;
+
+ /*< public >*/ /* with LOCK and/or STREAM_LOCK */
+ GSList *data; /* list of CollectData items */
+
+ /*< private >*/
+ GRecMutex stream_lock; /* used to serialize collection among several streams */
+
+ GstCollectPadsPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstCollectPadsClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_BASE_API
+GType gst_collect_pads_get_type (void);
+
+/* creating the object */
+
+GST_BASE_API
+GstCollectPads* gst_collect_pads_new (void);
+
+/* set the callbacks */
+
+GST_BASE_API
+void gst_collect_pads_set_function (GstCollectPads *pads,
+ GstCollectPadsFunction func,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_buffer_function (GstCollectPads *pads,
+ GstCollectPadsBufferFunction func,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_event_function (GstCollectPads *pads,
+ GstCollectPadsEventFunction func,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_query_function (GstCollectPads *pads,
+ GstCollectPadsQueryFunction func,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_compare_function (GstCollectPads *pads,
+ GstCollectPadsCompareFunction func,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_clip_function (GstCollectPads *pads,
+ GstCollectPadsClipFunction clipfunc,
+ gpointer user_data);
+GST_BASE_API
+void gst_collect_pads_set_flush_function (GstCollectPads *pads,
+ GstCollectPadsFlushFunction func,
+ gpointer user_data);
+
+/* pad management */
+
+GST_BASE_API
+GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size,
+ GstCollectDataDestroyNotify destroy_notify,
+ gboolean lock);
+GST_BASE_API
+gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad);
+
+/* start/stop collection */
+
+GST_BASE_API
+void gst_collect_pads_start (GstCollectPads *pads);
+
+GST_BASE_API
+void gst_collect_pads_stop (GstCollectPads *pads);
+
+GST_BASE_API
+void gst_collect_pads_set_flushing (GstCollectPads *pads, gboolean flushing);
+
+/* get collected buffers */
+
+GST_BASE_API
+GstBuffer* gst_collect_pads_peek (GstCollectPads *pads, GstCollectData *data);
+
+GST_BASE_API
+GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data);
+
+/* get collected bytes */
+
+GST_BASE_API
+guint gst_collect_pads_available (GstCollectPads *pads);
+
+GST_BASE_API
+guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data,
+ guint size);
+GST_BASE_API
+GstBuffer* gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
+ guint size);
+GST_BASE_API
+GstBuffer* gst_collect_pads_take_buffer (GstCollectPads * pads, GstCollectData * data,
+ guint size);
+
+/* setting and unsetting waiting mode */
+
+GST_BASE_API
+void gst_collect_pads_set_waiting (GstCollectPads *pads, GstCollectData *data,
+ gboolean waiting);
+
+/* convenience helper */
+
+GST_BASE_API
+GstFlowReturn gst_collect_pads_clip_running_time (GstCollectPads * pads,
+ GstCollectData * cdata,
+ GstBuffer * buf, GstBuffer ** outbuf,
+ gpointer user_data);
+
+/* default handlers */
+
+GST_BASE_API
+gboolean gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
+ GstEvent * event, gboolean discard);
+GST_BASE_API
+gboolean gst_collect_pads_src_event_default (GstCollectPads * pads, GstPad * pad,
+ GstEvent * event);
+GST_BASE_API
+gboolean gst_collect_pads_query_default (GstCollectPads * pads, GstCollectData * data,
+ GstQuery * query, gboolean discard);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstCollectPads, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_COLLECT_PADS_H__ */
diff --git a/include/gst/base/gstdataqueue.h b/include/gst/base/gstdataqueue.h
new file mode 100644
index 0000000000..e814a2b693
--- /dev/null
+++ b/include/gst/base/gstdataqueue.h
@@ -0,0 +1,184 @@
+/* GStreamer
+ * Copyright (C) 2006 Edward Hervey <edward@fluendo.com>
+ *
+ * gstdataqueue.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_DATA_QUEUE_H__
+#define __GST_DATA_QUEUE_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_DATA_QUEUE \
+ (gst_data_queue_get_type())
+#define GST_DATA_QUEUE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DATA_QUEUE,GstDataQueue))
+#define GST_DATA_QUEUE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DATA_QUEUE,GstDataQueueClass))
+#define GST_IS_DATA_QUEUE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DATA_QUEUE))
+#define GST_IS_DATA_QUEUE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DATA_QUEUE))
+
+typedef struct _GstDataQueue GstDataQueue;
+typedef struct _GstDataQueueClass GstDataQueueClass;
+typedef struct _GstDataQueueSize GstDataQueueSize;
+typedef struct _GstDataQueueItem GstDataQueueItem;
+typedef struct _GstDataQueuePrivate GstDataQueuePrivate;
+
+/**
+ * GstDataQueueItem: (skip)
+ * @object: the #GstMiniObject to queue.
+ * @size: the size in bytes of the miniobject.
+ * @duration: the duration in #GstClockTime of the miniobject. Can not be
+ * %GST_CLOCK_TIME_NONE.
+ * @visible: %TRUE if @object should be considered as a visible object.
+ * @destroy: The #GDestroyNotify function to use to free the #GstDataQueueItem.
+ * This function should also drop the reference to @object the owner of the
+ * #GstDataQueueItem is assumed to hold.
+ *
+ * Structure used by #GstDataQueue. You can supply a different structure, as
+ * long as the top of the structure is identical to this structure.
+ */
+
+struct _GstDataQueueItem
+{
+ GstMiniObject *object;
+ guint size;
+ guint64 duration;
+ gboolean visible;
+
+ /* user supplied destroy function */
+ GDestroyNotify destroy;
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDataQueueSize: (skip)
+ * @visible: number of buffers
+ * @bytes: number of bytes
+ * @time: amount of time
+ *
+ * Structure describing the size of a queue.
+ */
+struct _GstDataQueueSize
+{
+ guint visible;
+ guint bytes;
+ guint64 time;
+};
+
+/**
+ * GstDataQueueCheckFullFunction: (skip)
+ * @queue: a #GstDataQueue.
+ * @visible: The number of visible items currently in the queue.
+ * @bytes: The amount of bytes currently in the queue.
+ * @time: The accumulated duration of the items currently in the queue.
+ * @checkdata: The #gpointer registered when the #GstDataQueue was created.
+ *
+ * The prototype of the function used to inform the queue that it should be
+ * considered as full.
+ *
+ * Returns: %TRUE if the queue should be considered full.
+ */
+typedef gboolean (*GstDataQueueCheckFullFunction) (GstDataQueue * queue,
+ guint visible, guint bytes, guint64 time, gpointer checkdata);
+
+typedef void (*GstDataQueueFullCallback) (GstDataQueue * queue, gpointer checkdata);
+typedef void (*GstDataQueueEmptyCallback) (GstDataQueue * queue, gpointer checkdata);
+
+/**
+ * GstDataQueue:
+ * @object: the parent structure
+ *
+ * Opaque #GstDataQueue structure.
+ */
+struct _GstDataQueue
+{
+ GObject object;
+
+ /*< private >*/
+ GstDataQueuePrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDataQueueClass:
+ */
+struct _GstDataQueueClass
+{
+ GObjectClass parent_class;
+
+ /* signals */
+ void (*empty) (GstDataQueue * queue);
+ void (*full) (GstDataQueue * queue);
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_BASE_API
+GType gst_data_queue_get_type (void);
+
+GST_BASE_API
+GstDataQueue * gst_data_queue_new (GstDataQueueCheckFullFunction checkfull,
+ GstDataQueueFullCallback fullcallback,
+ GstDataQueueEmptyCallback emptycallback,
+ gpointer checkdata) G_GNUC_MALLOC;
+GST_BASE_API
+gboolean gst_data_queue_push (GstDataQueue * queue, GstDataQueueItem * item);
+
+GST_BASE_API
+gboolean gst_data_queue_push_force (GstDataQueue * queue, GstDataQueueItem * item);
+
+GST_BASE_API
+gboolean gst_data_queue_pop (GstDataQueue * queue, GstDataQueueItem ** item);
+
+GST_BASE_API
+gboolean gst_data_queue_peek (GstDataQueue * queue, GstDataQueueItem ** item);
+
+GST_BASE_API
+void gst_data_queue_flush (GstDataQueue * queue);
+
+GST_BASE_API
+void gst_data_queue_set_flushing (GstDataQueue * queue, gboolean flushing);
+
+GST_BASE_API
+gboolean gst_data_queue_drop_head (GstDataQueue * queue, GType type);
+
+GST_BASE_API
+gboolean gst_data_queue_is_full (GstDataQueue * queue);
+
+GST_BASE_API
+gboolean gst_data_queue_is_empty (GstDataQueue * queue);
+
+GST_BASE_API
+void gst_data_queue_get_level (GstDataQueue * queue, GstDataQueueSize *level);
+
+GST_BASE_API
+void gst_data_queue_limits_changed (GstDataQueue * queue);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDataQueue, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DATA_QUEUE_H__ */
diff --git a/include/gst/base/gstflowcombiner.h b/include/gst/base/gstflowcombiner.h
new file mode 100644
index 0000000000..fa905a93fc
--- /dev/null
+++ b/include/gst/base/gstflowcombiner.h
@@ -0,0 +1,82 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
+ * Author: Thiago Santos <ts.santos@sisa.samsung.com>
+ *
+ * gstflowcombiner.h: utility to combine multiple flow returns into a single one
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_FLOW_COMBINER_H__
+#define __GST_FLOW_COMBINER_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_FLOW_COMBINER gst_flow_combiner_get_type()
+
+/**
+ * GstFlowCombiner:
+ *
+ * Opaque helper structure to aggregate flow returns.
+ *
+ * Since: 1.4
+ */
+typedef struct _GstFlowCombiner GstFlowCombiner;
+
+GST_BASE_API
+GstFlowCombiner * gst_flow_combiner_new (void);
+
+GST_BASE_API
+GstFlowCombiner * gst_flow_combiner_ref (GstFlowCombiner * combiner);
+
+GST_BASE_API
+void gst_flow_combiner_unref (GstFlowCombiner * combiner);
+
+GST_BASE_API
+void gst_flow_combiner_free (GstFlowCombiner * combiner);
+
+GST_BASE_API
+GstFlowReturn gst_flow_combiner_update_flow (GstFlowCombiner * combiner, GstFlowReturn fret);
+
+GST_BASE_API
+GstFlowReturn gst_flow_combiner_update_pad_flow (GstFlowCombiner * combiner, GstPad * pad,
+ GstFlowReturn fret);
+GST_BASE_API
+void gst_flow_combiner_add_pad (GstFlowCombiner * combiner, GstPad * pad);
+
+GST_BASE_API
+void gst_flow_combiner_remove_pad (GstFlowCombiner * combiner, GstPad * pad);
+
+GST_BASE_API
+void gst_flow_combiner_clear (GstFlowCombiner * combiner);
+
+GST_BASE_API
+void gst_flow_combiner_reset (GstFlowCombiner * combiner);
+
+GST_BASE_API
+GType gst_flow_combiner_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstFlowCombiner, gst_flow_combiner_free)
+
+G_END_DECLS
+
+#endif /* __GST_FLOW_COMBINER_H__ */
diff --git a/include/gst/base/gstpushsrc.h b/include/gst/base/gstpushsrc.h
new file mode 100644
index 0000000000..d0d8cef9b7
--- /dev/null
+++ b/include/gst/base/gstpushsrc.h
@@ -0,0 +1,102 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstpushsrc.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PUSH_SRC_H__
+#define __GST_PUSH_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasesrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PUSH_SRC (gst_push_src_get_type())
+#define GST_PUSH_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PUSH_SRC,GstPushSrc))
+#define GST_PUSH_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PUSH_SRC,GstPushSrcClass))
+#define GST_PUSH_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PUSH_SRC, GstPushSrcClass))
+#define GST_IS_PUSH_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PUSH_SRC))
+#define GST_IS_PUSH_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PUSH_SRC))
+
+typedef struct _GstPushSrc GstPushSrc;
+typedef struct _GstPushSrcClass GstPushSrcClass;
+
+/**
+ * GstPushSrc:
+ *
+ * The opaque #GstPushSrc data structure.
+ */
+struct _GstPushSrc {
+ GstBaseSrc parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstPushSrcClass:
+ * @parent_class: Element parent class
+ * @create: Ask the subclass to create a buffer. The subclass decides which
+ * size this buffer should be. Other then that, refer to
+ * #GstBaseSrc<!-- -->.create() for more details. If this method is
+ * not implemented, @alloc followed by @fill will be called.
+ * @alloc: Ask the subclass to allocate a buffer. The subclass decides which
+ * size this buffer should be. The default implementation will create
+ * a new buffer from the negotiated allocator.
+ * @fill: Ask the subclass to fill the buffer with data.
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At the minimum, the @fill method should be overridden to produce
+ * buffers.
+ */
+struct _GstPushSrcClass {
+ GstBaseSrcClass parent_class;
+
+ /**
+ * GstPushSrcClass::create:
+ * @buf: (inout):
+ *
+ * Ask the subclass to create a buffer, the default implementation will call alloc if
+ * no allocated @buf is provided and then call fill.
+ */
+ GstFlowReturn (*create) (GstPushSrc *src, GstBuffer **buf);
+ /**
+ * GstPushSrcClass::alloc:
+ * @buf: (out):
+ *
+ * Allocate memory for a buffer.
+ */
+ GstFlowReturn (*alloc) (GstPushSrc *src, GstBuffer **buf);
+ /* ask the subclass to fill a buffer */
+ GstFlowReturn (*fill) (GstPushSrc *src, GstBuffer *buf);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_BASE_API
+GType gst_push_src_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPushSrc, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PUSH_SRC_H__ */
diff --git a/include/gst/base/gstqueuearray.h b/include/gst/base/gstqueuearray.h
new file mode 100644
index 0000000000..77edec0990
--- /dev/null
+++ b/include/gst/base/gstqueuearray.h
@@ -0,0 +1,109 @@
+/* GStreamer
+ * Copyright (C) 2009-2010 Edward Hervey <bilboed@bilboed.com>
+ *
+ * gstqueuearray.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+
+#ifndef __GST_QUEUE_ARRAY_H__
+#define __GST_QUEUE_ARRAY_H__
+
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstQueueArray: (skip)
+ */
+typedef struct _GstQueueArray GstQueueArray;
+
+GST_BASE_API
+GstQueueArray * gst_queue_array_new (guint initial_size);
+
+GST_BASE_API
+void gst_queue_array_free (GstQueueArray * array);
+
+GST_BASE_API
+void gst_queue_array_set_clear_func (GstQueueArray *array,
+ GDestroyNotify clear_func);
+
+GST_BASE_API
+void gst_queue_array_clear (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_pop_head (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_head (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_nth (GstQueueArray * array, guint idx);
+
+GST_BASE_API
+gpointer gst_queue_array_pop_tail (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_tail (GstQueueArray * array);
+
+GST_BASE_API
+void gst_queue_array_push_tail (GstQueueArray * array,
+ gpointer data);
+GST_BASE_API
+gboolean gst_queue_array_is_empty (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_drop_element (GstQueueArray * array,
+ guint idx);
+GST_BASE_API
+guint gst_queue_array_find (GstQueueArray * array,
+ GCompareFunc func,
+ gpointer data);
+GST_BASE_API
+guint gst_queue_array_get_length (GstQueueArray * array);
+
+/* Functions for use with structures */
+
+GST_BASE_API
+GstQueueArray * gst_queue_array_new_for_struct (gsize struct_size,
+ guint initial_size);
+GST_BASE_API
+void gst_queue_array_push_tail_struct (GstQueueArray * array,
+ gpointer p_struct);
+GST_BASE_API
+gpointer gst_queue_array_pop_head_struct (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_head_struct (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_nth_struct (GstQueueArray * array, guint idx);
+
+GST_BASE_API
+gboolean gst_queue_array_drop_struct (GstQueueArray * array,
+ guint idx,
+ gpointer p_struct);
+GST_BASE_API
+gpointer gst_queue_array_pop_tail_struct (GstQueueArray * array);
+
+GST_BASE_API
+gpointer gst_queue_array_peek_tail_struct (GstQueueArray * array);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/base/gsttypefindhelper.h b/include/gst/base/gsttypefindhelper.h
new file mode 100644
index 0000000000..bda346cac1
--- /dev/null
+++ b/include/gst/base/gsttypefindhelper.h
@@ -0,0 +1,105 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2000,2005 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ *
+ * gsttypefindhelper.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TYPEFINDHELPER_H__
+#define __GST_TYPEFINDHELPER_H__
+
+#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
+
+G_BEGIN_DECLS
+
+GST_BASE_API
+GstCaps * gst_type_find_helper (GstPad *src, guint64 size);
+
+GST_BASE_API
+GstCaps * gst_type_find_helper_for_data (GstObject *obj,
+ const guint8 *data,
+ gsize size,
+ GstTypeFindProbability *prob);
+
+GST_BASE_API
+GstCaps * gst_type_find_helper_for_data_with_extension (GstObject *obj,
+ const guint8 *data,
+ gsize size,
+ const gchar *extension,
+ GstTypeFindProbability *prob);
+
+GST_BASE_API
+GstCaps * gst_type_find_helper_for_buffer (GstObject *obj,
+ GstBuffer *buf,
+ GstTypeFindProbability *prob);
+
+GST_BASE_API
+GstCaps * gst_type_find_helper_for_buffer_with_extension (GstObject *obj,
+ GstBuffer *buf,
+ const gchar *extension,
+ GstTypeFindProbability *prob);
+
+GST_BASE_API
+GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
+ const gchar * extension);
+
+/**
+ * GstTypeFindHelperGetRangeFunction:
+ * @obj: a #GstObject that will handle the getrange request
+ * @parent: (allow-none): the parent of @obj or %NULL
+ * @offset: the offset of the range
+ * @length: the length of the range
+ * @buffer: (out): a memory location to hold the result buffer
+ *
+ * This function will be called by gst_type_find_helper_get_range() when
+ * typefinding functions request to peek at the data of a stream at certain
+ * offsets. If this function returns GST_FLOW_OK, the result buffer will be
+ * stored in @buffer. The contents of @buffer is invalid for any other
+ * return value.
+ *
+ * This function is supposed to behave exactly like a #GstPadGetRangeFunction.
+ *
+ * Returns: GST_FLOW_OK for success
+ */
+typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject *obj,
+ GstObject *parent,
+ guint64 offset,
+ guint length,
+ GstBuffer **buffer);
+GST_BASE_API
+GstCaps * gst_type_find_helper_get_range (GstObject *obj,
+ GstObject *parent,
+ GstTypeFindHelperGetRangeFunction func,
+ guint64 size,
+ const gchar *extension,
+ GstTypeFindProbability *prob);
+
+GST_BASE_API
+GstFlowReturn gst_type_find_helper_get_range_full (GstObject *obj,
+ GstObject *parent,
+ GstTypeFindHelperGetRangeFunction func,
+ guint64 size,
+ const gchar *extension,
+ GstCaps **caps,
+ GstTypeFindProbability *prob);
+
+G_END_DECLS
+
+#endif /* __GST_TYPEFINDHELPER_H__ */
diff --git a/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h b/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h
new file mode 100644
index 0000000000..ec9a766085
--- /dev/null
+++ b/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer BaseCameraBinSrc Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * basecamerasrc-prelude.h: prelude include header for gst-basecamerasrc library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__
+#define __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_BASE_CAMERA_BIN_SRC_API
+# ifdef BUILDING_GST_BASE_CAMERA_BIN_SRC
+# define GST_BASE_CAMERA_BIN_SRC_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_BASE_CAMERA_BIN_SRC_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__ */
diff --git a/include/gst/basecamerabinsrc/gstbasecamerasrc.h b/include/gst/basecamerabinsrc/gstbasecamerasrc.h
new file mode 100644
index 0000000000..9318c01c68
--- /dev/null
+++ b/include/gst/basecamerabinsrc/gstbasecamerasrc.h
@@ -0,0 +1,159 @@
+/*
+ * GStreamer
+ * Copyright (C) 2010 Texas Instruments, Inc
+ * Copyright (C) 2011 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_BASE_CAMERA_SRC_H__
+#define __GST_BASE_CAMERA_SRC_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "GstBaseCameraSrc is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/gstbin.h>
+#include "basecamerabinsrc-prelude.h"
+#include "gstcamerabin-enum.h"
+#include "gstcamerabinpreview.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BASE_CAMERA_SRC \
+ (gst_base_camera_src_get_type())
+#define GST_BASE_CAMERA_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrc))
+#define GST_BASE_CAMERA_SRC_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_CAMERA_SRC, GstBaseCameraSrcClass))
+#define GST_BASE_CAMERA_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrcClass))
+#define GST_IS_BASE_CAMERA_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_CAMERA_SRC))
+#define GST_IS_BASE_CAMERA_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_CAMERA_SRC))
+#define GST_BASE_CAMERA_SRC_CAST(obj) \
+ ((GstBaseCameraSrc *) (obj))
+GST_BASE_CAMERA_BIN_SRC_API
+GType gst_base_camera_src_get_type (void);
+
+typedef struct _GstBaseCameraSrc GstBaseCameraSrc;
+typedef struct _GstBaseCameraSrcClass GstBaseCameraSrcClass;
+
+#define GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME "vfsrc"
+#define GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME "imgsrc"
+#define GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME "vidsrc"
+
+#define GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME "preview-image"
+
+/**
+ * GstBaseCameraSrc:
+ */
+struct _GstBaseCameraSrc
+{
+ GstBin parent;
+
+ GstCameraBinMode mode;
+
+ gboolean auto_start;
+ gboolean capturing;
+ GMutex capturing_mutex;
+
+ /* Preview convert pipeline */
+ GstCaps *preview_caps;
+ gboolean post_preview;
+ GstElement *preview_filter;
+ GstCameraBinPreviewPipelineData *preview_pipeline;
+
+ /* Resolution of the buffers configured to camerabin */
+ gint width;
+ gint height;
+
+ gfloat zoom;
+ gfloat max_zoom;
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+
+/**
+ * GstBaseCameraSrcClass:
+ * @construct_pipeline: construct pipeline
+ * @setup_pipeline: configure pipeline for the chosen settings
+ * @set_zoom: set the zoom
+ * @set_mode: set the mode
+ */
+struct _GstBaseCameraSrcClass
+{
+ GstBinClass parent;
+
+ /* Construct pipeline. (called in GST_STATE_CHANGE_NULL_TO_READY) Optional. */
+ gboolean (*construct_pipeline) (GstBaseCameraSrc *self);
+
+ /* (called in GST_STATE_CHANGE_READY_TO_PAUSED). Optional. */
+ gboolean (*setup_pipeline) (GstBaseCameraSrc *self);
+
+ /* Set the zoom. If set, called when changing 'zoom' property. Optional. */
+ void (*set_zoom) (GstBaseCameraSrc *self, gfloat zoom);
+
+ /* Set the mode. If set, called when changing 'mode' property. Optional. */
+ gboolean (*set_mode) (GstBaseCameraSrc *self,
+ GstCameraBinMode mode);
+
+ /* Set preview caps. If set, called called when setting new 'preview-caps'. Optional. */
+ gboolean (*set_preview) (GstBaseCameraSrc *self,
+ GstCaps *preview_caps);
+
+ /* Called by the handler for 'start-capture'. Mandatory. */
+ gboolean (*start_capture) (GstBaseCameraSrc * src);
+
+ /* Called by the handler for 'stop-capture'. Mandatory. */
+ void (*stop_capture) (GstBaseCameraSrc * src);
+
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+
+/* FIXME: these should be properly namespaced if they're meant as exposed API */
+#ifndef __GI_SCANNER__
+#define MIN_ZOOM 1.0f
+#define MAX_ZOOM 10.0f
+#define ZOOM_1X MIN_ZOOM
+#endif /* !__GI_SCANNER__ */
+
+GST_BASE_CAMERA_BIN_SRC_API
+gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode);
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self);
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, GstCaps * preview_caps);
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self);
+
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_base_camera_src_post_preview (GstBaseCameraSrc *self, GstSample * sample);
+// XXX add methods to get/set img capture and vid capture caps..
+
+G_END_DECLS
+
+#endif /* __GST_BASE_CAMERA_SRC_H__ */
diff --git a/include/gst/basecamerabinsrc/gstcamerabin-enum.h b/include/gst/basecamerabinsrc/gstcamerabin-enum.h
new file mode 100644
index 0000000000..bba15c0b1f
--- /dev/null
+++ b/include/gst/basecamerabinsrc/gstcamerabin-enum.h
@@ -0,0 +1,68 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Nokia Corporation <multimedia@maemo.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CAMERABIN_ENUM_H__
+#define __GST_CAMERABIN_ENUM_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "camerabin enums are unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include "basecamerabinsrc-prelude.h"
+
+G_BEGIN_DECLS
+
+/* FIXME: these should be properly namespaced if they're meant as exposed API */
+#ifndef __GI_SCANNER__
+#define DEFAULT_WIDTH 640
+#define DEFAULT_HEIGHT 480
+#define DEFAULT_CAPTURE_WIDTH 800
+#define DEFAULT_CAPTURE_HEIGHT 600
+#define DEFAULT_FPS_N 0 /* makes it use the default */
+#define DEFAULT_FPS_D 1
+#define DEFAULT_ZOOM MIN_ZOOM
+#endif /* !__GI_SCANNER__ */
+
+
+/* FIXME: properly namespace these enums */
+/**
+ * GstCameraBinMode:
+ * @MODE_IMAGE: image capture
+ * @MODE_VIDEO: video capture
+ *
+ * Capture mode to use.
+ */
+typedef enum
+{
+ /* MODE_PREVIEW = 0, No use for this */
+ MODE_IMAGE = 1,
+ MODE_VIDEO = 2,
+} GstCameraBinMode;
+
+/* FIXME: should be CAMERA_BIN_MODE and camera_bin_mode */
+#define GST_TYPE_CAMERABIN_MODE (gst_camerabin_mode_get_type ())
+GST_BASE_CAMERA_BIN_SRC_API
+GType gst_camerabin_mode_get_type (void);
+
+G_END_DECLS
+
+#endif /* #ifndef __GST_CAMERABIN_ENUM_H__ */
diff --git a/include/gst/basecamerabinsrc/gstcamerabinpreview.h b/include/gst/basecamerabinsrc/gstcamerabinpreview.h
new file mode 100644
index 0000000000..a0f3c0f0ce
--- /dev/null
+++ b/include/gst/basecamerabinsrc/gstcamerabinpreview.h
@@ -0,0 +1,69 @@
+/*
+ * GStreamer
+ * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
+ * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CAMERABIN_PREVIEW_H_
+#define __CAMERABIN_PREVIEW_H_
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "camera bin preview is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include "basecamerabinsrc-prelude.h"
+
+/**
+ * GstCameraBinPreviewPipelineData: (skip)
+ */
+typedef struct
+{
+ GstElement *pipeline;
+
+ GstElement *appsrc;
+ GstElement *filter;
+ GstElement *appsink;
+ GstElement *vscale;
+
+ GstElement *element;
+
+ GstCaps *pending_preview_caps;
+ guint processing;
+ GMutex processing_lock;
+ GCond processing_cond;
+
+} GstCameraBinPreviewPipelineData;
+
+GST_BASE_CAMERA_BIN_SRC_API
+GstCameraBinPreviewPipelineData *gst_camerabin_create_preview_pipeline (GstElement * element, GstElement * filter);
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * preview);
+
+GST_BASE_CAMERA_BIN_SRC_API
+gboolean gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, GstSample * sample);
+
+GST_BASE_CAMERA_BIN_SRC_API
+void gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, GstCaps * caps);
+
+GST_BASE_CAMERA_BIN_SRC_API
+gboolean gst_camerabin_preview_set_filter (GstCameraBinPreviewPipelineData * preview, GstElement * filter);
+
+#endif /* #ifndef __CAMERABIN_PREVIEW_H_ */
diff --git a/include/gst/check/check-prelude.h b/include/gst/check/check-prelude.h
new file mode 100644
index 0000000000..0fc272598b
--- /dev/null
+++ b/include/gst/check/check-prelude.h
@@ -0,0 +1,43 @@
+/* GStreamer Check Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * check-prelude.h: prelude include header for gst-check library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CHECK_PRELUDE_H__
+#define __GST_CHECK_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_CHECK_API
+#ifdef BUILDING_GST_CHECK
+#define GST_CHECK_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_CHECK_API GST_API_IMPORT
+#endif
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_CHECK_DEPRECATED GST_CHECK_API
+#define GST_CHECK_DEPRECATED_FOR(f) GST_CHECK_API
+#else
+#define GST_CHECK_DEPRECATED G_DEPRECATED GST_CHECK_API
+#define GST_CHECK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_CHECK_API
+#endif
+
+#endif /* __GST_CHECK_PRELUDE_H__ */
diff --git a/include/gst/check/check.h b/include/gst/check/check.h
new file mode 100644
index 0000000000..512f06ca54
--- /dev/null
+++ b/include/gst/check/check.h
@@ -0,0 +1,33 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * check.h: single include header for gst-check library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CHECK__H__
+#define __GST_CHECK__H__
+
+#include <gst/check/check-prelude.h>
+
+#include <gst/check/gstbufferstraw.h>
+#include <gst/check/gstcheck.h>
+#include <gst/check/gstconsistencychecker.h>
+#include <gst/check/gstharness.h>
+#include <gst/check/gsttestclock.h>
+
+#endif /* __GST_CHECK__H__ */
diff --git a/include/gst/check/gstbufferstraw.h b/include/gst/check/gstbufferstraw.h
new file mode 100644
index 0000000000..9eec1f9bd4
--- /dev/null
+++ b/include/gst/check/gstbufferstraw.h
@@ -0,0 +1,40 @@
+/* GStreamer
+ *
+ * Copyright (C) 2006 Andy Wingo <wingo at pobox.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BUFFER_STRAW_H__
+#define __GST_BUFFER_STRAW_H__
+
+
+#include <gst/check/gstcheck.h>
+
+G_BEGIN_DECLS
+
+GST_CHECK_API
+void gst_buffer_straw_start_pipeline (GstElement * bin, GstPad * pad);
+
+GST_CHECK_API
+GstBuffer * gst_buffer_straw_get_buffer (GstElement * bin, GstPad * pad);
+
+GST_CHECK_API
+void gst_buffer_straw_stop_pipeline (GstElement * bin, GstPad * pad);
+
+G_END_DECLS
+
+#endif /* __GST_BUFFER_STRAW_H__ */
diff --git a/include/gst/check/gstcheck.h b/include/gst/check/gstcheck.h
new file mode 100644
index 0000000000..b7ec2c4ab3
--- /dev/null
+++ b/include/gst/check/gstcheck.h
@@ -0,0 +1,756 @@
+/* GStreamer
+ *
+ * Common code for GStreamer unittests
+ *
+ * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
+ * Copyright (C) <2008> Thijs Vermeir <thijsvermeir@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CHECK_H__
+#define __GST_CHECK_H__
+
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <gst/gst.h>
+#include <gst/check/check-prelude.h>
+
+#define CK_DLL_EXP GST_CHECK_API
+#include <gst/check/internal-check.h>
+
+G_BEGIN_DECLS
+
+GST_CHECK_API GstDebugCategory *check_debug;
+#define GST_CAT_DEFAULT check_debug
+
+/* logging function for tests
+ * a test uses g_message() to log a debug line
+ * a gst unit test can be run with GST_TEST_DEBUG env var set to see the
+ * messages
+ */
+GST_CHECK_API gboolean _gst_check_threads_running;
+GST_CHECK_API gboolean _gst_check_raised_critical;
+GST_CHECK_API gboolean _gst_check_raised_warning;
+GST_CHECK_API gboolean _gst_check_expecting_log;
+GST_CHECK_API gboolean _gst_check_list_tests;
+
+/* global variables used in test methods */
+GST_CHECK_API GList * buffers;
+
+GST_CHECK_API GMutex check_mutex;
+GST_CHECK_API GCond check_cond;
+
+/**
+ * GstCheckABIStruct:
+ * @name: The name of the structure
+ * @size: The current size of a structure
+ * @abi_size: The reference size of the structure
+ */
+typedef struct
+{
+ const char *name;
+ int size;
+ int abi_size;
+}
+GstCheckABIStruct;
+
+/**
+ * GstCheckLogFilter:
+ *
+ * Opaque structure containing data about a log filter
+ * function.
+ */
+typedef struct _GstCheckLogFilter GstCheckLogFilter;
+
+/**
+ * GstCheckLogFilterFunc:
+ * @log_domain: the log domain of the message
+ * @log_level: the log level of the message
+ * @message: the message that has occurred
+ * @user_data: user data
+ *
+ * A function that is called for messages matching the filter added by
+ * @gst_check_add_log_filter.
+ *
+ * Returns: %TRUE if message should be discarded by GstCheck.
+ *
+ * Since: 1.12
+ */
+typedef gboolean (*GstCheckLogFilterFunc) (const gchar * log_domain,
+ GLogLevelFlags log_level, const gchar * message, gpointer user_data);
+
+GST_CHECK_API
+void gst_check_init (int *argc, char **argv[]);
+
+GST_CHECK_API
+GstCheckLogFilter * gst_check_add_log_filter (const gchar * log_domain,
+ GLogLevelFlags log_level, GRegex * regex, GstCheckLogFilterFunc func,
+ gpointer user_data, GDestroyNotify destroy_data);
+
+GST_CHECK_API
+void gst_check_remove_log_filter (GstCheckLogFilter * filter);
+
+GST_CHECK_API
+void gst_check_clear_log_filter (void);
+
+GST_CHECK_API
+GstFlowReturn gst_check_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer);
+
+GST_CHECK_API
+void gst_check_message_error (GstMessage * message, GstMessageType type,
+ GQuark domain, gint code);
+
+GST_CHECK_API
+GstElement *gst_check_setup_element (const gchar * factory);
+
+GST_CHECK_API
+void gst_check_teardown_element (GstElement * element);
+
+GST_CHECK_API
+GstPad *gst_check_setup_src_pad (GstElement * element,
+ GstStaticPadTemplate * tmpl);
+
+GST_CHECK_API
+GstPad *gst_check_setup_src_pad_from_template (GstElement * element,
+ GstPadTemplate * tmpl);
+
+GST_CHECK_API
+GstPad * gst_check_setup_src_pad_by_name (GstElement * element,
+ GstStaticPadTemplate * tmpl, const gchar *name);
+
+GST_CHECK_API
+GstPad * gst_check_setup_src_pad_by_name_from_template (GstElement * element,
+ GstPadTemplate * tmpl, const gchar *name);
+
+GST_CHECK_API
+GstPad *gst_check_setup_sink_pad (GstElement * element,
+ GstStaticPadTemplate * tmpl);
+
+GST_CHECK_API
+GstPad *gst_check_setup_sink_pad_from_template (GstElement * element,
+ GstPadTemplate * tmpl);
+
+GST_CHECK_API
+GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
+ GstStaticPadTemplate * tmpl, const gchar *name);
+
+GST_CHECK_API
+GstPad * gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
+ GstPadTemplate * tmpl, const gchar *name);
+
+GST_CHECK_API
+void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
+
+GST_CHECK_API
+void gst_check_teardown_src_pad (GstElement * element);
+
+GST_CHECK_API
+void gst_check_drop_buffers (void);
+
+GST_CHECK_API
+void gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2);
+
+GST_CHECK_API
+void gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size);
+
+GST_CHECK_API
+void gst_check_element_push_buffer_list (const gchar * element_name,
+ GList * buffer_in, GstCaps * caps_in, GList * buffer_out,
+ GstCaps * caps_out, GstFlowReturn last_flow_return);
+
+GST_CHECK_API
+void gst_check_element_push_buffer (const gchar * element_name,
+ GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out,
+ GstCaps *caps_out);
+
+GST_CHECK_API
+void gst_check_teardown_sink_pad (GstElement * element);
+
+GST_CHECK_API
+void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
+
+GST_CHECK_API
+gint gst_check_run_suite (Suite * suite, const gchar * name,
+ const gchar * fname);
+
+GST_CHECK_API
+void gst_check_setup_events (GstPad * srcpad, GstElement * element,
+ GstCaps * caps, GstFormat format);
+
+GST_CHECK_API
+void gst_check_setup_events_with_stream_id (GstPad * srcpad,
+ GstElement * element, GstCaps * caps, GstFormat format,
+ const gchar * stream_id);
+
+GST_CHECK_API
+void gst_check_objects_destroyed_on_unref (gpointer object_to_unref, gpointer first_object, ...)
+ G_GNUC_NULL_TERMINATED;
+
+GST_CHECK_API
+void gst_check_object_destroyed_on_unref (gpointer object_to_unref);
+
+#ifndef __GI_SCANNER__
+
+#define fail_unless_message_error(msg, domain, code) \
+gst_check_message_error (msg, GST_MESSAGE_ERROR, \
+ GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
+#define assert_message_error(m, d, c) fail_unless_message_error(m, d, c)
+
+#ifdef GST_CHECK_TEST_ENVIRONMENT_BEACON
+#define GST_DO_CHECK_TEST_ENVIRONMENT \
+G_STMT_START { \
+ if (g_getenv (GST_CHECK_TEST_ENVIRONMENT_BEACON) == NULL) \
+ fail ("Test environment not set up correctly! Expected environment " \
+ "variable '%s' to be set.", GST_CHECK_TEST_ENVIRONMENT_BEACON); \
+} G_STMT_END
+
+#else
+#define GST_DO_CHECK_TEST_ENVIRONMENT /* nothing to check */
+#endif
+
+/**
+ * GST_START_TEST:
+ * @__testname: test function name
+ *
+ * wrapper for checks START_TEST
+ */
+/**
+ * GST_END_TEST:
+ *
+ * wrapper for checks END_TEST
+ */
+#define GST_START_TEST(__testname) \
+static void __testname (int G_GNUC_UNUSED __i__) \
+{\
+ GST_DEBUG ("test start"); \
+ GST_DO_CHECK_TEST_ENVIRONMENT; \
+ tcase_fn_start (""# __testname, __FILE__, __LINE__);
+
+#define GST_END_TEST GST_LOG ("cleaning up tasks"); \
+ gst_task_cleanup_all (); \
+ END_TEST
+
+/* additional fail macros */
+/**
+ * fail_unless_equals_int:
+ * @a: a #gint value or expression
+ * @b: a #gint value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define fail_unless_equals_int(a, b) \
+G_STMT_START { \
+ int first = a; \
+ int second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \
+} G_STMT_END;
+/**
+ * assert_equals_int:
+ * @a: a #gint value or expression
+ * @b: a #gint value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define assert_equals_int(a, b) fail_unless_equals_int(a, b)
+
+/**
+ * fail_unless_equals_int_hex:
+ * @a: a #gint value or expression
+ * @b: a #gint value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define fail_unless_equals_int_hex(a, b) \
+G_STMT_START { \
+ int first = a; \
+ int second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (0x%08x) is not equal to '" #b"' (0x%08x)", first, second);\
+} G_STMT_END;
+
+/**
+ * assert_equals_int_hex:
+ * @a: a #gint value or expression
+ * @b: a #gint value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define assert_equals_int_hex(a, b) fail_unless_equals_int_hex(a, b)
+
+/**
+ * fail_unless_equals_int64:
+ * @a: a #gint64 value or expression
+ * @b: a #gint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define fail_unless_equals_int64(a, b) \
+G_STMT_START { \
+ gint64 first = a; \
+ gint64 second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%" G_GINT64_FORMAT") is not equal to '" #b"' (%" \
+ G_GINT64_FORMAT")", first, second); \
+} G_STMT_END;
+/**
+ * assert_equals_int64:
+ * @a: a #gint64 value or expression
+ * @b: a #gint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define assert_equals_int64(a, b) fail_unless_equals_int64(a, b)
+
+/**
+ * fail_unless_equals_int64_hex:
+ * @a: a #gint64 value or expression
+ * @b: a #gint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define fail_unless_equals_int64_hex(a, b) \
+G_STMT_START { \
+ gint64 first = a; \
+ gint64 second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (0x%016x) is not equal to '" #b"' (0x%016x)", first, second);\
+} G_STMT_END;
+/**
+ * assert_equals_int64_hex:
+ * @a: a #gint64 value or expression
+ * @b: a #gint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define assert_equals_int64_hex(a,b) fail_unless_equals_int64_hex(a,b)
+
+/**
+ * fail_unless_equals_uint64:
+ * @a: a #guint64 value or expression
+ * @b: a #guint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define fail_unless_equals_uint64(a, b) \
+G_STMT_START { \
+ guint64 first = a; \
+ guint64 second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%" G_GUINT64_FORMAT ") is not equal to '" #b"' (%" \
+ G_GUINT64_FORMAT ")", first, second); \
+} G_STMT_END;
+/**
+ * assert_equals_uint64:
+ * @a: a #guint64 value or expression
+ * @b: a #guint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define assert_equals_uint64(a, b) fail_unless_equals_uint64(a, b)
+
+/**
+ * fail_unless_equals_uint64_hex:
+ * @a: a #gint64 value or expression
+ * @b: a #gint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define fail_unless_equals_uint64_hex(a, b) \
+G_STMT_START { \
+ guint64 first = a; \
+ guint64 second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (0x%016x) is not equal to '" #b"' (0x%016x)", first, second);\
+} G_STMT_END;
+/**
+ * assert_equals_uint64_hex:
+ * @a: a #guint64 value or expression
+ * @b: a #guint64 value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to in
+ * hexadecimal format. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define assert_equals_uint64_hex(a,b) fail_unless_equals_uint64_hex(a,b)
+
+/**
+ * fail_unless_equals_string:
+ * @a: a string literal or expression
+ * @b: a string literal or expression
+ *
+ * This macro checks that @a and @b are equal (as per g_strcmp0()) and aborts if
+ * this is not the case, printing both expressions and the values they
+ * evaluated to. This macro is for use in unit tests.
+ */
+#define fail_unless_equals_string(a, b) \
+G_STMT_START { \
+ const gchar * first = a; \
+ const gchar * second = b; \
+ fail_unless(g_strcmp0 (first, second) == 0, \
+ "'" #a "' (%s) is not equal to '" #b"' (%s)", first, second); \
+} G_STMT_END;
+/**
+ * assert_equals_string:
+ * @a: a string literal or expression
+ * @b: a string literal or expression
+ *
+ * This macro checks that @a and @b are equal (as per g_strcmp0()) and aborts if
+ * this is not the case, printing both expressions and the values they
+ * evaluated to. This macro is for use in unit tests.
+ */
+#define assert_equals_string(a, b) fail_unless_equals_string(a, b)
+
+/**
+ * fail_unless_equals_float:
+ * @a: a #gdouble or #gfloat value or expression
+ * @b: a #gdouble or #gfloat value or expression
+ *
+ * This macro checks that @a and @b are (almost) equal and aborts if this
+ * is not the case, printing both expressions and the values they evaluated
+ * to. This macro is for use in unit tests.
+ */
+#define fail_unless_equals_float(a, b) \
+G_STMT_START { \
+ double first = a; \
+ double second = b; \
+ /* This will only work for 'normal' values and values around 0, \
+ * which should be good enough for our purposes here */ \
+ fail_unless(fabs (first - second) < 0.0000001, \
+ "'" #a "' (%g) is not equal to '" #b "' (%g)", first, second);\
+} G_STMT_END;
+
+/**
+ * assert_equals_float:
+ * @a: a #gdouble or #gfloat value or expression
+ * @b: a #gdouble or #gfloat value or expression
+ *
+ * This macro checks that @a and @b are (almost) equal and aborts if this
+ * is not the case, printing both expressions and the values they evaluated
+ * to. This macro is for use in unit tests.
+ */
+#define assert_equals_float(a, b) fail_unless_equals_float(a, b)
+
+/**
+ * fail_unless_equals_pointer:
+ * @a: a pointer value or expression
+ * @b: a pointer value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this
+ * is not the case, printing both expressions and the values they
+ * evaluated to. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define fail_unless_equals_pointer(a, b) \
+G_STMT_START { \
+ gpointer first = a; \
+ gpointer second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%p) is not equal to '" #b "' (%p)", first, second);\
+} G_STMT_END;
+
+/**
+ * assert_equals_pointer:
+ * @a: a pointer value or expression
+ * @b: a pointer value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this
+ * is not the case, printing both expressions and the values they
+ * evaluated to. This macro is for use in unit tests.
+ *
+ * Since: 1.2
+ */
+#define assert_equals_pointer(a, b) fail_unless_equals_pointer(a, b)
+
+/**
+ * fail_unless_equals_clocktime:
+ * @a: a #GstClockTime value or expression
+ * @b: a #GstClockTime value or expression
+ *
+ * This macro checks that @a and @b are equal and aborts if this is not the
+ * case, printing both expressions and the values they evaluated to. This
+ * macro is for use in unit tests.
+ */
+#define fail_unless_equals_clocktime(a, b) \
+G_STMT_START { \
+ GstClockTime first = a; \
+ GstClockTime second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%" GST_TIME_FORMAT") is not equal to '" #b"' (%" GST_TIME_FORMAT")", \
+ GST_TIME_ARGS (first), GST_TIME_ARGS (second)); \
+} G_STMT_END;
+
+/***
+ * thread test macros and variables
+ */
+GST_CHECK_API GList *thread_list;
+GST_CHECK_API GMutex mutex;
+GST_CHECK_API GCond start_cond; /* used to notify main thread of thread startups */
+GST_CHECK_API GCond sync_cond; /* used to synchronize all threads and main thread */
+
+#define MAIN_START_THREADS(count, function, data) \
+MAIN_INIT(); \
+MAIN_START_THREAD_FUNCTIONS(count, function, data); \
+MAIN_SYNCHRONIZE();
+
+#define MAIN_INIT() \
+G_STMT_START { \
+ g_mutex_init (&mutex); \
+ g_cond_init (&start_cond); \
+ g_cond_init (&sync_cond); \
+ _gst_check_threads_running = TRUE; \
+} G_STMT_END;
+
+#define MAIN_START_THREAD_FUNCTIONS(count, function, data) \
+G_STMT_START { \
+ int i; \
+ for (i = 0; i < count; ++i) { \
+ MAIN_START_THREAD_FUNCTION (i, function, data); \
+ } \
+} G_STMT_END;
+
+#define MAIN_START_THREAD_FUNCTION(i, function, data) \
+G_STMT_START { \
+ GThread *thread = NULL; \
+ GST_DEBUG ("MAIN: creating thread %d", i); \
+ g_mutex_lock (&mutex); \
+ thread = g_thread_try_new ("gst-check", \
+ (GThreadFunc) function, data, NULL); \
+ /* wait for thread to signal us that it's ready */ \
+ GST_DEBUG ("MAIN: waiting for thread %d", i); \
+ g_cond_wait (&start_cond, &mutex); \
+ g_mutex_unlock (&mutex); \
+ \
+ thread_list = g_list_append (thread_list, thread); \
+} G_STMT_END;
+
+
+#define MAIN_SYNCHRONIZE() \
+G_STMT_START { \
+ GST_DEBUG ("MAIN: synchronizing"); \
+ g_cond_broadcast (&sync_cond); \
+ GST_DEBUG ("MAIN: synchronized"); \
+} G_STMT_END;
+
+#define MAIN_STOP_THREADS() \
+G_STMT_START { \
+ _gst_check_threads_running = FALSE; \
+ \
+ /* join all threads */ \
+ GST_DEBUG ("MAIN: joining"); \
+ g_list_foreach (thread_list, (GFunc) g_thread_join, NULL); \
+ g_list_free (thread_list); \
+ thread_list = NULL; \
+ g_mutex_clear (&mutex); \
+ g_cond_clear (&start_cond); \
+ g_cond_clear (&sync_cond); \
+ GST_DEBUG ("MAIN: joined"); \
+} G_STMT_END;
+
+#define THREAD_START() \
+THREAD_STARTED(); \
+THREAD_SYNCHRONIZE();
+
+#define THREAD_STARTED() \
+G_STMT_START { \
+ /* signal main thread that we started */ \
+ GST_DEBUG ("THREAD %p: started", g_thread_self ()); \
+ g_mutex_lock (&mutex); \
+ g_cond_signal (&start_cond); \
+} G_STMT_END;
+
+#define THREAD_SYNCHRONIZE() \
+G_STMT_START { \
+ /* synchronize everyone */ \
+ GST_DEBUG ("THREAD %p: syncing", g_thread_self ()); \
+ fail_if (g_mutex_trylock (&mutex), \
+ "bug in unit test, mutex should be locked at this point");\
+ g_cond_wait (&sync_cond, &mutex); \
+ GST_DEBUG ("THREAD %p: synced", g_thread_self ()); \
+ g_mutex_unlock (&mutex); \
+} G_STMT_END;
+
+#define THREAD_SWITCH() \
+G_STMT_START { \
+ g_thread_yield (); \
+} G_STMT_END;
+
+#define THREAD_TEST_RUNNING() (!!_gst_check_threads_running)
+
+/* additional assertions */
+
+#if GST_DISABLE_GLIB_CHECKS
+#define ASSERT_CRITICAL(code)
+#else
+#define ASSERT_CRITICAL(code) \
+G_STMT_START { \
+ _gst_check_expecting_log = TRUE; \
+ _gst_check_raised_critical = FALSE; \
+ code; \
+ if (!_gst_check_raised_critical) \
+ _ck_assert_failed (__FILE__, __LINE__, \
+ "Expected g_critical, got nothing", NULL); \
+ _gst_check_expecting_log = FALSE; \
+} G_STMT_END
+#endif /* GST_DISABLE_GLIB_CHECKS */
+
+#define ASSERT_WARNING(code) \
+G_STMT_START { \
+ _gst_check_expecting_log = TRUE; \
+ _gst_check_raised_warning = FALSE; \
+ code; \
+ if (!_gst_check_raised_warning) \
+ _ck_assert_failed (__FILE__, __LINE__, \
+ "Expected g_warning, got nothing", NULL); \
+ _gst_check_expecting_log = FALSE; \
+} G_STMT_END
+
+
+#define ASSERT_OBJECT_REFCOUNT(object, name, value) \
+G_STMT_START { \
+ int rc; \
+ rc = GST_OBJECT_REFCOUNT_VALUE (object); \
+ fail_unless (rc == value, \
+ "%s (%p) refcount is %d instead of %d", \
+ name, object, rc, value); \
+} G_STMT_END
+
+#define ASSERT_OBJECT_REFCOUNT_BETWEEN(object, name, lower, upper) \
+G_STMT_START { \
+ int rc = GST_OBJECT_REFCOUNT_VALUE (object); \
+ int lo = lower; \
+ int hi = upper; \
+ \
+ fail_unless (rc >= lo, \
+ "%s (%p) refcount %d is smaller than %d", \
+ name, object, rc, lo); \
+ fail_unless (rc <= hi, \
+ "%s (%p) refcount %d is bigger than %d", \
+ name, object, rc, hi); \
+} G_STMT_END
+
+
+#define ASSERT_CAPS_REFCOUNT(caps, name, value) \
+ ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
+
+#define ASSERT_BUFFER_REFCOUNT(buffer, name, value) \
+ ASSERT_MINI_OBJECT_REFCOUNT(buffer, name, value)
+
+#define ASSERT_MINI_OBJECT_REFCOUNT(miniobj, name, value) \
+G_STMT_START { \
+ int rc; \
+ rc = GST_MINI_OBJECT_REFCOUNT_VALUE (miniobj); \
+ fail_unless (rc == value, \
+ name " (%p) refcount is %d instead of %d", miniobj, rc, value); \
+} G_STMT_END
+
+#define ASSERT_SET_STATE(element, state, ret) \
+fail_unless (gst_element_set_state (GST_ELEMENT(element), \
+ state) == ret, \
+ "could not change state to " #state);
+
+#define GST_CHECK_MAIN(name) \
+int main (int argc, char **argv) \
+{ \
+ Suite *s; \
+ gst_check_init (&argc, &argv); \
+ s = name ## _suite (); \
+ return gst_check_run_suite (s, # name, __FILE__); \
+}
+
+/* Hack to allow run-time selection of unit tests to run via the
+ * GST_CHECKS environment variable (test function names globs, comma
+ * separated), or GST_CHECKS_IGNORE with the same semantics */
+
+GST_CHECK_API
+gboolean _gst_check_run_test_func (const gchar * func_name);
+
+static inline void
+__gst_tcase_add_test (TCase * tc, TFun tf, const char * fname, int signal,
+ int allowed_exit_value, int start, int end)
+{
+ if (_gst_check_list_tests) {
+ g_print ("Test: %s\n", fname);
+ return;
+ }
+
+ if (_gst_check_run_test_func (fname)) {
+ _tcase_add_test (tc, tf, fname, signal, allowed_exit_value, start, end);
+ }
+}
+
+#define _tcase_add_test __gst_tcase_add_test
+
+/* A special variant to add broken tests. These are normally skipped, but can be
+ * forced to run via GST_CHECKS */
+#define tcase_skip_broken_test(chain,test_func) \
+G_STMT_START { \
+ const char *env = g_getenv ("GST_CHECKS"); \
+ \
+ if (env != NULL && g_pattern_match_simple (env, G_STRINGIFY (test_func))) { \
+ tcase_add_test(chain,test_func); \
+ } else { \
+ g_printerr ("FIXME: skipping test %s because it's broken\n", G_STRINGIFY (test_func)); \
+ } \
+} G_STMT_END
+
+#define tcase_skip_broken_loop_test(chain,test_func,a,b) \
+ tcase_skip_broken_test (chain, test_func)
+
+#endif /* !__GI_SCANNER__ */
+
+G_END_DECLS
+
+#endif /* __GST_CHECK_H__ */
diff --git a/include/gst/check/gstconsistencychecker.h b/include/gst/check/gstconsistencychecker.h
new file mode 100644
index 0000000000..03ce583a8f
--- /dev/null
+++ b/include/gst/check/gstconsistencychecker.h
@@ -0,0 +1,52 @@
+/* GStreamer
+ *
+ * unit testing helper lib
+ *
+ * Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONSISTENCY_CHECKER_H__
+#define __GST_CONSISTENCY_CHECKER_H__
+
+#include <gst/check/gstcheck.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstStreamConsistency:
+ *
+ * Opaque consistency checker handle.
+ */
+typedef struct _GstStreamConsistency GstStreamConsistency;
+
+GST_CHECK_API
+GstStreamConsistency * gst_consistency_checker_new (GstPad * pad);
+
+GST_CHECK_API
+gboolean gst_consistency_checker_add_pad (GstStreamConsistency * consist,
+ GstPad * pad);
+
+GST_CHECK_API
+void gst_consistency_checker_reset (GstStreamConsistency * consist);
+
+GST_CHECK_API
+void gst_consistency_checker_free (GstStreamConsistency * consist);
+
+G_END_DECLS
+
+#endif /* __GST_CONSISTENCY_CHECKER_H__ */
diff --git a/include/gst/check/gstharness.h b/include/gst/check/gstharness.h
new file mode 100644
index 0000000000..160fdb01d8
--- /dev/null
+++ b/include/gst/check/gstharness.h
@@ -0,0 +1,474 @@
+/* GstHarness - A test-harness for GStreamer testing
+ *
+ * Copyright (C) 2012-2015 Pexip <pexip.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_HARNESS_H__
+#define __GST_HARNESS_H__
+
+#include <gst/gst.h>
+#include <gst/check/gsttestclock.h>
+#include <gst/check/check-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstHarnessThread:
+ *
+ * Opaque handle representing a GstHarness stress testing thread.
+ *
+ * Since: 1.6
+ */
+typedef struct _GstHarnessThread GstHarnessThread;
+
+typedef struct _GstHarness GstHarness;
+typedef struct _GstHarnessPrivate GstHarnessPrivate;
+
+/**
+ * GstHarness:
+ * @element: the element inside the harness
+ * @srcpad: the internal harness source pad
+ * @sinkpad: the internal harness sink pad
+ * @src_harness: the source (input) harness (if any)
+ * @sink_harness: the sink (output) harness (if any)
+ *
+ * Since: 1.6
+ */
+struct _GstHarness {
+ GstElement * element;
+
+ GstPad * srcpad;
+ GstPad * sinkpad;
+
+ GstHarness * src_harness;
+ GstHarness * sink_harness;
+
+ /*< private >*/
+ GstHarnessPrivate * priv;
+};
+
+/* Harness creation */
+
+GST_CHECK_API
+GstHarness * gst_harness_new_empty (void);
+
+GST_CHECK_API
+void gst_harness_add_element_full (GstHarness * h,
+ GstElement * element,
+ GstStaticPadTemplate * hsrc,
+ const gchar * element_sinkpad_name,
+ GstStaticPadTemplate * hsink,
+ const gchar * element_srcpad_name);
+
+GST_CHECK_API
+GstHarness * gst_harness_new_full (GstElement * element,
+ GstStaticPadTemplate * hsrc,
+ const gchar * element_sinkpad_name,
+ GstStaticPadTemplate * hsink,
+ const gchar * element_srcpad_name);
+
+GST_CHECK_API
+GstHarness * gst_harness_new_with_element (GstElement * element,
+ const gchar * element_sinkpad_name,
+ const gchar * element_srcpad_name);
+
+GST_CHECK_API
+GstHarness * gst_harness_new_with_padnames (const gchar * element_name,
+ const gchar * element_sinkpad_name,
+ const gchar * element_srcpad_name);
+
+GST_CHECK_API
+GstHarness * gst_harness_new_with_templates (const gchar * element_name,
+ GstStaticPadTemplate * hsrc,
+ GstStaticPadTemplate * hsink);
+
+GST_CHECK_API
+GstHarness * gst_harness_new (const gchar * element_name);
+
+GST_CHECK_API
+GstHarness * gst_harness_new_parse (const gchar * launchline);
+
+GST_CHECK_API
+void gst_harness_add_parse (GstHarness * h, const gchar * launchline);
+
+GST_CHECK_API
+void gst_harness_teardown (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_add_element_src_pad (GstHarness * h, GstPad * srcpad);
+
+GST_CHECK_API
+void gst_harness_add_element_sink_pad (GstHarness * h, GstPad * sinkpad);
+
+/* Caps Functions */
+
+GST_CHECK_API
+void gst_harness_set_src_caps (GstHarness * h, GstCaps * caps);
+
+GST_CHECK_API
+void gst_harness_set_sink_caps (GstHarness * h, GstCaps * caps);
+
+GST_CHECK_API
+void gst_harness_set_caps (GstHarness * h, GstCaps * in, GstCaps * out);
+
+GST_CHECK_API
+void gst_harness_set_src_caps_str (GstHarness * h, const gchar * str);
+
+GST_CHECK_API
+void gst_harness_set_sink_caps_str (GstHarness * h, const gchar * str);
+
+GST_CHECK_API
+void gst_harness_set_caps_str (GstHarness * h,
+ const gchar * in,
+ const gchar * out);
+
+/* Clock Functions */
+
+GST_CHECK_API
+void gst_harness_use_systemclock (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_use_testclock (GstHarness * h);
+
+GST_CHECK_API
+GstTestClock * gst_harness_get_testclock (GstHarness * h);
+
+GST_CHECK_API
+gboolean gst_harness_set_time (GstHarness * h, GstClockTime time);
+
+GST_CHECK_API
+gboolean gst_harness_wait_for_clock_id_waits (GstHarness * h,
+ guint waits,
+ guint timeout);
+
+GST_CHECK_API
+gboolean gst_harness_crank_single_clock_wait (GstHarness * h);
+
+GST_CHECK_API
+gboolean gst_harness_crank_multiple_clock_waits (GstHarness * h,
+ guint waits);
+
+/* misc */
+
+GST_CHECK_API
+void gst_harness_play (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_set_blocking_push_mode (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_set_forwarding (GstHarness * h, gboolean forwarding);
+
+/* buffers */
+
+GST_CHECK_API
+GstBuffer * gst_harness_create_buffer (GstHarness * h, gsize size);
+
+GST_CHECK_API
+GstFlowReturn gst_harness_push (GstHarness * h, GstBuffer * buffer);
+
+GST_CHECK_API
+GstBuffer * gst_harness_pull (GstHarness * h);
+
+GST_CHECK_API
+GstBuffer * gst_harness_try_pull (GstHarness * h);
+
+GST_CHECK_API
+gboolean gst_harness_pull_until_eos (GstHarness * h, GstBuffer ** buf);
+
+GST_CHECK_API
+GstBuffer * gst_harness_push_and_pull (GstHarness * h, GstBuffer * buffer);
+
+GST_CHECK_API
+guint gst_harness_buffers_received (GstHarness * h);
+
+GST_CHECK_API
+guint gst_harness_buffers_in_queue (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_set_drop_buffers (GstHarness * h, gboolean drop_buffers);
+
+GST_CHECK_API
+void gst_harness_dump_to_file (GstHarness * h, const gchar * filename);
+
+GST_CHECK_API
+guint8 * gst_harness_take_all_data (GstHarness * h, gsize * size);
+
+GST_CHECK_API
+GstBuffer * gst_harness_take_all_data_as_buffer (GstHarness * h);
+
+GST_CHECK_API
+GBytes * gst_harness_take_all_data_as_bytes (GstHarness * h);
+
+GST_CHECK_API
+GstClockTime gst_harness_get_last_pushed_timestamp (GstHarness * h);
+
+/* downstream events */
+
+GST_CHECK_API
+gboolean gst_harness_push_event (GstHarness * h, GstEvent * event);
+
+GST_CHECK_API
+GstEvent * gst_harness_pull_event (GstHarness * h);
+
+GST_CHECK_API
+GstEvent * gst_harness_try_pull_event (GstHarness * h);
+
+GST_CHECK_API
+guint gst_harness_events_received (GstHarness * h);
+
+GST_CHECK_API
+guint gst_harness_events_in_queue (GstHarness * h);
+
+/* upstream events */
+
+GST_CHECK_API
+gboolean gst_harness_push_upstream_event (GstHarness * h, GstEvent * event);
+
+GST_CHECK_API
+GstEvent * gst_harness_pull_upstream_event (GstHarness * h);
+
+GST_CHECK_API
+GstEvent * gst_harness_try_pull_upstream_event (GstHarness * h);
+
+GST_CHECK_API
+guint gst_harness_upstream_events_received (GstHarness * h);
+
+GST_CHECK_API
+guint gst_harness_upstream_events_in_queue (GstHarness * h);
+
+/* latency */
+
+GST_CHECK_API
+GstClockTime gst_harness_query_latency (GstHarness * h);
+
+GST_CHECK_API
+void gst_harness_set_upstream_latency (GstHarness * h, GstClockTime latency);
+
+GST_CHECK_API
+void gst_harness_set_live (GstHarness * h, gboolean is_live);
+
+/* allocation query parameters */
+
+GST_CHECK_API
+void gst_harness_set_propose_allocator (GstHarness * h,
+ GstAllocator * allocator,
+ const GstAllocationParams * params);
+
+GST_CHECK_API
+void gst_harness_get_allocator (GstHarness * h,
+ GstAllocator ** allocator,
+ GstAllocationParams * params);
+
+GST_CHECK_API
+void gst_harness_add_propose_allocation_meta (GstHarness * h,
+ GType api,
+ const GstStructure * params);
+
+/* src-harness */
+
+GST_CHECK_API
+void gst_harness_add_src_harness (GstHarness * h,
+ GstHarness * src_harness,
+ gboolean has_clock_wait);
+
+GST_CHECK_API
+void gst_harness_add_src (GstHarness * h,
+ const gchar * src_element_name,
+ gboolean has_clock_wait);
+
+GST_CHECK_API
+void gst_harness_add_src_parse (GstHarness * h,
+ const gchar * launchline,
+ gboolean has_clock_wait);
+
+GST_CHECK_API
+GstFlowReturn gst_harness_push_from_src (GstHarness * h);
+
+GST_CHECK_API
+GstFlowReturn gst_harness_src_crank_and_push_many (GstHarness * h,
+ gint cranks,
+ gint pushes);
+
+GST_CHECK_API
+gboolean gst_harness_src_push_event (GstHarness * h);
+
+/* sink-harness */
+
+GST_CHECK_API
+void gst_harness_add_sink_harness (GstHarness * h,
+ GstHarness * sink_harness);
+
+GST_CHECK_API
+void gst_harness_add_sink (GstHarness * h,
+ const gchar * sink_element_name);
+
+GST_CHECK_API
+void gst_harness_add_sink_parse (GstHarness * h,
+ const gchar * launchline);
+
+GST_CHECK_API
+GstFlowReturn gst_harness_push_to_sink (GstHarness * h);
+
+GST_CHECK_API
+GstFlowReturn gst_harness_sink_push_many (GstHarness * h, gint pushes);
+
+/* convenience functions */
+
+GST_CHECK_API
+GstElement * gst_harness_find_element (GstHarness * h,
+ const gchar * element_name);
+
+GST_CHECK_API
+void gst_harness_set (GstHarness * h,
+ const gchar * element_name,
+ const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED;
+
+GST_CHECK_API
+void gst_harness_get (GstHarness * h,
+ const gchar * element_name,
+ const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED;
+
+GST_CHECK_API
+void gst_harness_add_probe (GstHarness * h,
+ const gchar * element_name,
+ const gchar * pad_name,
+ GstPadProbeType mask,
+ GstPadProbeCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy_data);
+
+/* Stress */
+
+GST_CHECK_API
+guint gst_harness_stress_thread_stop (GstHarnessThread * t);
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_custom_start (GstHarness * h,
+ GFunc init,
+ GFunc callback,
+ gpointer data,
+ gulong sleep);
+
+#define gst_harness_stress_statechange_start(h) \
+ gst_harness_stress_statechange_start_full (h, G_USEC_PER_SEC / 100)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_statechange_start_full (GstHarness * h,
+ gulong sleep);
+
+#define gst_harness_stress_push_buffer_start(h, c, s, b) \
+ gst_harness_stress_push_buffer_start_full (h, c, s, b, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_buffer_start_full (GstHarness * h,
+ GstCaps * caps,
+ const GstSegment * segment,
+ GstBuffer * buf,
+ gulong sleep);
+
+/**
+ * GstHarnessPrepareBufferFunc:
+ * @h: a #GstHarness
+ * @data: user data
+ *
+ * Since: 1.6
+ */
+typedef GstBuffer * (*GstHarnessPrepareBufferFunc) (GstHarness * h, gpointer data);
+
+#define gst_harness_stress_push_buffer_with_cb_start(h, c, s, f, d, n) \
+ gst_harness_stress_push_buffer_with_cb_start_full (h, c, s, f, d, n, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_buffer_with_cb_start_full (GstHarness * h,
+ GstCaps * caps,
+ const GstSegment * segment,
+ GstHarnessPrepareBufferFunc func,
+ gpointer data,
+ GDestroyNotify notify,
+ gulong sleep);
+
+#define gst_harness_stress_push_event_start(h, e) \
+ gst_harness_stress_push_event_start_full (h, e, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_event_start_full (GstHarness * h,
+ GstEvent * event,
+ gulong sleep);
+
+/**
+ * GstHarnessPrepareEventFunc:
+ * @h: a #GstHarness
+ * @data: user data
+ *
+ * Since: 1.8
+ */
+typedef GstEvent * (*GstHarnessPrepareEventFunc) (GstHarness * h, gpointer data);
+
+#define gst_harness_stress_push_event_with_cb_start(h, f, d, n) \
+ gst_harness_stress_push_event_with_cb_start_full (h, f, d, n, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_event_with_cb_start_full (GstHarness * h,
+ GstHarnessPrepareEventFunc func,
+ gpointer data,
+ GDestroyNotify notify,
+ gulong sleep);
+
+#define gst_harness_stress_send_upstream_event_start(h, e) \
+ gst_harness_stress_push_upstream_event_start_full (h, e, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_upstream_event_start_full (GstHarness * h,
+ GstEvent * event,
+ gulong sleep);
+
+#define gst_harness_stress_send_upstream_event_with_cb_start(h, f, d, n) \
+ gst_harness_stress_push_upstream_event_with_cb_start_full (h, f, d, n, 0)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_push_upstream_event_with_cb_start_full (GstHarness * h,
+ GstHarnessPrepareEventFunc func,
+ gpointer data,
+ GDestroyNotify notify,
+ gulong sleep);
+
+
+#define gst_harness_stress_property_start(h, n, v) \
+ gst_harness_stress_property_start_full (h, n, v, G_USEC_PER_SEC / 1000)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_property_start_full (GstHarness * h,
+ const gchar * name,
+ const GValue * value,
+ gulong sleep);
+
+#define gst_harness_stress_requestpad_start(h, t, n, c, r) \
+ gst_harness_stress_requestpad_start_full (h, t, n, c, r, G_USEC_PER_SEC / 100)
+
+GST_CHECK_API
+GstHarnessThread * gst_harness_stress_requestpad_start_full (GstHarness * h,
+ GstPadTemplate * templ,
+ const gchar * name,
+ GstCaps * caps,
+ gboolean release,
+ gulong sleep);
+
+G_END_DECLS
+
+#endif /* __GST_HARNESS_H__ */
diff --git a/include/gst/check/gsttestclock.h b/include/gst/check/gsttestclock.h
new file mode 100644
index 0000000000..a1c1f5a88b
--- /dev/null
+++ b/include/gst/check/gsttestclock.h
@@ -0,0 +1,148 @@
+/* GstTestClock - A deterministic clock for GStreamer unit tests
+ *
+ * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
+ * Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
+ * Copyright (C) 2012 Havard Graff <havard@pexip.com>
+ * Copyright (C) 2013 Haakon Sporsheim <haakon@pexip.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_TEST_CLOCK_H__
+#define __GST_TEST_CLOCK_H__
+
+#include <gst/gst.h>
+#include <gst/check/check-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
+#define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
+ GST_TYPE_TEST_CLOCK, GstTestClock))
+#define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
+ GST_TYPE_TEST_CLOCK))
+#define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
+ GST_TYPE_TEST_CLOCK, GstTestClockClass))
+#define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (\
+ (klass), GST_TYPE_TEST_CLOCK))
+#define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (\
+ (obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
+#define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))
+
+typedef struct _GstTestClock GstTestClock;
+typedef struct _GstTestClockClass GstTestClockClass;
+typedef struct _GstTestClockPrivate GstTestClockPrivate;
+
+/**
+ * GstTestClock:
+ *
+ * A #GstTestClock structure which is based on a #GstClock along with some
+ * private data.
+ *
+ * Since: 1.2
+ */
+struct _GstTestClock
+{
+ GstClock parent;
+
+ /*< private >*/
+ GstTestClockPrivate *priv;
+};
+
+/**
+ * GstTestClockClass:
+ * @parent_class: the parent class structure
+ *
+ * The class of a #GstTestClock, which has no virtual methods to override.
+ *
+ * Since: 1.2
+ */
+struct _GstTestClockClass
+{
+ GstClockClass parent_class;
+};
+
+GST_CHECK_API
+GType gst_test_clock_get_type (void);
+
+GST_CHECK_API
+GstClock * gst_test_clock_new (void);
+
+GST_CHECK_API
+GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time);
+
+GST_CHECK_API
+void gst_test_clock_set_time (GstTestClock * test_clock,
+ GstClockTime new_time);
+
+GST_CHECK_API
+void gst_test_clock_advance_time (GstTestClock * test_clock,
+ GstClockTimeDiff delta);
+
+GST_CHECK_API
+guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
+
+GST_CHECK_API
+gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
+
+GST_CHECK_API
+gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
+ GstClockID * pending_id);
+
+GST_CHECK_API
+void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
+ GstClockID * pending_id);
+
+GST_CHECK_DEPRECATED_FOR(gst_test_clock_wait_for_multiple_pending_ids)
+void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
+ guint count);
+
+GST_CHECK_API
+GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
+
+GST_CHECK_API
+GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
+
+GST_CHECK_API
+void gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
+ guint count,
+ GList ** pending_list);
+
+GST_CHECK_API
+gboolean gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * test_clock,
+ guint count,
+ guint timeout_ms,
+ GList ** pending_list);
+
+GST_CHECK_API
+gboolean gst_test_clock_process_id (GstTestClock * test_clock,
+ GstClockID pending_id);
+
+GST_CHECK_API
+guint gst_test_clock_process_id_list (GstTestClock * test_clock,
+ const GList * pending_list);
+
+GST_CHECK_API
+GstClockTime gst_test_clock_id_list_get_latest_time (const GList * pending_list);
+
+GST_CHECK_API
+gboolean gst_test_clock_crank (GstTestClock * test_clock);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTestClock, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TEST_CLOCK_H__ */
diff --git a/include/gst/check/internal-check.h b/include/gst/check/internal-check.h
new file mode 100644
index 0000000000..52c8b766e2
--- /dev/null
+++ b/include/gst/check/internal-check.h
@@ -0,0 +1,1328 @@
+/*-*- mode:C; -*- */
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef CHECK_H
+#define CHECK_H
+
+#include <stddef.h>
+#include <string.h>
+
+/*
+ Macros and functions starting with _ (underscore) are internal and
+ may change without notice. You have been warned!.
+*/
+
+
+#ifdef __cplusplus
+#define CK_CPPSTART extern "C" {
+#define CK_CPPEND }
+CK_CPPSTART
+#endif
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define GCC_VERSION_AT_LEAST(major, minor) \
+((__GNUC__ > (major)) || \
+ (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
+#else
+#define GCC_VERSION_AT_LEAST(major, minor) 0
+#endif
+#if GCC_VERSION_AT_LEAST(2,95)
+#define CK_ATTRIBUTE_UNUSED __attribute__ ((unused))
+#else
+#define CK_ATTRIBUTE_UNUSED
+#endif /* GCC 2.95 */
+#if GCC_VERSION_AT_LEAST(2,5)
+#define CK_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+#else
+#define CK_ATTRIBUTE_NORETURN
+#endif /* GCC 2.5 */
+#include <sys/types.h>
+
+/*
+ * Used to create the linker script for hiding lib-local symbols. Shall
+ * be put directly in front of the exported symbol.
+ */
+#define CK_EXPORT
+
+/*
+ * Used for MSVC to create the export attribute
+ * CK_DLL_EXP is defined during the compilation of the library
+ * on the command line.
+ */
+#ifndef CK_DLL_EXP
+# if defined(_MSC_VER)
+# define CK_DLL_EXP __declspec(dllimport)
+# else
+# define CK_DLL_EXP extern
+# endif
+#endif
+
+/* check version numbers */
+#define CHECK_MAJOR_VERSION (0)
+#define CHECK_MINOR_VERSION (9)
+#define CHECK_MICRO_VERSION (14)
+CK_DLL_EXP /*extern*/ int CK_EXPORT check_major_version;
+CK_DLL_EXP /*extern*/ int CK_EXPORT check_minor_version;
+CK_DLL_EXP /*extern*/ int CK_EXPORT check_micro_version;
+
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
+#if defined(_MSC_VER)
+#define pid_t int
+#endif
+
+/**
+ * Type for a test case
+ *
+ * A TCase represents a test case. Create with tcase_create, free
+ * with tcase_free. For the moment, test cases can only be run
+ * through a suite
+*/
+typedef struct TCase TCase;
+
+/**
+ * Type for a test function
+ */
+typedef void (*TFun) (int);
+
+/**
+ * Type for a setup/teardown function
+ */
+typedef void (*SFun) (void);
+
+/**
+ * Type for a test suite
+ */
+typedef struct Suite Suite;
+
+/**
+ * Creates a test suite with the given name.
+ *
+ * Create a suite, which will contain test cases. Once
+ * created, use suite_add_tcase() to add test cases.
+ * When finished, create a suite runner from the
+ * suite using srunner_create()
+ *
+ * @param name name of the suite
+ *
+ * @return suite
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP Suite *CK_EXPORT suite_create (const char *name);
+
+/**
+ * Determines whether a given test suite contains a case named after a
+ * given string.
+ *
+ * @param s suite to check
+ * @param tcname test case to look for
+ *
+ * @return 1 iff the given test case is within the given suite;
+ * 0 otherwise
+ *
+ * @since 0.9.9
+ */
+CK_DLL_EXP int CK_EXPORT suite_tcase (Suite * s, const char *tcname);
+
+/**
+ * Add a test case to a suite.
+ *
+ * Note that if the TCase has already been added attempting
+ * to add it again will be ignored.
+ *
+ * @param s suite to add test case to
+ * @param tc test case to add to suite
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP void CK_EXPORT suite_add_tcase (Suite * s, TCase * tc);
+
+/**
+ * Create a test case.
+ *
+ * Once created, tests can be added with the tcase_add_test()
+ * function, and the test case assigned to a suite with the
+ * suite_add_tcase() function.
+ *
+ * @param name name of the test case
+ *
+ * @return test case containing no tests
+ *
+ * @since 0.6.0
+ * */
+CK_DLL_EXP TCase *CK_EXPORT tcase_create (const char *name);
+
+/**
+ * Associate a test case with certain tags.
+ * Replaces any existing tags with the new set.
+ *
+ * @param tc the test case
+ *
+ * @param tags string containing arbitrary tags separated by spaces.
+ * This will be copied. Passing NULL clears all tags.
+ *
+ * @since 0.11.0
+ * */
+CK_DLL_EXP void CK_EXPORT tcase_set_tags (TCase * tc, const char *tags);
+/**
+ * Add a test function to a test case
+ *
+ * @param tc test case to add test to
+ * @param tf test function to add to test case
+ *
+ * @since 0.6.0
+ * */
+#define tcase_add_test(tc,tf) tcase_add_test_raise_signal(tc,tf,0)
+
+/**
+ * Add a test function with signal handling to a test case
+ *
+ * The added test is expected to terminate by throwing the given signal
+ *
+ * @param tc test case to add test to
+ * @param tf test function to add to test case
+ * @param signal expected signal for test function to throw in order for
+ * the test to be considered passing
+ *
+ * @since 0.9.2
+ * */
+#define tcase_add_test_raise_signal(tc,tf,signal) \
+ _tcase_add_test((tc),(tf),"" # tf "",(signal), 0, 0, 1)
+
+/**
+ * Add a test function with an expected exit value to a test case
+ *
+ * The added test is expected to terminate by exiting with the given value
+ *
+ * @param tc test case to add test to
+ * @param tf test function to add to test case
+ * @param expected_exit_value exit value for test function to return in
+ * order for the test to be considered passing
+ *
+ * @since 0.9.7
+ */
+#define tcase_add_exit_test(tc, tf, expected_exit_value) \
+ _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),0,1)
+
+/**
+ * Add a looping test function to a test case
+ *
+ * The test will be called in a for(i = s; i < e; i++) loop with each
+ * iteration being executed in a new context. The loop variable 'i' is
+ * available in the test.
+ *
+ * @param tc test case to add test to
+ * @param tf function to add to test case
+ * @param s starting index for value "i" in test
+ * @param e ending index for value "i" in test
+ *
+ * @since 0.9.4
+ */
+#define tcase_add_loop_test(tc,tf,s,e) \
+ _tcase_add_test((tc),(tf),"" # tf "",0,0,(s),(e))
+
+/**
+ * Add a looping test function with signal handling to a test case
+ *
+ * The test will be called in a for(i = s; i < e; i++) loop with each
+ * iteration being executed in a new context. The loop variable 'i' is
+ * available in the test.
+ *
+ * The added test is expected to terminate by throwing the given signal
+ *
+ * @param tc test case to add test to
+ * @param tf function to add to test case
+ * @param signal expected signal for test function to throw in order for
+ * the test to be considered passing
+ * @param s starting index for value "i" in test
+ * @param e ending index for value "i" in test
+ *
+ * @since 0.9.5
+ */
+#define tcase_add_loop_test_raise_signal(tc,tf,signal,s,e) \
+ _tcase_add_test((tc),(tf),"" # tf "",(signal),0,(s),(e))
+
+/**
+ * Add a looping test function with an expected exit value to a test case
+ *
+ * The test will be called in a for(i = s; i < e; i++) loop with each
+ * iteration being executed in a new context. The loop variable 'i' is
+ * available in the test.
+ *
+ * The added test is expected to terminate by exiting with the given value
+ *
+ * @param tc test case to add test to
+ * @param tf function to add to test case
+ * @param expected_exit_value exit value for test function to return in
+ * order for the test to be considered passing
+ * @param s starting index for value "i" in test
+ * @param e ending index for value "i" in test
+ *
+ * @since 0.9.7
+ */
+#define tcase_add_loop_exit_test(tc,tf,expected_exit_value,s,e) \
+ _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),(s),(e))
+
+/* Add a test function to a test case
+ (function version -- use this when the macro won't work
+*/
+CK_DLL_EXP void CK_EXPORT _tcase_add_test (TCase * tc, TFun tf,
+ const char *fname, int _signal, int allowed_exit_value, int start, int end);
+
+/**
+ * Add unchecked fixture setup/teardown functions to a test case
+ *
+ * Unchecked fixture functions are run at the start and end of the
+ * test case, and not before and after unit tests. Further,
+ * unchecked fixture functions are not run in a separate address space,
+ * like test functions, and so must not exit or signal (e.g.,
+ * segfault).
+ *
+ * Also, when run in CK_NOFORK mode, unchecked fixture functions may
+ * lead to different unit test behavior if unit tests change data
+ * setup by the fixture functions.
+ *
+ * Note that if a setup function fails, the remaining setup functions
+ * will be omitted, as will the test case and the teardown functions.
+ * If a teardown function fails the remaining teardown functions will be
+ * omitted.
+ *
+ * @param tc test case to add unchecked fixture setup/teardown to
+ * @param setup function to add to be executed before the test case;
+ * if NULL no setup function is added
+ * @param teardown function to add to be executed after the test case;
+ * if NULL no teardown function is added
+ * @since 0.8.0
+ */
+CK_DLL_EXP void CK_EXPORT tcase_add_unchecked_fixture (TCase * tc, SFun setup,
+ SFun teardown);
+
+/**
+ * Add checked fixture setup/teardown functions to a test case
+ *
+ * Checked fixture functions are run before and after each unit test inside
+ * of the address space of the test. Thus, if using CK_FORK
+ * mode the separate process running the unit test will survive signals
+ * or unexpected exits in the fixture function. Also, if the setup
+ * function is idempotent, unit test behavior will be the same in
+ * CK_FORK and CK_NOFORK modes.
+ *
+ * However, since fixture functions are run before and after each unit
+ * test, they should not be expensive code.
+ *
+ * Note that if a setup function fails, the remaining setup functions
+ * will be omitted, as will the test and the teardown functions. If a
+ * teardown function fails the remaining teardown functions will be
+ * omitted.
+ *
+ * @param tc test case to add checked fixture setup/teardown to
+ * @param setup function to add to be executed before each unit test in
+ * the test case; if NULL no setup function is added
+ * @param teardown function to add to be executed after each unit test in
+ * the test case; if NULL no teardown function is added
+ *
+ * @since 0.8.0
+*/
+CK_DLL_EXP void CK_EXPORT tcase_add_checked_fixture (TCase * tc, SFun setup,
+ SFun teardown);
+
+/**
+ * Set the timeout for all tests in a test case.
+ *
+ * A test that lasts longer than the timeout (in seconds) will be killed
+ * and thus fail with an error.
+ *
+ * If not set, the default timeout is one assigned at compile time. If
+ * the environment variable CK_DEFAULT_TIMEOUT is defined and no timeout
+ * is set, the value in the environment variable is used.
+ *
+ * If Check is compile without fork() support this call is ignored,
+ * as timeouts are not possible.
+ *
+ * @param tc test case to assign timeout to
+ * @param timeout to use, in seconds. If the value contains a decimal
+ * portion, but no high resolution timer is available,
+ * the value is rounded up to the nearest second.
+ *
+ * @since 0.9.2
+ */
+CK_DLL_EXP void CK_EXPORT tcase_set_timeout (TCase * tc, double timeout);
+
+/* Internal function to mark the start of a test function */
+CK_DLL_EXP void CK_EXPORT tcase_fn_start (const char *fname, const char *file,
+ int line);
+
+/**
+ * Start a unit test with START_TEST(unit_name), end with END_TEST.
+ *
+ * One must use braces within a START_/END_ pair to declare new variables
+ *
+ * @since 0.6.0
+ */
+#define START_TEST(__testname)\
+static void __testname (int _i CK_ATTRIBUTE_UNUSED)\
+{\
+ tcase_fn_start (""# __testname, __FILE__, __LINE__);
+
+/**
+ * End a unit test
+ *
+ * @since 0.6.0
+ */
+#define END_TEST }
+
+/*
+ * Fail the test case unless expr is false
+ *
+ * This call is deprecated.
+ */
+#define fail_unless ck_assert_msg
+
+/*
+ * Fail the test case if expr is false
+ *
+ * This call is deprecated.
+ *
+ * NOTE: The space before the comma sign before ## is essential to be compatible
+ * with gcc 2.95.3 and earlier.
+ * FIXME: these macros may conflict with C89 if expr is
+ * FIXME: strcmp (str1, str2) due to excessive string length.
+ */
+#define fail_if(expr, ...)\
+ (expr) ? \
+ _ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__, NULL) \
+ : _mark_point(__FILE__, __LINE__)
+
+/*
+ * Fail the test
+ *
+ * This call is deprecated.
+ */
+#define fail ck_abort_msg
+
+/*
+ * This is called whenever an assertion fails.
+ */
+CK_DLL_EXP void CK_EXPORT
+_ck_assert_failed (const char *file, int line, const char *expr, ...)
+ CK_ATTRIBUTE_NORETURN;
+
+/**
+ * Fail the test if expression is false
+ *
+ * @param expr expression to evaluate
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert(expr) ck_assert_msg(expr, NULL)
+
+/* The space before the comma sign before ## is essential to be compatible
+ with gcc 2.95.3 and earlier.
+*/
+/**
+ * Fail the test if the expression is false; print message on failure
+ *
+ * @param expr expression to evaluate
+ * @param ... message to print (in printf format) if expression is false
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert_msg(expr, ...) \
+ (expr) ? \
+ _mark_point(__FILE__, __LINE__) : \
+ _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
+
+/**
+ * Unconditionally fail the test
+ *
+ * @note Once called, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_abort() ck_abort_msg(NULL)
+/**
+ * Unconditionally fail the test; print a message
+ *
+ * @param ... message to print (in printf format)
+ *
+ * @note Once called, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
+
+/* Signed and unsigned integer comparison macros with improved output compared to ck_assert(). */
+/* OP may be any comparison operator. */
+#define _ck_assert_int(X, OP, Y) do { \
+ gint64 _ck_x = (X); \
+ gint64 _ck_y = (Y); \
+ ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: " \
+ "%s==%" G_GINT64_FORMAT ", %s==%" G_GINT64_FORMAT, #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
+} while (0)
+
+/**
+ * Check two signed integers to determine if X==Y
+ *
+ * If not X==Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert_int_eq(X, Y) _ck_assert_int(X, ==, Y)
+/**
+ * Check two signed integers to determine if X!=Y
+ *
+ * If not X!=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert_int_ne(X, Y) _ck_assert_int(X, !=, Y)
+/**
+ * Check two signed integers to determine if X<Y
+ *
+ * If not X<Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_int_lt(X, Y) _ck_assert_int(X, <, Y)
+/**
+ * Check two signed integers to determine if X<=Y
+ *
+ * If not X<=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_int_le(X, Y) _ck_assert_int(X, <=, Y)
+/**
+ * Check two signed integers to determine if X>Y
+ *
+ * If not X>Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_int_gt(X, Y) _ck_assert_int(X, >, Y)
+/**
+ * Check two signed integers to determine if X>=Y
+ *
+ * If not X>=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_int_ge(X, Y) _ck_assert_int(X, >=, Y)
+
+#define _ck_assert_uint(X, OP, Y) do { \
+ guint64 _ck_x = (X); \
+ guint64 _ck_y = (Y); \
+ ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: " \
+ "%s==%" G_GUINT64_FORMAT ", %s==%" G_GUINT64_FORMAT, #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
+} while (0)
+/**
+ * Check two unsigned integers to determine if X==Y
+ *
+ * If not X==Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_eq(X, Y) _ck_assert_uint(X, ==, Y)
+/**
+ * Check two unsigned integers to determine if X!=Y
+ *
+ * If not X!=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_ne(X, Y) _ck_assert_uint(X, !=, Y)
+/**
+ * Check two unsigned integers to determine if X<Y
+ *
+ * If not X<Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_lt(X, Y) _ck_assert_uint(X, <, Y)
+/**
+ * Check two unsigned integers to determine if X<=Y
+ *
+ * If not X<=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_le(X, Y) _ck_assert_uint(X, <=, Y)
+/**
+ * Check two unsigned integers to determine if X>Y
+ *
+ * If not X>Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_gt(X, Y) _ck_assert_uint(X, >, Y)
+/**
+ * Check two unsigned integers to determine if X>=Y
+ *
+ * If not X>=Y, the test fails.
+ *
+ * @param X signed integer
+ * @param Y signed integer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_uint_ge(X, Y) _ck_assert_uint(X, >=, Y)
+
+/* String comparison macros with improved output compared to ck_assert() */
+/* OP might be any operator that can be used in '0 OP strcmp(X,Y)' comparison */
+/* The x and y parameter swap in strcmp() is needed to handle >, >=, <, <= operators */
+#define _ck_assert_str(X, OP, Y) do { \
+ const char* _ck_x = (X); \
+ const char* _ck_y = (Y); \
+ ck_assert_msg(0 OP strcmp(_ck_y, _ck_x), \
+ "Assertion '%s' failed: %s==\"%s\", %s==\"%s\"", #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
+} while (0)
+/**
+ * Check two strings to determine if 0==strcmp(X,Y)
+ *
+ * If not 0==strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert_str_eq(X, Y) _ck_assert_str(X, ==, Y)
+/**
+ * Check two strings to determine if 0!=strcmp(X,Y)
+ *
+ * If not 0!=strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.6
+ */
+#define ck_assert_str_ne(X, Y) _ck_assert_str(X, !=, Y)
+/**
+ * Check two strings to determine if 0<strcmp(X,Y), (e.g. strcmp(X,Y)>0)
+ *
+ * If not 0<strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_str_lt(X, Y) _ck_assert_str(X, <, Y)
+/**
+ * Check two strings to determine if 0<=strcmp(X,Y) (e.g. strcmp(X,Y)>=0)
+ *
+ * If not 0<=strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_str_le(X, Y) _ck_assert_str(X, <=, Y)
+/**
+ * Check two strings to determine if 0<strcmp(X,Y) (e.g. strcmp(X,Y)>0)
+ *
+ * If not 0<strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_str_gt(X, Y) _ck_assert_str(X, >, Y)
+/**
+ * Check two strings to determine if 0>=strcmp(X,Y) (e.g. strcmp(X,Y)<=0)
+ *
+ * If not 0>=strcmp(X,Y), the test fails.
+ *
+ * @param X string
+ * @param Y string to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_str_ge(X, Y) _ck_assert_str(X, >=, Y)
+
+/* Pointer comparison macros with improved output compared to ck_assert(). */
+/* OP may only be == or != */
+#define _ck_assert_ptr(X, OP, Y) do { \
+ const void* _ck_x = (X); \
+ const void* _ck_y = (Y); \
+ ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s==%#x, %s==%#x", #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
+} while (0)
+
+/**
+ * Check if two pointers are equal.
+ *
+ * If the two passed pointers are not equal, the test
+ * fails.
+ *
+ * @param X pointer
+ * @param Y pointer to compare against X
+ *
+ * @note If the check fails, the remaining of the test is aborted
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_ptr_eq(X, Y) _ck_assert_ptr(X, ==, Y)
+
+/**
+ * Check if two pointers are not.
+ *
+ * If the two passed pointers are equal, the test fails.
+ *
+ * @param X pointer
+ * @param Y pointer to compare against X
+ *
+ * @since 0.9.10
+ */
+#define ck_assert_ptr_ne(X, Y) _ck_assert_ptr(X, !=, Y)
+
+/**
+ * Mark the last point reached in a unit test.
+ *
+ * If the test throws a signal or exits, the location noted with the
+ * failure is the last location of a ck_assert*() or ck_abort() call.
+ * Use mark_point() to record intermediate locations (useful for tracking down
+ * crashes or exits).
+ *
+ * @since 0.6.0
+*/
+#define mark_point() _mark_point(__FILE__,__LINE__)
+
+/* Non macro version of #mark_point */
+CK_DLL_EXP void CK_EXPORT _mark_point (const char *file, int line);
+
+/**
+ * Enum describing the possible results of a test
+ */
+enum test_result
+{
+ CK_TEST_RESULT_INVALID, /**< Default value; should not encounter this */
+ CK_PASS, /**< Test passed */
+ CK_FAILURE, /**< Test completed but failed */
+ CK_ERROR /**< Test failed to complete
+ (unexpected signal or non-zero early exit) */
+};
+
+/**
+ * Enum specifying the verbosity of output a SRunner should produce
+ */
+enum print_output
+{
+ CK_SILENT, /**< No output */
+ CK_MINIMAL, /**< Only summary output */
+ CK_NORMAL, /**< All failed tests */
+ CK_VERBOSE, /**< All tests */
+ CK_ENV, /**< Look at environment var CK_VERBOSITY
+ for what verbosity to use, which can be
+ either "silent", "minimal", "normal",
+ or "verbose". If the environment variable
+ is not set, then CK_NORMAL will be used.*/
+#if 0
+ CK_SUBUNIT, /**< Run as a subunit child process */
+#endif
+ CK_LAST /**< Not a valid option */
+};
+
+/**
+ * Holds state for a running of a test suite
+ */
+typedef struct SRunner SRunner;
+
+/**
+ * Opaque type for a test failure
+ */
+typedef struct TestResult TestResult;
+
+/**
+ * Enum representing the types of contexts for a test
+ */
+enum ck_result_ctx
+{
+ CK_CTX_INVALID, /**< Default value; should not encounter this */
+ CK_CTX_SETUP, /**< Setup before a test */
+ CK_CTX_TEST, /**< Body of test itself */
+ CK_CTX_TEARDOWN /**< Teardown after a test */
+};
+
+/**
+ * Retrieve type of result that the given test result represents.
+ *
+ * This is a member of test_result, and can represent a
+ * pass, failure, or error.
+ *
+ * @param tr test result to retrieve result from
+ *
+ * @return result of given test
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP int CK_EXPORT tr_rtype (TestResult * tr);
+
+/**
+ * Retrieve context in which the result occurred for the given test result.
+ *
+ * The types of contents include the test setup, teardown, or the
+ * body of the test itself.
+ *
+ * @param tr test result to retrieve context from
+ *
+ * @return context to which the given test result applies
+ *
+ * @since 0.8.0
+ */
+CK_DLL_EXP enum ck_result_ctx CK_EXPORT tr_ctx (TestResult * tr);
+
+/**
+ * Retrieve failure message from test result, if applicable.
+ *
+ * @return pointer to a message, if one exists. NULL otherwise.
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP const char *CK_EXPORT tr_msg (TestResult * tr);
+
+/**
+ * Retrieve line number at which a failure occurred, if applicable.
+ *
+ * @return If the test resulted in a failure, returns the line number
+ * that the failure occurred on; otherwise returns -1.
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP int CK_EXPORT tr_lno (TestResult * tr);
+
+/**
+ * Retrieve file name at which a failure occurred, if applicable.
+ *
+ * @return If the test resulted in a failure, returns a string
+ * containing the name of the file where the failure
+ * occurred; otherwise returns NULL.
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP const char *CK_EXPORT tr_lfile (TestResult * tr);
+
+/**
+ * Retrieve test case name in which a failure occurred, if applicable.
+ *
+ * @return If the test resulted in a failure, returns a string
+ * containing the name of the test suite where the failure
+ * occurred; otherwise returns NULL.
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP const char *CK_EXPORT tr_tcname (TestResult * tr);
+
+/**
+ * Creates a suite runner for the given suite.
+ *
+ * Once created, additional suites can be added to the
+ * suite runner using srunner_add_suite(), and the suite runner can be
+ * run with srunner_run_all(). Once finished, the suite runner
+ * must be freed with srunner_free().
+ *
+ * @param s suite to generate a suite runner for
+ *
+ * @return suite runner for the given suite
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP SRunner *CK_EXPORT srunner_create (Suite * s);
+
+/**
+ * Add an additional suite to a suite runner.
+ *
+ * The first suite in a suite runner is always added in srunner_create().
+ * This call adds additional suites to a suite runner.
+ *
+ * @param sr suite runner to add the given suite
+ * @param s suite to add to the given suite runner
+ *
+ * @since 0.7.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_add_suite (SRunner * sr, Suite * s);
+
+/**
+ * Frees a suite runner, including all contained suite and test cases.
+ *
+ * This call is responsible for freeing all resources related to a
+ * suite runner and all contained suites and test cases. Suite and
+ * test cases need not be freed individually, as this call handles that.
+ *
+ * @param sr suite runner to free
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_free (SRunner * sr);
+
+/**
+ * Runs a suite runner and all contained suite, printing results to
+ * stdout as specified by the print_mode.
+ *
+ * In addition to running all suites, if the suite runner has been
+ * configured to output to a log, that is also performed.
+ *
+ * Note that if the CK_RUN_CASE, CK_RUN_SUITE, CK_INCLUDE_TAGS and/or
+ * CK_EXCLUDE_TAGS environment variables are defined, then only the
+ * named suites or test cases will run.
+ *
+ * @param sr suite runner to run all suites from
+ * @param print_mode the verbosity in which to report results to stdout
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_run_all (SRunner * sr,
+ enum print_output print_mode);
+
+/**
+ * Run a specific suite or test case from a suite runner, printing results
+ * to stdout as specified by the print_mode.
+ *
+ * In addition to running any applicable suites or test cases, if the
+ * suite runner has been configured to output to a log, that is also
+ * performed.
+ *
+ * Note that if the sname and tcname parameters are passed as null
+ * then the function will fallback to using the environment variables
+ * CK_RUN_SUITE and CK_RUN_CASE respectively in order to select the
+ * suite/cases.
+ *
+ * Similarly if the CK_INCLUDE_TAGS and/or CK_EXCLUDE_TAGS environment
+ * variables are defined then these will further filter the test cases
+ * (see srunner_run_tagged, below).
+ *
+ * @param sr suite runner where the given suite or test case must be
+ * @param sname suite name to run. A NULL means use the value of the
+ * environment variable CK_RUN_SUITE if set, otherwise run "any/every
+ * suite".
+ * @param tcname test case name to run. A NULL means use the value of
+ * the environment variable CK_RUN_CASE if set, otherwise run
+ * "any/every case".
+ * @param print_mode the verbosity in which to report results to stdout
+ *
+ * @since 0.9.9
+ */
+CK_DLL_EXP void CK_EXPORT srunner_run (SRunner * sr, const char *sname,
+ const char *tcname, enum print_output print_mode);
+
+
+/**
+ * Run a specific suite or test case or testcases with specific tags
+ * from a suite runner, printing results to stdout as specified by the
+ * print_mode.
+ *
+ * In addition to running any applicable suites or test cases, if the
+ * suite runner has been configured to output to a log, that is also
+ * performed.
+ *
+ * Note that if sname, tcname, include_tags, exclude_tags parameters
+ * are passed as NULL then if the environment variables CK_RUN_SUITE,
+ * CK_RUN_CASE, CK_INCLUDE_TAGS, CK_EXCLUDE_TAGS are defined then these
+ * values will be used instead.
+ *
+ * @param sr suite runner where the given suite or test case must be
+ * @param sname suite name to run. A NULL means use the value of the
+ * environment variable CK_RUN_SUITE if set, otherwise run "any/every
+ * suite".
+ * @param tcname test case name to run. A NULL means use the value of
+ * the environment variable CK_RUN_CASE if set, otherwise run
+ * "any/every case".
+ * @param include_tags space separate list of tags. Only run test
+ * cases that share one of these tags. A NULL means use the value of
+ * the environment variable CK_INCLUDE_TAGS if set, otherwise run
+ * "any/every test case".
+ * @param exclude_tags space separate list of tags. Only run test
+ * cases that do not share one of these tags even if they are selected
+ * by an included tag. A NULL means use the value of the environment
+ * variable CK_EXCLUDE_TAGS if set, otherwise run "any/every test
+ * case".
+ * @param print_mode the verbosity in which to report results to stdout
+ *
+ * @since 0.11.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_run_tagged (SRunner * sr, const char *sname,
+ const char *tcname,
+ const char *include_tags,
+ const char *exclude_tags, enum print_output print_mode);
+
+/**
+ * Retrieve the number of failed tests executed by a suite runner.
+ *
+ * This value represents both test failures and errors.
+ *
+ * @param sr suite runner to query for all failed tests
+ *
+ * @return number of test failures and errors found by the suite runner
+ *
+ * @since 0.6.1
+ */
+CK_DLL_EXP int CK_EXPORT srunner_ntests_failed (SRunner * sr);
+
+/**
+ * Retrieve the total number of tests run by a suite runner.
+ *
+ * @param sr suite runner to query for all tests run
+ *
+ * @return number of all tests run by the suite runner
+ *
+ * @since 0.6.1
+ */
+CK_DLL_EXP int CK_EXPORT srunner_ntests_run (SRunner * sr);
+
+/**
+ * Return an array of results for all failures found by a suite runner.
+ *
+ * Number of results is equal to srunner_nfailed_tests().
+ *
+ * Information about individual results can be queried using:
+ * tr_rtype(), tr_ctx(), tr_msg(), tr_lno(), tr_lfile(), and tr_tcname().
+ *
+ * Memory is malloc'ed and must be freed; however free the entire structure
+ * instead of individual test cases.
+ *
+ * @param sr suite runner to retrieve results from
+ *
+ * @return array of TestResult objects
+ *
+ * @since 0.6.0
+ */
+CK_DLL_EXP TestResult **CK_EXPORT srunner_failures (SRunner * sr);
+
+/**
+ * Return an array of results for all tests run by a suite runner.
+ *
+ * Number of results is equal to srunner_ntests_run(), and excludes
+ * failures due to setup function failure.
+ *
+ * Information about individual results can be queried using:
+ * tr_rtype(), tr_ctx(), tr_msg(), tr_lno(), tr_lfile(), and tr_tcname().
+ *
+ * Memory is malloc'ed and must be freed; however free the entire structure
+ * instead of individual test cases.
+ *
+ * @param sr suite runner to retrieve results from
+ *
+ * @return array of TestResult objects
+ *
+ * @since 0.6.1
+*/
+CK_DLL_EXP TestResult **CK_EXPORT srunner_results (SRunner * sr);
+
+/**
+ * Print the results contained in an SRunner to stdout.
+ *
+ * @param sr suite runner to print results for to stdout
+ * @param print_mode the print_output (verbosity) to use to report
+ * the result
+ *
+ * @since 0.7.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_print (SRunner * sr,
+ enum print_output print_mode);
+
+/**
+ * Set the suite runner to output the result in log format to the
+ * given file.
+ *
+ * Note: log file setting is an initialize only operation -- it should
+ * be done immediately after SRunner creation, and the log file can't be
+ * changed after being set.
+ *
+ * This setting does not conflict with the other log output types;
+ * all logging types can occur concurrently if configured.
+ *
+ * @param sr suite runner to log results of in log format
+ * @param fname file name to output log results to
+ *
+ * @since 0.7.1
+*/
+CK_DLL_EXP void CK_EXPORT srunner_set_log (SRunner * sr, const char *fname);
+
+/**
+ * Checks if the suite runner is assigned a file for log output.
+ *
+ * @param sr suite runner to check
+ *
+ * @return 1 iff the suite runner currently is configured to output
+ * in log format; 0 otherwise
+ *
+ * @since 0.7.1
+ */
+CK_DLL_EXP int CK_EXPORT srunner_has_log (SRunner * sr);
+
+/**
+ * Retrieves the name of the currently assigned file
+ * for log output, if any exists.
+ *
+ * @return the name of the log file, or NULL if none is configured
+ *
+ * @since 0.7.1
+ */
+CK_DLL_EXP const char *CK_EXPORT srunner_log_fname (SRunner * sr);
+
+/**
+ * Set the suite runner to output the result in XML format to the
+ * given file.
+ *
+ * Note: XML file setting is an initialize only operation -- it should
+ * be done immediately after SRunner creation, and the XML file can't be
+ * changed after being set.
+ *
+ * This setting does not conflict with the other log output types;
+ * all logging types can occur concurrently if configured.
+ *
+ * @param sr suite runner to log results of in XML format
+ * @param fname file name to output XML results to
+ *
+ * @since 0.9.1
+*/
+CK_DLL_EXP void CK_EXPORT srunner_set_xml (SRunner * sr, const char *fname);
+
+/**
+ * Checks if the suite runner is assigned a file for XML output.
+ *
+ * @param sr suite runner to check
+ *
+ * @return 1 iff the suite runner currently is configured to output
+ * in XML format; 0 otherwise
+ *
+ * @since 0.9.1
+ */
+CK_DLL_EXP int CK_EXPORT srunner_has_xml (SRunner * sr);
+
+/**
+ * Retrieves the name of the currently assigned file
+ * for XML output, if any exists.
+ *
+ * @return the name of the XML file, or NULL if none is configured
+ *
+ * @since 0.9.1
+ */
+CK_DLL_EXP const char *CK_EXPORT srunner_xml_fname (SRunner * sr);
+
+/**
+ * Set the suite runner to output the result in TAP format to the
+ * given file.
+ *
+ * Note: TAP file setting is an initialize only operation -- it should
+ * be done immediately after SRunner creation, and the TAP file can't be
+ * changed after being set.
+ *
+ * This setting does not conflict with the other log output types;
+ * all logging types can occur concurrently if configured.
+ *
+ * @param sr suite runner to log results of in TAP format
+ * @param fname file name to output TAP results to
+ *
+ * @since 0.9.12
+*/
+CK_DLL_EXP void CK_EXPORT srunner_set_tap (SRunner * sr, const char *fname);
+
+/**
+ * Checks if the suite runner is assigned a file for TAP output.
+ *
+ * @param sr suite runner to check
+ *
+ * @return 1 iff the suite runner currently is configured to output
+ * in TAP format; 0 otherwise
+ *
+ * @since 0.9.12
+ */
+CK_DLL_EXP int CK_EXPORT srunner_has_tap (SRunner * sr);
+
+/**
+ * Retrieves the name of the currently assigned file
+ * for TAP output, if any exists.
+ *
+ * @return the name of the TAP file, or NULL if none is configured
+ *
+ * @since 0.9.12
+ */
+CK_DLL_EXP const char *CK_EXPORT srunner_tap_fname (SRunner * sr);
+
+/**
+ * Enum describing the current fork usage.
+ */
+enum fork_status
+{
+ CK_FORK_GETENV, /**< look in the environment for CK_FORK */
+ CK_FORK, /**< call fork to run tests */
+ CK_NOFORK /**< don't call fork */
+};
+
+/**
+ * Retrieve the current fork status for the given suite runner
+ *
+ * @param sr suite runner to check fork status of
+ *
+ * @since 0.8.0
+ */
+CK_DLL_EXP enum fork_status CK_EXPORT srunner_fork_status (SRunner * sr);
+
+/**
+ * Set the fork status for a given suite runner.
+ *
+ * The default fork status is CK_FORK_GETENV, which will look
+ * for the CK_FORK environment variable, which can be set to
+ * "yes" or "no". If the environment variable is not present,
+ * CK_FORK will be used if fork() is available on the system,
+ * otherwise CK_NOFORK is used.
+ *
+ * If set to CK_FORK or CK_NOFORK, the environment variable
+ * if defined is ignored.
+ *
+ * If Check is compiled without support for fork(), attempting
+ * to set the status to CK_FORK is ignored.
+ *
+ * @param sr suite runner to assign the fork status to
+ * @param fstat fork status to assign
+ *
+ * @since 0.8.0
+ */
+CK_DLL_EXP void CK_EXPORT srunner_set_fork_status (SRunner * sr,
+ enum fork_status fstat);
+
+/**
+ * Invoke fork() during a test and assign the child to the same
+ * process group that the rest of the test case uses.
+ *
+ * One can invoke fork() directly during a test; however doing so
+ * may not guarantee that any children processes are destroyed once
+ * the test finishes. Once a test has completed, all processes in
+ * the process group will be killed; using this wrapper will prevent
+ * orphan processes.
+ *
+ * If Check is compiled without fork() support this call simply
+ * return -1 and does nothing.
+ *
+ * @return On success, the PID of the child process is returned in
+ * the parent, and 0 is returned in the child. On failure,
+ * a value of -1 is returned to the parent process and no
+ * child process is created.
+ *
+ * @since 0.9.3
+ */
+#if !defined(_MSC_VER)
+CK_DLL_EXP pid_t CK_EXPORT check_fork (void);
+#endif
+
+/**
+ * Wait for the pid and exit.
+ *
+ * This is to be used in conjunction with check_fork(). When called,
+ * will wait for the given process to terminate. If the process
+ * exited without error, exit(EXIT_SUCCESS) is invoked; otherwise
+ * exit(EXIT_FAILURE) is invoked.
+ *
+ * If Check is compiled without support for fork(), this invokes
+ * exit(EXIT_FAILURE).
+ *
+ * @param pid process to wait for, created by check_fork()
+ *
+ * @since 0.9.3
+ */
+#if !defined(_MSC_VER)
+CK_DLL_EXP void CK_EXPORT
+check_waitpid_and_exit (pid_t pid)
+ CK_ATTRIBUTE_NORETURN;
+#endif
+
+#ifdef __cplusplus
+CK_CPPEND
+#endif
+#endif /* CHECK_H */
diff --git a/include/gst/codecparsers/codecparsers-prelude.h b/include/gst/codecparsers/codecparsers-prelude.h
new file mode 100644
index 0000000000..b056c6489e
--- /dev/null
+++ b/include/gst/codecparsers/codecparsers-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Codec Parsers Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * codecparsers-prelude.h: prelude include header for gst-codecparsers library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CODEC_PARSERS_PRELUDE_H__
+#define __GST_CODEC_PARSERS_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_CODEC_PARSERS_API
+# ifdef BUILDING_GST_CODEC_PARSERS
+# define GST_CODEC_PARSERS_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_CODEC_PARSERS_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_CODEC_PARSERS_PRELUDE_H__ */
diff --git a/include/gst/codecparsers/gstav1parser.h b/include/gst/codecparsers/gstav1parser.h
new file mode 100644
index 0000000000..31f5945498
--- /dev/null
+++ b/include/gst/codecparsers/gstav1parser.h
@@ -0,0 +1,1846 @@
+/*
+ * gstav1parser.h
+ *
+ * Copyright (C) 2018 Georg Ottinger
+ * Copyright (C) 2019-2020 Intel Corporation
+ * Author: Georg Ottinger<g.ottinger@gmx.at>
+ * Author: Junyan He<junyan.he@hotmail.com>
+ * Author: Victor Jaquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AV1_PARSER_H__
+#define __GST_AV1_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The AV1 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_AV1_MAX_NUM_TEMPORAL_LAYERS 8
+#define GST_AV1_MAX_NUM_SPATIAL_LAYERS 4
+#define GST_AV1_MAX_TILE_WIDTH 4096
+#define GST_AV1_MAX_TILE_AREA (4096 * 2304)
+#define GST_AV1_TOTAL_REFS_PER_FRAME 8
+#define GST_AV1_MAX_SEGMENTS 8
+#define GST_AV1_SEG_LVL_MAX 8
+#define GST_AV1_MAX_TILE_COLS 64
+#define GST_AV1_MAX_TILE_ROWS 64
+
+#define GST_AV1_REFS_PER_FRAME 7
+#define GST_AV1_PRIMARY_REF_NONE 7
+#define GST_AV1_SUPERRES_NUM 8
+#define GST_AV1_SUPERRES_DENOM_MIN 9
+#define GST_AV1_SUPERRES_DENOM_BITS 3
+#define GST_AV1_MAX_LOOP_FILTER 63
+#define GST_AV1_GM_ABS_TRANS_BITS 12
+#define GST_AV1_GM_ABS_TRANS_ONLY_BITS 9
+#define GST_AV1_GM_ABS_ALPHA_BITS 12
+#define GST_AV1_GM_ALPHA_PREC_BITS 15
+#define GST_AV1_GM_TRANS_PREC_BITS 6
+#define GST_AV1_GM_TRANS_ONLY_PREC_BITS 3
+#define GST_AV1_WARPEDMODEL_PREC_BITS 16
+#define GST_AV1_WARP_PARAM_REDUCE_BITS 6
+#define GST_AV1_SELECT_SCREEN_CONTENT_TOOLS 2
+#define GST_AV1_SELECT_INTEGER_MV 2
+#define GST_AV1_RESTORATION_TILESIZE_MAX 256
+#define GST_AV1_SEG_LVL_ALT_Q 0
+#define GST_AV1_SEG_LVL_REF_FRAME 5
+/* Following defines are derived from the spec, but not mentioned by
+ * this particular name in the spec */
+#define GST_AV1_CDEF_MAX (1 << 3)
+#define GST_AV1_MAX_TILE_COUNT 512
+#define GST_AV1_MAX_OPERATING_POINTS \
+ (GST_AV1_MAX_NUM_TEMPORAL_LAYERS * GST_AV1_MAX_NUM_SPATIAL_LAYERS)
+#define GST_AV1_MAX_SPATIAL_LAYERS 2 /* correct? */
+#define GST_AV1_MAX_TEMPORAL_GROUP_SIZE 8 /* correct? */
+#define GST_AV1_MAX_TEMPORAL_GROUP_REFERENCES 8 /* correct? */
+#define GST_AV1_MAX_NUM_Y_POINTS 16
+#define GST_AV1_MAX_NUM_CB_POINTS 16
+#define GST_AV1_MAX_NUM_CR_POINTS 16
+#define GST_AV1_MAX_NUM_POS_LUMA 25
+#define GST_AV1_MAX_NUM_PLANES 3
+
+#define GST_AV1_DIV_LUT_PREC_BITS 14
+#define GST_AV1_DIV_LUT_BITS 8
+#define GST_AV1_DIV_LUT_NUM (1 << GST_AV1_DIV_LUT_BITS)
+
+
+typedef struct _GstAV1Parser GstAV1Parser;
+
+typedef struct _GstAV1OBUHeader GstAV1OBUHeader;
+typedef struct _GstAV1OBU GstAV1OBU;
+
+typedef struct _GstAV1SequenceHeaderOBU GstAV1SequenceHeaderOBU;
+typedef struct _GstAV1MetadataOBU GstAV1MetadataOBU;
+typedef struct _GstAV1FrameHeaderOBU GstAV1FrameHeaderOBU;
+typedef struct _GstAV1TileListOBU GstAV1TileListOBU;
+typedef struct _GstAV1TileGroupOBU GstAV1TileGroupOBU;
+typedef struct _GstAV1FrameOBU GstAV1FrameOBU;
+
+typedef struct _GstAV1OperatingPoint GstAV1OperatingPoint;
+typedef struct _GstAV1DecoderModelInfo GstAV1DecoderModelInfo;
+typedef struct _GstAV1TimingInfo GstAV1TimingInfo;
+typedef struct _GstAV1ColorConfig GstAV1ColorConfig;
+typedef struct _GstAV1MetadataITUT_T35 GstAV1MetadataITUT_T35;
+typedef struct _GstAV1MetadataHdrCll GstAV1MetadataHdrCll;
+typedef struct _GstAV1MetadataHdrMdcv GstAV1MetadataHdrMdcv;
+typedef struct _GstAV1MetadataScalability GstAV1MetadataScalability;
+typedef struct _GstAV1MetadataTimecode GstAV1MetadataTimecode;
+typedef struct _GstAV1LoopFilterParams GstAV1LoopFilterParams;
+typedef struct _GstAV1QuantizationParams GstAV1QuantizationParams;
+typedef struct _GstAV1SegmenationParams GstAV1SegmenationParams;
+typedef struct _GstAV1TileInfo GstAV1TileInfo;
+typedef struct _GstAV1CDEFParams GstAV1CDEFParams;
+typedef struct _GstAV1LoopRestorationParams GstAV1LoopRestorationParams;
+typedef struct _GstAV1GlobalMotionParams GstAV1GlobalMotionParams;
+typedef struct _GstAV1FilmGrainParams GstAV1FilmGrainParams;
+
+typedef struct _GstAV1ReferenceFrameInfo GstAV1ReferenceFrameInfo;
+
+/**
+ * GstAV1ParserResult:
+ * @GST_AV1_PARSER_OK: successful return
+ * @GST_AV1_PARSER_NO_MORE_DATA: the parser needs more data for one OBU
+ * @GST_AV1_PARSER_DROP: no need to handle this OBU, skip it
+ * @GST_AV1_PARSER_BITSTREAM_ERROR: stream error, for example, include invalid bits
+ * @GST_AV1_PARSER_MISSING_OBU_REFERENCE: no reference, for example, no sequence found
+ * @GST_AV1_PARSER_INVALID_OPERATION: something like invalid parameters
+ *
+ * Defines the result of parser process
+ */
+typedef enum {
+ GST_AV1_PARSER_OK = 0,
+ GST_AV1_PARSER_NO_MORE_DATA = 1,
+ GST_AV1_PARSER_DROP = 2,
+ GST_AV1_PARSER_BITSTREAM_ERROR = 3,
+ GST_AV1_PARSER_MISSING_OBU_REFERENCE = 4,
+ GST_AV1_PARSER_INVALID_OPERATION = 5,
+} GstAV1ParserResult;
+
+/**
+ * GstAV1Profile:
+ * @GST_AV1_PROFILE_0: 8-bit and 10-bit 4:2:0 and 4:0:0 only.
+ * @GST_AV1_PROFILE_1: 8-bit and 10-bit 4:4:4.
+ * @GST_AV1_PROFILE_2: 8-bit and 10-bit 4:2:2, 12-bit 4:0:0 4:2:2 and 4:4:4
+ * @GST_AV1_PROFILE_UNDEFINED: unknow AV1 profile (Since: 1.20)
+ *
+ * Defines the AV1 profiles
+ */
+/**
+ * GST_AV1_PROFILE_UNDEFINED:
+ *
+ * unknow AV1 profile
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_AV1_PROFILE_0 = 0,
+ GST_AV1_PROFILE_1 = 1,
+ GST_AV1_PROFILE_2 = 2,
+ GST_AV1_PROFILE_UNDEFINED,
+} GstAV1Profile;
+
+/**
+ * GstAV1OBUType:
+ * @GST_AV1_OBU_RESERVED_0: Reserved 0
+ * @GST_AV1_OBU_SEQUENCE_HEADER: Sequence Header OBU
+ * @GST_AV1_OBU_TEMPORAL_DELIMITER: Temporal Delimiter OBU
+ * @GST_AV1_OBU_FRAME_HEADER: Frame Header OBU
+ * @GST_AV1_OBU_TILE_GROUP: Tile Group OBU
+ * @GST_AV1_OBU_METADATA: Metadata OBU
+ * @GST_AV1_OBU_FRAME: Frame OBU (includes Frame Header and one Tile Group)
+ * @GST_AV1_OBU_REDUNDANT_FRAME_HEADER: Redundant Frame Header OBU
+ * @GST_AV1_OBU_TILE_LIST: Tile LIst OBU
+ * @GST_AV1_OBU_RESERVED_9: Reserved 9
+ * @GST_AV1_OBU_RESERVED_10: Reserved 10
+ * @GST_AV1_OBU_RESERVED_11: Reserved 11
+ * @GST_AV1_OBU_RESERVED_12: Reserved 12
+ * @GST_AV1_OBU_RESERVED_13: Reserved 13
+ * @GST_AV1_OBU_RESERVED_14: Reserved 14
+ * @GST_AV1_OBU_PADDING: Padding
+ *
+ * Defines all the possible OBU types
+ */
+typedef enum {
+ GST_AV1_OBU_RESERVED_0 = 0,
+ GST_AV1_OBU_SEQUENCE_HEADER = 1,
+ GST_AV1_OBU_TEMPORAL_DELIMITER = 2,
+ GST_AV1_OBU_FRAME_HEADER = 3,
+ GST_AV1_OBU_TILE_GROUP = 4,
+ GST_AV1_OBU_METADATA = 5,
+ GST_AV1_OBU_FRAME = 6,
+ GST_AV1_OBU_REDUNDANT_FRAME_HEADER = 7,
+ GST_AV1_OBU_TILE_LIST = 8,
+ GST_AV1_OBU_RESERVED_9 = 9,
+ GST_AV1_OBU_RESERVED_10 = 10,
+ GST_AV1_OBU_RESERVED_11 = 11,
+ GST_AV1_OBU_RESERVED_12 = 12,
+ GST_AV1_OBU_RESERVED_13 = 13,
+ GST_AV1_OBU_RESERVED_14 = 14,
+ GST_AV1_OBU_PADDING = 15,
+} GstAV1OBUType;
+
+/**
+ * GstAV1SeqLevels:
+ * @GST_AV1_SEQ_LEVEL_2_0: Level 2.0
+ * @GST_AV1_SEQ_LEVEL_2_1: Level 2.1
+ * @GST_AV1_SEQ_LEVEL_2_2: Level 2.2
+ * @GST_AV1_SEQ_LEVEL_2_3: Level 2.3
+ * @GST_AV1_SEQ_LEVEL_3_0: Level 3.0
+ * @GST_AV1_SEQ_LEVEL_3_1: Level 3.1
+ * @GST_AV1_SEQ_LEVEL_3_2: Level 3.2
+ * @GST_AV1_SEQ_LEVEL_3_3: Level 3.3
+ * @GST_AV1_SEQ_LEVEL_4_0: Level 4.0
+ * @GST_AV1_SEQ_LEVEL_4_1: Level 4.1
+ * @GST_AV1_SEQ_LEVEL_4_2: Level 4.2
+ * @GST_AV1_SEQ_LEVEL_4_3: Level 4.3
+ * @GST_AV1_SEQ_LEVEL_5_0: Level 5.0
+ * @GST_AV1_SEQ_LEVEL_5_1: Level 5.1
+ * @GST_AV1_SEQ_LEVEL_5_2: Level 5.2
+ * @GST_AV1_SEQ_LEVEL_5_3: Level 5.3
+ * @GST_AV1_SEQ_LEVEL_6_0: Level 6.0
+ * @GST_AV1_SEQ_LEVEL_6_1: Level 6.1
+ * @GST_AV1_SEQ_LEVEL_6_2: Level 6.2
+ * @GST_AV1_SEQ_LEVEL_6_3: Level 6.3
+ * @GST_AV1_SEQ_LEVEL_7_0: Level 7.0
+ * @GST_AV1_SEQ_LEVEL_7_1: Level 7.1
+ * @GST_AV1_SEQ_LEVEL_7_2: Level 7.2
+ * @GST_AV1_SEQ_LEVEL_7_3: Level 7.3
+ * @GST_AV1_SEQ_LEVELS: all valid levels
+ * @GST_AV1_SEQ_LEVEL_MAX: Maximum parameters
+ *
+ * Defines all the possible OBU types
+ */
+typedef enum {
+ GST_AV1_SEQ_LEVEL_2_0 = 0,
+ GST_AV1_SEQ_LEVEL_2_1 = 1,
+ GST_AV1_SEQ_LEVEL_2_2 = 2,
+ GST_AV1_SEQ_LEVEL_2_3 = 3,
+ GST_AV1_SEQ_LEVEL_3_0 = 4,
+ GST_AV1_SEQ_LEVEL_3_1 = 5,
+ GST_AV1_SEQ_LEVEL_3_2 = 6,
+ GST_AV1_SEQ_LEVEL_3_3 = 7,
+ GST_AV1_SEQ_LEVEL_4_0 = 8,
+ GST_AV1_SEQ_LEVEL_4_1 = 9,
+ GST_AV1_SEQ_LEVEL_4_2 = 10,
+ GST_AV1_SEQ_LEVEL_4_3 = 11,
+ GST_AV1_SEQ_LEVEL_5_0 = 12,
+ GST_AV1_SEQ_LEVEL_5_1 = 13,
+ GST_AV1_SEQ_LEVEL_5_2 = 14,
+ GST_AV1_SEQ_LEVEL_5_3 = 15,
+ GST_AV1_SEQ_LEVEL_6_0 = 16,
+ GST_AV1_SEQ_LEVEL_6_1 = 17,
+ GST_AV1_SEQ_LEVEL_6_2 = 18,
+ GST_AV1_SEQ_LEVEL_6_3 = 19,
+ GST_AV1_SEQ_LEVEL_7_0 = 20,
+ GST_AV1_SEQ_LEVEL_7_1 = 21,
+ GST_AV1_SEQ_LEVEL_7_2 = 22,
+ GST_AV1_SEQ_LEVEL_7_3 = 23,
+ GST_AV1_SEQ_LEVELS,
+ GST_AV1_SEQ_LEVEL_MAX = 31
+} GstAV1SeqLevels;
+
+/**
+ * GstAV1MetadataType:
+ * @GST_AV1_METADATA_TYPE_RESERVED_0: Reserved 0
+ * @GST_AV1_METADATA_TYPE_HDR_CLL: Metadata high dynamic range content
+ * light level semantics
+ * @GST_AV1_METADATA_TYPE_HDR_MDCV: Metadata high dynamic range mastering
+ * display color volume semantics
+ * @GST_AV1_METADATA_TYPE_SCALABILITY: Metadata scalability semantics
+ * @GST_AV1_METADATA_TYPE_ITUT_T35: Metadata ITUT T35 semantics
+ * @GST_AV1_METADATA_TYPE_TIMECODE: Timecode semantics
+ */
+typedef enum {
+ GST_AV1_METADATA_TYPE_RESERVED_0 = 0,
+ GST_AV1_METADATA_TYPE_HDR_CLL = 1,
+ GST_AV1_METADATA_TYPE_HDR_MDCV = 2,
+ GST_AV1_METADATA_TYPE_SCALABILITY = 3,
+ GST_AV1_METADATA_TYPE_ITUT_T35 = 4,
+ GST_AV1_METADATA_TYPE_TIMECODE = 5,
+} GstAV1MetadataType;
+
+/**
+ * GstAV1ScalabilityModes:
+ * @GST_AV1_SCALABILITY_L1T2: 1 spatial layer, 2 temporal layers
+ * @GST_AV1_SCALABILITY_L1T3: 1 spatial layer, 3 temporal layers
+ * @GST_AV1_SCALABILITY_L2T1: 2 spatial layer (ratio 2:1), 1 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T2: 2 spatial layer (ratio 2:1), 2 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T3: 2 spatial layer (ratio 2:1), 3 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_S2T1: 2 spatial layer (ratio 2:1), 1 temporal layer
+ * @GST_AV1_SCALABILITY_S2T2: 2 spatial layer (ratio 2:1), 2 temporal layer
+ * @GST_AV1_SCALABILITY_S2T3: 2 spatial layer (ratio 2:1), 3 temporal layer
+ * @GST_AV1_SCALABILITY_L2T1h: 2 spatial layer (ratio 1.5:1), 1 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T2h: 2 spatial layer (ratio 1.5:1), 2 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_L2T3h: 2 spatial layer (ratio 1.5:1), 3 temporal layer,
+ * inter-layer dependency
+ * @GST_AV1_SCALABILITY_S2T1h: 2 spatial layer (ratio 1.5:1), 1 temporal layer
+ * @GST_AV1_SCALABILITY_S2T2h: 2 spatial layer (ratio 1.5:1), 2 temporal layer
+ * @GST_AV1_SCALABILITY_S2T3h: 2 spatial layer (ratio 1.5:1), 3 temporal layer
+ * @GST_AV1_SCALABILITY_SS: Use scalability structure #GstAV1MetadataScalability
+ */
+typedef enum {
+ GST_AV1_SCALABILITY_L1T2 = 0,
+ GST_AV1_SCALABILITY_L1T3 = 1,
+ GST_AV1_SCALABILITY_L2T1 = 2,
+ GST_AV1_SCALABILITY_L2T2 = 3,
+ GST_AV1_SCALABILITY_L2T3 = 4,
+ GST_AV1_SCALABILITY_S2T1 = 5,
+ GST_AV1_SCALABILITY_S2T2 = 6,
+ GST_AV1_SCALABILITY_S2T3 = 7,
+ GST_AV1_SCALABILITY_L2T1h = 8,
+ GST_AV1_SCALABILITY_L2T2h = 9,
+ GST_AV1_SCALABILITY_L2T3h = 10,
+ GST_AV1_SCALABILITY_S2T1h = 11,
+ GST_AV1_SCALABILITY_S2T2h = 12,
+ GST_AV1_SCALABILITY_S2T3h = 13,
+ GST_AV1_SCALABILITY_SS = 14,
+} GstAV1ScalabilityModes;
+
+/**
+ * GstAV1ColorPrimaries:
+ * @GST_AV1_CP_BT_709: BT.709
+ * @GST_AV1_CP_UNSPECIFIED: Unspecified
+ * @GST_AV1_CP_BT_470_M: BT.470 System M (historical)
+ * @GST_AV1_CP_BT_470_B_G:BT.470 System B, G (historical),
+ * @GST_AV1_CP_BT_601: BT.601
+ * @GST_AV1_CP_SMPTE_240: SMPTE 240
+ * @GST_AV1_CP_GENERIC_FILM: Generic film (color filters using illuminant C,
+ * @GST_AV1_CP_BT_2020: BT.2020, BT.2100,
+ * @GST_AV1_CP_XYZ: SMPTE 428 (CIE 1921 XYZ),
+ * @GST_AV1_CP_SMPTE_431: SMPTE RP 431-2
+ * @GST_AV1_CP_SMPTE_432: SMPTE EG 432-1
+ * @GST_AV1_CP_EBU_3213: EBU Tech. 3213-E
+ */
+typedef enum {
+ GST_AV1_CP_BT_709 = 1,
+ GST_AV1_CP_UNSPECIFIED = 2,
+ GST_AV1_CP_BT_470_M = 4,
+ GST_AV1_CP_BT_470_B_G = 5,
+ GST_AV1_CP_BT_601 = 6,
+ GST_AV1_CP_SMPTE_240 = 7,
+ GST_AV1_CP_GENERIC_FILM = 8,
+ GST_AV1_CP_BT_2020 = 9,
+ GST_AV1_CP_XYZ = 10,
+ GST_AV1_CP_SMPTE_431 = 11,
+ GST_AV1_CP_SMPTE_432 = 12,
+ GST_AV1_CP_EBU_3213 = 22,
+} GstAV1ColorPrimaries;
+
+/**
+ * GstAV1TransferCharacteristics:
+ * @GST_AV1_TC_RESERVED_0: For future use
+ * @GST_AV1_TC_BT_709: BT.709
+ * @GST_AV1_TC_UNSPECIFIED: Unspecified
+ * @GST_AV1_TC_RESERVED_3: For future use
+ * @GST_AV1_TC_BT_470_M: BT.470 System M (historical)
+ * @GST_AV1_TC_BT_470_B_G: BT.470 System B, G (historical)
+ * @GST_AV1_TC_BT_601: BT.601
+ * @GST_AV1_TC_SMPTE_240: SMPTE 240 M
+ * @GST_AV1_TC_LINEAR: Linear
+ * @GST_AV1_TC_LOG_100: Logarithmic (100 : 1 range)
+ * @GST_AV1_TC_LOG_100_SQRT10: Logarithmic (100 * Sqrt(10) : 1 range)
+ * @GST_AV1_TC_IEC_61966: IEC 61966-2-4
+ * @GST_AV1_TC_BT_1361: BT.1361
+ * @GST_AV1_TC_SRGB: sRGB or sYCC
+ * @GST_AV1_TC_BT_2020_10_BIT: BT.2020 10-bit systems
+ * @GST_AV1_TC_BT_2020_12_BIT: BT.2020 12-bit systems
+ * @GST_AV1_TC_SMPTE_2084: SMPTE ST 2084, ITU BT.2100 PQ
+ * @GST_AV1_TC_SMPTE_428: SMPTE ST 428
+ * @GST_AV1_TC_HLG: BT.2100 HLG, ARIB STD-B67
+ */
+typedef enum {
+ GST_AV1_TC_RESERVED_0 = 0,
+ GST_AV1_TC_BT_709 = 1,
+ GST_AV1_TC_UNSPECIFIED = 2,
+ GST_AV1_TC_RESERVED_3 = 3,
+ GST_AV1_TC_BT_470_M = 4,
+ GST_AV1_TC_BT_470_B_G = 5,
+ GST_AV1_TC_BT_601 = 6,
+ GST_AV1_TC_SMPTE_240 = 7,
+ GST_AV1_TC_LINEAR = 8,
+ GST_AV1_TC_LOG_100 = 9,
+ GST_AV1_TC_LOG_100_SQRT10 = 10,
+ GST_AV1_TC_IEC_61966 = 11,
+ GST_AV1_TC_BT_1361 = 12,
+ GST_AV1_TC_SRGB = 13,
+ GST_AV1_TC_BT_2020_10_BIT = 14,
+ GST_AV1_TC_BT_2020_12_BIT = 15,
+ GST_AV1_TC_SMPTE_2084 = 16,
+ GST_AV1_TC_SMPTE_428 = 17,
+ GST_AV1_TC_HLG = 18,
+} GstAV1TransferCharacteristics;
+
+/**
+ * GstAV1MatrixCoefficients:
+ * @GST_AV1_MC_IDENTITY: Identity matrix
+ * @GST_AV1_MC_BT_709: BT.709
+ * @GST_AV1_MC_UNSPECIFIED: Unspecified
+ * @GST_AV1_MC_RESERVED_3: For future use
+ * @GST_AV1_MC_FCC: US FCC 73.628
+ * @GST_AV1_MC_BT_470_B_G: BT.470 System B, G (historical)
+ * @GST_AV1_MC_BT_601: BT.601
+ * @GST_AV1_MC_SMPTE_240: SMPTE 240 M
+ * @GST_AV1_MC_SMPTE_YCGCO: YCgCo
+ * @GST_AV1_MC_BT_2020_NCL: BT.2020 non-constant luminance, BT.2100 YCbCr
+ * @GST_AV1_MC_BT_2020_CL: BT.2020 constant luminance
+ * @GST_AV1_MC_SMPTE_2085: SMPTE ST 2085 YDzDx
+ * @GST_AV1_MC_CHROMAT_NCL: Chromaticity-derived non-constant luminance
+ * @GST_AV1_MC_CHROMAT_CL: Chromaticity-derived constant luminancw
+ * @GST_AV1_MC_ICTCP: BT.2100 ICtCp
+ */
+typedef enum {
+ GST_AV1_MC_IDENTITY = 0,
+ GST_AV1_MC_BT_709 = 1,
+ GST_AV1_MC_UNSPECIFIED = 2,
+ GST_AV1_MC_RESERVED_3 = 3,
+ GST_AV1_MC_FCC = 4,
+ GST_AV1_MC_BT_470_B_G = 5,
+ GST_AV1_MC_BT_601 = 6,
+ GST_AV1_MC_SMPTE_240 = 7,
+ GST_AV1_MC_SMPTE_YCGCO = 8,
+ GST_AV1_MC_BT_2020_NCL = 9,
+ GST_AV1_MC_BT_2020_CL = 10,
+ GST_AV1_MC_SMPTE_2085 = 11,
+ GST_AV1_MC_CHROMAT_NCL = 12,
+ GST_AV1_MC_CHROMAT_CL = 13,
+ GST_AV1_MC_ICTCP = 14,
+} GstAV1MatrixCoefficients;
+
+/**
+ * GstAV1ChromaSamplePositions:
+ * @GST_AV1_CSP_UNKNOWN: Unknown (in this case the source video transfer
+ * function must be signaled outside the AV1 bitstream).
+ * @GST_AV1_CSP_VERTICAL: Horizontally co-located with (0, 0) luma sample,
+ * vertical position in the middle between two luma samples.
+ * @GST_AV1_CSP_COLOCATED: co-located with (0, 0) luma sample.
+ * @GST_AV1_CSP_RESERVED: For future use.
+ */
+typedef enum {
+ GST_AV1_CSP_UNKNOWN = 0,
+ GST_AV1_CSP_VERTICAL = 1,
+ GST_AV1_CSP_COLOCATED = 2,
+ GST_AV1_CSP_RESERVED = 3,
+} GstAV1ChromaSamplePositions;
+
+/**
+ * GstAV1FrameType:
+ * @GST_AV1_KEY_FRAME: Key Frame
+ * @GST_AV1_INTER_FRAME: InterFrame
+ * @GST_AV1_INTRA_ONLY_FRAME: Intra-Only Frame
+ * @GST_AV1_SWITCH_FRAME: Switch Frame
+ */
+typedef enum {
+ GST_AV1_KEY_FRAME = 0,
+ GST_AV1_INTER_FRAME = 1,
+ GST_AV1_INTRA_ONLY_FRAME = 2,
+ GST_AV1_SWITCH_FRAME = 3,
+} GstAV1FrameType;
+
+/**
+ * GstAV1InterpolationFilter:
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP: Eighttap
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH: Eighttap Smooth
+ * @GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP: Eighttap Sharp
+ * @GST_AV1_INTERPOLATION_FILTER_BILINEAR: Bilinear
+ * @GST_AV1_INTERPOLATION_FILTER_SWITCHABLE: Filter is swichtable
+ */
+typedef enum {
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP = 0,
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
+ GST_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
+ GST_AV1_INTERPOLATION_FILTER_BILINEAR = 3,
+ GST_AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
+} GstAV1InterpolationFilter;
+
+/**
+ * GstAV1TXModes:
+ * @GST_AV1_TX_MODE_ONLY_4x4: the inverse transform will use only 4x4 transforms.
+ * @GST_AV1_TX_MODE_LARGEST: the inverse transform will use the largest transform
+ * size that fits inside the block.
+ * @GST_AV1_TX_MODE_SELECT: the choice of transform size is specified explicitly
+ * for each block.
+ */
+typedef enum {
+ GST_AV1_TX_MODE_ONLY_4x4 = 0,
+ GST_AV1_TX_MODE_LARGEST = 1,
+ GST_AV1_TX_MODE_SELECT = 2,
+} GstAV1TXModes;
+
+/**
+ * GstAV1FrameRestorationType:
+ * @GST_AV1_FRAME_RESTORE_NONE: no filtering is applied
+ * @GST_AV1_FRAME_RESTORE_WIENER: Wiener filter process is invoked
+ * @GST_AV1_FRAME_RESTORE_SGRPROJ: self guided filter proces is invoked
+ * @GST_AV1_FRAME_RESTORE_SWITCHABLE: restoration filter is swichtable
+ */
+typedef enum {
+ GST_AV1_FRAME_RESTORE_NONE = 0,
+ GST_AV1_FRAME_RESTORE_WIENER = 1,
+ GST_AV1_FRAME_RESTORE_SGRPROJ = 2,
+ GST_AV1_FRAME_RESTORE_SWITCHABLE = 3,
+} GstAV1FrameRestorationType;
+
+/**
+ * GstAV1ReferenceFrame:
+ * @GST_AV1_REF_INTRA_FRAME: Intra Frame Reference
+ * @GST_AV1_REF_LAST_FRAME: Last Reference Frame
+ * @GST_AV1_REF_LAST2_FRAME: Last2 Reference Frame
+ * @GST_AV1_REF_LAST3_FRAME: Last3 Reference Frame
+ * @GST_AV1_REF_GOLDEN_FRAME: Golden Reference Frame
+ * @GST_AV1_REF_BWDREF_FRAME: BWD Reference Frame
+ * @GST_AV1_REF_ALTREF2_FRAME: Alternative2 Reference Frame
+ * @GST_AV1_REF_ALTREF_FRAME: Alternative Reference Frame
+ * @GST_AV1_NUM_REF_FRAMES: Total Reference Frame Number
+ */
+typedef enum {
+ GST_AV1_REF_INTRA_FRAME = 0,
+ GST_AV1_REF_LAST_FRAME = 1,
+ GST_AV1_REF_LAST2_FRAME = 2,
+ GST_AV1_REF_LAST3_FRAME = 3,
+ GST_AV1_REF_GOLDEN_FRAME = 4,
+ GST_AV1_REF_BWDREF_FRAME = 5,
+ GST_AV1_REF_ALTREF2_FRAME = 6,
+ GST_AV1_REF_ALTREF_FRAME = 7,
+ GST_AV1_NUM_REF_FRAMES
+} GstAV1ReferenceFrame;
+
+/**
+ * GstAV1WarpModelType:
+ * @GST_AV1_WARP_MODEL_IDENTITY: Warp model is just an identity transform
+ * @GST_AV1_WARP_MODEL_TRANSLATION: Warp model is a pure translation
+ * @GST_AV1_WARP_MODEL_ROTZOOM: Warp model is a rotation + symmetric zoom
+ * + translation
+ * @GST_AV1_WARP_MODEL_AFFINE: Warp model is a general affine transform
+ */
+typedef enum {
+ GST_AV1_WARP_MODEL_IDENTITY = 0,
+ GST_AV1_WARP_MODEL_TRANSLATION = 1,
+ GST_AV1_WARP_MODEL_ROTZOOM = 2,
+ GST_AV1_WARP_MODEL_AFFINE = 3,
+} GstAV1WarpModelType;
+
+/**
+ * GstAV1OBUHeader:
+ * @obu_type: the type of data structure contained in the OBU payload.
+ * @obu_extention_flag: indicates if OBU header extention is present.
+ * @obu_has_size_field: equal to 1 indicates that the obu_size syntax element will be
+ * present. @obu_has_size_field equal to 0 indicates that the @obu_size syntax element
+ * will not be present.
+ * @obu_temporal_id: specifies the temporal level of the data contained in the OBU.
+ * @obu_spatial_id: specifies the spatial level of the data contained in the OBU.
+ *
+ * Collect info for OBU header and OBU extension header if
+ * obu_extension_flag == 1.
+ */
+struct _GstAV1OBUHeader {
+ GstAV1OBUType obu_type;
+ gboolean obu_extention_flag;
+ gboolean obu_has_size_field;
+ guint8 obu_temporal_id;
+ guint8 obu_spatial_id;
+};
+
+/**
+ * GstAV1OBU:
+ * @header: a #GstAV1OBUHeader OBU Header
+ * @obu_type: the type of data structure contained in the OBU payload.
+ * @data: references the current data chunk that holds the OBU
+ * @obu_size: size of the OBU, not include header size
+ *
+ * It is the general representation of AV1 OBU (Open Bitstream
+ * Unit). One OBU include its header and payload.
+ */
+struct _GstAV1OBU {
+ GstAV1OBUHeader header;
+ GstAV1OBUType obu_type;
+ guint8 *data;
+ guint32 obu_size;
+};
+
+/**
+ * GstAV1OperatingPoint:
+ * @seq_level_idx: specifies the level that the coded video sequence conforms to.
+ * @seq_tier: specifies the tier that the coded video sequence conforms to.
+ * @idc: contains a bitmask that indicates which spatial and temporal layers should be
+ * decoded. Bit k is equal to 1 if temporal layer k should be decoded (for k between
+ * 0 and 7). Bit j+8 is equal to 1 if spatial layer j should be decoded (for j between
+ * 0 and 3).
+ * @decoder_model_present_for_this_op: equal to one indicates that there is a decoder model
+ * associated with this operating point. @decoder_model_present_for_this_op equal to zero
+ * indicates that there is not a decoder model associated.
+ * @decoder_buffer_delay: specifies the time interval between the arrival of the first bit
+ * in the smoothing buffer and the subsequent removal of the data that belongs to the
+ * first coded frame for operating point op, measured in units of 1/90000 seconds. The
+ * length of @decoder_buffer_delay is specified by @buffer_delay_length_minus_1 + 1, in bits.
+ * @encoder_buffer_delay: specifies, in combination with @decoder_buffer_delay syntax element,
+ * the first bit arrival time of frames to be decoded to the smoothing buffer.
+ * @encoder_buffer_delay is measured in units of 1/90000 seconds. For a video sequence that
+ * includes one or more random access points the sum of @decoder_buffer_delay and
+ * @encoder_buffer_delay shall be kept constant.
+ * @low_delay_mode_flag: equal to 1 indicates that the smoothing buffer operates in low-delay
+ * mode for operating point op. In low-delay mode late decode times and buffer underflow
+ * are both permitted. @low_delay_mode_flag equal to 0 indicates that the smoothing buffer
+ * operates in strict mode, where buffer underflow is not allowed.
+ * @initial_display_delay_present_for_this_op: equal to 1 indicates that
+ * @initial_display_delay_minus_1 is specified for this operating. 0 indicates that
+ * @initial_display_delay_minus_1 is not specified for this operating point.
+ * @initial_display_delay_minus_1: plus 1 specifies, for operating point i, the number of
+ * decoded frames that should be present in the buffer pool before the first presentable
+ * frame is displayed. This will ensure that all presentable frames in the sequence can
+ * be decoded at or before the time that they are scheduled for display.
+ */
+struct _GstAV1OperatingPoint {
+ guint8 seq_level_idx;
+ guint8 seq_tier;
+ guint16 idc;
+ gboolean decoder_model_present_for_this_op;
+ guint8 decoder_buffer_delay;
+ guint8 encoder_buffer_delay;
+ gboolean low_delay_mode_flag;
+ gboolean initial_display_delay_present_for_this_op;
+ guint8 initial_display_delay_minus_1;
+};
+
+/**
+ * GstAV1DecoderModelInfo:
+ * @buffer_delay_length_minus_1: plus 1 specifies the length of the
+ * @decoder_buffer_delay and the @encoder_buffer_delay syntax elements,
+ * in bits.
+ * @num_units_in_decoding_tick: is the number of time units of a decoding clock
+ * operating at the frequency @time_scale Hz that corresponds to one increment
+ * of a clock tick counter.
+ * @buffer_removal_time_length_minus_1: plus 1 specifies the length of the
+ * @buffer_removal_time syntax element, in bits.
+ * @frame_presentation_time_length_minus_1: plus 1 specifies the length of the
+ * @frame_presentation_time syntax element, in bits.
+ */
+struct _GstAV1DecoderModelInfo {
+ guint8 buffer_delay_length_minus_1;
+ guint32 num_units_in_decoding_tick;
+ guint8 buffer_removal_time_length_minus_1;
+ guint8 frame_presentation_time_length_minus_1;
+};
+
+/**
+ * GstAV1TimingInfo:
+ * @num_units_in_display_tick: is the number of time units of a clock operating at the
+ * frequency @time_scale Hz that corresponds to one increment of a clock tick counter.
+ * A clock tick, in seconds, is equal to num_units_in_display_tick divided by time_scale.
+ * It is a requirement of bitstream conformance that num_units_in_display_tick is greater
+ * than 0.
+ * @time_scale: is the number of time units that pass in one second. It is a requirement of
+ * bitstream conformance that @time_scale is greater than 0.
+ * @equal_picture_interval: equal to 1 indicates that pictures should be displayed according
+ * to their output order with the number of ticks between two consecutive pictures (without
+ * dropping frames) specified by @num_ticks_per_picture_minus_1 + 1. @equal_picture_interval
+ * equal to 0 indicates that the interval between two consecutive pictures is not specified.
+ * @num_ticks_per_picture_minus_1: plus 1 specifies the number of clock ticks corresponding
+ * to output time between two consecutive pictures in the output order. It is a requirement
+ * of bitstream conformance that the value of @num_ticks_per_picture_minus_1 shall be in the
+ * range of 0 to (1 << 32) - 2, inclusive.
+ */
+struct _GstAV1TimingInfo {
+ guint32 num_units_in_display_tick;
+ guint32 time_scale;
+ gboolean equal_picture_interval;
+ guint32 num_ticks_per_picture_minus_1;
+};
+
+/**
+ * GstAV1ColorConfig:
+ * @high_bitdepth: syntax element which, together with @seq_profile, determine the bit depth.
+ * @twelve_bit: is syntax elements which, together with @seq_profile and @high_bitdepth,
+ * determines the bit depth.
+ * @mono_chrome: equal to 1 indicates that the video does not contain U and V color planes.
+ * @mono_chrome equal to 0 indicates that the video contains Y, U, and V color planes.
+ * @color_description_present_flag: equal to 1 specifies that color_primaries,
+ * @transfer_characteristics, and @matrix_coefficients are present.
+ * @color_description_present_flag equal to 0 specifies that @color_primaries,
+ * @transfer_characteristics and @matrix_coefficients are not present.
+ * @color_primaries: is an integer that is defined by the "Color primaries" section of
+ * ISO/IEC 23091-4/ITU-T H.273.
+ * @transfer_characteristics: is an integer that is defined by the "Transfer characteristics"
+ * section of ISO/IEC 23091-4/ITU-T H.273.
+ * @matrix_coefficients: is an integer that is defined by the "Matrix coefficients" section
+ * of ISO/IEC 23091-4/ITU-T H.273.
+ * @color_range: is a binary value that is associated with the VideoFullRangeFlag variable
+ * specified in ISO/IEC 23091-4/ITU-T H.273. color range equal to 0 shall be referred to
+ * as the studio swing representation and color range equal to 1 shall be referred to as
+ * the full swing representation for all intents relating to this specification.
+ * @subsampling_x, @subsampling_y: specify the chroma subsampling format. If
+ * @matrix_coefficients is equal to GST_AV1_MC_IDENTITY, it is a requirement of bitstream
+ * conformance that @subsampling_x is equal to 0 and @subsampling_y is equal to 0.
+ * @chroma_sample_position specifies the sample position for subsampled streams:
+ * @separate_uv_delta_q: equal to 1 indicates that the U and V planes may have separate
+ * delta quantizer values. @separate_uv_delta_q equal to 0 indicates that the U and V
+ * planes will share the same delta quantizer value.
+ */
+struct _GstAV1ColorConfig {
+ gboolean high_bitdepth;
+ gboolean twelve_bit;
+ gboolean mono_chrome;
+ gboolean color_description_present_flag;
+ GstAV1ColorPrimaries color_primaries;
+ GstAV1TransferCharacteristics transfer_characteristics;
+ GstAV1MatrixCoefficients matrix_coefficients;
+ gboolean color_range;
+ guint8 subsampling_x;
+ guint8 subsampling_y;
+ GstAV1ChromaSamplePositions chroma_sample_position;
+ gboolean separate_uv_delta_q;
+};
+
+/**
+ * GstAV1SequenceHeaderOBU:
+ * @seq_profile: specifies the features that can be used in the coded video sequence
+ * @still_picture: equal to 1 specifies that the bitstream contains only one coded frame.
+ * @reduced_still_picture_header: specifies that the syntax elements not needed by a still
+ * picture are omitted.
+ * @frame_width_bits_minus_1: specifies the number of bits minus 1 used for transmitting
+ * the frame width syntax elements.
+ * @frame_height_bits_minus_1: specifies the number of bits minus 1 used for transmitting
+ * the frame height syntax elements.
+ * @max_frame_width_minus_1: specifies the maximum frame width minus 1 for the frames
+ * represented by this sequenceheader.
+ * @max_frame_height_minus_1: specifies the maximum frame height minus 1 for the frames
+ * represented by this sequenceheader.
+ * @frame_id_numbers_present_flag: specifies whether frame id numbers are present in the bitstream.
+ * @delta_frame_id_length_minus_2: specifies the number of bits minus 2 used to encode
+ * delta_frame_id syntax elements.
+ * @additional_frame_id_length_minus_1: is used to calculate the number of bits used to
+ * encode the frame_id syntax element.
+ * @use_128x128_superblock: when equal to 1, indicates that superblocks contain 128x128 luma
+ * samples. When equal to 0, it indicates that superblocks contain 64x64 luma samples.
+ * (The number of contained chroma samples depends on @subsampling_x and @subsampling_y).
+ * @enable_filter_intra: equal to 1 specifies that the @use_filter_intra syntax element may
+ * be present. @enable_filter_intra equal to 0 specifies that the @use_filter_intra syntax
+ * element will not be present.
+ * @enable_intra_edge_filter: specifies whether the intra edge filtering process should be enabled.
+ * @enable_interintra_compound: equal to 1 specifies that the mode info for inter blocks may
+ * contain the syntax element interintra. @enable_interintra_compound equal to 0 specifies
+ * that the syntax element interintra will not be present.
+ * @enable_masked_compound: equal to 1 specifies that the mode info for inter blocks may
+ * contain the syntax element @compound_type. @enable_masked_compound equal to 0 specifies
+ * that the syntax element @compound_type will not be present.
+ * @enable_warped_motion: equal to 1 indicates that the allow_warped_motion syntax element
+ * may be present. @enable_warped_motion equal to 0 indicates that the @allow_warped_motion
+ * syntax element will not be present.
+ * @enable_order_hint: equal to 1 indicates that tools based on the values of order hints
+ * may be used. @enable_order_hint equal to 0 indicates that tools based on order hints
+ * are disabled.
+ * @enable_dual_filter: equal to 1 indicates that the inter prediction filter type may be
+ * specified independently in the horizontal and vertical directions. If the flag is equal
+ * to 0, only one filter type may be specified, which is then used in both directions.
+ * @enable_jnt_comp: equal to 1 indicates that the distance weights process may be used
+ * for inter prediction.
+ * @enable_ref_frame_mvs: equal to 1 indicates that the @use_ref_frame_mvs syntax element
+ * may be present. @enable_ref_frame_mvs equal to 0 indicates that the @use_ref_frame_mvs
+ * syntax element will not be present.
+ * @seq_choose_screen_content_tools: equal to 0 indicates that the @seq_force_screen_content_tools
+ * syntax element will be present. @seq_choose_screen_content_tools equal to 1 indicates
+ * that @seq_force_screen_content_tools should be set equal to SELECT_SCREEN_CONTENT_TOOLS.
+ * @seq_force_screen_content_tools: equal to SELECT_SCREEN_CONTENT_TOOLS indicates that the
+ * @allow_screen_content_tools syntax element will be present in the frame header. Otherwise,
+ * @seq_force_screen_content_tools contains the value for @allow_screen_content_tools.
+ * @seq_choose_integer_mv: equal to 0 indicates that the seq_force_integer_mv syntax element
+ * will be present. @seq_choose_integer_mv equal to 1 indicates that @seq_force_integer_mv
+ * should be set equal to SELECT_INTEGER_MV.
+ * @seq_force_integer_mv: equal to SELECT_INTEGER_MV indicates that the @force_integer_mv
+ * syntax element will be present in the frame header (providing allow_screen_content_tools
+ * is equal to 1). Otherwise, @seq_force_integer_mv contains the value for @force_integer_mv.
+ * @order_hint_bits_minus_1: is used to compute OrderHintBits.
+ * @enable_superres: equal to 1 specifies that the use_superres syntax element will be present
+ * in the uncompressed header. enable_superres equal to 0 specifies that the use_superres
+ * syntax element will not be present (instead use_superres will be set to 0 in the
+ * uncompressed header without being read).
+ * @enable_cdef: equal to 1 specifies that cdef filtering may be enabled. enable_cdef equal
+ * to 0 specifies that cdef filtering is disabled.
+ * @enable_restoration: equal to 1 specifies that loop restoration filtering may be enabled.
+ * enable_restoration equal to 0 specifies that loop restoration filtering is disabled.
+ * @film_grain_params_present: specifies whether film grain parameters are present in the bitstream.
+ * @operating_points_cnt_minus_1: indicates the number of operating points minus 1 present
+ * in this bitstream.
+ * @operating_points: specifies the corresponding operating point for a set of operating
+ * parameters.
+ * @decoder_model_info_present_flag: specifies whether the decoder model info is present in
+ * the bitstream.
+ * @decoder_model_info: holds information about the decoder model.
+ * @initial_display_delay_present_flag: specifies whether initial display delay information
+ * is present in the bitstream or not.
+ * @timing_info_present_flag: specifies whether timing info is present in the bitstream.
+ * @timing_info: holds the timing information.
+ * @color_config: hold the color configuration.
+ * @order_hint_bits: specifies the number of bits used for the order_hint syntax element.
+ * @bit_depth: the bit depth of the stream.
+ * @num_planes: the YUV plane number.
+ */
+struct _GstAV1SequenceHeaderOBU {
+ GstAV1Profile seq_profile;
+ gboolean still_picture;
+ guint8 reduced_still_picture_header;
+
+ guint8 frame_width_bits_minus_1;
+ guint8 frame_height_bits_minus_1;
+ guint16 max_frame_width_minus_1;
+ guint16 max_frame_height_minus_1;
+
+ gboolean frame_id_numbers_present_flag;
+ guint8 delta_frame_id_length_minus_2;
+ guint8 additional_frame_id_length_minus_1;
+
+ gboolean use_128x128_superblock;
+ gboolean enable_filter_intra;
+ gboolean enable_intra_edge_filter;
+ gboolean enable_interintra_compound;
+ gboolean enable_masked_compound;
+ gboolean enable_warped_motion;
+ gboolean enable_order_hint;
+ gboolean enable_dual_filter;
+ gboolean enable_jnt_comp;
+ gboolean enable_ref_frame_mvs;
+ gboolean seq_choose_screen_content_tools;
+ guint8 seq_force_screen_content_tools;
+ gboolean seq_choose_integer_mv;
+ guint8 seq_force_integer_mv;
+ gint8 order_hint_bits_minus_1;
+
+ gboolean enable_superres;
+ gboolean enable_cdef;
+ gboolean enable_restoration;
+
+ guint8 film_grain_params_present;
+
+ guint8 operating_points_cnt_minus_1;
+ GstAV1OperatingPoint operating_points[GST_AV1_MAX_OPERATING_POINTS];
+
+ gboolean decoder_model_info_present_flag;
+ GstAV1DecoderModelInfo decoder_model_info;
+ guint8 initial_display_delay_present_flag;
+
+ gboolean timing_info_present_flag;
+ GstAV1TimingInfo timing_info;
+
+ GstAV1ColorConfig color_config;
+
+ /* Global var calculated by sequence */
+ guint8 order_hint_bits; /* OrderHintBits */
+ guint8 bit_depth; /* BitDepth */
+ guint8 num_planes; /* NumPlanes */
+};
+
+/**
+ * GstAV1MetadataITUT_T35:
+ * @itu_t_t35_country_code: shall be a byte having a value specified as a country code by
+ * Annex A of Recommendation ITU-T T.35.
+ * @itu_t_t35_country_code_extension_byte: shall be a byte having a value specified as a
+ * country code by Annex B of Recommendation ITU-T T.35.
+ * @itu_t_t35_payload_bytes: shall be bytes containing data registered as specified in
+ * Recommendation ITU-T T.35.
+ */
+struct _GstAV1MetadataITUT_T35 {
+ guint8 itu_t_t35_country_code;
+ guint8 itu_t_t35_country_code_extention_byte;
+ /* itu_t_t35_payload_bytes - not specified at this spec */
+ guint8 *itu_t_t35_payload_bytes;
+};
+
+/**
+ * GstAV1MetadataHdrCll:
+ * @max_cll: specifies the maximum content light level as specified in CEA-861.3, Appendix A.
+ * @max_fall: specifies the maximum frame-average light level as specified in CEA-861.3, Appendix A.
+ *
+ * High Dynamic Range content light level syntax metadata.
+ */
+struct _GstAV1MetadataHdrCll {
+ guint16 max_cll;
+ guint16 max_fall;
+};
+
+/**
+ * GstAV1MetadataHdrMdcv:
+ * @primary_chromaticity_x: specifies a 0.16 fixed-point X chromaticity coordinate as
+ * defined by CIE 1931, where i = 0,1,2 specifies Red, Green, Blue respectively.
+ * @primary_chromaticity_y: specifies a 0.16 fixed-point Y chromaticity coordinate as
+ * defined by CIE 1931, where i = 0,1,2 specifies Red, Green, Blue respectively.
+ * @white_point_chromaticity_x: specifies a 0.16 fixed-point white X chromaticity coordinate
+ * as defined by CIE 1931.
+ * @white_point_chromaticity_y: specifies a 0.16 fixed-point white Y chromaticity coordinate
+ * as defined by CIE 1931.
+ * @luminance_max: is a 24.8 fixed-point maximum luminance, represented in candelas per
+ * square meter.
+ * @luminance_min: is a 18.14 fixed-point minimum luminance, represented in candelas per
+ * square meter.
+ *
+ * High Dynamic Range mastering display color volume metadata.
+ */
+struct _GstAV1MetadataHdrMdcv {
+ guint16 primary_chromaticity_x[3];
+ guint16 primary_chromaticity_y[3];
+ guint16 white_point_chromaticity_x;
+ guint16 white_point_chromaticity_y;
+ guint32 luminance_max;
+ guint32 luminance_min;
+};
+
+/**
+ * GstAV1MetadataScalability:
+ * @scalability_mode_idc: indicates the picture prediction structure of the bitstream.
+ * @spatial_layers_cnt_minus_1: indicates the number of spatial layers present in the video
+ * sequence minus one.
+ * @spatial_layer_description_present_flag: indicates when set to 1 that the
+ * spatial_layer_ref_id is present for each of the (@spatial_layers_cnt_minus_1 + 1) layers,
+ * or that it is not present when set to 0.
+ * @spatial_layer_dimensions_present_flag: indicates when set to 1 that the
+ * @spatial_layer_max_width and @spatial_layer_max_height parameters are present for each of
+ * the (@spatial_layers_cnt_minus_1 + 1) layers, or that it they are not present when set to 0.
+ * @temporal_group_description_present_flag: indicates when set to 1 that the temporal
+ * dependency information is present, or that it is not when set to 0.
+ * @spatial_layer_max_width: specifies the maximum frame width for the frames with
+ * @spatial_id equal to i. This number must not be larger than @max_frame_width_minus_1 + 1.
+ * @spatial_layer_max_height: specifies the maximum frame height for the frames with
+ * @spatial_id equal to i. This number must not be larger than @max_frame_height_minus_1 + 1.
+ * @spatial_layer_ref_id: specifies the @spatial_id value of the frame within the current
+ * temporal unit that the frame of layer i uses for reference. If no frame within the
+ * current temporal unit is used for reference the value must be equal to 255.
+ * @temporal_group_size: indicates the number of pictures in a temporal picture group. If the
+ * @temporal_group_size is greater than 0, then the scalability structure data allows the
+ * inter-picture temporal dependency structure of the video sequence to be specified. If the
+ * @temporal_group_size is greater than 0, then for @temporal_group_size pictures in the
+ * temporal group, each picture's temporal layer id (@temporal_id), switch up points
+ * (@temporal_group_temporal_switching_up_point_flag and
+ * @temporal_group_spatial_switching_up_point_flag), and the reference picture indices
+ * (@temporal_group_ref_pic_diff) are specified. The first picture specified in a temporal
+ * group must have @temporal_id equal to 0. If the parameter @temporal_group_size is not
+ * present or set to 0, then either there is only one temporal layer or there is no fixed
+ * inter-picture temporal dependency present going forward in the video sequence. Note that
+ * for a given picture, all frames follow the same inter-picture temporal dependency
+ * structure. However, the frame rate of each layer can be different from each other. The
+ * specified dependency structure in the scalability structure data must be for the highest
+ * frame rate layer.
+ * @temporal_group_temporal_id: specifies the temporal_id value for the i-th picture in
+ * the temporal group.
+ * @temporal_group_temporal_switching_up_point_flag: is set to 1 if subsequent (in decoding
+ * order) pictures with a @temporal_id higher than @temporal_group_temporal_id[i] do not
+ * depend on any picture preceding the current picture (in coding order) with @temporal_id
+ * higher than @temporal_group_temporal_id[ i ].
+ * @temporal_group_spatial_switching_up_point_flag: is set to 1 if spatial layers of the
+ * current picture in the temporal group (i.e., pictures with a spatial_id higher than zero)
+ * do not depend on any picture preceding the current picture in the temporal group.
+ * @temporal_group_ref_cnt: indicates the number of reference pictures used by the i-th
+ * picture in the temporal group.
+ * @temporal_group_ref_pic_diff: indicates, for the i-th picture in the temporal group,
+ * the temporal distance between the i-th picture and the j-th reference picture used by
+ * the i-th picture. The temporal distance is measured in frames, counting only frames of
+ * identical @spatial_id values.
+ *
+ * The scalability metadata OBU is intended for use by intermediate
+ * processing entities that may perform selective layer elimination.
+ */
+struct _GstAV1MetadataScalability {
+ GstAV1ScalabilityModes scalability_mode_idc;
+ guint8 spatial_layers_cnt_minus_1;
+ gboolean spatial_layer_dimensions_present_flag;
+ gboolean spatial_layer_description_present_flag;
+ gboolean temporal_group_description_present_flag;
+ guint16 spatial_layer_max_width[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint16 spatial_layer_max_height[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint8 spatial_layer_ref_id[GST_AV1_MAX_SPATIAL_LAYERS];
+ guint8 temporal_group_size;
+
+ guint8 temporal_group_temporal_id[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_temporal_switching_up_point_flag[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_spatial_switching_up_point_flag[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_ref_cnt[GST_AV1_MAX_TEMPORAL_GROUP_SIZE];
+ guint8 temporal_group_ref_pic_diff[GST_AV1_MAX_TEMPORAL_GROUP_SIZE]
+ [GST_AV1_MAX_TEMPORAL_GROUP_REFERENCES];
+};
+
+/**
+ * GstAV1MetadataTimecode:
+ * @counting_type: specifies the method of dropping values of the n_frames syntax element as
+ * specified in AV1 Spec 6.1.1. @counting_type should be the same for all pictures in the
+ * coded video sequence.
+ * @full_timestamp_flag: equal to 1 indicates that the the @seconds_value, @minutes_value,
+ * @hours_value syntax elements will be present. @full_timestamp_flag equal to 0 indicates
+ * that there are flags to control the presence of these syntax elements.
+ * @discontinuity_flag: equal to 0 indicates that the difference between the current value
+ * of clockTimestamp and the value of clockTimestamp computed from the previous set of
+ * timestamp syntax elements in output order can be interpreted as the time difference
+ * between the times of origin or capture of the associated frames or fields.
+ * @discontinuity_flag equal to 1 indicates that the difference between the current value of
+ * clockTimestamp and the value of clockTimestamp computed from the previous set of clock
+ * timestamp syntax elements in output order should not be interpreted as the time difference
+ * between the times of origin or capture of the associated frames or fields.
+ * @cnt_dropped_flag: specifies the skipping of one or more values of @n_frames using the
+ * counting method specified by counting_type.
+ * @n_frames: is used to compute clockTimestamp. When @timing_info_present_flag is equal to 1,
+ * @n_frames shall be less than maxFps, where maxFps is specified by
+ * maxFps = ceil( time_scale / ( 2 * @num_units_in_display_tick ) ).
+ * @seconds_flag: equal to 1 specifies that @seconds_value and @minutes_flag are present when
+ * @full_timestamp_flag is equal to 0. @seconds_flag equal to 0 specifies that @seconds_value
+ * and @minutes_flag are not present.
+ * @seconds_value: is used to compute clockTimestamp and shall be in the range of 0 to 59.
+ * When @seconds_value is not present, its value is inferred to be equal to the value of
+ * @seconds_value for the previous set of clock timestamp syntax elements in decoding order,
+ * and it is required that such a previous @seconds_value shall have been present.
+ * @minutes_flag: equal to 1 specifies that @minutes_value and @hours_flag are present when
+ * @full_timestamp_flag is equal to 0 and @seconds_flag is equal to 1. @minutes_flag equal to 0
+ * specifies that @minutes_value and @hours_flag are not present.
+ * @minutes_value: specifies the value of mm used to compute clockTimestamp and shall be in
+ * the range of 0 to 59, inclusive. When minutes_value is not present, its value is inferred
+ * to be equal to the value of @minutes_value for the previous set of clock timestamp syntax
+ * elements in decoding order, and it is required that such a previous @minutes_value shall
+ * have been present.
+ * @hours_flag: equal to 1 specifies that @hours_value is present when @full_timestamp_flag is
+ * equal to 0 and @seconds_flag is equal to 1 and @minutes_flag is equal to 1.
+ * @hours_value: is used to compute clockTimestamp and shall be in the range of 0 to 23,
+ * inclusive. When @hours_value is not present, its value is inferred to be equal to the
+ * value of @hours_value for the previous set of clock timestamp syntax elements in decoding
+ * order, and it is required that such a previous @hours_value shall have been present.
+ * @time_offset_length: greater than 0 specifies the length in bits of the @time_offset_value
+ * syntax element. @time_offset_length equal to 0 specifies that the @time_offset_value syntax
+ * element is not present. @time_offset_length should be the same for all pictures in the
+ * coded video sequence.
+ * @time_offset_value: is used to compute clockTimestamp. The number of bits used to represent
+ * @time_offset_value is equal to @time_offset_length. When @time_offset_value is not present,
+ * its value is inferred to be equal to 0.
+ */
+struct _GstAV1MetadataTimecode {
+ guint8 counting_type; /* candidate for sperate Type GstAV1TimecodeCountingType */
+ gboolean full_timestamp_flag;
+ gboolean discontinuity_flag;
+ gboolean cnt_dropped_flag;
+ guint8 n_frames;
+ gboolean seconds_flag;
+ guint8 seconds_value;
+ gboolean minutes_flag;
+ guint8 minutes_value;
+ gboolean hours_flag;
+ guint8 hours_value;
+ guint8 time_offset_length;
+ guint32 time_offset_value;
+};
+
+/**
+ * GstAV1MetadataOBU:
+ * @metadata_type: type of metadata
+ * @itut_t35: ITUT T35 metadata
+ * @hdrcll: high dynamic range content light level metadata
+ * @hdrcmdcv: high dynamic range mastering display color volume metadata_type
+ * @scalability: Scalability metadata
+ * @timecode: Timecode metadata
+ */
+struct _GstAV1MetadataOBU {
+ GstAV1MetadataType metadata_type;
+ union {
+ GstAV1MetadataITUT_T35 itut_t35;
+ GstAV1MetadataHdrCll hdr_cll;
+ GstAV1MetadataHdrMdcv hdr_mdcv;
+ GstAV1MetadataScalability scalability;
+ GstAV1MetadataTimecode timecode;
+ };
+};
+
+/**
+ * GstAV1LoopFilterParams:
+ * @loop_filter_level: is an array containing loop filter strength values. Different loop
+ * filter strength values from the array are used depending on the image plane being
+ * filtered, and the edge direction (vertical or horizontal) being filtered.
+ * @loop_filter_sharpness: indicates the sharpness level. The @loop_filter_level and
+ * @loop_filter_sharpness together determine when a block edge is filtered, and by how much
+ * the filtering can change the sample values. The loop filter process is described in AV1
+ * Bitstream Spec. section 7.14.
+ * @loop_filter_delta_enabled: equal to 1 means that the filter level depends on the mode and
+ * reference frame used to predict a block. @loop_filter_delta_enabled equal to 0 means that
+ * the filter level does not depend on the mode and reference frame.
+ * @loop_filter_delta_update: equal to 1 means that the bitstream contains additional syntax
+ * elements that specify which mode and reference frame deltas are to be updated.
+ * @loop_filter_delta_update equal to 0 means that these syntax elements are not present.
+ * @loop_filter_ref_deltas: contains the adjustment needed for the filter level based on
+ * the chosen reference frame. If this syntax element is not present in the bitstream,
+ * it maintains its previous value.
+ * @loop_filter_mode_deltas: contains the adjustment needed for the filter level based on
+ * the chosen mode. If this syntax element is not present in the bitstream, it maintains
+ * its previous value.
+ * @delta_lf_present: specifies whether loop filter delta values are present in the bitstream.
+ * @delta_lf_res: specifies the left shift which should be applied to decoded loop filter
+ * delta values.
+ * @delta_lf_multi: equal to 1 specifies that separate loop filter deltas are sent for
+ * horizontal luma edges, vertical luma edges, the U edges, and the V edges. @delta_lf_multi
+ * equal to 0 specifies that the same loop filter delta is used for all edges.
+ */
+struct _GstAV1LoopFilterParams {
+ guint8 loop_filter_level[4];
+ guint8 loop_filter_sharpness;
+ gboolean loop_filter_delta_enabled;
+ gboolean loop_filter_delta_update;
+
+ gint8 loop_filter_ref_deltas[GST_AV1_TOTAL_REFS_PER_FRAME];
+ gint8 loop_filter_mode_deltas[2];
+
+ gboolean delta_lf_present;
+ guint8 delta_lf_res;
+ guint8 delta_lf_multi;
+};
+
+/**
+ * GstAV1QuantizationParams:
+ * @base_q_idx: indicates the base frame qindex. This is used for Y AC coefficients and as
+ * the base value for the other quantizers.
+ * @diff_uv_delta: equal to 1 indicates that the U and V delta quantizer values are coded
+ * separately. @diff_uv_delta equal to 0 indicates that the U and V delta quantizer values
+ * share a common value.
+ * @using_qmatrix: specifies that the quantizer matrix will be used to compute quantizers.
+ * @qm_y: specifies the level in the quantizer matrix that should be used for luma plane decoding.
+ * @qm_u: specifies the level in the quantizer matrix that should be used for chroma U plane decoding.
+ * @qm_v: specifies the level in the quantizer matrix that should be used for chroma V plane decoding.
+ * @delta_q_present: specifies whether quantizer index delta values are present in the bitstream.
+ * @delta_q_res: specifies the left shift which should be applied to decoded quantizer index
+ * delta values.
+ * @delta_q_y_dc: indicates the Y DC quantizer relative to base_q_idx.
+ * @delta_q_u_dc: indicates the U DC quantizer relative to base_q_idx.
+ * @delta_q_u_ac: indicates the U AC quantizer relative to base_q_idx.
+ * @delta_q_v_dc: indicates the V DC quantizer relative to base_q_idx.
+ * @delta_q_v_ac: indicates the V AC quantizer relative to base_q_idx.
+ */
+struct _GstAV1QuantizationParams {
+ guint8 base_q_idx;
+ gboolean diff_uv_delta;
+ gboolean using_qmatrix;
+ guint8 qm_y;
+ guint8 qm_u;
+ guint8 qm_v;
+
+ gboolean delta_q_present;
+ guint8 delta_q_res;
+
+ gint8 delta_q_y_dc; /* DeltaQYDc */
+ gint8 delta_q_u_dc; /* DeltaQUDc */
+ gint8 delta_q_u_ac; /* DeltaQUAc */
+ gint8 delta_q_v_dc; /* DeltaQVDc */
+ gint8 delta_q_v_ac; /* DeltaQVAc */
+};
+
+/**
+ * GstAV1SegmenationParams:
+ * @segmentation_enabled: equal to 1 indicates that this frame makes use of the segmentation
+ * tool; @segmentation_enabled equal to 0 indicates that the frame does not use segmentation.
+ * @segmentation_update_map: equal to 1 indicates that the segmentation map are updated during
+ * the decoding of this frame. @segmentation_update_map equal to 0 means that the segmentation
+ * map from the previous frame is used.
+ * @segmentation_temporal_update: equal to 1 indicates that the updates to the segmentation map
+ * are coded relative to the existing segmentation map. @segmentation_temporal_update equal to
+ * 0 indicates that the new segmentation map is coded without reference to the existing
+ * segmentation map.
+ * @segmentation_update_data: equal to 1 indicates that new parameters are about to be
+ * specified for each segment. @segmentation_update_data equal to 0 indicates that the
+ * segmentation parameters should keep their existing values.
+ * @feature_enabled: set to 1 when the feature of segmentation is enabled.
+ * @feature_data: the value of according segmentation feature.
+ * @seg_id_pre_skip: equal to 1 indicates that the segment id will be read before the skip
+ * syntax element. @seg_id_pre_skip equal to 0 indicates that the skip syntax element will be
+ * read first.
+ * @last_active_seg_id: indicates the highest numbered segment id that has some enabled feature.
+ * This is used when decoding the segment id to only decode choices corresponding to used
+ * segments.
+ */
+struct _GstAV1SegmenationParams {
+ gboolean segmentation_enabled;
+ guint8 segmentation_update_map;
+ guint8 segmentation_temporal_update;
+ guint8 segmentation_update_data;
+
+ gint8 feature_enabled[GST_AV1_MAX_SEGMENTS][GST_AV1_SEG_LVL_MAX]; /* FeatureEnabled */
+ gint16 feature_data[GST_AV1_MAX_SEGMENTS][GST_AV1_SEG_LVL_MAX]; /* FeatureData */
+ guint8 seg_id_pre_skip; /* SegIdPreSkip */
+ guint8 last_active_seg_id; /* LastActiveSegId */
+};
+
+/**
+ * GstAV1TileInfo:
+ * @uniform_tile_spacing_flag: equal to 1 means that the tiles are uniformly spaced across the
+ * frame. (In other words, all tiles are the same size except for the ones at the right and
+ * bottom edge which can be smaller.) @uniform_tile_spacing_flag equal to 0 means that the
+ * tile sizes are coded.
+ * @increment_tile_rows_log2: is used to compute @tile_rows_log2.
+ * @width_in_sbs_minus_1: specifies the width of a tile minus 1 in units of superblocks.
+ * @height_in_sbs_minus_1: specifies the height of a tile minus 1 in units of superblocks.
+ * @tile_size_bytes_minus_1: is used to compute @tile_size_bytes
+ * @context_update_tile_id: specifies which tile to use for the CDF update.
+ * @mi_col_starts: is an array specifying the start column (in units of 4x4 luma samples) for
+ * each tile across the image.
+ * @mi_row_starts: is an array specifying the start row (in units of 4x4 luma samples) for
+ * each tile down the image.
+ * @tile_cols_log2: specifies the base 2 logarithm of the desired number of tiles across the frame.
+ * @tile_cols: specifies the number of tiles across the frame. It is a requirement of bitstream
+ * conformance that @tile_cols is less than or equal to GST_AV1_MAX_TILE_COLS.
+ * @tile_rows_log2: specifies the base 2 logarithm of the desired number of tiles down the frame.
+ * @tile_rows: specifies the number of tiles down the frame. It is a requirement of bitstream
+ * conformance that @tile_rows is less than or equal to GST_AV1_MAX_TILE_ROWS.
+ * @tile_size_bytes: specifies the number of bytes needed to code each tile size.
+ */
+struct _GstAV1TileInfo {
+ guint8 uniform_tile_spacing_flag;
+ gint increment_tile_rows_log2;
+ gint width_in_sbs_minus_1[GST_AV1_MAX_TILE_COLS];
+ gint height_in_sbs_minus_1[GST_AV1_MAX_TILE_ROWS];
+ gint tile_size_bytes_minus_1;
+ guint8 context_update_tile_id;
+
+ guint32 mi_col_starts[GST_AV1_MAX_TILE_COLS + 1]; /* MiColStarts */
+ guint32 mi_row_starts[GST_AV1_MAX_TILE_ROWS + 1]; /* MiRowStarts */
+ guint8 tile_cols_log2; /* TileColsLog2 */
+ guint8 tile_cols; /* TileCols */
+ guint8 tile_rows_log2; /* TileRowsLog2 */
+ guint8 tile_rows; /* TileRows */
+ guint8 tile_size_bytes; /* TileSizeBytes */
+};
+
+/**
+ * GstAV1CDEFParams:
+ * @cdef_damping: controls the amount of damping in the deringing filter.
+ * @cdef_bits: specifies the number of bits needed to specify which CDEF filter to apply.
+ * @cdef_y_pri_strength: specify the strength of the primary filter (Y component)
+ * @cdef_uv_pri_strength: specify the strength of the primary filter (UV components).
+ * @cdef_y_sec_strength: specify the strength of the secondary filter (Y component).
+ * @cdef_uv_sec_strength: specify the strength of the secondary filter (UV components).
+ *
+ * Parameters of Constrained Directional Enhancement Filter (CDEF).
+ */
+struct _GstAV1CDEFParams {
+ guint8 cdef_damping;
+ guint8 cdef_bits;
+ guint8 cdef_y_pri_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_y_sec_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_uv_pri_strength[GST_AV1_CDEF_MAX];
+ guint8 cdef_uv_sec_strength[GST_AV1_CDEF_MAX];
+};
+
+/**
+ * GstAV1LoopRestorationParams:
+ * @lr_unit_shift: specifies if the luma restoration size should be halved.
+ * @lr_uv_shift: is only present for 4:2:0 formats and specifies if the chroma size should be
+ * half the luma size.
+ * @frame_restoration_type: specifies the type of restoration used for each plane.
+ * @loop_restoration_size: specifies the size of loop restoration units in units of samples in
+ * the current plane.
+ * @uses_lr: indicates if any plane uses loop restoration.
+ */
+struct _GstAV1LoopRestorationParams {
+ guint8 lr_unit_shift;
+ gboolean lr_uv_shift;
+
+ GstAV1FrameRestorationType frame_restoration_type[GST_AV1_MAX_NUM_PLANES]; /* FrameRestorationType */
+ guint32 loop_restoration_size[GST_AV1_MAX_NUM_PLANES]; /* LoopRestorationSize */
+ guint8 uses_lr; /* UsesLr */
+};
+
+/**
+ * GstAV1GlobalMotionParams:
+ * @is_global: specifies whether global motion parameters are present for a particular
+ * reference frame.
+ * @is_rot_zoom: specifies whether a particular reference frame uses rotation and zoom
+ * global motion.
+ * @is_translation: specifies whether a particular reference frame uses translation
+ * global motion.
+ * @gm_params: is set equal to SavedGmParams[ frame_to_show_map_idx ][ ref ][ j ] for
+ * ref = LAST_FRAME..ALTREF_FRAME, for j = 0..5.
+ * @gm_type: specifying the type of global motion.
+ * @invalid: whether this global motion parameters is invalid. (Since: 1.20)
+ */
+/**
+ * _GstAV1GlobalMotionParams.invalid:
+ *
+ * whether this global motion parameters is invalid.
+ *
+ * Since: 1.20
+ */
+struct _GstAV1GlobalMotionParams {
+ gboolean is_global[GST_AV1_NUM_REF_FRAMES];
+ gboolean is_rot_zoom[GST_AV1_NUM_REF_FRAMES];
+ gboolean is_translation[GST_AV1_NUM_REF_FRAMES];
+ gint32 gm_params[GST_AV1_NUM_REF_FRAMES][6];
+
+ GstAV1WarpModelType gm_type[GST_AV1_NUM_REF_FRAMES]; /* GmType */
+ gboolean invalid[GST_AV1_NUM_REF_FRAMES];
+};
+
+/**
+ * GstAV1FilmGrainParams:
+ * @apply_grain: equal to 1 specifies that film grain should be added to this frame.
+ * apply_grain equal to 0 specifies that film grain should not be added.
+ * @grain_seed: specifies the starting value for the pseudo-random numbers used during film
+ * grain synthesis.
+ * @update_grain: equal to 1 means that a new set of parameters should be sent. @update_grain
+ * equal to 0 means that the previous set of parameters should be used.
+ * @film_grain_params_ref_idx: indicates which reference frame contains the film grain
+ * parameters to be used for this frame.
+ * @num_y_points: specifies the number of points for the piece-wise linear scaling function
+ * of the luma component. It is a requirement of bitstream conformance that @num_y_points is
+ * less than or equal to 14.
+ * @point_y_value: represents the x (luma value) coordinate for the i-th point of the
+ * piecewise linear scaling function for luma component. The values are signaled on the
+ * scale of 0..255. (In case of 10 bit video, these values correspond to luma values divided
+ * by 4. In case of 12 bit video, these values correspond to luma values divided by 16.)
+ * If i is greater than 0, it is a r equirement of bitstream conformance that
+ * @point_y_value[ i ] is greater than @point_y_value[ i - 1 ] (this ensures the x coordinates
+ * are specified in increasing order).
+ * @point_y_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for luma component.
+ * @chroma_scaling_from_luma: specifies that the chroma scaling is inferred from the luma scaling.
+ * @num_cb_points: specifies the number of points for the piece-wise linear scaling function
+ * of the cb component. It is a requirement of bitstream conformance that @num_cb_points is
+ * less than or equal to 10.
+ * @point_cb_value: represents the x coordinate for the i-th point of the piece-wise linear
+ * scaling function for cb component. The values are signaled on the scale of 0..255. If i
+ * is greater than 0, it is a requirement of bitstream conformance that point_cb_value[ i ]
+ * is greater than point_cb_value[ i - 1 ].
+ * @point_cb_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for cb component.
+ * @num_cr_points: specifies represents the number of points for the piece-wise linear scaling
+ * function of the cr component. It is a requirement of bitstream conformance that
+ * num_cr_points is less than or equal to 10. If subsampling_x is equal to 1 and
+ * @subsampling_y is equal to 1 and num_cb_points is equal to 0, it is a requirement of
+ * bitstream conformance that num_cr_points is equal to 0. If @subsampling_x is equal to 1
+ * and @subsampling_y is equal to 1 and @num_cb_points is not equal to 0, it is a requirement
+ * of bitstream conformance that @num_cr_points is not equal to 0.
+ * @point_cr_value: represents the x coordinate for the i-th point of the piece-wise linear
+ * scaling function for cr component. The values are signaled on the scale of 0..255. If i
+ * is greater than 0, it is a requirement of bitstream conformance that @point_cr_value[ i ]
+ * is greater than @point_cr_value[ i - 1 ].
+ * @point_cr_scaling: represents the scaling (output) value for the i-th point of the
+ * piecewise linear scaling function for cr component.
+ * @grain_scaling_minus_8: represents the shift - 8 applied to the values of the chroma
+ * component. The @grain_scaling_minus_8 can take values of 0..3 and determines the range and
+ * quantization step of the standard deviation of film grain.
+ * @ar_coeff_lag: specifies the number of auto-regressive coefficients for luma and chroma.
+ * @ar_coeffs_y_plus_128: specifies auto-regressive coefficients used for the Y plane.
+ * @ar_coeffs_cb_plus_128: specifies auto-regressive coefficients used for the U plane.
+ * @ar_coeffs_cr_plus_128: specifies auto-regressive coefficients used for the V plane.
+ * @ar_coeff_shift_minus_6: specifies the range of the auto-regressive coefficients. Values
+ * of 0, 1, 2, and 3 correspond to the ranges for auto-regressive coefficients of [-2, 2),
+ * [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.
+ * @grain_scale_shift: specifies how much the Gaussian random numbers should be scaled down
+ * during the grain synthesis process.
+ * @cb_mult: represents a multiplier for the cb component used in derivation of the input
+ * index to the cb component scaling function.
+ * @cb_luma_mult: represents a multiplier for the average luma component used in derivation
+ * of the input index to the cb component scaling function.
+ * @cb_offset: represents an offset used in derivation of the input index to the cb component
+ * scaling function.
+ * @cr_mult: represents a multiplier for the cr component used in derivation of the input
+ * index to the cr component scaling function.
+ * @cr_luma_mult: represents a multiplier for the average luma component used in derivation
+ * of the input index to the cr component scaling function.
+ * @cr_offset: represents an offset used in derivation of the input index to the cr component
+ * scaling function.
+ * @overlap_flag: equal to 1 indicates that the overlap between film grain blocks shall be
+ * applied. overlap_flag equal to 0 indicates that the overlap between film grain blocks
+ * shall not be applied.
+ * @clip_to_restricted_range: equal to 1 indicates that clipping to the restricted (studio)
+ * range shall be applied to the sample values after adding the film grain (see the
+ * semantics for color_range for an explanation of studio swing). clip_to_restricted_range
+ * equal to 0 indicates that clipping to the full range shall be applied to the sample
+ * values after adding the film grain.
+ */
+struct _GstAV1FilmGrainParams {
+ gboolean apply_grain;
+ guint16 grain_seed;
+ gboolean update_grain;
+ guint8 film_grain_params_ref_idx;
+ guint8 num_y_points;
+ guint8 point_y_value[GST_AV1_MAX_NUM_Y_POINTS];
+ guint8 point_y_scaling[GST_AV1_MAX_NUM_Y_POINTS];
+ guint8 chroma_scaling_from_luma;
+ guint8 num_cb_points;
+ guint8 point_cb_value[GST_AV1_MAX_NUM_CB_POINTS];
+ guint8 point_cb_scaling[GST_AV1_MAX_NUM_CB_POINTS];
+ guint8 num_cr_points;
+ guint8 point_cr_value[GST_AV1_MAX_NUM_CR_POINTS];
+ guint8 point_cr_scaling[GST_AV1_MAX_NUM_CR_POINTS];
+ guint8 grain_scaling_minus_8;
+ guint8 ar_coeff_lag;
+ guint8 ar_coeffs_y_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeffs_cb_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeffs_cr_plus_128[GST_AV1_MAX_NUM_POS_LUMA];
+ guint8 ar_coeff_shift_minus_6;
+ guint8 grain_scale_shift;
+ guint8 cb_mult;
+ guint8 cb_luma_mult;
+ guint16 cb_offset;
+ guint8 cr_mult;
+ guint8 cr_luma_mult;
+ guint16 cr_offset;
+ gboolean overlap_flag;
+ gboolean clip_to_restricted_range;
+};
+
+/**
+ * GstAV1FrameHeaderOBU:
+ * @show_existing_frame: equal to 1, indicates the frame indexed by @frame_to_show_map_idx is
+ * to be output; @show_existing_frame equal to 0 indicates that further processing is required.
+ * If @obu_type is equal to #GST_AV1_OBU_FRAME, it is a requirement of bitstream conformance that
+ * @show_existing_frame is equal to 0.
+ * @frame_to_show_map_idx: specifies the frame to be output. It is only available if
+ * @show_existing_frame is 1.
+ * @frame_presentation_time: specifies the presentation time of the frame in clock ticks
+ * DispCT counted from the removal time of the last frame with frame_type equal to KEY_FRAME
+ * for the operating point that is being decoded. The syntax element is signaled as a fixed
+ * length unsigned integer with a length in bits given by
+ * @frame_presentation_time_length_minus_1 + 1. The @frame_presentation_time is the remainder
+ * of a modulo 1 << (@frame_presentation_time_length_minus_1 + 1) counter.
+ * @tu_presentation_delay: is a syntax element used by the decoder model. It does not affect
+ * the decoding process.
+ * @display_frame_id: provides the frame id number for the frame to output. It is a requirement
+ * of bitstream conformance that whenever @display_frame_id is read, the value matches
+ * @ref_frame_id[ @frame_to_show_map_idx ] (the value of @current_frame_id at the time that the
+ * frame indexed by @frame_to_show_map_idx was stored), and that
+ * @ref_valid[ @frame_to_show_map_idx ] is equjal to 1. It is a requirement of bitstream
+ * conformance that the number of bits needed to read @display_frame_id does not exceed 16.
+ * This is equivalent to the constraint that idLen <= 16
+ * @frame_type: specifies the type of the frame.
+ * @show_frame: equal to 1 specifies that this frame should be immediately output once decoded.
+ * show_frame equal to 0 specifies that this frame should not be immediately output. (It may
+ * be output later if a later uncompressed header uses @show_existing_frame equal to 1).
+ * @showable_frame: equal to 1 specifies that the frame may be output using the
+ * @show_existing_frame mechanism. showable_frame equal to 0 specifies that this frame will
+ * not be output using the @show_existing_frame mechanism. It is a requirement of bitstream
+ * conformance that when @show_existing_frame is used to show a previous frame, that the
+ * value of @showable_frame for the previous frame was equal to 1. It is a requirement of
+ * bitstream conformance that a particular showable frame is output via the
+ * @show_existing_frame mechanism at most once.
+ * @error_resilient_mode: equal to 1 indicates that error resilient mode is enabled;
+ * @error_resilient_mode equal to 0 indicates that error resilient mode is disabled.
+ * @disable_cdf_update: specifies whether the CDF update in the symbol decoding process should
+ * be disabled.
+ * @allow_screen_content_tools: equal to 1 indicates that intra blocks may use palette encoding;
+ * @allow_screen_content_tools equal to 0 indicates that palette encoding is never used.
+ * @force_integer_mv: equal to 1 specifies that motion vectors will always be integers.
+ * @force_integer_mv equal to 0 specifies that motion vectors can contain fractional bits.
+ * @current_frame_id: specifies the frame id number for the current frame. Frame id numbers
+ * are additional information that do not affect the decoding process, but provide decoders
+ * with a way of detecting missing reference frames so that appropriate action can be taken.
+ * @frame_size_override_flag: equal to 0 specifies that the frame size is equal to the size in
+ * the sequence header. @frame_size_override_flag equal to 1 specifies that the frame size
+ * will either be specified as the size of one of the reference frames, or computed from the
+ * @frame_width_minus_1 and @frame_height_minus_1 syntax elements.
+ * @order_hint: is used to compute order_hint.
+ * @primary_ref_frame: specifies which reference frame contains the CDF values and other state
+ * that should be loaded at the start of the frame.
+ * @buffer_removal_time_present_flag: equal to 1 specifies that @buffer_removal_time is present
+ * in the bitstream. @buffer_removal_time_present_flag equal to 0 specifies that
+ * @buffer_removal_time is not present in the bitstream.
+ * @buffer_removal_time: specifies the frame removal time in units of DecCT clock ticks
+ * counted from the removal time of the last frame with frame_type equal to KEY_FRAME for
+ * operating point opNum. @buffer_removal_time is signaled as a fixed length unsigned integer
+ * with a length in bits given by @buffer_removal_time_length_minus_1 + 1. @buffer_removal_time
+ * is the remainder of a modulo 1 << ( @buffer_removal_time_length_minus_1 + 1 ) counter.
+ * @refresh_frame_flags: contains a bitmask that specifies which reference frame slots will be
+ * updated with the current frame after it is decoded. If @frame_type is equal to
+ * #GST_AV1_INTRA_ONLY_FRAME, it is a requirement of bitstream conformance that
+ * @refresh_frame_flags is not equal to 0xff.
+ * @ref_order_hint: specifies the expected output order hint for each reference buffer.
+ * @allow_intrabc: equal to 1 indicates that intra block copy may be used in this frame.
+ * allow_intrabc equal to 0 indicates that intra block copy is not allowed in this frame.
+ * @frame_refs_short_signaling: equal to 1 indicates that only two reference frames are
+ * explicitly signaled. frame_refs_short_signaling equal to 0 indicates that all reference
+ * frames are explicitly signaled.
+ * @last_frame_idx: specifies the reference frame to use for LAST_FRAME.
+ * @gold_frame_idx: specifies the reference frame to use for GOLDEN_FRAME.
+ * @ref_frame_idx[i]: specifies which reference frames are used by inter frames.
+ * @delta_frame_id_minus_1 is used to calculate @delta_frame_id.
+ * @allow_high_precision_mv: equal to 0 specifies that motion vectors are specified to quarter
+ * pel precision; @allow_high_precision_mv equal to 1 specifies that motion vectors are
+ * specified to eighth pel precision.
+ * @is_motion_mode_switchable: equal to 0 specifies that only the SIMPLE motion mode will be used.
+ * @use_ref_frame_mvs: equal to 1 specifies that motion vector information from a previous
+ * frame can be used when decoding the current frame. @use_ref_frame_mvs equal to 0 specifies
+ * that this information will not be used.
+ * @disable_frame_end_update_cdf: equal to 1 indicates that the end of frame CDF update is
+ * disabled; @disable_frame_end_update_cdf equal to 0 indicates that the end of frame CDF
+ * update is enabled.
+ * @allow_warped_motion: equal to 1 indicates that the syntax element @motion_mode may be
+ * present. @allow_warped_motion equal to 0 indicates that the syntax element motion_mode
+ * will not be present (this means that LOCALWARP cannot be signaled if @allow_warped_motion
+ * is equal to 0).
+ * @reduced_tx_set: equal to 1 specifies that the frame is restricted to a reduced subset of
+ * the full set of transform types.
+ * @render_and_frame_size_different: equal to 0 means that the render width and height are
+ * inferred from the frame width and height. @render_and_frame_size_different equal to 1
+ * means that the render width and height are explicitly coded in the bitstream.
+ * @use_superres: equal to 0 indicates that no upscaling is needed. @use_superres equal to 1
+ * indicates that upscaling is needed.
+ * @is_filter_switchable: equal to 1 indicates that the filter selection is signaled at the
+ * block level; @is_filter_switchable equal to 0 indicates that the filter selection is
+ * signaled at the frame level.
+ * @interpolation_filter: a #GstAV1InterpolationFilter that specifies the filter selection used
+ * for performing inter prediction.
+ * @loop_filter_params: a #GstAV1LoopFilterParams holding the loop filter parameters.
+ * @quantization_params: a #GstAV1QuantizationParams holding the quantization parameters.
+ * @segmentation_params: a #GstAV1SegmenationParams holding the segementation parameters.
+ * @tile_info: a #GstAV1TileInfo holding the tile info.
+ * @cdef_params: a #GstAV1CDEFParams holding the CDEF paramters.
+ * @loop_restoration_params: a #GstAV1LoopRestorationParams holding the loop restoration parameters.
+ * @tx_mode_select: is used to compute TxMode.
+ * @skip_mode_present: equal to 1 specifies that the syntax element @skip_mode will be coded
+ * in the bitstream. @skip_mode_present equal to 0 specifies that @skip_mode will not be used
+ * for this frame.
+ * @reference_select: equal to 1 specifies that the mode info for inter blocks contains the
+ * syntax element comp_mode that indicates whether to use single or compound reference
+ * prediction. Reference_select equal to 0 specifies that all interblocks will use single
+ * prediction.
+ * @global_motion_params: a #GstAV1GlobalMotionParams holding the global motion parameters.
+ * @film_grain_params: a #GstAV1FilmGrainParams holding the Film Grain parameters.
+ * @superres_denom: is the denominator of a fraction that specifies the ratio between the
+ * superblock width before and after upscaling.
+ * @frame_is_intra: if equal to 0 indicating that this frame may use inter prediction.
+ * @order_hints: specifies the expected output order for each reference frame.
+ * @ref_frame_sign_bias: specifies the intended direction of the motion vector in time for
+ * each reference frame.
+ * @coded_lossless: is a variable that is equal to 1 when all segments use lossless encoding.
+ * @all_lossless: is a variable that is equal to 1 when @coded_lossless is equal to 1 and
+ * @frame_width is equal to @upscaled_width. This indicates that the frame is fully lossless
+ * at the upscaled resolution.
+ * @lossless_array: whether the segmentation is lossless.
+ * @seg_qm_Level: the segmentation's qm level.
+ * @upscaled_width: the upscaled width.
+ * @frame_width: the frame width.
+ * @frame_height: the frame height.
+ * @render_width: the frame width to be rendered.
+ * @render_height: the frame height to be rendered.
+ * @tx_mode: specifies how the transform size is determined.
+ * @skip_mode_frame: specifies the frames to use for compound prediction when @skip_mode is 1.
+ */
+struct _GstAV1FrameHeaderOBU {
+ gboolean show_existing_frame;
+ gint8 frame_to_show_map_idx;
+ guint32 frame_presentation_time;
+ guint32 tu_presentation_delay;
+ guint32 display_frame_id;
+ GstAV1FrameType frame_type;
+ gboolean show_frame;
+ gboolean showable_frame;
+ gboolean error_resilient_mode;
+ gboolean disable_cdf_update;
+ guint8 allow_screen_content_tools;
+ gboolean force_integer_mv;
+ guint32 current_frame_id;
+ gboolean frame_size_override_flag;
+ guint32 order_hint;
+ guint8 primary_ref_frame;
+ gboolean buffer_removal_time_present_flag;
+ guint32 buffer_removal_time[GST_AV1_MAX_OPERATING_POINTS];
+ guint8 refresh_frame_flags;
+ guint32 ref_order_hint[GST_AV1_NUM_REF_FRAMES];
+ gboolean allow_intrabc;
+ gboolean frame_refs_short_signaling;
+ gint8 last_frame_idx;
+ gint8 gold_frame_idx;
+ gint8 ref_frame_idx[GST_AV1_REFS_PER_FRAME];
+ gboolean allow_high_precision_mv;
+ gboolean is_motion_mode_switchable;
+ gboolean use_ref_frame_mvs;
+ gboolean disable_frame_end_update_cdf;
+ gboolean allow_warped_motion;
+ gboolean reduced_tx_set;
+ gboolean render_and_frame_size_different;
+ gboolean use_superres;
+ gboolean is_filter_switchable;
+ GstAV1InterpolationFilter interpolation_filter;
+ GstAV1LoopFilterParams loop_filter_params;
+ GstAV1QuantizationParams quantization_params;
+ GstAV1SegmenationParams segmentation_params;
+ GstAV1TileInfo tile_info;
+ GstAV1CDEFParams cdef_params;
+ GstAV1LoopRestorationParams loop_restoration_params;
+ gboolean tx_mode_select;
+ gboolean skip_mode_present;
+ gboolean reference_select;
+ GstAV1GlobalMotionParams global_motion_params;
+ GstAV1FilmGrainParams film_grain_params;
+
+ /* Global vars set by frame header */
+ guint32 superres_denom; /* SuperresDenom */
+ guint8 frame_is_intra; /* FrameIsIntra */
+ guint32 order_hints[GST_AV1_NUM_REF_FRAMES]; /* OrderHints */
+ guint32 ref_frame_sign_bias[GST_AV1_NUM_REF_FRAMES]; /* RefFrameSignBias */
+
+ guint8 coded_lossless; /* CodedLossless */
+ guint8 all_lossless; /* AllLossless */
+ guint8 lossless_array[GST_AV1_MAX_SEGMENTS]; /* LosslessArray */
+ guint8 seg_qm_Level[3][GST_AV1_MAX_SEGMENTS]; /* SegQMLevel */
+
+ guint32 upscaled_width; /* UpscaledWidth */
+ guint32 frame_width; /* FrameWidth */
+ guint32 frame_height; /* FrameHeight */
+ guint32 render_width; /* RenderWidth */
+ guint32 render_height; /* RenderHeight */
+
+ GstAV1TXModes tx_mode; /* TxMode */
+
+ guint8 skip_mode_frame[2]; /* SkipModeFrame */
+};
+
+/**
+ * GstAV1ReferenceFrameInfo:
+ *
+ * All the info related to a reference frames.
+ */
+struct _GstAV1ReferenceFrameInfo {
+ struct {
+ gboolean ref_valid; /* RefValid */
+ guint32 ref_frame_id; /* RefFrameId */
+ guint32 ref_upscaled_width; /* RefUpscaledWidth */
+ guint32 ref_frame_width; /* RefFrameWidth */
+ guint32 ref_frame_height; /* RefFrameHeight */
+ guint32 ref_render_width; /* RefRenderWidth */
+ guint32 ref_render_height; /* RefRenderHeight */
+ guint32 ref_mi_cols; /* RefMiCols */
+ guint32 ref_mi_rows; /* RefMiRows */
+ GstAV1FrameType ref_frame_type; /* RefFrameType */
+ guint8 ref_subsampling_x; /* RefSubsamplingX */
+ guint8 ref_subsampling_y; /* RefSubsamplingY */
+ guint8 ref_bit_depth; /* RefBitDepth */
+ guint32 ref_order_hint; /* RefOrderHint */
+ GstAV1SegmenationParams ref_segmentation_params;
+ GstAV1GlobalMotionParams ref_global_motion_params;
+ GstAV1LoopFilterParams ref_lf_params;
+ GstAV1FilmGrainParams ref_film_grain_params;
+ GstAV1TileInfo ref_tile_info;
+ } entry[GST_AV1_NUM_REF_FRAMES];
+};
+
+/**
+ * GstAV1TileListOBU:
+ * @output_frame_width_in_tiles_minus_1: plus one is the width of the output frame, in tile units.
+ * @output_frame_height_in_tiles_minus_1: plus one is the height of the output frame, in tile units.
+ * @tile_count_minus_1: plus one is the number of @tile_list_entry in the list. It is a requirement
+ * of bitstream conformance that @tile_count_minus_1 is less than or equal to 511.
+ * @anchor_frame_idx: is the index into an array AnchorFrames of the frames that the tile uses
+ * for prediction. The AnchorFrames array is provided by external means and may change for
+ * each tile list OBU. The process for creating the AnchorFrames array is outside of the
+ * scope of this specification. It is a requirement of bitstream conformance that
+ * @anchor_frame_idx is less than or equal to 127.
+ * @anchor_tile_row: the row coordinate of the tile in the frame that it belongs, in tile
+ * units. It is a requirement of bitstream conformance that @anchor_tile_row is less than @tile_rows.
+ * @anchor_tile_col: is the column coordinate of the tile in the frame that it belongs, in tile
+ * units. It is a requirement of bitstream conformance that @anchor_tile_col is less than @tile_cols.
+ * @tile_data_size_minus_1: plus one is the size of the coded tile data, @coded_tile_data, in bytes.
+ * @coded_tile_data: are the @tile_data_size_minus_1 + 1 bytes of the coded tile.
+ */
+struct _GstAV1TileListOBU {
+ guint8 output_frame_width_in_tiles_minus_1;
+ guint8 output_frame_height_in_tiles_minus_1;
+ guint16 tile_count_minus_1;
+ struct {
+ gint8 anchor_frame_idx;
+ guint8 anchor_tile_row;
+ guint8 anchor_tile_col;
+ guint16 tile_data_size_minus_1;
+ /* Just refer to obu's data, invalid after OBU data released */
+ guint8 *coded_tile_data;
+ } entry[GST_AV1_MAX_TILE_COUNT];
+};
+
+/**
+ * GstAV1TileListOBU:
+ * @tile_start_and_end_present_flag: specifies whether @tg_start and @tg_end are present
+ * in the bitstream. If @tg_start and @tg_end are not present in the bitstream, this
+ * tile group covers the entire frame. If @obu_type is equal to #GST_AV1_OBU_FRAME, it is a
+ * requirement of bitstream conformance that the value of @tile_start_and_end_present_flag
+ * is equal to 0.
+ * @tg_start: specifies the zero-based index of the first tile in the current tile group.
+ * It is a requirement of bitstream conformance that the value of @tg_start is equal to
+ * the value of TileNum at the point that tile_group_obu is invoked.
+ * @tg_end: specifies the zero-based index of the last tile in the current tile group.
+ * It is a requirement of bitstream conformance that the value of tg_end is greater
+ * than or equal to tg_start. It is a requirement of bitstream conformance that the
+ * value of tg_end for the last tile group in each frame is equal to num_tiles-1.
+ * @tile_offset: Offset from the OBU data, the real data start of this tile.
+ * @tg_size: Data size of this tile.
+ * @tile_row: Tile index in row.
+ * @tile_col: Tile index in column.
+ * @mi_row_start: start position in mi rows
+ * @mi_row_end: end position in mi rows
+ * @mi_col_start: start position in mi cols
+ * @mi_col_end: end position in mi cols
+ * @num_tiles: specifies the total number of tiles in the frame.
+ */
+struct _GstAV1TileGroupOBU {
+ gboolean tile_start_and_end_present_flag;
+ guint8 tg_start;
+ guint8 tg_end;
+ struct {
+ guint32 tile_offset; /* Tile data offset from the OBU data. */
+ guint32 tile_size; /* Data size of this tile */
+ guint32 tile_row; /* tileRow */
+ guint32 tile_col; /* tileCol */
+ /* global varialbes */
+ guint32 mi_row_start; /* MiRowStart */
+ guint32 mi_row_end; /* MiRowEnd */
+ guint32 mi_col_start; /* MiColStart */
+ guint32 mi_col_end; /* MiColEnd */
+ } entry[GST_AV1_MAX_TILE_COUNT];
+
+ guint32 num_tiles; /* NumTiles */
+};
+
+/**
+ * GstAV1FrameOBU:
+ * @frame_header: a #GstAV1FrameHeaderOBU holding frame_header data.
+ * @tile_group: a #GstAV1TileGroupOBU holding tile_group data.
+ */
+struct _GstAV1FrameOBU {
+ GstAV1TileGroupOBU tile_group;
+ GstAV1FrameHeaderOBU frame_header;
+};
+
+/**
+ * GstAV1Parser:
+ *
+ * #GstAV1Parser opaque structure
+ *
+ * Instantiante it with gst_av1_parser_new() and destroy it with
+ * gst_av1_parser_free()
+ */
+struct _GstAV1Parser
+{
+ /*< private >*/
+ struct
+ {
+ guint32 operating_point; /* Set by choose_operating_point() */
+ guint8 seen_frame_header; /* SeenFrameHeader */
+ guint32 operating_point_idc; /* OperatingPointIdc */
+ gboolean sequence_changed; /* Received a new sequence */
+ gboolean begin_first_frame; /* already find the first frame */
+
+ /* frame */
+ guint32 upscaled_width; /* UpscaledWidth */
+ guint32 frame_width; /* FrameWidth */
+ guint32 frame_height; /* FrameHeight */
+ guint32 mi_cols; /* MiCols */
+ guint32 mi_rows; /* MiRows */
+ guint32 render_width; /* RenderWidth */
+ guint32 render_height; /* RenderHeight */
+ guint32 prev_frame_id; /* PrevFrameID */
+ guint32 current_frame_id; /* the current frame ID */
+ GstAV1ReferenceFrameInfo ref_info; /* RefInfo */
+
+ guint32 mi_col_starts[GST_AV1_MAX_TILE_COLS + 1]; /* MiColStarts */
+ guint32 mi_row_starts[GST_AV1_MAX_TILE_ROWS + 1]; /* MiRowStarts */
+ guint8 tile_cols_log2; /* TileColsLog2 */
+ guint8 tile_cols; /* TileCols */
+ guint8 tile_rows_log2; /* TileRowsLog2 */
+ guint8 tile_rows; /* TileRows */
+ guint8 tile_size_bytes; /* TileSizeBytes */
+ } state;
+
+ gboolean annex_b;
+ guint32 temporal_unit_size;
+ /* consumed of this temporal unit */
+ guint32 temporal_unit_consumed;
+ guint32 frame_unit_size;
+ /* consumed of this frame unit */
+ guint32 frame_unit_consumed;
+
+ GstAV1SequenceHeaderOBU *seq_header;
+};
+
+GST_CODEC_PARSERS_API
+void
+gst_av1_parser_reset (GstAV1Parser * parser, gboolean annex_b);
+
+GST_CODEC_PARSERS_API
+void
+gst_av1_parser_reset_annex_b (GstAV1Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
+ guint32 size, GstAV1OBU * obu, guint32 * consumed);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_sequence_header_obu (GstAV1Parser * parser,
+ GstAV1OBU * obu, GstAV1SequenceHeaderOBU * seq_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_temporal_delimiter_obu (GstAV1Parser * parser,
+ GstAV1OBU * obu);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_metadata_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1MetadataOBU * metadata);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_tile_list_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1TileListOBU * tile_list);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_tile_group_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1TileGroupOBU * tile_group);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_frame_header_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_parse_frame_obu (GstAV1Parser * parser, GstAV1OBU * obu,
+ GstAV1FrameOBU * frame);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_reference_frame_loading (GstAV1Parser * parser,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_reference_frame_update (GstAV1Parser * parser,
+ GstAV1FrameHeaderOBU * frame_header);
+
+GST_CODEC_PARSERS_API
+GstAV1ParserResult
+gst_av1_parser_set_operating_point (GstAV1Parser * parser,
+ gint32 operating_point);
+
+GST_CODEC_PARSERS_API
+GstAV1Parser * gst_av1_parser_new (void);
+
+GST_CODEC_PARSERS_API
+void gst_av1_parser_free (GstAV1Parser * parser);
+
+G_END_DECLS
+
+#endif /* __GST_AV1_PARSER_H__ */
diff --git a/include/gst/codecparsers/gsth264parser.h b/include/gst/codecparsers/gsth264parser.h
new file mode 100644
index 0000000000..d2f9542320
--- /dev/null
+++ b/include/gst/codecparsers/gsth264parser.h
@@ -0,0 +1,1336 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * Some bits C-c,C-v'ed and s/4/3 from h264parse and videoparsers/h264parse.c:
+ * Copyright (C) <2010> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
+ * Copyright (C) <2010> Collabora Multimedia
+ * Copyright (C) <2010> Nokia Corporation
+ *
+ * (C) 2005 Michal Benes <michal.benes@itonis.tv>
+ * (C) 2008 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_H264_PARSER_H__
+#define __GST_H264_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The H.264 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_H264_MAX_SPS_COUNT 32
+#define GST_H264_MAX_PPS_COUNT 256
+#define GST_H264_MAX_VIEW_COUNT 1024
+#define GST_H264_MAX_VIEW_ID (GST_H264_MAX_VIEW_COUNT - 1)
+
+#define GST_H264_IS_P_SLICE(slice) (((slice)->type % 5) == GST_H264_P_SLICE)
+#define GST_H264_IS_B_SLICE(slice) (((slice)->type % 5) == GST_H264_B_SLICE)
+#define GST_H264_IS_I_SLICE(slice) (((slice)->type % 5) == GST_H264_I_SLICE)
+#define GST_H264_IS_SP_SLICE(slice) (((slice)->type % 5) == GST_H264_SP_SLICE)
+#define GST_H264_IS_SI_SLICE(slice) (((slice)->type % 5) == GST_H264_SI_SLICE)
+
+/**
+ * GST_H264_IS_SVC_NALU:
+ * @nalu: a #GstH264NalUnit
+ *
+ * Check if @nalu is a scalable extension NAL unit.
+ *
+ * Since: 1.6
+ */
+#define GST_H264_IS_SVC_NALU(nalu) \
+ ((nalu)->extension_type == GST_H264_NAL_EXTENSION_SVC)
+
+/**
+ * GST_H264_IS_MVC_NALU:
+ * @nalu: a #GstH264NalUnit
+ *
+ * Check if @nalu is a multiview extension NAL unit.
+ *
+ * Since: 1.6
+ */
+#define GST_H264_IS_MVC_NALU(nalu) \
+ ((nalu)->extension_type == GST_H264_NAL_EXTENSION_MVC)
+
+/**
+ * GstH264Profile:
+ * @GST_H264_PROFILE_BASELINE: Baseline profile (A.2.1)
+ * @GST_H264_PROFILE_MAIN: Main profile (A.2.2)
+ * @GST_H264_PROFILE_EXTENDED: Extended profile (A.2.3)
+ * @GST_H264_PROFILE_HIGH: High profile (A.2.4),
+ * or Progressive High profile (A.2.4.1), or Constrained High profile (A.2.4.2)
+ * depending on constraint_set4_flag and constraint_set5_flag
+ * @GST_H264_PROFILE_HIGH10: High 10 profile (A.2.5) or High 10 Intra
+ * profile (A.2.8), or Progressive High 10 profile (A.2.5.1) depending on
+ * constraint_set3_flag and constraint_set4_flag
+ * @GST_H264_PROFILE_HIGH_422: High 4:2:2 profile (A.2.6) or High
+ * 4:2:2 Intra profile (A.2.9), depending on constraint_set3_flag
+ * @GST_H264_PROFILE_HIGH_444: High 4:4:4 Predictive profile (A.2.7)
+ * or High 4:4:4 Intra profile (A.2.10), depending on the value of
+ * constraint_set3_flag
+ * @GST_H264_PROFILE_MULTIVIEW_HIGH: Multiview High profile (H.10.1.1)
+ * @GST_H264_PROFILE_STEREO_HIGH: Stereo High profile (H.10.1.2)
+ * @GST_H264_PROFILE_SCALABLE_BASELINE: Scalable Baseline profile (G.10.1.1)
+ * @GST_H264_PROFILE_SCALABLE_HIGH: Scalable High profile (G.10.1.2)
+ * or Scalable High Intra profile (G.10.1.3), depending on the value
+ * of constraint_set3_flag
+ *
+ * H.264 Profiles.
+ *
+ * Since: 1.2
+ */
+typedef enum {
+ GST_H264_PROFILE_BASELINE = 66,
+ GST_H264_PROFILE_MAIN = 77,
+ GST_H264_PROFILE_EXTENDED = 88,
+ GST_H264_PROFILE_HIGH = 100,
+ GST_H264_PROFILE_HIGH10 = 110,
+ GST_H264_PROFILE_HIGH_422 = 122,
+ GST_H264_PROFILE_HIGH_444 = 244,
+ GST_H264_PROFILE_MULTIVIEW_HIGH = 118,
+ GST_H264_PROFILE_STEREO_HIGH = 128,
+ GST_H264_PROFILE_SCALABLE_BASELINE = 83,
+ GST_H264_PROFILE_SCALABLE_HIGH = 86
+} GstH264Profile;
+
+/**
+ * GstH264NalUnitType:
+ * @GST_H264_NAL_UNKNOWN: Unknown nal type
+ * @GST_H264_NAL_SLICE: Slice nal
+ * @GST_H264_NAL_SLICE_DPA: DPA slice nal
+ * @GST_H264_NAL_SLICE_DPB: DPB slice nal
+ * @GST_H264_NAL_SLICE_DPC: DPC slice nal
+ * @GST_H264_NAL_SLICE_IDR: DPR slice nal
+ * @GST_H264_NAL_SEI: Supplemental enhancement information (SEI) nal unit
+ * @GST_H264_NAL_SPS: Sequence parameter set (SPS) nal unit
+ * @GST_H264_NAL_PPS: Picture parameter set (PPS) nal unit
+ * @GST_H264_NAL_AU_DELIMITER: Access unit (AU) delimiter nal unit
+ * @GST_H264_NAL_SEQ_END: End of sequence nal unit
+ * @GST_H264_NAL_STREAM_END: End of stream nal unit
+ * @GST_H264_NAL_FILLER_DATA: Filler data nal lunit
+ * @GST_H264_NAL_SPS_EXT: Sequence parameter set (SPS) extension NAL unit
+ * @GST_H264_NAL_PREFIX_UNIT: Prefix NAL unit
+ * @GST_H264_NAL_SUBSET_SPS: Subset sequence parameter set (SSPS) NAL unit
+ * @GST_H264_NAL_DEPTH_SPS: Depth parameter set (DPS) NAL unit
+ * @GST_H264_NAL_SLICE_AUX: Auxiliary coded picture without partitioning NAL unit
+ * @GST_H264_NAL_SLICE_EXT: Coded slice extension NAL unit
+ * @GST_H264_NAL_SLICE_DEPTH: Coded slice extension for depth or 3D-AVC texture view
+ *
+ * Indicates the type of H264 Nal Units
+ */
+typedef enum
+{
+ GST_H264_NAL_UNKNOWN = 0,
+ GST_H264_NAL_SLICE = 1,
+ GST_H264_NAL_SLICE_DPA = 2,
+ GST_H264_NAL_SLICE_DPB = 3,
+ GST_H264_NAL_SLICE_DPC = 4,
+ GST_H264_NAL_SLICE_IDR = 5,
+ GST_H264_NAL_SEI = 6,
+ GST_H264_NAL_SPS = 7,
+ GST_H264_NAL_PPS = 8,
+ GST_H264_NAL_AU_DELIMITER = 9,
+ GST_H264_NAL_SEQ_END = 10,
+ GST_H264_NAL_STREAM_END = 11,
+ GST_H264_NAL_FILLER_DATA = 12,
+ GST_H264_NAL_SPS_EXT = 13,
+ GST_H264_NAL_PREFIX_UNIT = 14,
+ GST_H264_NAL_SUBSET_SPS = 15,
+ GST_H264_NAL_DEPTH_SPS = 16,
+ GST_H264_NAL_SLICE_AUX = 19,
+ GST_H264_NAL_SLICE_EXT = 20,
+ GST_H264_NAL_SLICE_DEPTH = 21
+} GstH264NalUnitType;
+
+/**
+ * GstH264NalUnitExtensionType:
+ * @GST_H264_NAL_EXTENSION_NONE: No NAL unit header extension is available
+ * @GST_H264_NAL_EXTENSION_SVC: NAL unit header extension for SVC (Annex G)
+ * @GST_H264_NAL_EXTENSION_MVC: NAL unit header extension for MVC (Annex H)
+ *
+ * Indicates the type of H.264 NAL unit extension.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+ GST_H264_NAL_EXTENSION_NONE = 0,
+ GST_H264_NAL_EXTENSION_SVC,
+ GST_H264_NAL_EXTENSION_MVC,
+} GstH264NalUnitExtensionType;
+
+/**
+ * GstH264ParserResult:
+ * @GST_H264_PARSER_OK: The parsing succeeded
+ * @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
+ * @GST_H264_PARSER_ERROR: An error occurred when parsing
+ * @GST_H264_PARSER_NO_NAL: No NAL unit found during the parsing
+ * @GST_H264_PARSER_NO_NAL_END: Start of the NAL unit found, but not the end.
+ * This will be returned if no start/sync marker for the next NAL unit was
+ * found. In this case the parser will assume that the end of the data is
+ * also the end of the NAL unit. Whether this assumption is correct or not
+ * depends on the context, which only the caller can know, which is why a
+ * special result value is returned in this case. If the data is NAL-aligned
+ * then #GST_H264_PARSER_NO_NAL_END can be treated just like
+ * #GST_H264_PARSER_OK. If the data is not guaranteed to be NAL-aligned,
+ * then the caller probably wants to collect more data until there's another
+ * sync marker or the end of the stream has been reached.
+ *
+ * The result of parsing H264 data.
+ */
+typedef enum
+{
+ GST_H264_PARSER_OK,
+ GST_H264_PARSER_BROKEN_DATA,
+ GST_H264_PARSER_BROKEN_LINK,
+ GST_H264_PARSER_ERROR,
+ GST_H264_PARSER_NO_NAL,
+ GST_H264_PARSER_NO_NAL_END
+} GstH264ParserResult;
+
+/**
+ * GstH264FramePackingType:
+ * @GST_H264_FRAME_PACKING_NONE: A complete 2D frame without any frame packing
+ * @GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING: Checkerboard
+ * based interleaving
+ * @GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING: Column based interleaving
+ * @GST_H264_FRAME_PACKING_ROW_INTERLEAVING: Row based interleaving
+ * @GST_H264_FRAME_PACKING_SIDE_BY_SIDE: Side-by-side packing
+ * @GST_H264_FRMAE_PACKING_TOP_BOTTOM: Top-Bottom packing
+ * @GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING: Temporal interleaving
+ *
+ * Frame packing arrangement types.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+ GST_H264_FRAME_PACKING_NONE = 6,
+ GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING = 0,
+ GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING = 1,
+ GST_H264_FRAME_PACKING_ROW_INTERLEAVING = 2,
+ GST_H264_FRAME_PACKING_SIDE_BY_SIDE = 3,
+ GST_H264_FRMAE_PACKING_TOP_BOTTOM = 4,
+ GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING = 5
+} GstH264FramePackingType;
+
+/**
+ * GstH264SEIPayloadType:
+ * @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
+ * @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
+ * @GST_H264_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
+ * @GST_H264_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.2.7)
+ * @GST_H264_SEI_STEREO_VIDEO_INFO: stereo video info SEI message (Since: 1.6)
+ * @GST_H264_SEI_FRAME_PACKING: Frame Packing Arrangement (FPA) message that
+ * contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
+ * @GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.29) (Since: 1.18)
+ * @GST_H264_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.31) (Since: 1.18)
+ * @GST_H264_SEI_UNHANDLED_PAYLOAD: Unhandled SEI message. This may or may not
+ * be defined by spec (Since 1.18)
+ * ...
+ *
+ * The type of SEI message.
+ */
+typedef enum
+{
+ GST_H264_SEI_BUF_PERIOD = 0,
+ GST_H264_SEI_PIC_TIMING = 1,
+ GST_H264_SEI_REGISTERED_USER_DATA = 4,
+ GST_H264_SEI_RECOVERY_POINT = 6,
+ GST_H264_SEI_STEREO_VIDEO_INFO = 21,
+ GST_H264_SEI_FRAME_PACKING = 45,
+ GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
+ GST_H264_SEI_CONTENT_LIGHT_LEVEL = 144,
+ /* and more... */
+
+ /* Unhandled SEI type */
+ GST_H264_SEI_UNHANDLED_PAYLOAD = -1
+} GstH264SEIPayloadType;
+
+/**
+ * GstH264SEIPicStructType:
+ * @GST_H264_SEI_PIC_STRUCT_FRAME: Picture is a frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD: Bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
+ * @GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
+ * @GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
+ * be displayed two times consecutively
+ * @GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
+ * displayed three times consecutively
+ *
+ * SEI pic_struct type
+ */
+typedef enum
+{
+ GST_H264_SEI_PIC_STRUCT_FRAME = 0,
+ GST_H264_SEI_PIC_STRUCT_TOP_FIELD = 1,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
+ GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
+ GST_H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
+ GST_H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
+ GST_H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
+ GST_H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
+} GstH264SEIPicStructType;
+
+/**
+ * GstH264SliceType:
+ *
+ * Type of Picture slice
+ */
+
+typedef enum
+{
+ GST_H264_P_SLICE = 0,
+ GST_H264_B_SLICE = 1,
+ GST_H264_I_SLICE = 2,
+ GST_H264_SP_SLICE = 3,
+ GST_H264_SI_SLICE = 4,
+ GST_H264_S_P_SLICE = 5,
+ GST_H264_S_B_SLICE = 6,
+ GST_H264_S_I_SLICE = 7,
+ GST_H264_S_SP_SLICE = 8,
+ GST_H264_S_SI_SLICE = 9
+} GstH264SliceType;
+
+/**
+ * GstH264CtType
+ *
+ * Mapping of ct_type to source picture scan
+ *
+ * Since: 1.16
+ */
+
+typedef enum
+{
+ GST_H264_CT_TYPE_PROGRESSIVE = 0,
+ GST_H264_CT_TYPE_INTERLACED = 1,
+ GST_H264_CT_TYPE_UNKNOWN = 2,
+} GstCtType;
+
+typedef struct _GstH264NalParser GstH264NalParser;
+
+typedef struct _GstH264NalUnit GstH264NalUnit;
+typedef struct _GstH264NalUnitExtensionMVC GstH264NalUnitExtensionMVC;
+
+typedef struct _GstH264SPSExtMVCView GstH264SPSExtMVCView;
+typedef struct _GstH264SPSExtMVCLevelValue GstH264SPSExtMVCLevelValue;
+typedef struct _GstH264SPSExtMVCLevelValueOp GstH264SPSExtMVCLevelValueOp;
+typedef struct _GstH264SPSExtMVC GstH264SPSExtMVC;
+
+typedef struct _GstH264SPS GstH264SPS;
+typedef struct _GstH264PPS GstH264PPS;
+typedef struct _GstH264HRDParams GstH264HRDParams;
+typedef struct _GstH264VUIParams GstH264VUIParams;
+
+typedef struct _GstH264RefPicListModification GstH264RefPicListModification;
+typedef struct _GstH264DecRefPicMarking GstH264DecRefPicMarking;
+typedef struct _GstH264RefPicMarking GstH264RefPicMarking;
+typedef struct _GstH264PredWeightTable GstH264PredWeightTable;
+typedef struct _GstH264SliceHdr GstH264SliceHdr;
+
+typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
+typedef struct _GstH264PicTiming GstH264PicTiming;
+typedef struct _GstH264RegisteredUserData GstH264RegisteredUserData;
+typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
+typedef struct _GstH264RecoveryPoint GstH264RecoveryPoint;
+typedef struct _GstH264StereoVideoInfo GstH264StereoVideoInfo;
+typedef struct _GstH264FramePacking GstH264FramePacking;
+typedef struct _GstH264MasteringDisplayColourVolume GstH264MasteringDisplayColourVolume;
+typedef struct _GstH264ContentLightLevel GstH264ContentLightLevel;
+typedef struct _GstH264SEIUnhandledPayload GstH264SEIUnhandledPayload;
+typedef struct _GstH264SEIMessage GstH264SEIMessage;
+
+/**
+ * GstH264NalUnitExtensionMVC:
+ * @non_idr_flag: If equal to 0, it specifies that the current access
+ * unit is an IDR access unit
+ * @priority_id: The priority identifier for the NAL unit
+ * @view_id: The view identifier for the NAL unit
+ * @temporal_id: The temporal identifier for the NAL unit
+ * @anchor_pic_flag: If equal to 1, it specifies that the current
+ * access unit is an anchor access unit
+ * @inter_view_flag: If equal to 0, it specifies that the current view
+ * component is not used for inter-view prediction by any other view
+ * component in the current access unit
+ *
+ * Since: 1.6
+ */
+struct _GstH264NalUnitExtensionMVC
+{
+ guint8 non_idr_flag;
+ guint8 priority_id;
+ guint16 view_id;
+ guint8 temporal_id;
+ guint8 anchor_pic_flag;
+ guint8 inter_view_flag;
+};
+
+/**
+ * GstH264NalUnit:
+ * @ref_idc: not equal to 0 specifies that the content of the NAL unit
+ * contains a sequence parameter set, a sequence parameter set
+ * extension, a subset sequence parameter set, a picture parameter
+ * set, a slice of a reference picture, a slice data partition of a
+ * reference picture, or a prefix NAL unit preceding a slice of a
+ * reference picture.
+ * @type: A #GstH264NalUnitType
+ * @idr_pic_flag: calculated idr_pic_flag
+ * @size: The size of the NAL unit starting from @offset, thus
+ * including the header bytes. e.g. @type (nal_unit_type),
+ * but not the start code.
+ * @offset: The offset of the first byte of the NAL unit header,
+ * just after the start code.
+ * @sc_offset: The offset of the first byte of the start code of
+ * the NAL unit.
+ * @valid: If the NAL unit is valid, which means it has
+ * already been parsed
+ * @data: The data array from which the NAL unit has been parsed,
+ * into which the offset and sc_offset apply.
+ * @header_bytes: The size of the NALU header in bytes. The NALU
+ * header is the 1-byte type code, and for extension / prefix NALs
+ * includes the extension header bytes. @offset + @header_bytes is
+ * therefore the first byte of the actual packet payload.
+ * (Since: 1.6)
+ * @extension_type: the extension type for prefix NAL/MVC/SVC
+ * (Since: 1.6)
+ *
+ * Structure defining the NAL unit headers
+ */
+struct _GstH264NalUnit
+{
+ guint16 ref_idc;
+ guint16 type;
+
+ /* calculated values */
+ guint8 idr_pic_flag;
+ guint size;
+ guint offset;
+ guint sc_offset;
+ gboolean valid;
+
+ guint8 *data;
+
+ guint8 header_bytes;
+ guint8 extension_type;
+ union {
+ GstH264NalUnitExtensionMVC mvc;
+ } extension;
+};
+
+/**
+ * GstH264HRDParams:
+ * @cpb_cnt_minus1: plus 1 specifies the number of alternative
+ * CPB specifications in the bitstream
+ * @bit_rate_scale: specifies the maximum input bit rate of the
+ * SchedSelIdx-th CPB
+ * @cpb_size_scale: specifies the CPB size of the SchedSelIdx-th CPB
+ * @guint32 bit_rate_value_minus1: specifies the maximum input bit rate for the
+ * SchedSelIdx-th CPB
+ * @cpb_size_value_minus1: is used together with cpb_size_scale to specify the
+ * SchedSelIdx-th CPB size
+ * @cbr_flag: Specifies if running in constant or intermittent bit rate mode
+ * @initial_cpb_removal_delay_length_minus1: specifies the length in bits of
+ * the cpb_removal_delay syntax element
+ * @cpb_removal_delay_length_minus1: specifies the length in bits of the
+ * dpb_output_delay syntax element
+ * @dpb_output_delay_length_minus1: >0 specifies the length in bits of the time_offset syntax element.
+ * =0 specifies that the time_offset syntax element is not present
+ * @time_offset_length: Length of the time offset
+ *
+ * Defines the HRD parameters
+ */
+struct _GstH264HRDParams
+{
+ guint8 cpb_cnt_minus1;
+ guint8 bit_rate_scale;
+ guint8 cpb_size_scale;
+
+ guint32 bit_rate_value_minus1[32];
+ guint32 cpb_size_value_minus1[32];
+ guint8 cbr_flag[32];
+
+ guint8 initial_cpb_removal_delay_length_minus1;
+ guint8 cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+ guint8 time_offset_length;
+};
+
+/**
+ * GstH264VUIParams:
+ * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
+ * %FALSE specifies that aspect_ratio_idc is not present
+ * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
+ * @sar_width indicates the horizontal size of the sample aspect ratio
+ * @sar_height indicates the vertical size of the sample aspect ratio
+ * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
+ * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
+ * output are suitable for display using overscan. %FALSE the cropped decoded pictures
+ * output contain visually important information
+ * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
+ * colour_description_present_flag are present.
+ * @video_format: indicates the representation of the picture
+ * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
+ * @colour_description_present_flag: %TRUE specifies that colour_primaries,
+ * transfer_characteristics and matrix_coefficients are present
+ * @colour_primaries: indicates the chromaticity coordinates of the source primaries
+ * @transfer_characteristics: indicates the opto-electronic transfer characteristic
+ * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
+ * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
+ * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
+ * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
+ * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
+ * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
+ * time_scale and fixed_frame_rate_flag are present in the bitstream
+ * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
+ * time_scale: is the number of time units that pass in one second
+ * @fixed_frame_rate_flag: %TRUE indicates that the temporal distance between the HRD output times
+ * of any two consecutive pictures in output order is constrained as specified in the spec, %FALSE
+ * otherwise.
+ * @nal_hrd_parameters_present_flag: %TRUE if NAL HRD parameters exist in the bitstream
+ * @vcl_hrd_parameters_present_flag: %TRUE if VCL HRD parameters exist in the bitstream
+ * @low_delay_hrd_flag: specifies the HRD operational mode
+ * @pic_struct_present_flag: %TRUE specifies that picture timing SEI messages are present or not
+ * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
+ * parameters are present
+ * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
+ * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
+ * samples outside picture boundaries may be used in inter prediction
+ * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
+ * the VCL NAL units associated with any coded picture in the coded video sequence.
+ * @max_bits_per_mb_denom: indicates the maximum number of coded bits of macroblock_layer
+ * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
+ * motion vector component
+ * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
+ * motion vector component
+ * @num_reorder_frames: indicates the maximum number of frames, complementary field pairs,
+ * or non-paired fields that precede any frame,
+ * @max_dec_frame_buffering: specifies the required size of the HRD decoded picture buffer in
+ * units of frame buffers.
+ *
+ * The structure representing the VUI parameters.
+ */
+struct _GstH264VUIParams
+{
+ guint8 aspect_ratio_info_present_flag;
+ guint8 aspect_ratio_idc;
+ /* if aspect_ratio_idc == 255 */
+ guint16 sar_width;
+ guint16 sar_height;
+
+ guint8 overscan_info_present_flag;
+ /* if overscan_info_present_flag */
+ guint8 overscan_appropriate_flag;
+
+ guint8 video_signal_type_present_flag;
+ guint8 video_format;
+ guint8 video_full_range_flag;
+ guint8 colour_description_present_flag;
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint8 chroma_loc_info_present_flag;
+ guint8 chroma_sample_loc_type_top_field;
+ guint8 chroma_sample_loc_type_bottom_field;
+
+ guint8 timing_info_present_flag;
+ /* if timing_info_present_flag */
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 fixed_frame_rate_flag;
+
+ guint8 nal_hrd_parameters_present_flag;
+ /* if nal_hrd_parameters_present_flag */
+ GstH264HRDParams nal_hrd_parameters;
+
+ guint8 vcl_hrd_parameters_present_flag;
+ /* if vcl_hrd_parameters_present_flag */
+ GstH264HRDParams vcl_hrd_parameters;
+
+ guint8 low_delay_hrd_flag;
+ guint8 pic_struct_present_flag;
+
+ guint8 bitstream_restriction_flag;
+ /* if bitstream_restriction_flag */
+ guint8 motion_vectors_over_pic_boundaries_flag;
+ guint32 max_bytes_per_pic_denom;
+ guint32 max_bits_per_mb_denom;
+ guint32 log2_max_mv_length_horizontal;
+ guint32 log2_max_mv_length_vertical;
+ guint32 num_reorder_frames;
+ guint32 max_dec_frame_buffering;
+
+ /* calculated values */
+ guint par_n;
+ guint par_d;
+};
+
+/**
+ * GstH264SPSExtMVCView:
+ * @num_anchor_refs_l0: specifies the number of view components for
+ * inter-view prediction in the initialized RefPicList0 in decoding
+ * anchor view components.
+ * @anchor_ref_l0: specifies the view_id for inter-view prediction in
+ * the initialized RefPicList0 in decoding anchor view components.
+ * @num_anchor_refs_l1: specifies the number of view components for
+ * inter-view prediction in the initialized RefPicList1 in decoding
+ * anchor view components.
+ * @anchor_ref_l1: specifies the view_id for inter-view prediction in
+ * the initialized RefPicList1 in decoding anchor view components.
+ * @num_non_anchor_refs_l0: specifies the number of view components
+ * for inter-view prediction in the initialized RefPicList0 in
+ * decoding non-anchor view components.
+ * @non_anchor_ref_l0: specifies the view_id for inter-view prediction
+ * in the initialized RefPicList0 in decoding non-anchor view
+ * components.
+ * @num_non_anchor_refs_l1: specifies the number of view components
+ * for inter-view prediction in the initialized RefPicList1 in
+ * decoding non-anchor view components.
+ * @non_anchor_ref_l1: specifies the view_id for inter-view prediction
+ * in the initialized RefPicList1 in decoding non-anchor view
+ * components.
+ *
+ * Represents inter-view dependency relationships for the coded video
+ * sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCView
+{
+ guint16 view_id;
+ guint8 num_anchor_refs_l0;
+ guint16 anchor_ref_l0[15];
+ guint8 num_anchor_refs_l1;
+ guint16 anchor_ref_l1[15];
+ guint8 num_non_anchor_refs_l0;
+ guint16 non_anchor_ref_l0[15];
+ guint8 num_non_anchor_refs_l1;
+ guint16 non_anchor_ref_l1[15];
+};
+
+/**
+ * GstH264SPSExtMVCLevelValueOp:
+ *
+ * Represents an operation point for the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValueOp
+{
+ guint8 temporal_id;
+ guint16 num_target_views_minus1;
+ guint16 *target_view_id;
+ guint16 num_views_minus1;
+};
+
+/**
+ * GstH264SPSExtMVCLevelValue:
+ * @level_idc: specifies the level value signalled for the coded video
+ * sequence
+ * @num_applicable_ops_minus1: plus 1 specifies the number of
+ * operation points to which the level indicated by level_idc applies
+ * @applicable_op: specifies the applicable operation point
+ *
+ * Represents level values for a subset of the operation points for
+ * the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValue
+{
+ guint8 level_idc;
+ guint16 num_applicable_ops_minus1;
+ GstH264SPSExtMVCLevelValueOp *applicable_op;
+};
+
+/**
+ * GstH264SPSExtMVC:
+ * @num_views_minus1: plus 1 specifies the maximum number of coded
+ * views in the coded video sequence
+ * @view: array of #GstH264SPSExtMVCView
+ * @num_level_values_signalled_minus1: plus 1 specifies the number of
+ * level values signalled for the coded video sequence.
+ * @level_value: array of #GstH264SPSExtMVCLevelValue
+ *
+ * Represents the parsed `seq_parameter_set_mvc_extension()`.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVC
+{
+ guint16 num_views_minus1;
+ GstH264SPSExtMVCView *view;
+ guint8 num_level_values_signalled_minus1;
+ GstH264SPSExtMVCLevelValue *level_value;
+};
+
+/**
+ * GstH264SPS:
+ * @id: The ID of the sequence parameter set
+ * @profile_idc: indicate the profile to which the coded video sequence conforms
+ *
+ * H264 Sequence Parameter Set (SPS)
+ */
+struct _GstH264SPS
+{
+ gint id;
+
+ guint8 profile_idc;
+ guint8 constraint_set0_flag;
+ guint8 constraint_set1_flag;
+ guint8 constraint_set2_flag;
+ guint8 constraint_set3_flag;
+ guint8 constraint_set4_flag;
+ guint8 constraint_set5_flag;
+ guint8 level_idc;
+
+ guint8 chroma_format_idc;
+ guint8 separate_colour_plane_flag;
+ guint8 bit_depth_luma_minus8;
+ guint8 bit_depth_chroma_minus8;
+ guint8 qpprime_y_zero_transform_bypass_flag;
+
+ guint8 scaling_matrix_present_flag;
+ guint8 scaling_lists_4x4[6][16];
+ guint8 scaling_lists_8x8[6][64];
+
+ guint8 log2_max_frame_num_minus4;
+ guint8 pic_order_cnt_type;
+
+ /* if pic_order_cnt_type == 0 */
+ guint8 log2_max_pic_order_cnt_lsb_minus4;
+
+ /* else if pic_order_cnt_type == 1 */
+ guint8 delta_pic_order_always_zero_flag;
+ gint32 offset_for_non_ref_pic;
+ gint32 offset_for_top_to_bottom_field;
+ guint8 num_ref_frames_in_pic_order_cnt_cycle;
+ gint32 offset_for_ref_frame[255];
+
+ /* FIXME rename according to spec, max_num_ref_frames */
+ guint32 num_ref_frames;
+ guint8 gaps_in_frame_num_value_allowed_flag;
+ guint32 pic_width_in_mbs_minus1;
+ guint32 pic_height_in_map_units_minus1;
+ guint8 frame_mbs_only_flag;
+
+ guint8 mb_adaptive_frame_field_flag;
+
+ guint8 direct_8x8_inference_flag;
+
+ guint8 frame_cropping_flag;
+
+ /* if frame_cropping_flag */
+ guint32 frame_crop_left_offset;
+ guint32 frame_crop_right_offset;
+ guint32 frame_crop_top_offset;
+ guint32 frame_crop_bottom_offset;
+
+ guint8 vui_parameters_present_flag;
+ /* if vui_parameters_present_flag */
+ GstH264VUIParams vui_parameters;
+
+ /* calculated values */
+ guint8 chroma_array_type;
+ guint32 max_frame_num;
+ gint width, height;
+ gint crop_rect_width, crop_rect_height;
+ gint crop_rect_x, crop_rect_y;
+ gint fps_num_removed, fps_den_removed; /* FIXME: remove */
+ gboolean valid;
+
+ /* Subset SPS extensions */
+ guint8 extension_type;
+ union {
+ GstH264SPSExtMVC mvc;
+ } extension;
+};
+
+/**
+ * GstH264PPS:
+ *
+ * H264 Picture Parameter Set
+ */
+struct _GstH264PPS
+{
+ gint id;
+
+ GstH264SPS *sequence;
+
+ guint8 entropy_coding_mode_flag;
+ guint8 pic_order_present_flag;
+
+ guint32 num_slice_groups_minus1;
+
+ /* if num_slice_groups_minus1 > 0 */
+ guint8 slice_group_map_type;
+ /* and if slice_group_map_type == 0 */
+ guint32 run_length_minus1[8];
+ /* or if slice_group_map_type == 2 */
+ guint32 top_left[8];
+ guint32 bottom_right[8];
+ /* or if slice_group_map_type == (3, 4, 5) */
+ guint8 slice_group_change_direction_flag;
+ guint32 slice_group_change_rate_minus1;
+ /* or if slice_group_map_type == 6 */
+ guint32 pic_size_in_map_units_minus1;
+ guint8 *slice_group_id;
+
+ /* FIXME rename to num_ref_idx_l{0,1}_default_active_minus1 */
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+ guint8 weighted_pred_flag;
+ guint8 weighted_bipred_idc;
+ gint8 pic_init_qp_minus26;
+ gint8 pic_init_qs_minus26;
+ gint8 chroma_qp_index_offset;
+ guint8 deblocking_filter_control_present_flag;
+ guint8 constrained_intra_pred_flag;
+ guint8 redundant_pic_cnt_present_flag;
+
+ guint8 transform_8x8_mode_flag;
+
+ guint8 scaling_lists_4x4[6][16];
+ guint8 scaling_lists_8x8[6][64];
+
+ guint8 second_chroma_qp_index_offset;
+
+ gboolean valid;
+
+ /* Since: 1.18 */
+ guint8 pic_scaling_matrix_present_flag;
+};
+
+struct _GstH264RefPicListModification
+{
+ guint8 modification_of_pic_nums_idc;
+ union
+ {
+ /* if modification_of_pic_nums_idc == 0 || 1 */
+ guint32 abs_diff_pic_num_minus1;
+ /* if modification_of_pic_nums_idc == 2 */
+ guint32 long_term_pic_num;
+ /* if modification_of_pic_nums_idc == 4 || 5 */
+ guint32 abs_diff_view_idx_minus1;
+ } value;
+};
+
+struct _GstH264PredWeightTable
+{
+ guint8 luma_log2_weight_denom;
+ guint8 chroma_log2_weight_denom;
+
+ gint16 luma_weight_l0[32];
+ gint8 luma_offset_l0[32];
+
+ /* if seq->ChromaArrayType != 0 */
+ gint16 chroma_weight_l0[32][2];
+ gint8 chroma_offset_l0[32][2];
+
+ /* if slice->slice_type % 5 == 1 */
+ gint16 luma_weight_l1[32];
+ gint8 luma_offset_l1[32];
+
+ /* and if seq->ChromaArrayType != 0 */
+ gint16 chroma_weight_l1[32][2];
+ gint8 chroma_offset_l1[32][2];
+};
+
+struct _GstH264RefPicMarking
+{
+ guint8 memory_management_control_operation;
+
+ guint32 difference_of_pic_nums_minus1;
+ guint32 long_term_pic_num;
+ guint32 long_term_frame_idx;
+ guint32 max_long_term_frame_idx_plus1;
+};
+
+struct _GstH264DecRefPicMarking
+{
+ /* if slice->nal_unit.IdrPicFlag */
+ guint8 no_output_of_prior_pics_flag;
+ guint8 long_term_reference_flag;
+
+ guint8 adaptive_ref_pic_marking_mode_flag;
+ GstH264RefPicMarking ref_pic_marking[10];
+ guint8 n_ref_pic_marking;
+
+ /* Size of the dec_ref_pic_marking() syntax element in bits (Since: 1.18) */
+ guint bit_size;
+};
+
+
+struct _GstH264SliceHdr
+{
+ guint32 first_mb_in_slice;
+ guint32 type;
+ GstH264PPS *pps;
+
+ /* if seq->separate_colour_plane_flag */
+ guint8 colour_plane_id;
+
+ guint16 frame_num;
+
+ guint8 field_pic_flag;
+ guint8 bottom_field_flag;
+
+ /* if nal_unit.type == 5 */
+ guint16 idr_pic_id;
+
+ /* if seq->pic_order_cnt_type == 0 */
+ guint16 pic_order_cnt_lsb;
+ /* if seq->pic_order_present_flag && !field_pic_flag */
+ gint32 delta_pic_order_cnt_bottom;
+
+ gint32 delta_pic_order_cnt[2];
+ guint8 redundant_pic_cnt;
+
+ /* if slice_type == B_SLICE */
+ guint8 direct_spatial_mv_pred_flag;
+
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+
+ guint8 ref_pic_list_modification_flag_l0;
+ guint8 n_ref_pic_list_modification_l0;
+ GstH264RefPicListModification ref_pic_list_modification_l0[32];
+ guint8 ref_pic_list_modification_flag_l1;
+ guint8 n_ref_pic_list_modification_l1;
+ GstH264RefPicListModification ref_pic_list_modification_l1[32];
+
+ GstH264PredWeightTable pred_weight_table;
+ /* if nal_unit.ref_idc != 0 */
+ GstH264DecRefPicMarking dec_ref_pic_marking;
+
+ guint8 cabac_init_idc;
+ gint8 slice_qp_delta;
+ gint8 slice_qs_delta;
+
+ guint8 disable_deblocking_filter_idc;
+ gint8 slice_alpha_c0_offset_div2;
+ gint8 slice_beta_offset_div2;
+
+ guint16 slice_group_change_cycle;
+
+ /* calculated values */
+ guint32 max_pic_num;
+ gboolean valid;
+
+ /* Size of the slice_header() in bits */
+ guint header_size;
+
+ /* Number of emulation prevention bytes (EPB) in this slice_header() */
+ guint n_emulation_prevention_bytes;
+
+ /* Since: 1.18 */
+ guint8 num_ref_idx_active_override_flag;
+ guint8 sp_for_switch_flag;
+
+ /*
+ * Size of the pic_order_cnt related syntax elements pic_order_cnt_lsb,
+ * delta_pic_order_cnt_bottom, delta_pic_order_cnt[0], and
+ * delta_pic_order_cnt[1]. (Since: 1.18)
+ */
+ guint pic_order_cnt_bit_size;
+};
+
+/**
+ * GstH264ClockTimestamp:
+ * @ct_type: indicates the scan type, 0: progressive, 1: interlaced, 2: unknown,
+ * 3: reserved
+ * @nuit_field_based_flag: used in calculating clockTimestamp
+ * @counting_type: specifies the method of dropping values of the n_frames
+ * @full_timestamp_flag: equal to 1 specifies that the n_frames syntax element
+ * is followed by seconds_value, minutes_value, and hours_value (Since 1.18)
+ * @discontinuity_flag: indicates whether the difference between the current
+ * value of clockTimestamp and the value of clockTimestamp computed from the
+ * previous clock timestamp can be interpreted as the time difference or not.
+ * @cnt_dropped_flag: specifies the skipping of one or more values of n_frames
+ * using the counting method specified by counting_type
+ * @n_frames: specifies the value of nFrames used to compute clockTimestamp
+ * @seconds_flag: equal to 1 specifies that @seconds_value and minutes_flag are
+ * present when @full_timestamp_flag is equal to 0
+ * @seconds_value: specifies the value of seconds to compute clockTimestamp
+ * @minutes_flag: equal to 1 specifies that @minutes_value and hours_flag are
+ * present when @full_timestamp_flag is equal to 0 and @seconds_flag is
+ * equal to 1
+ * @minutes_value: specifies the value of minutes to compute clockTimestamp
+ * @hours_flag: equal to 1 specifies that @hours_value is present when
+ * @full_timestamp_flag is equal to 0 and @seconds_flag is equal to 1 and
+ * @minutes_flag is equal to 1
+ * @time_offset: specifies the value of tOffset used to compute clockTimestamp
+ */
+struct _GstH264ClockTimestamp
+{
+ guint8 ct_type;
+ guint8 nuit_field_based_flag;
+ guint8 counting_type;
+ guint8 full_timestamp_flag;
+ guint8 discontinuity_flag;
+ guint8 cnt_dropped_flag;
+ guint8 n_frames;
+
+ guint8 seconds_flag;
+ guint8 seconds_value;
+
+ guint8 minutes_flag;
+ guint8 minutes_value;
+
+ guint8 hours_flag;
+ guint8 hours_value;
+
+ guint32 time_offset;
+};
+
+/**
+ * GstH264FramePacking:
+ *
+ * Since: 1.6
+ */
+struct _GstH264FramePacking
+{
+ guint32 frame_packing_id;
+ guint8 frame_packing_cancel_flag;
+ guint8 frame_packing_type; /* GstH264FramePackingType */
+ guint8 quincunx_sampling_flag;
+ guint8 content_interpretation_type;
+ guint8 spatial_flipping_flag;
+ guint8 frame0_flipped_flag;
+ guint8 field_views_flag;
+ guint8 current_frame_is_frame0_flag;
+ guint8 frame0_self_contained_flag;
+ guint8 frame1_self_contained_flag;
+ guint8 frame0_grid_position_x;
+ guint8 frame0_grid_position_y;
+ guint8 frame1_grid_position_x;
+ guint8 frame1_grid_position_y;
+ guint16 frame_packing_repetition_period;
+};
+
+/**
+ * GstH264StereoVideoInfo:
+ *
+ * Since: 1.6
+ */
+struct _GstH264StereoVideoInfo
+{
+ guint8 field_views_flag;
+ guint8 top_field_is_left_view_flag;
+ guint8 current_frame_is_left_view_flag;
+ guint8 next_frame_is_second_view_flag;
+ guint8 left_view_self_contained_flag;
+ guint8 right_view_self_contained_flag;
+};
+
+/**
+ * GstH264PicTiming:
+ * @CpbDpbDelaysPresentFlag: non-zero if linked
+ * GstH264VUIParams::nal_hrd_parameters_present_flag or
+ * GstH264VUIParams::vcl_hrd_parameters_present_flag is non-zero (Since: 1.18)
+ * @cpb_removal_delay_length_minus1: specifies the length of @cpb_removal_delay
+ * in bits (Since 1.18)
+ * @dpb_output_delay_length_minus1: specifies the length of @dpb_output_delay
+ * in bits (Since 1.18)
+ * @cpb_removal_delay: specifies how many clock ticks to wait after removal from
+ * the CPB of the access unit associated with the most recent buffering period
+ * SEI message in a preceding access unit before removing from the
+ * buffer the access unit data associated with the picture timing SEI message
+ * @dpb_output_delay: used to compute the DPB output time of the picture
+ * @pic_struct_present_flag: GstH264VUIParams::pic_struct_present_flag
+ * @pic_struct: indicates whether a picture should be displayed as a frame or
+ * one or more fields
+ * @clock_timestamp_flag: equal to 1 indicates that a number of clock timestamp
+ * syntax elements are present
+ * @clock_timestamp: a #GstH264ClockTimestamp
+ * @time_offset_length: specifies the length time_offset of
+ * #GstH264ClockTimestamp in bits (Since 1.18)
+ */
+struct _GstH264PicTiming
+{
+ /* from vui */
+ guint8 CpbDpbDelaysPresentFlag;
+ /* if CpbDpbDelaysPresentFlag */
+ guint8 cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+ guint32 cpb_removal_delay;
+ guint32 dpb_output_delay;
+
+ guint8 pic_struct_present_flag;
+ /* if pic_struct_present_flag */
+ guint8 pic_struct;
+
+ guint8 clock_timestamp_flag[3];
+ GstH264ClockTimestamp clock_timestamp[3];
+ guint8 time_offset_length;
+};
+
+/**
+ * GstH264RegisteredUserData:
+ * The User data registered by Rec. ITU-T T.35 SEI messag.
+ * @country_code: an itu_t_t35_country_code.
+ * @country_code_extension: an itu_t_t35_country_code_extension_byte.
+ * Should be ignored when @country_code is not 0xff
+ * @data: the data of itu_t_t35_payload_byte
+ * excluding @country_code and @country_code_extension
+ * @size: the size of @data in bytes
+ *
+ * Since: 1.16
+ */
+struct _GstH264RegisteredUserData
+{
+ guint8 country_code;
+ guint8 country_code_extension;
+ const guint8 *data;
+ guint size;
+};
+
+struct _GstH264BufferingPeriod
+{
+ GstH264SPS *sps;
+
+ /* seq->vui_parameters->nal_hrd_parameters_present_flag */
+ guint32 nal_initial_cpb_removal_delay[32];
+ guint32 nal_initial_cpb_removal_delay_offset[32];
+
+ /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
+ guint32 vcl_initial_cpb_removal_delay[32];
+ guint32 vcl_initial_cpb_removal_delay_offset[32];
+};
+
+struct _GstH264RecoveryPoint
+{
+ guint32 recovery_frame_cnt;
+ guint8 exact_match_flag;
+ guint8 broken_link_flag;
+ guint8 changing_slice_group_idc;
+};
+
+/**
+ * GstH264MasteringDisplayColourVolume:
+ * The colour volume (primaries, white point and luminance range) of display
+ * defined by SMPTE ST 2086.
+ *
+ * D.2.29
+ *
+ * Since: 1.18
+ */
+struct _GstH264MasteringDisplayColourVolume
+{
+ guint16 display_primaries_x[3];
+ guint16 display_primaries_y[3];
+ guint16 white_point_x;
+ guint16 white_point_y;
+ guint32 max_display_mastering_luminance;
+ guint32 min_display_mastering_luminance;
+};
+
+/**
+ * GstH264ContentLightLevel:
+ * The upper bounds for the nominal target brightness light level
+ * as specified in CEA-861.3
+ *
+ * D.2.31
+ *
+ * Since: 1.18
+ */
+struct _GstH264ContentLightLevel
+{
+ guint16 max_content_light_level;
+ guint16 max_pic_average_light_level;
+};
+
+/**
+ * GstH264SEIUnhandledPayload:
+ * @payloadType: Payload type
+ * @data: payload raw data excluding payload type and payload size byte
+ * @size: the size of @data
+ *
+ * Contains unhandled SEI payload data. This SEI may or may not
+ * be defined by spec
+ *
+ * Since: 1.18
+ */
+struct _GstH264SEIUnhandledPayload
+{
+ guint payloadType;
+
+ guint8 *data;
+ guint size;
+};
+
+struct _GstH264SEIMessage
+{
+ GstH264SEIPayloadType payloadType;
+
+ union {
+ GstH264BufferingPeriod buffering_period;
+ GstH264PicTiming pic_timing;
+ GstH264RegisteredUserData registered_user_data;
+ GstH264RecoveryPoint recovery_point;
+ GstH264StereoVideoInfo stereo_video_info;
+ GstH264FramePacking frame_packing;
+ GstH264MasteringDisplayColourVolume mastering_display_colour_volume;
+ GstH264ContentLightLevel content_light_level;
+ GstH264SEIUnhandledPayload unhandled_payload;
+ /* ... could implement more */
+ } payload;
+};
+
+/**
+ * GstH264NalParser:
+ *
+ * H264 NAL Parser (opaque structure).
+ */
+struct _GstH264NalParser
+{
+ /*< private >*/
+ GstH264SPS sps[GST_H264_MAX_SPS_COUNT];
+ GstH264PPS pps[GST_H264_MAX_PPS_COUNT];
+ GstH264SPS *last_sps;
+ GstH264PPS *last_pps;
+};
+
+GST_CODEC_PARSERS_API
+GstH264NalParser *gst_h264_nal_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu (GstH264NalParser *nalparser,
+ const guint8 *data, guint offset,
+ gsize size, GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu_unchecked (GstH264NalParser *nalparser,
+ const guint8 *data, guint offset,
+ gsize size, GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_identify_nalu_avc (GstH264NalParser *nalparser, const guint8 *data,
+ guint offset, gsize size, guint8 nal_length_size,
+ GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_nal (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_slice_hdr (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SliceHdr *slice, gboolean parse_pred_weight_table,
+ gboolean parse_dec_ref_pic_marking);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_subset_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_sps (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_pps (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_parse_sei (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GArray ** messages);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_update_sps (GstH264NalParser *nalparser,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parser_update_pps (GstH264NalParser *nalparser,
+ GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_nal_parser_free (GstH264NalParser *nalparser);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_subset_sps (GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_sps (GstH264NalUnit *nalu,
+ GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+GstH264ParserResult gst_h264_parse_pps (GstH264NalParser *nalparser,
+ GstH264NalUnit *nalu, GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_sps_clear (GstH264SPS *sps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_pps_clear (GstH264PPS *pps);
+
+GST_CODEC_PARSERS_API
+void gst_h264_sei_clear (GstH264SEIMessage *sei);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h264_video_calculate_framerate (const GstH264SPS * sps, guint field_pic_flag,
+ guint pic_struct, gint * fps_num, gint * fps_den);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h264_create_sei_memory (guint8 start_code_prefix_length,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h264_create_sei_memory_avc (guint8 nal_length_size,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h264_parser_insert_sei (GstH264NalParser * nalparser,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h264_parser_insert_sei_avc (GstH264NalParser * nalparser,
+ guint8 nal_length_size,
+ GstBuffer * au,
+ GstMemory * sei);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gsth265parser.h b/include/gst/codecparsers/gsth265parser.h
new file mode 100644
index 0000000000..0d80c19b36
--- /dev/null
+++ b/include/gst/codecparsers/gsth265parser.h
@@ -0,0 +1,1815 @@
+/* Gstreamer H.265 bitstream parser
+ * Copyright (C) 2013 Intel Corporation
+ * Copyright (C) 2013 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ *
+ * Contact: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_H265_PARSER_H__
+#define __GST_H265_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The H.265 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_H265_MAX_SUB_LAYERS 8
+#define GST_H265_MAX_VPS_COUNT 16
+#define GST_H265_MAX_SPS_COUNT 16
+#define GST_H265_MAX_PPS_COUNT 64
+
+#define GST_H265_IS_B_SLICE(slice) ((slice)->type == GST_H265_B_SLICE)
+#define GST_H265_IS_P_SLICE(slice) ((slice)->type == GST_H265_P_SLICE)
+#define GST_H265_IS_I_SLICE(slice) ((slice)->type == GST_H265_I_SLICE)
+
+/**
+ * GST_H265_IS_NAL_TYPE_IDR:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is IDR or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_IDR(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_IDR_W_RADL || (nal_type) == GST_H265_NAL_SLICE_IDR_N_LP)
+
+/**
+ * GST_H265_IS_NAL_TYPE_IRAP:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is IRAP or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_IRAP(nal_type) \
+ ((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= RESERVED_IRAP_NAL_TYPE_MAX)
+
+/**
+ * GST_H265_IS_NAL_TYPE_BLA:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is BLA or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_BLA(nal_type) \
+ ((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= GST_H265_NAL_SLICE_BLA_N_LP)
+
+/**
+ * GST_H265_IS_NAL_TYPE_CRA:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is CRA or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_CRA(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_CRA_NUT)
+
+/**
+ * GST_H265_IS_NAL_TYPE_RADL:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is RADL or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_RADL(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_RADL_N || (nal_type) == GST_H265_NAL_SLICE_RADL_R)
+
+/**
+ * GST_H265_IS_NAL_TYPE_RASL:
+ * @nal_type: a #GstH265NalUnitType
+ *
+ * Check whether @nal_type is RASL or not
+ *
+ * Since: 1.18
+ */
+#define GST_H265_IS_NAL_TYPE_RASL(nal_type) \
+ ((nal_type) == GST_H265_NAL_SLICE_RASL_N || (nal_type) == GST_H265_NAL_SLICE_RASL_R)
+
+/**
+ * GstH265Profile:
+ * @GST_H265_PROFILE_MAIN: Main profile (A.3.2)
+ * @GST_H265_PROFILE_MAIN_10: Main 10 profile (A.3.3)
+ * @GST_H265_PROFILE_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME: Monochrome profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_12: Monochrome 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_16: Monochrome 16-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_12: Main profile 12-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_10: Main 4:2:2 profile 10-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_12: Main 4:2:2 profile 12-bits (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444: Main 4:4:4 profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_10: Main 4:4:4 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_12: Main 4:4:4 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_INTRA: Main Intra profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_10_INTRA: Main Intra 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_12_INTRA: Main Intra 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_10_INTRA: Main Intra 4:2:2 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_422_12_INTRA: Main Intra 4:2:2 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_INTRA: Main Intra 4:4:4 profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_10_INTRA: Main Intra 4:4:4 10-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_12_INTRA: Main Intra 4:4:4 12-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_16_INTRA: Main Intra 4:4:4 16-bits profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_STILL_PICTURE: Main 4:4:4 Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE: Main 4:4:4 16-bits Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_MONOCHROME_10: Monochrome 10-bits profile (A.3.5) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444: High Throughput 4:4:4 profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_10: High Throughput 4:4:4 10-bits profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_14: High Throughput 4:4:4 14-bits profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA: High Throughput 4:4:4 16-bits Intra profile (A.3.6) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN: Screen-Extended Main profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10: Screen-Extended Main 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444: Screen-Extended Main 4:4:4 profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10: Screen-Extended Main 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444: Screen-Extended High Throughput 4:4:4 profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10: Screen-Extended High Throughput 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14: Screen-Extended High Throughput 4:4:4 14-bits profile (A.3.7) (Since: 1.18)
+ * @GST_H265_PROFILE_MULTIVIEW_MAIN: Multiview Main profile (G.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN: Scalable Main profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN_10: Scalable Main 10-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME: Scalable Monochrome profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME_12: Scalable Monochrome 12-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MONOCHROME_16: Scalable Monochrome 16-bits profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_SCALABLE_MAIN_444: Scalable Main 4:4:4 profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_3D_MAIN: 3D Main 4:4:4 profile (I.11.1) (Since: 1.18)
+ *
+ * H.265 Profiles.
+ *
+ */
+typedef enum {
+ GST_H265_PROFILE_INVALID = -1,
+ GST_H265_PROFILE_MAIN = 1,
+ GST_H265_PROFILE_MAIN_10 = 2,
+ GST_H265_PROFILE_MAIN_STILL_PICTURE = 3,
+ GST_H265_PROFILE_MONOCHROME,
+ GST_H265_PROFILE_MONOCHROME_12,
+ GST_H265_PROFILE_MONOCHROME_16,
+ GST_H265_PROFILE_MAIN_12,
+ GST_H265_PROFILE_MAIN_422_10,
+ GST_H265_PROFILE_MAIN_422_12,
+ GST_H265_PROFILE_MAIN_444,
+ GST_H265_PROFILE_MAIN_444_10,
+ GST_H265_PROFILE_MAIN_444_12,
+ GST_H265_PROFILE_MAIN_INTRA,
+ GST_H265_PROFILE_MAIN_10_INTRA,
+ GST_H265_PROFILE_MAIN_12_INTRA,
+ GST_H265_PROFILE_MAIN_422_10_INTRA,
+ GST_H265_PROFILE_MAIN_422_12_INTRA,
+ GST_H265_PROFILE_MAIN_444_INTRA,
+ GST_H265_PROFILE_MAIN_444_10_INTRA,
+ GST_H265_PROFILE_MAIN_444_12_INTRA,
+ GST_H265_PROFILE_MAIN_444_16_INTRA,
+ GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
+ GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
+ GST_H265_PROFILE_MONOCHROME_10,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
+ GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
+ GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
+ GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
+ GST_H265_PROFILE_MULTIVIEW_MAIN,
+ GST_H265_PROFILE_SCALABLE_MAIN,
+ GST_H265_PROFILE_SCALABLE_MAIN_10,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
+ GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
+ GST_H265_PROFILE_SCALABLE_MAIN_444,
+ GST_H265_PROFILE_3D_MAIN,
+
+ /* end of the profiles */
+ GST_H265_PROFILE_MAX
+} GstH265Profile;
+
+/**
+ * GstH265ProfileIDC:
+ * @GST_H265_PROFILE_IDC_MAIN: Main profile (A.3.2)
+ * @GST_H265_PROFILE_IDC_MAIN_10: Main 10 profile (A.3.3)
+ * @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
+ * @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5)
+ * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6)
+ * @GST_H265_PROFILE_IDC_MULTIVIEW_MAIN: Multiview Main profiles (G.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCALABLE_MAIN: Scalable Main and Scalable Main 10 profile (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7)
+ * @GST_H265_PROFILE_IDC_3D_MAIN: 3D Main profile (I.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION: Scalable Format range extensions profiles (H.11.1) (Since: 1.18)
+ * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION: High throughput screen content coding extensions profiles (A.3.8) (Since: 1.18)
+ *
+ * Valid values for the profile_idc field. This is different from
+ * #GstH265Profile as an extension idc can be used to encode a whole variety of
+ * profiles.
+ *
+ */
+typedef enum {
+ GST_H265_PROFILE_IDC_MAIN = 1,
+ GST_H265_PROFILE_IDC_MAIN_10 = 2,
+ GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
+ GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4,
+ GST_H265_PROFILE_IDC_HIGH_THROUGHPUT = 5,
+ GST_H265_PROFILE_IDC_MULTIVIEW_MAIN = 6,
+ GST_H265_PROFILE_IDC_SCALABLE_MAIN = 7,
+ GST_H265_PROFILE_IDC_3D_MAIN = 8,
+ GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING = 9,
+ GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION = 10,
+ GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION = 11,
+} GstH265ProfileIDC;
+
+/**
+ * GstH265NalUnitType:
+ * @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture
+ * @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture
+ * @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture
+ * @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture
+ * @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture
+ * @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture
+ * @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture
+ * @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture
+ * @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture
+ * @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture
+ * @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture
+ * @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture
+ * @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture
+ * @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture
+ * @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit
+ * @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit
+ * @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit
+ * @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit
+ * @GST_H265_NAL_EOS: End of sequence (EOS) nal unit
+ * @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit
+ * @GST_H265_NAL_FD: Filler data (FD) nal lunit
+ * @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit
+ * @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit
+ *
+ * Indicates the type of H265 Nal Units
+ */
+typedef enum
+{
+ GST_H265_NAL_SLICE_TRAIL_N = 0,
+ GST_H265_NAL_SLICE_TRAIL_R = 1,
+ GST_H265_NAL_SLICE_TSA_N = 2,
+ GST_H265_NAL_SLICE_TSA_R = 3,
+ GST_H265_NAL_SLICE_STSA_N = 4,
+ GST_H265_NAL_SLICE_STSA_R = 5,
+ GST_H265_NAL_SLICE_RADL_N = 6,
+ GST_H265_NAL_SLICE_RADL_R = 7,
+ GST_H265_NAL_SLICE_RASL_N = 8,
+ GST_H265_NAL_SLICE_RASL_R = 9,
+ GST_H265_NAL_SLICE_BLA_W_LP = 16,
+ GST_H265_NAL_SLICE_BLA_W_RADL = 17,
+ GST_H265_NAL_SLICE_BLA_N_LP = 18,
+ GST_H265_NAL_SLICE_IDR_W_RADL = 19,
+ GST_H265_NAL_SLICE_IDR_N_LP = 20,
+ GST_H265_NAL_SLICE_CRA_NUT = 21,
+ GST_H265_NAL_VPS = 32,
+ GST_H265_NAL_SPS = 33,
+ GST_H265_NAL_PPS = 34,
+ GST_H265_NAL_AUD = 35,
+ GST_H265_NAL_EOS = 36,
+ GST_H265_NAL_EOB = 37,
+ GST_H265_NAL_FD = 38,
+ GST_H265_NAL_PREFIX_SEI = 39,
+ GST_H265_NAL_SUFFIX_SEI = 40
+} GstH265NalUnitType;
+
+#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10
+#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15
+
+#define RESERVED_IRAP_NAL_TYPE_MIN 22
+#define RESERVED_IRAP_NAL_TYPE_MAX 23
+
+#define RESERVED_NON_IRAP_NAL_TYPE_MIN 24
+#define RESERVED_NON_IRAP_NAL_TYPE_MAX 31
+
+#define RESERVED_NON_VCL_NAL_TYPE_MIN 41
+#define RESERVED_NON_VCL_NAL_TYPE_MAX 47
+
+#define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48
+#define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63
+
+/**
+ * GstH265ParserResult:
+ * @GST_H265_PARSER_OK: The parsing succeeded
+ * @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
+ * @GST_H265_PARSER_ERROR: An error accured when parsing
+ * @GST_H265_PARSER_NO_NAL: No nal found during the parsing
+ * @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end.
+ *
+ * The result of parsing H265 data.
+ */
+typedef enum
+{
+ GST_H265_PARSER_OK,
+ GST_H265_PARSER_BROKEN_DATA,
+ GST_H265_PARSER_BROKEN_LINK,
+ GST_H265_PARSER_ERROR,
+ GST_H265_PARSER_NO_NAL,
+ GST_H265_PARSER_NO_NAL_END
+} GstH265ParserResult;
+
+/**
+ * GstH265SEIPayloadType:
+ * @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message
+ * @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message
+ * @GST_H265_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
+ * @GST_H265_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.3.8)
+ * @GST_H265_SEI_TIME_CODE: Time code SEI message (D.2.27) (Since: 1.16)
+ * @GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.28) (Since: 1.18)
+ * @GST_H265_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.35) (Since: 1.18)
+ * ...
+ *
+ * The type of SEI message.
+ */
+typedef enum
+{
+ GST_H265_SEI_BUF_PERIOD = 0,
+ GST_H265_SEI_PIC_TIMING = 1,
+ GST_H265_SEI_REGISTERED_USER_DATA = 4,
+ GST_H265_SEI_RECOVERY_POINT = 6,
+ GST_H265_SEI_TIME_CODE = 136,
+ GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
+ GST_H265_SEI_CONTENT_LIGHT_LEVEL = 144,
+ /* and more... */
+} GstH265SEIPayloadType;
+
+/**
+ * GstH265SEIPicStructType:
+ * @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
+ * @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
+ * be displayed two times consecutively
+ * @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
+ * displayed three times consecutively
+ * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with
+ * previous bottom field in output order
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with
+ * previous top field in output order
+ * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next
+ * bottom field in output order
+ * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with
+ * next top field in output order
+ *
+ * SEI pic_struct type
+ */
+typedef enum
+{
+ GST_H265_SEI_PIC_STRUCT_FRAME = 0,
+ GST_H265_SEI_PIC_STRUCT_TOP_FIELD = 1,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
+ GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
+ GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
+ GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
+ GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING = 8,
+ GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM = 9,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP = 10,
+ GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM = 11,
+ GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP = 12
+} GstH265SEIPicStructType;
+
+/**
+ * GstH265SliceType:
+ *
+ * Type of Picture slice
+ */
+
+typedef enum
+{
+ GST_H265_B_SLICE = 0,
+ GST_H265_P_SLICE = 1,
+ GST_H265_I_SLICE = 2
+} GstH265SliceType;
+
+typedef enum
+{
+ GST_H265_QUANT_MATIX_4X4 = 0,
+ GST_H265_QUANT_MATIX_8X8 = 1,
+ GST_H265_QUANT_MATIX_16X16 = 2,
+ GST_H265_QUANT_MATIX_32X32 = 3
+} GstH265QuantMatrixSize;
+
+typedef struct _GstH265Parser GstH265Parser;
+
+typedef struct _GstH265NalUnit GstH265NalUnit;
+
+typedef struct _GstH265VPS GstH265VPS;
+typedef struct _GstH265SPS GstH265SPS;
+typedef struct _GstH265PPS GstH265PPS;
+typedef struct _GstH265ProfileTierLevel GstH265ProfileTierLevel;
+typedef struct _GstH265SubLayerHRDParams GstH265SubLayerHRDParams;
+typedef struct _GstH265HRDParams GstH265HRDParams;
+typedef struct _GstH265VUIParams GstH265VUIParams;
+typedef struct _GstH265SPSExtensionParams GstH265SPSExtensionParams;
+typedef struct _GstH265SPSSccExtensionParams GstH265SPSSccExtensionParams;
+typedef struct _GstH265PPSExtensionParams GstH265PPSExtensionParams;
+typedef struct _GstH265PPSSccExtensionParams GstH265PPSSccExtensionParams;
+
+typedef struct _GstH265ScalingList GstH265ScalingList;
+typedef struct _GstH265RefPicListModification GstH265RefPicListModification;
+typedef struct _GstH265PredWeightTable GstH265PredWeightTable;
+typedef struct _GstH265ShortTermRefPicSet GstH265ShortTermRefPicSet;
+typedef struct _GstH265SliceHdr GstH265SliceHdr;
+
+typedef struct _GstH265PicTiming GstH265PicTiming;
+typedef struct _GstH265RegisteredUserData GstH265RegisteredUserData;
+typedef struct _GstH265BufferingPeriod GstH265BufferingPeriod;
+typedef struct _GstH265RecoveryPoint GstH265RecoveryPoint;
+typedef struct _GstH265TimeCode GstH265TimeCode;
+typedef struct _GstH265MasteringDisplayColourVolume GstH265MasteringDisplayColourVolume;
+typedef struct _GstH265ContentLightLevel GstH265ContentLightLevel;
+typedef struct _GstH265SEIMessage GstH265SEIMessage;
+
+/**
+ * GstH265NalUnit:
+ * @type: A #GstH265NalUnitType
+ * @layer_id: A nal unit layer id
+ * @temporal_id_plus1: A nal unit temporal identifier
+ * @size: The size of the nal unit starting from @offset
+ * @offset: The offset of the actual start of the nal unit
+ * @sc_offset:The offset of the start code of the nal unit
+ * @valid: If the nal unit is valid, which mean it has
+ * already been parsed
+ * @data: The data from which the Nalu has been parsed
+ *
+ * Structure defining the Nal unit headers
+ */
+struct _GstH265NalUnit
+{
+ guint8 type;
+ guint8 layer_id;
+ guint8 temporal_id_plus1;
+
+ /* calculated values */
+ guint size;
+ guint offset;
+ guint sc_offset;
+ gboolean valid;
+
+ guint8 *data;
+ guint8 header_bytes;
+};
+
+/**
+ * GstH265ProfileTierLevel:
+ * @profile_space: specifies the context for the interpretation of
+ * general_profile_idc and general_profile_combatibility_flag
+ * @tier_flag: the tier context for the interpretation of general_level_idc
+ * @profile_idc: profile id
+ * @profile_compatibility_flag: compatibility flags
+ * @progressive_source_flag: flag to indicate the type of stream
+ * @interlaced_source_flag: flag to indicate the type of stream
+ * @non_packed_constraint_flag: indicate the presence of frame packing
+ * arrangement sei message
+ * @frame_only_constraint_flag: recognize the field_seq_flag
+ * @max_12bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_10bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_8bit_constraint_flag: used to define profile extensions, see Annex A
+ * @max_422chroma_constraint_flag: used to define profile extensions, see Annex A
+ * @max_420chroma_constraint_flag: used to define profile extensions, see Annex A
+ * @max_monochrome_constraint_flag: used to define profile extensions, see Annex A
+ * @intra_constraint_flag: used to define profile extensions, see Annex A
+ * @one_picture_only_constraint_flag: used to define profile extensions, see Annex A
+ * @lower_bit_rate_constraint_flag: used to define profile extensions, see Annex A
+ * @max_14bit_constraint_flag: used to define profile extensions, see Annex A
+ * @level idc: indicate the level which the CVS confirms
+ * @sub_layer_profile_present_flag: sublayer profile presence ind
+ * @sub_layer_level_present_flag:sublayer level presence indicator.
+ * @sub_layer_profile_space: profile space for sublayers
+ * @sub_layer_tier_flag: tier flags for sublayers.
+ * @sub_layer_profile_idc: conformant profile indicator for sublayers.
+ * @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers
+ * @sub_layer_progressive_source_flag:progressive stream indicator for sublayer
+ * @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer
+ * @sub_layer_non_packed_constraint_flag: indicate the presence of
+ * frame packing arrangement sei message with in sublayers
+ * @sub_layer_frame_only_constraint_flag:recognize the sublayer
+ * specific field_seq_flag
+ * @sub_layer_level_idc:indicate the sublayer specific level
+ *
+ * Define ProfileTierLevel parameters
+ */
+struct _GstH265ProfileTierLevel {
+ guint8 profile_space;
+ guint8 tier_flag;
+ guint8 profile_idc;
+
+ guint8 profile_compatibility_flag[32];
+
+ guint8 progressive_source_flag;
+ guint8 interlaced_source_flag;
+ guint8 non_packed_constraint_flag;
+ guint8 frame_only_constraint_flag;
+
+ guint8 max_12bit_constraint_flag;
+ guint8 max_10bit_constraint_flag;
+ guint8 max_8bit_constraint_flag;
+ guint8 max_422chroma_constraint_flag;
+ guint8 max_420chroma_constraint_flag;
+ guint8 max_monochrome_constraint_flag;
+ guint8 intra_constraint_flag;
+ guint8 one_picture_only_constraint_flag;
+ guint8 lower_bit_rate_constraint_flag;
+ guint8 max_14bit_constraint_flag;
+
+ guint8 level_idc;
+
+ guint8 sub_layer_profile_present_flag[6];
+ guint8 sub_layer_level_present_flag[6];
+
+ guint8 sub_layer_profile_space[6];
+ guint8 sub_layer_tier_flag[6];
+ guint8 sub_layer_profile_idc[6];
+ guint8 sub_layer_profile_compatibility_flag[6][32];
+ guint8 sub_layer_progressive_source_flag[6];
+ guint8 sub_layer_interlaced_source_flag[6];
+ guint8 sub_layer_non_packed_constraint_flag[6];
+ guint8 sub_layer_frame_only_constraint_flag[6];
+ guint8 sub_layer_level_idc[6];
+};
+
+/**
+ * GstH265SubLayerHRDParams:
+ * @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies
+ * the maximum input bitrate when the CPB operates at the access
+ * unit level
+ * @cpb_size_value_minus1: is used together with cpb_size_scale to
+ * specify the CPB size when the CPB operates at the access unit
+ * level
+ * @cpb_size_du_value_minus1: is used together with cpb_size_du_scale
+ * to specify the CPB size when the CPB operates at sub-picture
+ * level
+ * @bit_rate_du_value_minus1: together with bit_rate_scale, it
+ * specifies the maximum input bit rate when the CPB operates at the
+ * sub-picture level
+ * @cbr_flag: indicate whether HSS operates in intermittent bit rate
+ * mode or constant bit rate mode.
+ *
+ * Defines the Sublayer HRD parameters
+ */
+struct _GstH265SubLayerHRDParams
+{
+ guint32 bit_rate_value_minus1[32];
+ guint32 cpb_size_value_minus1[32];
+
+ guint32 cpb_size_du_value_minus1[32];
+ guint32 bit_rate_du_value_minus1[32];
+
+ guint8 cbr_flag[32];
+};
+
+/**
+ * GstH265HRDParams:
+ * @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters
+ * @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters
+ * @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params
+ * @tick_divisor_minus2: is used to specify the clock sub-tick
+ * @du_cpb_removal_delay_increment_length_minus1: specifies the length,
+ * in bits, of the nal_initial_cpb_removal_delay
+ * @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of
+ * the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements.
+ * @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the
+ * dpb_delay_offset and the pic_dpb_output_delay syntax elements
+ * @bit_rate_scale: maximum input bitrate
+ * @cpb_size_scale: CPB size when operates in access unit level
+ * @cpb_size_du_scale: CPB size when operates in sub-picture level
+ * @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
+ * nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset,
+ * vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset.
+ * @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
+ * cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements
+ * @dpb_output_delay_length_minus1: specifies the length, in bits, of the
+ * dpb_delay_offset and the pic_dpb_output_delay syntax elements
+ * @fixed_pic_rate_general_flag: flag to indicate the presence of constraint
+ * on the temporal distance between the HRD output times of consecutive
+ * pictures in output order
+ * @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag
+ * @elemental_duration_in_tc_minus1: temporal distance in clock ticks
+ * @low_delay_hrd_flag: specifies the HRD operational mode
+ * @cpb_cnt_minus1:specifies the number of alternative CPS specifications.
+ * @sublayer_hrd_params: Sublayer HRD parameters.
+ *
+ * Defines the HRD parameters
+ */
+struct _GstH265HRDParams
+{
+ guint8 nal_hrd_parameters_present_flag;
+ guint8 vcl_hrd_parameters_present_flag;
+ guint8 sub_pic_hrd_params_present_flag;
+
+ guint8 tick_divisor_minus2;
+ guint8 du_cpb_removal_delay_increment_length_minus1;
+ guint8 sub_pic_cpb_params_in_pic_timing_sei_flag;
+ guint8 dpb_output_delay_du_length_minus1;
+
+ guint8 bit_rate_scale;
+ guint8 cpb_size_scale;
+ guint8 cpb_size_du_scale;
+
+ guint8 initial_cpb_removal_delay_length_minus1;
+ guint8 au_cpb_removal_delay_length_minus1;
+ guint8 dpb_output_delay_length_minus1;
+
+ guint8 fixed_pic_rate_general_flag [7];
+ guint8 fixed_pic_rate_within_cvs_flag [7];
+ guint16 elemental_duration_in_tc_minus1 [7];
+ guint8 low_delay_hrd_flag [7];
+ guint8 cpb_cnt_minus1[7];
+
+ GstH265SubLayerHRDParams sublayer_hrd_params[7];
+};
+
+/**
+ * GstH265VPS:
+ * @id: vps id
+ * @base_layer_internal_flag and @base_layer_available_flag:
+ * specify availability of base layer
+ * @max_layers_minus1: should be zero, but can be other values in future
+ * @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers
+ * @temporal_id_nesting_flag: specifies whether inter prediction is
+ * additionally restricted
+ * @profile_tier_level: ProfileTierLevel info
+ * @sub_layer_ordering_info_present_flag: indicates the presence of
+ * vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and
+ * vps_max_latency_increase_plus1
+ * @max_dec_pic_buffering_minus1: specifies the maximum required size
+ * of the decoded picture buffer
+ * @max_num_reorder_pics: indicates the maximum allowed number of
+ * pictures that can precede any picture in the CVS in decoding
+ * order
+ * @max_latency_increase_plus1: is used to compute the value of
+ * VpsMaxLatencyPictures
+ * @max_layer_id: specifies the maximum allowed value of nuh_layer_id
+ * @num_layer_sets_minus1: specifies the number of layer sets
+ * @layer_id_included_flag: specifies whether a nuh_layer_id included
+ * in the layer identifier list
+ * @timing_info_present_flag: indicate the presence of
+ * num_units_in_tick, time_scale, poc_proportional_to_timing_flag
+ * and num_hrd_parameters
+ * @num_units_in_tick: number of time units in a tick
+ * @time_scale: number of time units that pass in one second
+ * @poc_proportional_to_timing_flag: indicate whether the picture
+ * order count is proportional to output timin
+ * @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks
+ * corresponding to a difference of picture order count values equal
+ * to 1
+ * @num_hrd_parameters: number of hrd_parameters present
+ * @hrd_layer_set_idx: index to the list of layer hrd params.
+ * @hrd_params: the GstH265HRDParams list
+ *
+ * Defines the VPS parameters
+ */
+struct _GstH265VPS {
+ guint8 id;
+
+ guint8 base_layer_internal_flag;
+ guint8 base_layer_available_flag;
+
+ guint8 max_layers_minus1;
+ guint8 max_sub_layers_minus1;
+ guint8 temporal_id_nesting_flag;
+
+ GstH265ProfileTierLevel profile_tier_level;
+
+ guint8 sub_layer_ordering_info_present_flag;
+ guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
+ guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
+
+ guint8 max_layer_id;
+ guint16 num_layer_sets_minus1;
+
+ guint8 timing_info_present_flag;
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 poc_proportional_to_timing_flag;
+ guint32 num_ticks_poc_diff_one_minus1;
+
+ guint16 num_hrd_parameters;
+
+ /* FIXME: following HRD related info should be an array */
+ guint16 hrd_layer_set_idx;
+ guint8 cprms_present_flag;
+ GstH265HRDParams hrd_params;
+
+ guint8 vps_extension;
+
+ gboolean valid;
+};
+/**
+ * GstH265ShortTermRefPicSet:
+ * @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate
+ * short-term RPS is predicted from another candidate short-term RPS
+ * @delta_idx_minus1: plus 1 specifies the difference between the value of source and
+ * candidate short term RPS.
+ * @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify
+ * the value of the variable deltaRps.
+ * @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify
+ * the value of the variable deltaRps
+ * @NumDeltaPocs: sum of @NumNegativePics and @NumPositivePics.
+ * @NumNegativePics: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
+ * the number of entries in the stRpsIdx-th candidate
+ * short-term RPS that have poc values less than the poc of the current picture.
+ * @NumPositivePics: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
+ * the number of entires in the stRpsIdx-th candidate
+ * short-term RPS that have poc values greater than the poc value of the current picture.
+ * @UsedByCurrPicS0: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * equal to zero specifies that the i-th entry in the stRpsIdx-th
+ * candidate short-term RPS that has poc value less than of the current picture
+ * is not used for reference by the current picture
+ * @UsedByCurrPicS1: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * equal to zero specifies that the i-th entry in the current
+ * candidate short-term RPS that has poc value greater than that of the current picture
+ * is not used for reference by the current picture.
+ * @DeltaPocS0: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * See 7.4.8 Short-term reference picture set semantics
+ * @DeltaPocS1: Derived value depending on inter_ref_pic_set_prediction_flag.
+ * See 7.4.8 Short-term reference picture set semantics
+ * @NumDeltaPocsOfRefRpsIdx: The value of NumDeltaPocs[RefRpsIdx].
+ * If inter_ref_pic_set_prediction_flag is equal to 0,
+ * this value should be ignored (Since: 1.18)
+ *
+ * Defines the #GstH265ShortTermRefPicSet params
+ */
+struct _GstH265ShortTermRefPicSet
+{
+ guint8 inter_ref_pic_set_prediction_flag;
+ guint8 delta_idx_minus1;
+ guint8 delta_rps_sign;
+ guint16 abs_delta_rps_minus1;
+
+ /* calculated values */
+ guint8 NumDeltaPocs;
+ guint8 NumNegativePics;
+ guint8 NumPositivePics;
+ guint8 UsedByCurrPicS0[16];
+ guint8 UsedByCurrPicS1[16];
+ gint32 DeltaPocS0[16];
+ gint32 DeltaPocS1[16];
+ guint8 NumDeltaPocsOfRefRpsIdx;
+};
+
+/**
+ * GstH265VUIParams:
+ * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
+ * %FALSE specifies that aspect_ratio_idc is not present
+ * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
+ * @sar_width indicates the horizontal size of the sample aspect ratio
+ * @sar_height indicates the vertical size of the sample aspect ratio
+ * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
+ * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
+ * output are suitable for display using overscan. %FALSE the cropped decoded pictures
+ * output contain visually important information
+ * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
+ * colour_description_present_flag are present.
+ * @video_format: indicates the representation of the picture
+ * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
+ * @colour_description_present_flag: %TRUE specifies that colour_primaries,
+ * transfer_characteristics and matrix_coefficients are present
+ * @colour_primaries: indicates the chromaticity coordinates of the source primaries
+ * @transfer_characteristics: indicates the opto-electronic transfer characteristic
+ * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
+ * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
+ * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
+ * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
+ * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
+ * @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla
+ * to 1<<(BitDepthchrom-1).
+ * @field_seq_flag: %TRUE indicate field and %FALSE indicate frame
+ * @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every
+ * picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements.
+ * @default_display_window_flag: %TRUE indicate that the default display window parameters present
+ * def_disp_win_left_offset:left offset of display rect
+ * def_disp_win_right_offset: right offset of display rect
+ * def_disp_win_top_offset: top offset of display rect
+ * def_disp_win_bottom_offset: bottom offset of display rect
+ * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
+ * time_scale and fixed_frame_rate_flag are present in the bitstream
+ * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
+ * @time_scale: is the number of time units that pass in one second
+ * @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture
+ * in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output
+ * time of the picture relative to the output time of the first picture in the CVS.
+ * @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a
+ * difference of picture order count values equal to 1
+ * @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream
+ * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
+ * parameters are present
+ * @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value
+ * of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag,
+ * column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present
+ * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
+ * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
+ * samples outside picture boundaries may be used in inter prediction
+ * @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to
+ * the same picture have an identical reference picture list 0, and that all B slices (when present)
+ * that belong to the same picture have an identical reference picture list 1
+ * @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size
+ * of distinct coded spatial segmentation regions in the pictures of the CVS
+ * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
+ * the VCL NAL units associated with any coded picture in the coded video sequence.
+ * @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit
+ * data for any coding block in any picture of the CVS
+ * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
+ * motion vector component
+ * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
+ * motion vector component
+ *
+ * The structure representing the VUI parameters.
+ */
+struct _GstH265VUIParams
+{
+ guint8 aspect_ratio_info_present_flag;
+ guint8 aspect_ratio_idc;
+ /* if aspect_ratio_idc == 255 */
+ guint16 sar_width;
+ guint16 sar_height;
+
+ guint8 overscan_info_present_flag;
+ /* if overscan_info_present_flag */
+ guint8 overscan_appropriate_flag;
+
+ guint8 video_signal_type_present_flag;
+ guint8 video_format;
+ guint8 video_full_range_flag;
+ guint8 colour_description_present_flag;
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint8 chroma_loc_info_present_flag;
+ guint8 chroma_sample_loc_type_top_field;
+ guint8 chroma_sample_loc_type_bottom_field;
+
+ guint8 neutral_chroma_indication_flag;
+ guint8 field_seq_flag;
+ guint8 frame_field_info_present_flag;
+ guint8 default_display_window_flag;
+ guint32 def_disp_win_left_offset;
+ guint32 def_disp_win_right_offset;
+ guint32 def_disp_win_top_offset;
+ guint32 def_disp_win_bottom_offset;
+
+ guint8 timing_info_present_flag;
+ /* if timing_info_present_flag */
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ guint8 poc_proportional_to_timing_flag;
+ /* if poc_proportional_to_timing_flag */
+ guint32 num_ticks_poc_diff_one_minus1;
+ guint8 hrd_parameters_present_flag;
+ /*if hrd_parameters_present_flat */
+ GstH265HRDParams hrd_params;
+
+ guint8 bitstream_restriction_flag;
+ /* if bitstream_restriction_flag */
+ guint8 tiles_fixed_structure_flag;
+ guint8 motion_vectors_over_pic_boundaries_flag;
+ guint8 restricted_ref_pic_lists_flag;
+ guint16 min_spatial_segmentation_idc;
+ guint8 max_bytes_per_pic_denom;
+ guint8 max_bits_per_min_cu_denom;
+ guint8 log2_max_mv_length_horizontal;
+ guint8 log2_max_mv_length_vertical;
+
+ /* calculated values */
+ guint par_n;
+ guint par_d;
+};
+
+/**
+ * GstH265SPSExtensionParams:
+ * @transform_skip_rotation_enabled_flag: %TRUE specifies that a rotation is applied to
+ * the residual data block from intra 4X4 blocks coded using a transform skip operation.
+ * @transform_skip_context_enabled_flag: %TRUE specifies tspecifies that a particular
+ * context is used for the parsing of the sig_coeff_flag for transform blocks with a skipped
+ * transform.
+ * @implicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
+ * for blocks using a transform bypass may be used for intra blocks in the CVS
+ * @explicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
+ * for blocks using a transform bypass may be used for inter blocks in the CVS
+ * @extended_precision_processing_flag: %TRUE specifies that an extended dynamic range is used
+ * for coefficient parsing and inverse transform processing
+ * @intra_smoothing_disabled_flag: %TRUE specifies that the filtering process of neighbouring
+ * samples is unconditionally disabled for intra prediction
+ * @high_precision_offsets_enabled_flag: %TRUE specifies that weighted prediction offset values
+ * are signalled using a bit-depth-dependent precision.
+ * @persistent_rice_adaptation_enabled_flag: %TRUE specifies that the Rice parameter derivation
+ * for the binarization of coeff_abs_level_remaining[] is initialized at the start of each
+ * sub-block using mode dependent statistics accumulated from previous sub-blocks.
+ * @cabac_bypass_alignment_enabled_flag: %TRUE specifies that a context-based adaptive binary
+ * arithmetic coding (CABAC) alignment process is used prior to bypass decoding of the syntax
+ * elements coeff_sign_flag[] and coeff_abs_level_remaining[]
+ *
+ * Defines the GstH265SPSExtensionParams
+ */
+struct _GstH265SPSExtensionParams {
+ guint8 transform_skip_rotation_enabled_flag;
+ guint8 transform_skip_context_enabled_flag;
+ guint8 implicit_rdpcm_enabled_flag;
+ guint8 explicit_rdpcm_enabled_flag;
+ guint8 extended_precision_processing_flag;
+ guint8 intra_smoothing_disabled_flag;
+ guint8 high_precision_offsets_enabled_flag;
+ guint8 persistent_rice_adaptation_enabled_flag;
+ guint8 cabac_bypass_alignment_enabled_flag;
+};
+
+/**
+ * GstH265SPSSccExtensionParams:
+ * @sps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture in the CVS may be
+ * included in a reference picture list of a slice of the picture itself.
+ * @palette_mode_enabled_flag: equal to 1 specifies that the decoding process for palette mode
+ * may be used for intra blocks. Equal to 0 specifies that the decoding process for palette
+ * mode is not applied.
+ * @palette_max_size: specifies the maximum allowed palette size.
+ * @delta_palette_max_predictor_size: specifies the difference between the maximum allowed
+ * palette predictor size and the maximum allowed palette size.
+ * @sps_palette_predictor_initializers_present_flag: equal to 1 specifies that the sequence
+ * palette predictors are initialized using the sps_palette_predictor_initializer specified
+ * in clause 7.3.2.2.3.
+ * @sps_num_palette_predictor_initializer_minus1: plus 1 specifies the number of entries in
+ * the sequence palette predictor initializer.
+ * @sps_palette_predictor_initializer: specifies the value of the comp-th component of the
+ * i-th palette entry in the SPS that is used to initialize the array PredictorPaletteEntries.
+ * @motion_vector_resolution_control_idc: controls the presence and inference of the
+ * use_integer_mv_flag that specifies the resolution of motion vectors for inter prediction.
+ * @intra_boundary_filtering_disabled_flag: equal to 1 specifies that the intra boundary
+ * filtering process is unconditionally disabled for intra prediction.
+ * Defines the _GstH265SPSSccExtensionParams
+ *
+ * Since: 1.18
+ */
+struct _GstH265SPSSccExtensionParams {
+ guint8 sps_curr_pic_ref_enabled_flag;
+ guint8 palette_mode_enabled_flag;
+ guint8 palette_max_size;
+ guint8 delta_palette_max_predictor_size;
+ guint8 sps_palette_predictor_initializers_present_flag;
+ guint8 sps_num_palette_predictor_initializer_minus1;
+ guint32 sps_palette_predictor_initializer[3][128];
+ guint8 motion_vector_resolution_control_idc;
+ guint8 intra_boundary_filtering_disabled_flag;
+};
+
+/**
+ * GstH265PPSExtensionParams:
+ * @log2_max_transform_skip_block_size_minus2: plus 2 specifies the maximum transform block size for which
+ * transform_skip_flag may be present in coded pictures referring to the PPS.
+ * @cross_component_prediction_enabled_flag: equal to 1 specifies that log2_res_scale_abs_plus1 and
+ * res_scale_sign_flag may be present in the transform unit syntax for pictures referring to the PPS.
+ * @chroma_qp_offset_list_enabled_flag: equal to 1 specifies that the cu_chroma_qp_offset_flag may be
+ * present in the transform unit syntax.
+ * @diff_cu_chroma_qp_offset_depth: specifies the difference between the luma coding tree block size and
+ * the minimum luma coding block size of coding units that convey cu_chroma_qp_offset_flag.
+ * @chroma_qp_offset_list_len_minus1: plus 1 specifies the number of cb_qp_offset_list[] and
+ * cr_qp_offset_list[] syntax elements that are present in the PPS.
+ * @cb_qp_offset_list: specify offsets used in the derivation of qp cb.
+ * @cr_qp_offset_list: specify offsets used in the derivation of qp cr.
+ * @log2_sao_offset_scale_luma: the base 2 logarithm of the scaling parameter that is used to scale sample
+ * adaptive offset (SAO) offset values for luma samples.
+ * @log2_sao_offset_scale_chroma: the base 2 logarithm of the scaling parameter that is used to scale SAO
+ * offset values for chroma samples.
+ *
+ * Defines the GstH265SPSExtensionParams
+ */
+struct _GstH265PPSExtensionParams {
+ guint32 log2_max_transform_skip_block_size_minus2;
+ guint8 cross_component_prediction_enabled_flag;
+ guint8 chroma_qp_offset_list_enabled_flag;
+ guint8 diff_cu_chroma_qp_offset_depth;
+ guint8 chroma_qp_offset_list_len_minus1;
+ gint8 cb_qp_offset_list[6];
+ gint8 cr_qp_offset_list[6];
+ guint8 log2_sao_offset_scale_luma;
+ guint8 log2_sao_offset_scale_chroma;
+};
+
+/**
+ * GstH265PPSSccExtensionParams:
+ * @pps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture referring to the PPS may
+ * be included in a reference picture list of a slice of the picture itself.
+ * @residual_adaptive_colour_transform_enabled_flag: equal to 1 specifies that an adaptive
+ * colour transform may be applied to the residual in the decoding process.
+ * @pps_slice_act_qp_offsets_present_flag: equal to 1 specifies that slice_act_y_qp_offset,
+ * slice_act_cb_qp_offset, slice_act_cr_qp_offset are present in the slice header.
+ * @pps_act_y_qp_offset_plus5 @pps_act_cb_qp_offset_plus5 @pps_act_cr_qp_offset_plus3:
+ * are used to determine the offsets that are applied to the quantization parameter values
+ * qp derived in clause 8.6.2 for the luma, Cb and Cr components, respectively, when
+ * tu_residual_act_flag[ xTbY ][ yTbY ] is equal to 1.
+ * @pps_palette_predictor_initializers_present_flag: equal to 1 specifies that the palette
+ * predictor initializers used for the pictures referring to the PPS are derived based on
+ * the palette predictor initializers specified by the PPS.
+ * @pps_num_palette_predictor_initializer: specifies the number of entries in the picture
+ * palette predictor initializer.
+ * @monochrome_palette_flag: equal to 1 specifies that the pictures that refer to this PPS
+ * are monochrome. Equal to 0 specifies that the pictures that refer to this PPS have
+ * multiple components.
+ * @luma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the luma component of the
+ * entries of the palette predictor initializer.
+ * @chroma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the chroma components of
+ * the entries of the palette predictor initializer.
+ * @pps_palette_predictor_initializer: specifies the value of the comp-th component of the
+ * i-th palette entry in the PPS that is used to initialize the array PredictorPaletteEntries.
+ * Defines the _GstH265PPSSccExtensionParams
+ *
+ * Since: 1.18
+ */
+struct _GstH265PPSSccExtensionParams {
+ guint8 pps_curr_pic_ref_enabled_flag;
+ guint8 residual_adaptive_colour_transform_enabled_flag;
+ guint8 pps_slice_act_qp_offsets_present_flag;
+ guint8 pps_act_y_qp_offset_plus5;
+ guint8 pps_act_cb_qp_offset_plus5;
+ guint8 pps_act_cr_qp_offset_plus3;
+ guint8 pps_palette_predictor_initializers_present_flag;
+ guint8 pps_num_palette_predictor_initializer;
+ guint8 monochrome_palette_flag;
+ guint8 luma_bit_depth_entry_minus8;
+ guint32 chroma_bit_depth_entry_minus8;
+ guint32 pps_palette_predictor_initializer[3][128];
+};
+
+/**
+ * GstH265ScalingList:
+ * @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC
+ * Coefficient values for 16x16 scaling list
+ * @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC
+ * Coefficient values for 32x32 scaling list
+ * @scaling_lists_4x4: 4x4 scaling list
+ * @scaling_lists_8x8: 8x8 scaling list
+ * @scaling_lists_16x16: 16x16 scaling list
+ * @guint8 scaling_lists_32x32: 32x32 scaling list
+ *
+ * Defines the GstH265ScalingList
+ */
+struct _GstH265ScalingList {
+
+ gint16 scaling_list_dc_coef_minus8_16x16[6];
+ gint16 scaling_list_dc_coef_minus8_32x32[2];
+
+ guint8 scaling_lists_4x4 [6][16];
+ guint8 scaling_lists_8x8 [6][64];
+ guint8 scaling_lists_16x16 [6][64];
+ guint8 scaling_lists_32x32 [2][64];
+};
+
+/**
+ * GstH265SPS:
+ * @id: The ID of the sequence parameter set
+ * @profile_idc: indicate the profile to which the coded video sequence conforms
+ *
+ * H265 Sequence Parameter Set (SPS)
+ */
+struct _GstH265SPS
+{
+ guint8 id;
+
+ GstH265VPS *vps;
+
+ guint8 max_sub_layers_minus1;
+ guint8 temporal_id_nesting_flag;
+
+ GstH265ProfileTierLevel profile_tier_level;
+
+ guint8 chroma_format_idc;
+ guint8 separate_colour_plane_flag;
+ guint16 pic_width_in_luma_samples;
+ guint16 pic_height_in_luma_samples;
+
+ guint8 conformance_window_flag;
+ /* if conformance_window_flag */
+ guint32 conf_win_left_offset;
+ guint32 conf_win_right_offset;
+ guint32 conf_win_top_offset;
+ guint32 conf_win_bottom_offset;
+
+ guint8 bit_depth_luma_minus8;
+ guint8 bit_depth_chroma_minus8;
+ guint8 log2_max_pic_order_cnt_lsb_minus4;
+
+ guint8 sub_layer_ordering_info_present_flag;
+ guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
+ guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
+
+ guint8 log2_min_luma_coding_block_size_minus3;
+ guint8 log2_diff_max_min_luma_coding_block_size;
+ guint8 log2_min_transform_block_size_minus2;
+ guint8 log2_diff_max_min_transform_block_size;
+ guint8 max_transform_hierarchy_depth_inter;
+ guint8 max_transform_hierarchy_depth_intra;
+
+ guint8 scaling_list_enabled_flag;
+ /* if scaling_list_enabled_flag */
+ guint8 scaling_list_data_present_flag;
+
+ GstH265ScalingList scaling_list;
+
+ guint8 amp_enabled_flag;
+ guint8 sample_adaptive_offset_enabled_flag;
+ guint8 pcm_enabled_flag;
+ /* if pcm_enabled_flag */
+ guint8 pcm_sample_bit_depth_luma_minus1;
+ guint8 pcm_sample_bit_depth_chroma_minus1;
+ guint8 log2_min_pcm_luma_coding_block_size_minus3;
+ guint8 log2_diff_max_min_pcm_luma_coding_block_size;
+ guint8 pcm_loop_filter_disabled_flag;
+
+ guint8 num_short_term_ref_pic_sets;
+ GstH265ShortTermRefPicSet short_term_ref_pic_set[65];
+
+ guint8 long_term_ref_pics_present_flag;
+ /* if long_term_ref_pics_present_flag */
+ guint8 num_long_term_ref_pics_sps;
+ guint16 lt_ref_pic_poc_lsb_sps[32];
+ guint8 used_by_curr_pic_lt_sps_flag[32];
+
+ guint8 temporal_mvp_enabled_flag;
+ guint8 strong_intra_smoothing_enabled_flag;
+ guint8 vui_parameters_present_flag;
+
+ /* if vui_parameters_present_flat */
+ GstH265VUIParams vui_params;
+
+ guint8 sps_extension_flag;
+
+ /* if sps_extension_present_flag */
+ guint8 sps_range_extension_flag;
+ guint8 sps_multilayer_extension_flag;
+ guint8 sps_3d_extension_flag;
+ guint8 sps_scc_extension_flag;
+ guint8 sps_extension_4bits;
+
+ /* if sps_range_extension_flag */
+ GstH265SPSExtensionParams sps_extnsion_params;
+ /* if sps_scc_extension_flag */
+ GstH265SPSSccExtensionParams sps_scc_extension_params;
+
+ /* calculated values */
+ guint8 chroma_array_type;
+ gint width, height;
+ gint crop_rect_width, crop_rect_height;
+ gint crop_rect_x, crop_rect_y;
+ gint fps_num, fps_den;
+ gboolean valid;
+};
+
+/**
+ * GstH265PPS:
+ *
+ * H265 Picture Parameter Set
+ */
+struct _GstH265PPS
+{
+ guint id;
+
+ GstH265SPS *sps;
+
+ guint8 dependent_slice_segments_enabled_flag;
+ guint8 output_flag_present_flag;
+ guint8 num_extra_slice_header_bits;
+ guint8 sign_data_hiding_enabled_flag;
+ guint8 cabac_init_present_flag;
+ guint8 num_ref_idx_l0_default_active_minus1;
+ guint8 num_ref_idx_l1_default_active_minus1;
+ gint8 init_qp_minus26;
+ guint8 constrained_intra_pred_flag;
+ guint8 transform_skip_enabled_flag;
+ guint8 cu_qp_delta_enabled_flag;
+ /*if cu_qp_delta_enabled_flag */
+ guint8 diff_cu_qp_delta_depth;
+
+ gint8 cb_qp_offset;
+ gint8 cr_qp_offset;
+ guint8 slice_chroma_qp_offsets_present_flag;
+ guint8 weighted_pred_flag;
+ guint8 weighted_bipred_flag;
+ guint8 transquant_bypass_enabled_flag;
+ guint8 tiles_enabled_flag;
+ guint8 entropy_coding_sync_enabled_flag;
+
+ guint8 num_tile_columns_minus1;
+ guint8 num_tile_rows_minus1;
+ guint8 uniform_spacing_flag;
+ guint32 column_width_minus1[20];
+ guint32 row_height_minus1[22];
+ guint8 loop_filter_across_tiles_enabled_flag;
+
+ guint8 loop_filter_across_slices_enabled_flag;
+ guint8 deblocking_filter_control_present_flag;
+ guint8 deblocking_filter_override_enabled_flag;
+ guint8 deblocking_filter_disabled_flag;
+ gint8 beta_offset_div2;
+ gint8 tc_offset_div2;
+
+ guint8 scaling_list_data_present_flag;
+
+ GstH265ScalingList scaling_list;
+
+ guint8 lists_modification_present_flag;
+ guint8 log2_parallel_merge_level_minus2;
+ guint8 slice_segment_header_extension_present_flag;
+
+ guint8 pps_extension_flag;
+
+ /* if pps_extension_flag*/
+ guint8 pps_range_extension_flag;
+ guint8 pps_multilayer_extension_flag;
+ guint8 pps_3d_extension_flag;
+ guint8 pps_scc_extension_flag;
+ guint8 pps_extension_4bits;
+
+ /* if pps_range_extension_flag*/
+ GstH265PPSExtensionParams pps_extension_params;
+ /* if pps_scc_extension_flag*/
+ GstH265PPSSccExtensionParams pps_scc_extension_params;
+
+ /* calculated values */
+ guint32 PicWidthInCtbsY;
+ guint32 PicHeightInCtbsY;
+ gboolean valid;
+};
+
+struct _GstH265RefPicListModification
+{
+ guint8 ref_pic_list_modification_flag_l0;
+ guint32 list_entry_l0[15];
+ guint8 ref_pic_list_modification_flag_l1;
+ guint32 list_entry_l1[15];
+};
+
+struct _GstH265PredWeightTable
+{
+ guint8 luma_log2_weight_denom;
+ gint8 delta_chroma_log2_weight_denom;
+
+ guint8 luma_weight_l0_flag[15];
+ guint8 chroma_weight_l0_flag[15];
+ gint8 delta_luma_weight_l0[15];
+ gint8 luma_offset_l0[15];
+ gint8 delta_chroma_weight_l0 [15][2];
+ gint16 delta_chroma_offset_l0 [15][2];
+
+ guint8 luma_weight_l1_flag[15];
+ guint8 chroma_weight_l1_flag[15];
+ gint8 delta_luma_weight_l1[15];
+ gint8 luma_offset_l1[15];
+ gint8 delta_chroma_weight_l1[15][2];
+ gint16 delta_chroma_offset_l1[15][2];
+};
+
+/**
+ * GstH265SliceHdr:
+ * @first_slice_segment_in_pic_flag: equal to 1 if this slice segment is
+ * the first slice segment of the picture in decoding order
+ * @no_output_of_prior_pics_flag: affects the output of previously-decoded pictures
+ * in the decoded picture buffer after the decoding of an IDR or a BLA picture
+ * that is not the first picture in the bitstream as specified in Annex C
+ * @pps: a #GstH265PPS
+ * @dependent_slice_segment_flag: equal to 1 if the value of each slice segment header
+ * syntax element that is not present is inferred to be equal to the value of corresponding
+ * slice segment header syntax element in the slice header.
+ * @segment_address: the address of the first CTB in the slice segment
+ * @type: slice type (B, P, or I)
+ * @pic_output_flag: affects the decoded picture output and removal processes
+ * as specified in Annex C.
+ * @colour_plane_id: specifies the colour plane associated with the current slice RBSP
+ * when separate_colour_plane_flag is equal to 1
+ * @pic_order_cnt_lsb: the picture order count modulo MaxPicOrderCntLsb for the current picture
+ * @short_term_ref_pic_set_sps_flag: equal to 1 specifies that the short-term RPS
+ * of the current picture is derived based on the active SPS.
+ * @short_term_ref_pic_sets: a #GstH265ShortTermRefPicSet structure
+ * @short_term_ref_pic_set_idx: the index of st_ref_pic_set syntax structure
+ * that is used for derivation of the short-term RPS of the current picture.
+ * @num_long_term_sps: the number of entries in the long-term RPS of current picture
+ * that are derived based on the syntax in active SPS.
+ * @num_long_term_pics: the number of entries in the long-term RPS of the current picture
+ * that are directly signalled in the slice header.
+ * @lt_idx_sps: the index of candidate long-term reference pictures
+ * specified in the active SPS.
+ * @poc_lsb_lt: the value of the picture order count modulo MaxPicOrderCntLsb
+ * of the each entry in the long-term RPS of the current picture.
+ * @used_by_curr_pic_lt_flag: equal to 0 if the entry in the long-term RPS
+ * of the current picture is not used for reference by the current picture.
+ * @delta_poc_msb_present_flag: equal to 1 if i-th delta_poc_msb_cycle_lt[] is present.
+ * @delta_poc_msb_cycle_lt: used to determine the value of the most significant bits
+ * of the picture order count value of the i-th entry in the long-term RPS of the current picture.
+ * @temporal_mvp_enabled_flag: whether temporal motion vector predictors can be used for inter prediction.
+ * @sao_luma_flag: equal to 1 if SAO is enabled for the luma component in the current slice.
+ * @sao_chroma_flag: equal to 1 if SAO is enabled for the chroma component in the current slice.
+ * @num_ref_idx_active_override_flag: equal to 1 specifies that the syntax elements
+ * num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1 are present.
+ * @num_ref_idx_l0_active_minus1: the maximum reference index for reference picture list 0
+ * that may be used to decode the slice.
+ * @num_ref_idx_l1_active_minus1: the maximum reference index for reference picture list 1
+ * that may be used to decode the slice.
+ * @ref_pic_list_modification: a #GstH265RefPicListModification
+ * @mvd_l1_zero_flag: equal to 1 if the mvd_coding sytanx structure is not parsed
+ * @cabac_init_flag: specifies the method for determining the initialization table
+ * used in the initialization process for context variables.
+ * @collocated_from_l0_flag: equal to 1 specifies that the collocated picture
+ * used for temporal motion vector prediction is derived from reference picture list 0.
+ * @collocated_ref_idx: the reference index of the collocated picture
+ * used for temporal motion vector prediction.
+ * @pred_weight_table: a #GstH265PredWeightTable
+ * @five_minus_max_num_merge_cand: specifies the maximum number of merging motion vector prediction (MVP)
+ * candidates supported in the slice.
+ * @use_integer_mv_flag: equal to 1 specifies that the resolution of motion vectors for inter
+ * prediction in the current slice is integer. (Since: 1.18)
+ * @qp_delta: specifies the inital value of QPy to be used for the coding blocks in the slice.
+ * @cb_qp_offset: a difference to be added to the value of pps_cb_qp_offset.
+ * @cr_qp_offset: a difference to be added to the value of pps_cr_qp_offset.
+ * @slice_act_y_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for luma components. (Since: 1.18)
+ * @slice_act_cb_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for Cb components. (Since: 1.18)
+ * @slice_act_cr_qp_offset: specify offsets to the quantization parameter values qP derived in
+ * clause 8.6.2 for Cr components. (Since: 1.18)
+ * @cu_chroma_qp_offset_enabled_flag: equal to 1 if the cu_chroma_qp_offset_flag
+ * may be present in the transform unit syntax. (Since: 1.18)
+ * @deblocking_filter_override_flag: equal to 1 if deblocking paramertes are present in the slice header.
+ * @deblocking_filter_disabled_flag: equal to 1 specifies that the operation of
+ * the deblocking filter is not applied for the current slice.
+ * @beta_offset_div2: deblocking parameter offset for beta divided by 2 for the current slice.
+ * @tc_offset_div2: deblocking parameter offset for tC divided by 2 for the current slice.
+ * @loop_filter_across_slices_enabled_flag: equal to 1 specifies that in-loop filtering
+ * operation may be performed across the left and upper boundaries of the current slice.
+ * @num_entry_point_offsets: specifies the number of entry_point_offset_minus1 syntax elements
+ * in the slice header.
+ * @offset_len_minus1: specifies the length of the entry_point_minus1 syntax elements
+ * in bits.
+ * @entry_point_offset_minus1: the entry point offset in bytes.
+ * @NumPocTotalCurr: calculated NumPocTotalCurr which is used for
+ * decoding process for reference picture set
+ * @header_size: the calculated size of the slice_header\() in bits.
+ * @n_emulation_prevention_bytes: number of emulation prevention bytes (EPB)
+ * in this slice_header\()
+ * @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set\()
+ * in bits. (Since: 1.18)
+ */
+struct _GstH265SliceHdr
+{
+ guint8 first_slice_segment_in_pic_flag;
+ guint8 no_output_of_prior_pics_flag;
+
+ GstH265PPS *pps;
+
+ guint8 dependent_slice_segment_flag;
+ guint32 segment_address;
+
+ guint8 type;
+
+ guint8 pic_output_flag;
+ guint8 colour_plane_id;
+ guint16 pic_order_cnt_lsb;
+
+ guint8 short_term_ref_pic_set_sps_flag;
+ GstH265ShortTermRefPicSet short_term_ref_pic_sets;
+ guint8 short_term_ref_pic_set_idx;
+
+ guint8 num_long_term_sps;
+ guint8 num_long_term_pics;
+ guint8 lt_idx_sps[16];
+ guint32 poc_lsb_lt[16];
+ guint8 used_by_curr_pic_lt_flag[16];
+ guint8 delta_poc_msb_present_flag[16];
+ guint32 delta_poc_msb_cycle_lt[16];
+
+ guint8 temporal_mvp_enabled_flag;
+ guint8 sao_luma_flag;
+ guint8 sao_chroma_flag;
+ guint8 num_ref_idx_active_override_flag;
+ guint8 num_ref_idx_l0_active_minus1;
+ guint8 num_ref_idx_l1_active_minus1;
+
+ GstH265RefPicListModification ref_pic_list_modification;
+
+ guint8 mvd_l1_zero_flag;
+ guint8 cabac_init_flag;
+ guint8 collocated_from_l0_flag;
+ guint8 collocated_ref_idx;
+
+ GstH265PredWeightTable pred_weight_table;
+
+ guint8 five_minus_max_num_merge_cand;
+ guint8 use_integer_mv_flag;
+
+ gint8 qp_delta;
+ gint8 cb_qp_offset;
+ gint8 cr_qp_offset;
+ gint8 slice_act_y_qp_offset;
+ gint8 slice_act_cb_qp_offset;
+ gint8 slice_act_cr_qp_offset;
+
+ guint8 cu_chroma_qp_offset_enabled_flag;
+
+ guint8 deblocking_filter_override_flag;
+ guint8 deblocking_filter_disabled_flag;
+ gint8 beta_offset_div2;
+ gint8 tc_offset_div2;
+
+ guint8 loop_filter_across_slices_enabled_flag;
+
+ guint32 num_entry_point_offsets;
+ guint8 offset_len_minus1;
+ guint32 *entry_point_offset_minus1;
+
+ /* calculated values */
+
+ gint NumPocTotalCurr;
+ /* Size of the slice_header() in bits */
+ guint header_size;
+ /* Number of emulation prevention bytes (EPB) in this slice_header() */
+ guint n_emulation_prevention_bytes;
+
+ /* Size of short_term_ref_pic_set() in bits */
+ guint short_term_ref_pic_set_size;
+};
+
+struct _GstH265PicTiming
+{
+ guint8 pic_struct;
+ guint8 source_scan_type;
+ guint8 duplicate_flag;
+
+ guint8 au_cpb_removal_delay_minus1;
+ guint8 pic_dpb_output_delay;
+ guint8 pic_dpb_output_du_delay;
+ guint32 num_decoding_units_minus1;
+ guint8 du_common_cpb_removal_delay_flag;
+ guint8 du_common_cpb_removal_delay_increment_minus1;
+ guint32 *num_nalus_in_du_minus1;
+ guint8 *du_cpb_removal_delay_increment_minus1;
+};
+
+struct _GstH265BufferingPeriod
+{
+ GstH265SPS *sps;
+
+ guint8 irap_cpb_params_present_flag;
+ guint8 cpb_delay_offset;
+ guint8 dpb_delay_offset;
+ guint8 concatenation_flag;
+ guint8 au_cpb_removal_delay_delta_minus1;
+
+ /* seq->vui_parameters->nal_hrd_parameters_present_flag */
+ guint8 nal_initial_cpb_removal_delay[32];
+ guint8 nal_initial_cpb_removal_offset[32];
+ guint8 nal_initial_alt_cpb_removal_delay[32];
+ guint8 nal_initial_alt_cpb_removal_offset [32];
+
+ /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
+ guint8 vcl_initial_cpb_removal_delay[32];
+ guint8 vcl_initial_cpb_removal_offset[32];
+ guint8 vcl_initial_alt_cpb_removal_delay[32];
+ guint8 vcl_initial_alt_cpb_removal_offset[32];
+};
+
+struct _GstH265RecoveryPoint
+{
+ gint32 recovery_poc_cnt;
+ guint8 exact_match_flag;
+ guint8 broken_link_flag;
+};
+
+/**
+ * GstH265RegisteredUserData:
+ * The User data registered by Rec. ITU-T T.35 SEI message.
+ * @country_code: an itu_t_t35_country_code.
+ * @country_code_extension: an itu_t_t35_country_code_extension_byte.
+ * Should be ignored when @country_code is not 0xff
+ * @data: the data of itu_t_t35_payload_byte
+ * excluding @country_code and @country_code_extension
+ * @size: the size of @data in bytes
+ *
+ * Since: 1.18
+ */
+struct _GstH265RegisteredUserData
+{
+ guint8 country_code;
+ guint8 country_code_extension;
+ const guint8 *data;
+ guint size;
+};
+
+
+/**
+ * GstH265TimeCode:
+ * The time code SEI message provides time code information similar to that
+ * defined by SMPTE ST 12-1 (2014) for field(s) or frame(s) of the current
+ * picture.
+ *
+ * D.2.27
+ *
+ * Since: 1.16
+ */
+struct _GstH265TimeCode
+{
+ guint8 num_clock_ts;
+ guint8 clock_timestamp_flag[3];
+ guint8 units_field_based_flag[3];
+ guint8 counting_type[3];
+ guint8 full_timestamp_flag[3];
+ guint8 discontinuity_flag[3];
+ guint8 cnt_dropped_flag[3];
+ guint16 n_frames[3];
+ guint8 seconds_flag[3];
+ guint8 seconds_value[3];
+ guint8 minutes_flag[3];
+ guint8 minutes_value[3];
+ guint8 hours_flag[3];
+ guint8 hours_value[3];
+ guint8 time_offset_length[3];
+ guint32 time_offset_value[3];
+};
+
+/**
+ * GstH265MasteringDisplayColourVolume:
+ * The colour volume (primaries, white point and luminance range) of display
+ * defined by SMPTE ST 2086.
+ *
+ * D.2.28
+ *
+ * Since: 1.18
+ */
+struct _GstH265MasteringDisplayColourVolume
+{
+ guint16 display_primaries_x[3];
+ guint16 display_primaries_y[3];
+ guint16 white_point_x;
+ guint16 white_point_y;
+ guint32 max_display_mastering_luminance;
+ guint32 min_display_mastering_luminance;
+};
+
+/**
+ * GstH265ContentLightLevel:
+ * The upper bounds for the nominal target brightness light level
+ * as specified in CEA-861.3
+ *
+ * D.2.35
+ *
+ * Since: 1.18
+ */
+struct _GstH265ContentLightLevel
+{
+ guint16 max_content_light_level;
+ guint16 max_pic_average_light_level;
+};
+
+struct _GstH265SEIMessage
+{
+ GstH265SEIPayloadType payloadType;
+
+ union {
+ GstH265BufferingPeriod buffering_period;
+ GstH265PicTiming pic_timing;
+ GstH265RegisteredUserData registered_user_data;
+ GstH265RecoveryPoint recovery_point;
+ GstH265TimeCode time_code;
+ GstH265MasteringDisplayColourVolume mastering_display_colour_volume;
+ GstH265ContentLightLevel content_light_level;
+ /* ... could implement more */
+ } payload;
+};
+
+/**
+ * GstH265Parser:
+ *
+ * H265 NAL Parser (opaque structure).
+ */
+struct _GstH265Parser
+{
+ /*< private >*/
+ GstH265VPS vps[GST_H265_MAX_VPS_COUNT];
+ GstH265SPS sps[GST_H265_MAX_SPS_COUNT];
+ GstH265PPS pps[GST_H265_MAX_PPS_COUNT];
+ GstH265VPS *last_vps;
+ GstH265SPS *last_sps;
+ GstH265PPS *last_pps;
+};
+
+GST_CODEC_PARSERS_API
+GstH265Parser * gst_h265_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
+ const guint8 * data,
+ guint offset,
+ gsize size,
+ guint8 nal_length_size,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_nal (GstH265Parser * parser,
+ GstH265NalUnit * nalu);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SliceHdr * slice);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_vps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_sps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SPS * sps,
+ gboolean parse_vui_params);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_pps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_parse_sei (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GArray **messages);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_vps (GstH265Parser * parser,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_sps (GstH265Parser * parser,
+ GstH265SPS * sps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parser_update_pps (GstH265Parser * parser,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+void gst_h265_parser_free (GstH265Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_vps (GstH265NalUnit * nalu,
+ GstH265VPS * vps);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_sps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265SPS * sps,
+ gboolean parse_vui_params);
+
+GST_CODEC_PARSERS_API
+GstH265ParserResult gst_h265_parse_pps (GstH265Parser * parser,
+ GstH265NalUnit * nalu,
+ GstH265PPS * pps);
+
+GST_CODEC_PARSERS_API
+gboolean gst_h265_slice_hdr_copy (GstH265SliceHdr * dst_slice,
+ const GstH265SliceHdr * src_slice);
+
+GST_CODEC_PARSERS_API
+void gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_h265_sei_copy (GstH265SEIMessage * dest_sei,
+ const GstH265SEIMessage * src_sei);
+
+GST_CODEC_PARSERS_API
+void gst_h265_sei_free (GstH265SEIMessage * sei);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+#define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \
+ gst_h265_quant_matrix_8x8_get_zigzag_from_raster
+#define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \
+ gst_h265_quant_matrix_8x8_get_raster_from_zigzag
+#define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \
+ gst_h265_quant_matrix_8x8_get_zigzag_from_raster
+#define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \
+ gst_h265_quant_matrix_8x8_get_raster_from_zigzag
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16],
+ const guint8 quant[16]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+#define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \
+ gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
+#define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\
+ gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
+#define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \
+ gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
+#define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\
+ gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_profile_tier_level_get_profile (const GstH265ProfileTierLevel * ptl);
+
+GST_CODEC_PARSERS_API
+const gchar * gst_h265_profile_to_string (GstH265Profile profile);
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_profile_from_string (const gchar * string);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h265_create_sei_memory (guint8 layer_id,
+ guint8 temporal_id_plus1,
+ guint8 start_code_prefix_length,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstMemory * gst_h265_create_sei_memory_hevc (guint8 layer_id,
+ guint8 temporal_id_plus1,
+ guint8 nal_length_size,
+ GArray * messages);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h265_parser_insert_sei (GstH265Parser * parser,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstBuffer * gst_h265_parser_insert_sei_hevc (GstH265Parser * parser,
+ guint8 nal_length_size,
+ GstBuffer * au,
+ GstMemory * sei);
+
+GST_CODEC_PARSERS_API
+GstH265Profile gst_h265_get_profile_from_sps (GstH265SPS * sps);
+
+G_END_DECLS
+#endif
diff --git a/include/gst/codecparsers/gstjpeg2000sampling.h b/include/gst/codecparsers/gstjpeg2000sampling.h
new file mode 100644
index 0000000000..4b5bea5a3c
--- /dev/null
+++ b/include/gst/codecparsers/gstjpeg2000sampling.h
@@ -0,0 +1,115 @@
+/* GStreamer JPEG 2000 Sampling
+ * Copyright (C) <2016> Grok Image Compression Inc.
+ * @author Aaron Boxer <boxerab@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_JPEG2000_SAMPLING_H__
+#define __GST_JPEG2000_SAMPLING_H__
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+/**
+ * GstJPEG2000Sampling:
+ * Sampling values from RF 5371 for JPEG 2000 over RTP : https://datatracker.ietf.org/doc/rfc5371/C
+ * Note: sampling extensions that are not listed in the RFC are signified by an _EXT at the end of the enum
+ *
+ * @GST_JPEG2000_SAMPLING_NONE: no sampling
+ * @GST_JPEG2000_SAMPLING_RGB: standard Red, Green, Blue color space.
+ * @GST_JPEG2000_SAMPLING_BGR: standard Blue, Green, Red color space.
+ * @GST_JPEG2000_SAMPLING_RGBA: standard Red, Green, Blue, Alpha color space.
+ * @GST_JPEG2000_SAMPLING_BGRA: standard Blue, Green, Red, Alpha color space.
+ * @GST_JPEG2000_SAMPLING_YBR444: standard YCbCr color space; no subsampling.
+ * @GST_JPEG2000_SAMPLING_YBR422: standard YCbCr color space; Cb and Cr are subsampled horizontally by 1/2.
+ * @GST_JPEG2000_SAMPLING_YBR420: standard YCbCr color space; Cb and Cr are subsampled horizontally and vertically by 1/2.
+ * @GST_JPEG2000_SAMPLING_YBR411: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 (Since: 1.20).
+ * @GST_JPEG2000_SAMPLING_YBR410: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 alternating the Cb and Cr component.
+ * @GST_JPEG2000_SAMPLING_GRAYSCALE: basically, a single component image of just multilevels of grey.
+ * @GST_JPEG2000_SAMPLING_YBRA4444_EXT: standard YCbCr color space, alpha channel, no subsampling,
+ */
+
+/**
+ * GST_JPEG2000_SAMPLING_YBR411:
+ *
+ * standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_JPEG2000_SAMPLING_NONE,
+ GST_JPEG2000_SAMPLING_RGB,
+ GST_JPEG2000_SAMPLING_BGR,
+ GST_JPEG2000_SAMPLING_RGBA,
+ GST_JPEG2000_SAMPLING_BGRA,
+ GST_JPEG2000_SAMPLING_YBR444,
+ GST_JPEG2000_SAMPLING_YBR422,
+ GST_JPEG2000_SAMPLING_YBR420,
+ GST_JPEG2000_SAMPLING_YBR410,
+ GST_JPEG2000_SAMPLING_GRAYSCALE,
+ GST_JPEG2000_SAMPLING_YBRA4444_EXT,
+ GST_JPEG2000_SAMPLING_YBR411
+} GstJPEG2000Sampling;
+
+/* GST_JPEG2000_SAMPLING_LIST: sampling strings in list form, for use in caps */
+#define GST_JPEG2000_SAMPLING_LIST "sampling = (string) {\"RGB\", \"BGR\", \"RGBA\", \"BGRA\", \"YCbCr-4:4:4\", \"YCbCr-4:2:2\", \"YCbCr-4:2:0\", \"YCbCr-4:1:1\", \"YCbCr-4:1:0\", \"GRAYSCALE\" , \"YCbCrA-4:4:4:4\"}"
+
+GST_CODEC_PARSERS_API
+const gchar *gst_jpeg2000_sampling_to_string (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+GstJPEG2000Sampling gst_jpeg2000_sampling_from_string (const gchar *
+ sampling_string);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_rgb (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_yuv (GstJPEG2000Sampling sampling);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg2000_sampling_is_mono (GstJPEG2000Sampling sampling);
+
+
+/**
+ * GstJPEG2000Colorspace:
+ * @GST_JPEG2000_COLORSPACE_NONE: no color space
+ * @GST_JPEG2000_COLORSPACE_RGB: standard RGB color space
+ * @GST_JPEG2000_COLORSPACE_YUV: standard YUV color space
+ * @GST_JPEG2000_COLORSPACE_GRAY: monochrome color space
+ */
+typedef enum
+{
+ GST_JPEG2000_COLORSPACE_NONE,
+ GST_JPEG2000_COLORSPACE_RGB,
+ GST_JPEG2000_COLORSPACE_YUV,
+ GST_JPEG2000_COLORSPACE_GRAY
+} GstJPEG2000Colorspace;
+
+GST_CODEC_PARSERS_API
+const gchar *gst_jpeg2000_colorspace_to_string (GstJPEG2000Colorspace
+ colorspace);
+
+GST_CODEC_PARSERS_API
+GstJPEG2000Colorspace gst_jpeg2000_colorspace_from_string (const gchar *
+ colorspace_string);
+
+/* GST_JPEG2000_COLORSPACE_LIST: color space strings in list form, for use in caps */
+#define GST_JPEG2000_COLORSPACE_LIST "colorspace = (string) { \"sRGB\", \"sYUV\", \"GRAY\" }"
+
+#endif
diff --git a/include/gst/codecparsers/gstjpegparser.h b/include/gst/codecparsers/gstjpegparser.h
new file mode 100644
index 0000000000..ca96e89abb
--- /dev/null
+++ b/include/gst/codecparsers/gstjpegparser.h
@@ -0,0 +1,412 @@
+/* GStreamer JPEG parser
+ * Copyright (C) 2011-2012 Intel Corporation
+ * Copyright (C) 2015 Tim-Philipp Müller <tim@centricular.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GST_JPEG_PARSER_H
+#define GST_JPEG_PARSER_H
+
+#ifndef GST_USE_UNSTABLE_API
+# warning "The JPEG parsing library is unstable API and may change in future."
+# warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_JPEG_MAX_FRAME_COMPONENTS:
+ *
+ * Maximum number of image components in a frame (Nf).
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_FRAME_COMPONENTS 256
+
+/**
+ * GST_JPEG_MAX_SCAN_COMPONENTS:
+ *
+ * Maximum number of image components in a scan (Ns).
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_SCAN_COMPONENTS 4
+
+/**
+ * GST_JPEG_MAX_QUANT_ELEMENTS:
+ *
+ * Number of elements in the quantization table.
+ *
+ * Since: 1.6
+ */
+#define GST_JPEG_MAX_QUANT_ELEMENTS 64
+
+typedef struct _GstJpegQuantTable GstJpegQuantTable;
+typedef struct _GstJpegQuantTables GstJpegQuantTables;
+typedef struct _GstJpegHuffmanTable GstJpegHuffmanTable;
+typedef struct _GstJpegHuffmanTables GstJpegHuffmanTables;
+typedef struct _GstJpegScanComponent GstJpegScanComponent;
+typedef struct _GstJpegScanHdr GstJpegScanHdr;
+typedef struct _GstJpegFrameComponent GstJpegFrameComponent;
+typedef struct _GstJpegFrameHdr GstJpegFrameHdr;
+typedef struct _GstJpegSegment GstJpegSegment;
+
+/**
+ * GstJpegMarker:
+ * @GST_JPEG_MARKER_SOF0: Start of frame marker code (Baseline)
+ * @GST_JPEG_MARKER_SOF1: Start of frame marker code (Extended Sequential, Huffman)
+ * @GST_JPEG_MARKER_SOF2: Start of frame marker code (Progressive, Huffman)
+ * @GST_JPEG_MARKER_SOF3: Start of frame marker code (Lossless, Huffman)
+ * @GST_JPEG_MARKER_SOF5: Start of frame marker code (Differential Sequential, Huffman)
+ * @GST_JPEG_MARKER_SOF6: Start of frame marker code (Differential Progressive, Huffman)
+ * @GST_JPEG_MARKER_SOF7: Start of frame marker code (Differential Lossless, Huffman)
+ * @GST_JPEG_MARKER_SOF9: Start of frame marker code (Extended Sequential, Arithmetic)
+ * @GST_JPEG_MARKER_SOF10: Start of frame marker code (Progressive, Arithmetic)
+ * @GST_JPEG_MARKER_SOF11: Start of frame marker code (Lossless, Arithmetic)
+ * @GST_JPEG_MARKER_SOF13: Start of frame marker code (Differential Sequential, Arithmetic)
+ * @GST_JPEG_MARKER_SOF14: Start of frame marker code (Differential Progressive, Arithmetic)
+ * @GST_JPEG_MARKER_SOF15: Start of frame marker code (Differential Lossless, Arithmetic)
+ * @GST_JPEG_MARKER_DHT: Huffman table marker code
+ * @GST_JPEG_MARKER_DAC: Arithmetic coding marker code
+ * @GST_JPEG_MARKER_RST_MIN: Restart interval min marker code
+ * @GST_JPEG_MARKER_RST_MAX: Restart interval max marker code
+ * @GST_JPEG_MARKER_SOI: Start of image marker code
+ * @GST_JPEG_MARKER_EOI: End of image marker code
+ * @GST_JPEG_MARKER_SOS: Start of scan marker code
+ * @GST_JPEG_MARKER_DQT: Define quantization table marker code
+ * @GST_JPEG_MARKER_DNL: Define number of lines marker code
+ * @GST_JPEG_MARKER_DRI: Define restart interval marker code
+ * @GST_JPEG_MARKER_APP0: Application segment 0 marker code
+ * @GST_JPEG_MARKER_APP1: Application segment 1 marker code
+ * @GST_JPEG_MARKER_APP2: Application segment 2 marker code
+ * @GST_JPEG_MARKER_APP3: Application segment 3 marker code
+ * @GST_JPEG_MARKER_APP4: Application segment 4 marker code
+ * @GST_JPEG_MARKER_APP5: Application segment 5 marker code
+ * @GST_JPEG_MARKER_APP6: Application segment 6 marker code
+ * @GST_JPEG_MARKER_APP7: Application segment 7 marker code
+ * @GST_JPEG_MARKER_APP8: Application segment 8 marker code
+ * @GST_JPEG_MARKER_APP9: Application segment 9 marker code
+ * @GST_JPEG_MARKER_APP10: Application segment 10 marker code
+ * @GST_JPEG_MARKER_APP11: Application segment 11 marker code
+ * @GST_JPEG_MARKER_APP12: Application segment 12 marker code
+ * @GST_JPEG_MARKER_APP13: Application segment 13 marker code
+ * @GST_JPEG_MARKER_APP14: Application segment 14 marker code
+ * @GST_JPEG_MARKER_APP15: Application segment 15 marker code
+ * @GST_JPEG_MARKER_COM: Comment marker code
+ *
+ * Indicates the type of JPEG segment.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_MARKER_SOF0 = 0xC0,
+ GST_JPEG_MARKER_SOF1 = 0xC1,
+ GST_JPEG_MARKER_SOF2 = 0xC2,
+ GST_JPEG_MARKER_SOF3 = 0xC3,
+ /* 0xC4 = DHT see below */
+ GST_JPEG_MARKER_SOF5 = 0xC5,
+ GST_JPEG_MARKER_SOF6 = 0xC6,
+ GST_JPEG_MARKER_SOF7 = 0xC7,
+ /* 0xC8 = reserved */
+ GST_JPEG_MARKER_SOF9 = 0xC9,
+ GST_JPEG_MARKER_SOF10 = 0xCA,
+ GST_JPEG_MARKER_SOF11 = 0xCB,
+ /* 0xCC = DAC see below */
+ GST_JPEG_MARKER_SOF13 = 0xCD,
+ GST_JPEG_MARKER_SOF14 = 0xCE,
+ GST_JPEG_MARKER_SOF15 = 0xCF,
+ GST_JPEG_MARKER_DHT = 0xC4,
+ GST_JPEG_MARKER_DAC = 0xCC,
+ GST_JPEG_MARKER_RST0 = 0xD0,
+ GST_JPEG_MARKER_RST1 = 0xD1,
+ GST_JPEG_MARKER_RST2 = 0xD2,
+ GST_JPEG_MARKER_RST3 = 0xD3,
+ GST_JPEG_MARKER_RST4 = 0xD4,
+ GST_JPEG_MARKER_RST5 = 0xD5,
+ GST_JPEG_MARKER_RST6 = 0xD6,
+ GST_JPEG_MARKER_RST7 = 0xD7,
+ GST_JPEG_MARKER_SOI = 0xD8,
+ GST_JPEG_MARKER_EOI = 0xD9,
+ GST_JPEG_MARKER_SOS = 0xDA,
+ GST_JPEG_MARKER_DQT = 0xDB,
+ GST_JPEG_MARKER_DNL = 0xDC,
+ GST_JPEG_MARKER_DRI = 0xDD,
+ GST_JPEG_MARKER_APP0 = 0xE0,
+ GST_JPEG_MARKER_APP1 = 0xE1,
+ GST_JPEG_MARKER_APP2 = 0xE2,
+ GST_JPEG_MARKER_APP3 = 0xE3,
+ GST_JPEG_MARKER_APP4 = 0xE4,
+ GST_JPEG_MARKER_APP5 = 0xE5,
+ GST_JPEG_MARKER_APP6 = 0xE6,
+ GST_JPEG_MARKER_APP7 = 0xE7,
+ GST_JPEG_MARKER_APP8 = 0xE8,
+ GST_JPEG_MARKER_APP9 = 0xE9,
+ GST_JPEG_MARKER_APP10 = 0xEA,
+ GST_JPEG_MARKER_APP11 = 0xEB,
+ GST_JPEG_MARKER_APP12 = 0xEC,
+ GST_JPEG_MARKER_APP13 = 0xED,
+ GST_JPEG_MARKER_APP14 = 0xEE,
+ GST_JPEG_MARKER_APP15 = 0xEF,
+ GST_JPEG_MARKER_COM = 0xFE,
+} GstJpegMarker;
+
+#define GST_JPEG_MARKER_SOF_MIN GST_JPEG_MARKER_SOF0
+#define GST_JPEG_MARKER_SOF_MAX GST_JPEG_MARKER_SOF15
+
+#define GST_JPEG_MARKER_APP_MIN GST_JPEG_MARKER_APP0
+#define GST_JPEG_MARKER_APP_MAX GST_JPEG_MARKER_APP15
+
+#define GST_JPEG_MARKER_RST_MIN GST_JPEG_MARKER_RST0
+#define GST_JPEG_MARKER_RST_MAX GST_JPEG_MARKER_RST7
+
+/**
+ * GstJpegProfile:
+ * @GST_JPEG_PROFILE_BASELINE: Baseline DCT
+ * @GST_JPEG_PROFILE_EXTENDED: Extended sequential DCT
+ * @GST_JPEG_PROFILE_PROGRESSIVE: Progressive DCT
+ * @GST_JPEG_PROFILE_LOSSLESS: Lossless (sequential)
+ *
+ * JPEG encoding processes.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_PROFILE_BASELINE = 0x00,
+ GST_JPEG_PROFILE_EXTENDED = 0x01,
+ GST_JPEG_PROFILE_PROGRESSIVE = 0x02,
+ GST_JPEG_PROFILE_LOSSLESS = 0x03,
+} GstJpegProfile;
+
+/**
+ * GstJpegEntropyCodingMode:
+ * @GST_JPEG_ENTROPY_CODING_HUFFMAN: Huffman coding
+ * @GST_JPEG_ENTROPY_CODING_ARITHMETIC: arithmetic coding
+ *
+ * JPEG entropy coding mode.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_JPEG_ENTROPY_CODING_HUFFMAN = 0x00,
+ GST_JPEG_ENTROPY_CODING_ARITHMETIC = 0x08
+} GstJpegEntropyCodingMode;
+
+/**
+ * GstJpegQuantTable:
+ * @quant_precision: Quantization table element precision (Pq)
+ * @quant_table: Quantization table elements (Qk)
+ * @valid: If the quantization table is valid, which means it has
+ * already been parsed
+ *
+ * Quantization table.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegQuantTable
+{
+ guint8 quant_precision;
+ guint16 quant_table[GST_JPEG_MAX_QUANT_ELEMENTS];
+ gboolean valid;
+};
+
+/**
+ * GstJpegQuantTables:
+ * @quant_tables: All quantization tables
+ *
+ * Helper data structure that holds all quantization tables used to
+ * decode an image.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegQuantTables
+{
+ GstJpegQuantTable quant_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+};
+
+/**
+ * GstJpegHuffmanTable:
+ * @huf_bits: Number of Huffman codes of length i + 1 (Li)
+ * @huf_vales: Value associated with each Huffman code (Vij)
+ * @valid: If the Huffman table is valid, which means it has already
+ * been parsed
+ *
+ * Huffman table.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegHuffmanTable
+{
+ guint8 huf_bits[16];
+ guint8 huf_values[256];
+ gboolean valid;
+};
+
+/**
+ * GstJpegHuffmanTables:
+ * @dc_tables: DC Huffman tables
+ * @ac_tables: AC Huffman tables
+ *
+ * Helper data structure that holds all AC/DC Huffman tables used to
+ * decode an image.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegHuffmanTables
+{
+ GstJpegHuffmanTable dc_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+ GstJpegHuffmanTable ac_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
+};
+
+/**
+ * GstJpegScanComponent:
+ * @component_selector: Scan component selector (Csj)
+ * @dc_selector: DC entropy coding table destination selector (Tdj)
+ * @ac_selector: AC entropy coding table destination selector (Taj)
+
+ * Component-specification parameters.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegScanComponent
+{
+ guint8 component_selector; /* 0 .. 255 */
+ guint8 dc_selector; /* 0 .. 3 */
+ guint8 ac_selector; /* 0 .. 3 */
+};
+
+/**
+ * GstJpegScanHdr:
+ * @num_components: Number of image components in scan (Ns)
+ * @components: Image components
+ *
+ * Scan header.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegScanHdr
+{
+ guint8 num_components; /* 1 .. 4 */
+ GstJpegScanComponent components[GST_JPEG_MAX_SCAN_COMPONENTS];
+
+ /*< private >*/
+ guint8 _reserved1; /* Ss */
+ guint8 _reserved2; /* Se */
+ guint8 _reserved3; /* Al */
+ guint8 _reserved4; /* Ah */
+};
+
+/**
+ * GstJpegFrameComponent:
+ * @identifier: Component identifier (Ci)
+ * @horizontal_factor: Horizontal sampling factor (Hi)
+ * @vertical_factor: Vertical sampling factor (Vi)
+ * @quant_table_selector: Quantization table destination selector (Tqi)
+ *
+ * Component-specification parameters.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegFrameComponent
+{
+ guint8 identifier; /* 0 .. 255 */
+ guint8 horizontal_factor; /* 1 .. 4 */
+ guint8 vertical_factor; /* 1 .. 4 */
+ guint8 quant_table_selector; /* 0 .. 3 */
+};
+
+/**
+ * GstJpegFrameHdr:
+ * @sample_precision: Sample precision (P)
+ * @height: Number of lines (Y)
+ * @width: Number of samples per line (X)
+ * @num_components: Number of image components in frame (Nf)
+ * @components: Image components
+ * @restart_interval: Number of MCU in the restart interval (Ri)
+ *
+ * Frame header.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegFrameHdr
+{
+ guint8 sample_precision; /* 2 .. 16 */
+ guint16 width; /* 1 .. 65535 */
+ guint16 height; /* 0 .. 65535 */
+ guint8 num_components; /* 1 .. 255 */
+ GstJpegFrameComponent components[GST_JPEG_MAX_FRAME_COMPONENTS];
+};
+
+/**
+ * GstJpegSegment:
+ * @marker: The type of the segment that starts at @offset
+ * @data: the data containing the jpeg segment starting at @offset
+ * @offset: The offset to the segment start in bytes. This is the
+ * exact start of the segment, no marker code included
+ * @size: The size of the segment in bytes, or -1 if the end was not
+ * found. It is the exact size of the segment, without the sync byte and
+ * marker code but including any length bytes.
+ *
+ * A structure that contains the type of a segment, its offset and its size.
+ *
+ * Since: 1.6
+ */
+struct _GstJpegSegment
+{
+ GstJpegMarker marker;
+ const guint8 *data;
+ guint offset;
+ gssize size;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_parse (GstJpegSegment * seg,
+ const guint8 * data,
+ gsize size,
+ guint offset);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_frame_header (const GstJpegSegment * segment,
+ GstJpegFrameHdr * frame_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_scan_header (const GstJpegSegment * segment,
+ GstJpegScanHdr * scan_hdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_huffman_table (const GstJpegSegment * segment,
+ GstJpegHuffmanTables * huff_tables);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_restart_interval (const GstJpegSegment * segment,
+ guint * interval);
+
+GST_CODEC_PARSERS_API
+gboolean gst_jpeg_segment_parse_quantization_table (const GstJpegSegment * segment,
+ GstJpegQuantTables * quant_tables);
+
+GST_CODEC_PARSERS_API
+void gst_jpeg_get_default_quantization_tables (GstJpegQuantTables * quant_tables);
+
+GST_CODEC_PARSERS_API
+void gst_jpeg_get_default_huffman_tables (GstJpegHuffmanTables * huff_tables);
+
+G_END_DECLS
+
+#endif /* GST_JPEG_PARSER_H */
diff --git a/include/gst/codecparsers/gstmpeg4parser.h b/include/gst/codecparsers/gstmpeg4parser.h
new file mode 100644
index 0000000000..7916c28898
--- /dev/null
+++ b/include/gst/codecparsers/gstmpeg4parser.h
@@ -0,0 +1,592 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MPEG4UTIL_H__
+#define __GST_MPEG4UTIL_H__
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The MPEG4 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpeg4VisualObjectSequence GstMpeg4VisualObjectSequence;
+typedef struct _GstMpeg4VisualObject GstMpeg4VisualObject;
+typedef struct _GstMpeg4VideoObjectLayer GstMpeg4VideoObjectLayer;
+typedef struct _GstMpeg4GroupOfVOP GstMpeg4GroupOfVOP;
+typedef struct _GstMpeg4VideoObjectPlane GstMpeg4VideoObjectPlane;
+typedef struct _GstMpeg4VideoSignalType GstMpeg4VideoSignalType;
+typedef struct _GstMpeg4VideoPlaneShortHdr GstMpeg4VideoPlaneShortHdr;
+typedef struct _GstMpeg4VideoPacketHdr GstMpeg4VideoPacketHdr;
+
+typedef struct _GstMpeg4SpriteTrajectory GstMpeg4SpriteTrajectory;
+
+typedef struct _GstMpeg4Packet GstMpeg4Packet;
+
+/**
+ * GstMpeg4StartCode:
+ *
+ * Defines the different startcodes present in the bitstream as
+ * defined in: Table 6-3 — Start code values
+ */
+typedef enum
+{
+ GST_MPEG4_VIDEO_OBJ_FIRST = 0x00,
+ GST_MPEG4_VIDEO_OBJ_LAST = 0x1f,
+ GST_MPEG4_VIDEO_LAYER_FIRST = 0x20,
+ GST_MPEG4_VIDEO_LAYER_LAST = 0x2f,
+ GST_MPEG4_VISUAL_OBJ_SEQ_START = 0xb0,
+ GST_MPEG4_VISUAL_OBJ_SEQ_END = 0xb1,
+ GST_MPEG4_USER_DATA = 0xb2,
+ GST_MPEG4_GROUP_OF_VOP = 0xb3,
+ GST_MPEG4_VIDEO_SESSION_ERR = 0xb4,
+ GST_MPEG4_VISUAL_OBJ = 0xb5,
+ GST_MPEG4_VIDEO_OBJ_PLANE = 0xb6,
+ GST_MPEG4_FBA = 0xba,
+ GST_MPEG4_FBA_PLAN = 0xbb,
+ GST_MPEG4_MESH = 0xbc,
+ GST_MPEG4_MESH_PLAN = 0xbd,
+ GST_MPEG4_STILL_TEXTURE_OBJ = 0xbe,
+ GST_MPEG4_TEXTURE_SPATIAL = 0xbf,
+ GST_MPEG4_TEXTURE_SNR_LAYER = 0xc0,
+ GST_MPEG4_TEXTURE_TILE = 0xc1,
+ GST_MPEG4_SHAPE_LAYER = 0xc2,
+ GST_MPEG4_STUFFING = 0xc3,
+ GST_MPEG4_SYSTEM_FIRST = 0xc6,
+ GST_MPEG4_SYSTEM_LAST = 0xff,
+ GST_MPEG4_RESYNC = 0xfff
+} GstMpeg4StartCode;
+
+/**
+ * GstMpeg4VisualObjectType:
+ *
+ * Defines the different visual object types as
+ * defined in: Table 6-5 -- Meaning of visual object type
+ */
+typedef enum {
+ GST_MPEG4_VIDEO_ID = 0x01,
+ GST_MPEG4_STILL_TEXTURE_ID = 0x02,
+ GST_MPEG4_STILL_MESH_ID = 0x03,
+ GST_MPEG4_STILL_FBA_ID = 0x04,
+ GST_MPEG4_STILL_3D_MESH_ID = 0x05,
+ /*... reserved */
+
+} GstMpeg4VisualObjectType;
+
+/**
+ * GstMpeg4AspectRatioInfo:
+ * @GST_MPEG4_SQUARE: 1:1 square
+ * @GST_MPEG4_625_TYPE_4_3: 12:11 (625-type for 4:3 picture)
+ * @GST_MPEG4_525_TYPE_4_3: 10:11 (525-type for 4:3 picture)
+ * @GST_MPEG4_625_TYPE_16_9: 16:11 (625-type stretched for 16:9 picture)
+ * @GST_MPEG4_525_TYPE_16_9: 40:33 (525-type stretched for 16:9 picture)
+ * @GST_MPEG4_EXTENDED_PAR: Extended par
+ *
+ * Defines the different pixel aspect ratios as
+ * defined in: Table 6-12 -- Meaning of pixel aspect ratio
+ */
+typedef enum {
+ GST_MPEG4_SQUARE = 0x01,
+ GST_MPEG4_625_TYPE_4_3 = 0x02,
+ GST_MPEG4_525_TYPE_4_3 = 0x03,
+ GST_MPEG4_625_TYPE_16_9 = 0x04,
+ GST_MPEG4_525_TYPE_16_9 = 0x05,
+ GST_MPEG4_EXTENDED_PAR = 0x0f,
+} GstMpeg4AspectRatioInfo;
+
+/**
+ * GstMpeg4ParseResult:
+ * @GST_MPEG4_PARSER_OK: The parsing went well
+ * @GST_MPEG4_PARSER_BROKEN_DATA: The bitstream was broken
+ * @GST_MPEG4_PARSER_NO_PACKET: There was no packet in the buffer
+ * @GST_MPEG4_PARSER_NO_PACKET_END: There was no packet end in the buffer
+ * @GST_MPEG4_PARSER_NO_PACKET_ERROR: An error accured durint the parsing
+ *
+ * Result type of any parsing function.
+ */
+typedef enum {
+ GST_MPEG4_PARSER_OK,
+ GST_MPEG4_PARSER_BROKEN_DATA,
+ GST_MPEG4_PARSER_NO_PACKET,
+ GST_MPEG4_PARSER_NO_PACKET_END,
+ GST_MPEG4_PARSER_ERROR,
+} GstMpeg4ParseResult;
+
+/**
+ * GstMpeg4VideoObjectCodingType:
+ * @GST_MPEG4_I_VOP: intra-coded (I)
+ * @GST_MPEG4_P_VOP: predictive-coded (P)
+ * @GST_MPEG4_B_VOP: bidirectionally-predictive-coded (B)
+ * @GST_MPEG4_S_VOP: sprite (S)
+ *
+ * The vop coding types as defined in:
+ * Table 6-20 -- Meaning of vop_coding_type
+ */
+typedef enum {
+ GST_MPEG4_I_VOP = 0x0,
+ GST_MPEG4_P_VOP = 0x1,
+ GST_MPEG4_B_VOP = 0x2,
+ GST_MPEG4_S_VOP = 0x3
+} GstMpeg4VideoObjectCodingType;
+
+/**
+ * GstMpeg4ChromaFormat:
+ *
+ * The chroma format in use as
+ * defined in: Table 6-13 -- Meaning of chroma_format
+ */
+typedef enum {
+ /* Other value are reserved */
+ GST_MPEG4_CHROMA_4_2_0 = 0x01
+} GstMpeg4ChromaFormat;
+
+/**
+ * GstMpeg4VideoObjectLayerShape:
+ *
+ * The different video object layer shapes as defined in:
+ * Table 6-16 — Video Object Layer shape type
+ */
+typedef enum {
+ GST_MPEG4_RECTANGULAR,
+ GST_MPEG4_BINARY,
+ GST_MPEG4_BINARY_ONLY,
+ GST_MPEG4_GRAYSCALE
+} GstMpeg4VideoObjectLayerShape;
+
+/**
+ * GstMpeg4SpriteEnable:
+ *
+ * Indicates the usage of static sprite coding
+ * or global motion compensation (GMC) as defined in:
+ * Table V2 - 2 -- Meaning of sprite_enable codewords
+ */
+typedef enum {
+ GST_MPEG4_SPRITE_UNUSED,
+ GST_MPEG4_SPRITE_STATIC,
+ GST_MPEG4_SPRITE_GMG
+} GstMpeg4SpriteEnable;
+
+/**
+ * GstMpeg4Profile:
+ *
+ * Different defined profiles as defined in:
+ * 9- Profiles and levels
+ *
+ * It is computed using:
+ * Table G.1 — FLC table for profile_and_level_indication
+ */
+typedef enum {
+ GST_MPEG4_PROFILE_CORE,
+ GST_MPEG4_PROFILE_MAIN,
+ GST_MPEG4_PROFILE_N_BIT,
+ GST_MPEG4_PROFILE_SIMPLE,
+ GST_MPEG4_PROFILE_HYBRID,
+ GST_MPEG4_PROFILE_RESERVED,
+ GST_MPEG4_PROFILE_SIMPLE_FBA,
+ GST_MPEG4_PROFILE_CORE_STUDIO,
+ GST_MPEG4_PROFILE_SIMPLE_STUDIO,
+ GST_MPEG4_PROFILE_CORE_SCALABLE,
+ GST_MPEG4_PROFILE_ADVANCED_CORE,
+ GST_MPEG4_PROFILE_ADVANCED_SIMPLE,
+ GST_MPEG4_PROFILE_SIMPLE_SCALABLE,
+ GST_MPEG4_PROFILE_SCALABLE_TEXTURE,
+ GST_MPEG4_PROFILE_SIMPLE_FACE_ANIMATION,
+ GST_MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE,
+ GST_MPEG4_PROFILE_ADVANCED_REALTIME_SIMPLE,
+ GST_MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE,
+ GST_MPEG4_PROFILE_FINE_GRANULARITY_SCALABLE,
+ GST_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY
+} GstMpeg4Profile;
+
+/**
+ * GstMpeg4Level:
+ *
+ * Different levels as defined in:
+ * 9- Profiles and levels
+ *
+ * It is computed using:
+ * Table G.1 — FLC table for profile_and_level_indication
+ */
+typedef enum {
+ GST_MPEG4_LEVEL0,
+ GST_MPEG4_LEVEL1,
+ GST_MPEG4_LEVEL2,
+ GST_MPEG4_LEVEL3,
+ GST_MPEG4_LEVEL3b,
+ GST_MPEG4_LEVEL4,
+ GST_MPEG4_LEVEL5,
+ GST_MPEG4_LEVEL_RESERVED
+} GstMpeg4Level;
+
+/**
+ * GstMpeg4VisualObjectSequence:
+ *
+ * The visual object sequence structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object
+ */
+struct _GstMpeg4VisualObjectSequence {
+ guint8 profile_and_level_indication;
+
+ /* Computed according to:
+ * Table G.1 — FLC table for profile_and_level_indication */
+ GstMpeg4Level level;
+ GstMpeg4Profile profile;
+};
+
+/**
+ * GstMpeg4VisualObject:
+ *
+ * The visual object structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object
+ */
+struct _GstMpeg4VisualObject {
+ guint8 is_identifier;
+ /* If is_identifier */
+ guint8 verid;
+ guint8 priority;
+
+ GstMpeg4VisualObjectType type;
+};
+
+/**
+ * GstMpeg4VideoSignalType:
+ *
+ * The video signal type structure as defined in:
+ * 6.2.2 Visual Object Sequence and Visual Object.
+ */
+struct _GstMpeg4VideoSignalType {
+ guint8 type;
+
+ guint8 format;
+ guint8 range;
+ guint8 color_description;
+ guint8 color_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+};
+
+/**
+ * GstMpeg4VideoPlaneShortHdr:
+ *
+ * The video plane short header structure as defined in:
+ * 6.2.5.2 Video Plane with Short Header
+ */
+struct _GstMpeg4VideoPlaneShortHdr {
+ guint8 temporal_reference;
+ guint8 split_screen_indicator;
+ guint8 document_camera_indicator;
+ guint8 full_picture_freeze_release;
+ guint8 source_format;
+ guint8 picture_coding_type;
+ guint8 vop_quant;
+ guint8 pei;
+ guint8 psupp;
+
+ /* Gob layer specific fields */
+ guint8 gob_header_empty;
+ guint8 gob_number;
+ guint8 gob_frame_id;
+ guint8 quant_scale;
+
+ /* Computed
+ * If all the values are set to 0, then it is reserved
+ * Table 6-25 -- Parameters Defined by source_format Field
+ */
+ guint16 vop_width;
+ guint16 vop_height;
+ guint16 num_macroblocks_in_gob;
+ guint8 num_gobs_in_vop;
+
+ /* The size in bits */
+ guint size;
+};
+
+/**
+ * GstMpeg4VideoObjectLayer:
+ *
+ * The video object layer structure as defined in:
+ * 6.2.3 Video Object Layer
+ */
+struct _GstMpeg4VideoObjectLayer {
+ guint8 random_accessible_vol;
+ guint8 video_object_type_indication;
+
+ guint8 is_object_layer_identifier;
+ /* if is_object_layer_identifier */
+ guint8 verid;
+ guint8 priority;
+
+ GstMpeg4AspectRatioInfo aspect_ratio_info;
+ guint8 par_width;
+ guint8 par_height;
+
+ guint8 control_parameters;
+ /* if control_parameters */
+ GstMpeg4ChromaFormat chroma_format;
+ guint8 low_delay;
+ guint8 vbv_parameters;
+ /* if vbv_parameters */
+ guint16 first_half_bitrate;
+ guint16 latter_half_bitrate;
+ guint16 first_half_vbv_buffer_size;
+ guint16 latter_half_vbv_buffer_size;
+ guint16 first_half_vbv_occupancy;
+ guint16 latter_half_vbv_occupancy;
+
+ /* Computed values */
+ guint32 bit_rate;
+ guint32 vbv_buffer_size;
+
+ GstMpeg4VideoObjectLayerShape shape;
+ /* if shape == GST_MPEG4_GRAYSCALE && verid =! 1 */
+ guint8 shape_extension;
+
+ guint16 vop_time_increment_resolution;
+ guint8 vop_time_increment_bits;
+ guint8 fixed_vop_rate;
+ /* if fixed_vop_rate */
+ guint16 fixed_vop_time_increment;
+
+ guint16 width;
+ guint16 height;
+ guint8 interlaced;
+ guint8 obmc_disable;
+
+ GstMpeg4SpriteEnable sprite_enable;
+ /* if vol->sprite_enable == SPRITE_GMG or SPRITE_STATIC*/
+ /* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
+ guint16 sprite_width;
+ guint16 sprite_height;
+ guint16 sprite_left_coordinate;
+ guint16 sprite_top_coordinate;
+
+ guint8 no_of_sprite_warping_points;
+ guint8 sprite_warping_accuracy;
+ guint8 sprite_brightness_change;
+ /* if vol->sprite_enable != GST_MPEG4_SPRITE_GMG */
+ guint8 low_latency_sprite_enable;
+
+ /* if shape != GST_MPEG4_RECTANGULAR */
+ guint8 sadct_disable;
+
+ guint8 not_8_bit;
+
+ /* if no_8_bit */
+ guint8 quant_precision;
+ guint8 bits_per_pixel;
+
+ /* if shape == GRAYSCALE */
+ guint8 no_gray_quant_update;
+ guint8 composition_method;
+ guint8 linear_composition;
+
+ guint8 quant_type;
+ /* if quant_type */
+ guint8 load_intra_quant_mat;
+ guint8 intra_quant_mat[64];
+ guint8 load_non_intra_quant_mat;
+ guint8 non_intra_quant_mat[64];
+
+ guint8 quarter_sample;
+ guint8 complexity_estimation_disable;
+ guint8 resync_marker_disable;
+ guint8 data_partitioned;
+ guint8 reversible_vlc;
+ guint8 newpred_enable;
+ guint8 reduced_resolution_vop_enable;
+ guint8 scalability;
+ guint8 enhancement_type;
+
+ GstMpeg4VideoPlaneShortHdr short_hdr;
+};
+
+/**
+ * GstMpeg4SpriteTrajectory:
+ *
+ * The sprite trajectory structure as defined in:
+ * 7.8.4 Sprite reference point decoding and
+ * 6.2.5.4 Sprite coding
+ */
+struct _GstMpeg4SpriteTrajectory {
+ guint16 vop_ref_points[63]; /* Defined as "du" in 6.2.5.4 */
+ guint16 sprite_ref_points[63]; /* Defined as "dv" in 6.2.5.4 */
+};
+
+/**
+ * GstMpeg4GroupOfVOP:
+ *
+ * The group of video object plane structure as defined in:
+ * 6.2.4 Group of Video Object Plane
+ */
+struct _GstMpeg4GroupOfVOP {
+ guint8 hours;
+ guint8 minutes;
+ guint8 seconds;
+
+ guint8 closed;
+ guint8 broken_link;
+};
+
+/**
+ * GstMpeg4VideoObjectPlane:
+ *
+ * The Video object plane structure as defined in:
+ * 6.2.5 Video Object Plane and Video Plane with Short Header
+ */
+struct _GstMpeg4VideoObjectPlane {
+ GstMpeg4VideoObjectCodingType coding_type;
+
+ guint8 modulo_time_base;
+ guint16 time_increment;
+
+ guint8 coded;
+ /* if newpred_enable */
+ guint16 id;
+ guint8 id_for_prediction_indication;
+ guint16 id_for_prediction;
+
+ guint16 width;
+ guint16 height;
+ guint16 horizontal_mc_spatial_ref;
+ guint16 vertical_mc_spatial_ref;
+
+ guint8 rounding_type;
+ /*if vol->shape != GST_MPEG4_RECTANGULAR */
+ guint8 background_composition;
+ guint8 change_conv_ratio_disable;
+ guint8 constant_alpha;
+ guint8 constant_alpha_value;
+ guint8 reduced_resolution;
+
+ guint8 intra_dc_vlc_thr;
+
+
+ guint8 top_field_first;
+ guint8 alternate_vertical_scan_flag;
+
+ guint16 quant;
+
+ guint8 fcode_forward;
+ guint8 fcode_backward;
+
+ guint8 shape_coding_type;
+ guint8 load_backward_shape;
+ guint8 ref_select_code;
+
+ /* Computed macroblock information */
+ guint16 mb_height;
+ guint16 mb_width;
+ guint mb_num;
+
+ /* The size of the header */
+ guint size;
+};
+
+/**
+ * GstMpeg4VideoPacketHdr:
+ * @size: Size of the header in bit.
+ *
+ * The video packet header structure as defined in:
+ * 6.2.5.2 Video Plane with Short Header
+ */
+struct _GstMpeg4VideoPacketHdr {
+ guint8 header_extension_code;
+ guint16 macroblock_number;
+ guint16 quant_scale;
+ guint size;
+};
+
+/**
+ * GstMpeg4Packet:
+ * @type: the type of the packet that start at @offset
+ * @data: the data containing packet starting at @offset
+ * @offset: offset of the start of the packet (without the 3 bytes startcode), but
+ * including the #GstMpeg4StartCode byte.
+ * @size: The size in bytes of the packet or %G_MAXUINT if the end wasn't found.
+ * @marker_size: The size in bit of the resync marker.
+ *
+ * A structure that contains the type of a packet, its offset and its size
+ */
+struct _GstMpeg4Packet
+{
+ const guint8 *data;
+ guint offset;
+ gsize size;
+ guint marker_size;
+
+ GstMpeg4StartCode type;
+};
+
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult gst_h263_parse (GstMpeg4Packet * packet,
+ const guint8 * data, guint offset,
+ gsize size);
+
+
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult gst_mpeg4_parse (GstMpeg4Packet * packet,
+ gboolean skip_user_data,
+ GstMpeg4VideoObjectPlane *vop,
+ const guint8 * data, guint offset,
+ gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_object_plane (GstMpeg4VideoObjectPlane *vop,
+ GstMpeg4SpriteTrajectory *sprite_trajectory,
+ GstMpeg4VideoObjectLayer *vol,
+ const guint8 * data,
+ gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_group_of_vop (GstMpeg4GroupOfVOP *gov,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_object_layer (GstMpeg4VideoObjectLayer *vol,
+ GstMpeg4VisualObject *vo,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_visual_object (GstMpeg4VisualObject *vo,
+ GstMpeg4VideoSignalType *signal_type,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_visual_object_sequence (GstMpeg4VisualObjectSequence *vos,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_plane_short_header (GstMpeg4VideoPlaneShortHdr * shorthdr,
+ const guint8 * data, gsize size);
+GST_CODEC_PARSERS_API
+GstMpeg4ParseResult
+gst_mpeg4_parse_video_packet_header (GstMpeg4VideoPacketHdr * videopackethdr,
+ GstMpeg4VideoObjectLayer * vol,
+ GstMpeg4VideoObjectPlane * vop,
+ GstMpeg4SpriteTrajectory * sprite_trajectory,
+ const guint8 * data, gsize size);
+
+G_END_DECLS
+
+#endif /* __GST_MPEG4UTIL_H__ */
diff --git a/include/gst/codecparsers/gstmpegvideometa.h b/include/gst/codecparsers/gstmpegvideometa.h
new file mode 100644
index 0000000000..df33d97666
--- /dev/null
+++ b/include/gst/codecparsers/gstmpegvideometa.h
@@ -0,0 +1,92 @@
+/* Gstreamer
+ * Copyright (C) <2012> Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MPEG_VIDEO_META_H__
+#define __GST_MPEG_VIDEO_META_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Mpeg video parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/gstmpegvideoparser.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpegVideoMeta GstMpegVideoMeta;
+
+GST_CODEC_PARSERS_API
+GType gst_mpeg_video_meta_api_get_type (void);
+#define GST_MPEG_VIDEO_META_API_TYPE (gst_mpeg_video_meta_api_get_type())
+#define GST_MPEG_VIDEO_META_INFO (gst_mpeg_video_meta_get_info())
+GST_CODEC_PARSERS_API
+const GstMetaInfo * gst_mpeg_video_meta_get_info (void);
+
+/**
+ * GstMpegVideoMeta:
+ * @meta: parent #GstMeta
+ * @sequencehdr: the #GstMpegVideoSequenceHdr if present in the buffer
+ * @sequenceext: the #GstMpegVideoSequenceExt if present in the buffer
+ * @sequencedispext: the #GstMpegVideoSequenceDisplayExt if present in the
+ * buffer.
+ * @pichdr: the #GstMpegVideoPictureHdr if present in the buffer.
+ * @picext: the #GstMpegVideoPictureExt if present in the buffer.
+ * @quantext: the #GstMpegVideoQuantMatrixExt if present in the buffer
+ *
+ * Extra buffer metadata describing the contents of a MPEG1/2 Video frame
+ *
+ * Can be used by elements (mainly decoders) to avoid having to parse
+ * Mpeg video 1/2 packets if it can be done upstream.
+ *
+ * The various fields are only valid during the lifetime of the #GstMpegVideoMeta.
+ * If elements wish to use those for longer, they are required to make a copy.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoMeta {
+ GstMeta meta;
+
+ GstMpegVideoSequenceHdr *sequencehdr;
+ GstMpegVideoSequenceExt *sequenceext;
+ GstMpegVideoSequenceDisplayExt *sequencedispext;
+ GstMpegVideoPictureHdr *pichdr;
+ GstMpegVideoPictureExt *picext;
+ GstMpegVideoQuantMatrixExt *quantext;
+
+ guint num_slices;
+ gsize slice_offset;
+};
+
+
+#define gst_buffer_get_mpeg_video_meta(b) ((GstMpegVideoMeta*)gst_buffer_get_meta((b),GST_MPEG_VIDEO_META_API_TYPE))
+
+GST_CODEC_PARSERS_API
+GstMpegVideoMeta *
+gst_buffer_add_mpeg_video_meta (GstBuffer * buffer,
+ const GstMpegVideoSequenceHdr *seq_hdr,
+ const GstMpegVideoSequenceExt *seq_ext,
+ const GstMpegVideoSequenceDisplayExt *disp_ext,
+ const GstMpegVideoPictureHdr *pic_hdr,
+ const GstMpegVideoPictureExt *pic_ext,
+ const GstMpegVideoQuantMatrixExt *quant_ext);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gstmpegvideoparser.h b/include/gst/codecparsers/gstmpegvideoparser.h
new file mode 100644
index 0000000000..008e67a150
--- /dev/null
+++ b/include/gst/codecparsers/gstmpegvideoparser.h
@@ -0,0 +1,570 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * From bad/sys/vdpau/mpeg/mpegutil.c:
+ * Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
+ * Copyright (C) <2009> Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MPEG_VIDEO_UTILS_H__
+#define __GST_MPEG_VIDEO_UTILS_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Mpeg video parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegVideoPacketTypeCode:
+ * @GST_MPEG_VIDEO_PACKET_PICTURE: Picture packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SLICE_MIN: Slice min packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SLICE_MAX: Slice max packet starting code
+ * @GST_MPEG_VIDEO_PACKET_USER_DATA: User data packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SEQUENCE : Sequence packet starting code
+ * @GST_MPEG_VIDEO_PACKET_EXTENSION: Extension packet starting code
+ * @GST_MPEG_VIDEO_PACKET_SEQUENCE_END: Sequence end packet code
+ * @GST_MPEG_VIDEO_PACKET_GOP: Group of Picture packet starting code
+ * @GST_MPEG_VIDEO_PACKET_NONE: None packet code
+ *
+ * Indicates the type of MPEG packet
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PACKET_PICTURE = 0x00,
+ GST_MPEG_VIDEO_PACKET_SLICE_MIN = 0x01,
+ GST_MPEG_VIDEO_PACKET_SLICE_MAX = 0xaf,
+ GST_MPEG_VIDEO_PACKET_USER_DATA = 0xb2,
+ GST_MPEG_VIDEO_PACKET_SEQUENCE = 0xb3,
+ GST_MPEG_VIDEO_PACKET_EXTENSION = 0xb5,
+ GST_MPEG_VIDEO_PACKET_SEQUENCE_END = 0xb7,
+ GST_MPEG_VIDEO_PACKET_GOP = 0xb8,
+ GST_MPEG_VIDEO_PACKET_NONE = 0xff
+} GstMpegVideoPacketTypeCode;
+
+/**
+ * GST_MPEG_VIDEO_PACKET_IS_SLICE:
+ * @typecode: The MPEG video packet type code
+ *
+ * Checks whether a packet type code is a slice.
+ *
+ * Returns: %TRUE if the packet type code corresponds to a slice,
+ * else %FALSE.
+ */
+#define GST_MPEG_VIDEO_PACKET_IS_SLICE(typecode) ((typecode) >= GST_MPEG_VIDEO_PACKET_SLICE_MIN && \
+ (typecode) <= GST_MPEG_VIDEO_PACKET_SLICE_MAX)
+
+/**
+ * GstMpegVideoPacketExtensionCode:
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE: Sequence extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY: Sequence Display extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX: Quantization Matrix extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE: Sequence Scalable extension code
+ * @GST_MPEG_VIDEO_PACKET_EXT_PICTURE: Picture coding extension
+ *
+ * Indicates what type of packets are in this block, some are mutually
+ * exclusive though - ie, sequence packs are accumulated separately. GOP &
+ * Picture may occur together or separately.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE = 0x01,
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_DISPLAY = 0x02,
+ GST_MPEG_VIDEO_PACKET_EXT_QUANT_MATRIX = 0x03,
+ GST_MPEG_VIDEO_PACKET_EXT_SEQUENCE_SCALABLE = 0x05,
+ GST_MPEG_VIDEO_PACKET_EXT_PICTURE = 0x08
+} GstMpegVideoPacketExtensionCode;
+
+/**
+ * GstMpegVideoSequenceScalableMode:
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING: Data partitioning
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL: Spatial Scalability
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR: SNR Scalability
+ * @GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL: Temporal Scalability
+ */
+typedef enum {
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_DATA_PARTITIONING = 0x00,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SPATIAL = 0x01,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_SNR = 0x02,
+ GST_MPEG_VIDEO_SEQ_SCALABLE_MODE_TEMPORAL = 0x03
+} GstMpegVideoSequenceScalableMode;
+
+/**
+ * GstMpegVideoLevel:
+ * @GST_MPEG_VIDEO_LEVEL_LOW: Low level (LL)
+ * @GST_MPEG_VIDEO_LEVEL_MAIN: Main level (ML)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH_1440: High 1440 level (H-14)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH: High level (HL)
+ * @GST_MPEG_VIDEO_LEVEL_HIGH_P: High-P level (HL Progressive)
+ *
+ * Mpeg-2 Levels.
+ **/
+typedef enum {
+ GST_MPEG_VIDEO_LEVEL_HIGH_P = 0x02,
+ GST_MPEG_VIDEO_LEVEL_HIGH = 0x04,
+ GST_MPEG_VIDEO_LEVEL_HIGH_1440 = 0x06,
+ GST_MPEG_VIDEO_LEVEL_MAIN = 0x08,
+ GST_MPEG_VIDEO_LEVEL_LOW = 0x0a
+} GstMpegVideoLevel;
+
+/**
+ * GstMpegVideoProfile:
+ * @GST_MPEG_VIDEO_PROFILE_422: 4:2:2 profile (422)
+ * @GST_MPEG_VIDEO_PROFILE_HIGH: High profile (HP)
+ * @GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE: Spatially Scalable profile (Spatial)
+ * @GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE: SNR Scalable profile (SNR)
+ * @GST_MPEG_VIDEO_PROFILE_MAIN: Main profile (MP)
+ * @GST_MPEG_VIDEO_PROFILE_SIMPLE: Simple profile (SP)
+ *
+ * Mpeg-2 Profiles.
+ **/
+typedef enum {
+ GST_MPEG_VIDEO_PROFILE_422 = 0x00,
+ GST_MPEG_VIDEO_PROFILE_HIGH = 0x01,
+ GST_MPEG_VIDEO_PROFILE_SPATIALLY_SCALABLE = 0x02,
+ GST_MPEG_VIDEO_PROFILE_SNR_SCALABLE = 0x03,
+ GST_MPEG_VIDEO_PROFILE_MAIN = 0x04,
+ GST_MPEG_VIDEO_PROFILE_SIMPLE = 0x05
+} GstMpegVideoProfile;
+
+/**
+ * GstMpegVideoChromaFormat:
+ * @GST_MPEG_VIDEO_CHROMA_RES: Invalid (reserved for future use)
+ * @GST_MPEG_VIDEO_CHROMA_420: 4:2:0 subsampling
+ * @GST_MPEG_VIDEO_CHROMA_422: 4:2:2 subsampling
+ * @GST_MPEG_VIDEO_CHROMA_444: 4:4:4 (non-subsampled)
+ *
+ * Chroma subsampling type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_CHROMA_RES = 0x00,
+ GST_MPEG_VIDEO_CHROMA_420 = 0x01,
+ GST_MPEG_VIDEO_CHROMA_422 = 0x02,
+ GST_MPEG_VIDEO_CHROMA_444 = 0x03,
+} GstMpegVideoChromaFormat;
+
+/**
+ * GstMpegVideoPictureType:
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_I: Intra-coded (I) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_P: Predictive-codec (P) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_B: Bidirectionally predictive-coded (B) frame
+ * @GST_MPEG_VIDEO_PICTURE_TYPE_D: D frame
+ *
+ * Picture type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PICTURE_TYPE_I = 0x01,
+ GST_MPEG_VIDEO_PICTURE_TYPE_P = 0x02,
+ GST_MPEG_VIDEO_PICTURE_TYPE_B = 0x03,
+ GST_MPEG_VIDEO_PICTURE_TYPE_D = 0x04
+} GstMpegVideoPictureType;
+
+/**
+ * GstMpegVideoPictureStructure:
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD: Top field
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD: Bottom field
+ * @GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME: Frame picture
+ *
+ * Picture structure type.
+ */
+typedef enum {
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD = 0x01,
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02,
+ GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME = 0x03
+} GstMpegVideoPictureStructure;
+
+typedef struct _GstMpegVideoSequenceHdr GstMpegVideoSequenceHdr;
+typedef struct _GstMpegVideoSequenceExt GstMpegVideoSequenceExt;
+typedef struct _GstMpegVideoSequenceDisplayExt GstMpegVideoSequenceDisplayExt;
+typedef struct _GstMpegVideoSequenceScalableExt GstMpegVideoSequenceScalableExt;
+typedef struct _GstMpegVideoPictureHdr GstMpegVideoPictureHdr;
+typedef struct _GstMpegVideoGop GstMpegVideoGop;
+typedef struct _GstMpegVideoPictureExt GstMpegVideoPictureExt;
+typedef struct _GstMpegVideoQuantMatrixExt GstMpegVideoQuantMatrixExt;
+typedef struct _GstMpegVideoSliceHdr GstMpegVideoSliceHdr;
+typedef struct _GstMpegVideoPacket GstMpegVideoPacket;
+
+/**
+ * GstMpegVideoSequenceHdr:
+ * @width: Width of each frame
+ * @height: Height of each frame
+ * @par_w: Calculated Pixel Aspect Ratio width
+ * @par_h: Calculated Pixel Aspect Ratio height
+ * @fps_n: Calculated Framrate nominator
+ * @fps_d: Calculated Framerate denominator
+ * @bitrate_value: Value of the bitrate as is in the stream (400bps unit)
+ * @bitrate: the real bitrate of the Mpeg video stream in bits per second, 0 if VBR stream
+ * @constrained_parameters_flag: %TRUE if this stream uses constrained parameters.
+ * @load_intra_quantiser_matrix: %TRUE indicates the presence of intra_quantiser_matrix
+ * @intra_quantizer_matrix: intra-quantization table, in zigzag scan order
+ * @load_non_intra_quantiser_matrix: %TRUE indicates the presence of non_intra_quantiser_matrix
+ * @non_intra_quantizer_matrix: non-intra quantization table, in zigzag scan order
+ *
+ * The Mpeg2 Video Sequence Header structure.
+ */
+struct _GstMpegVideoSequenceHdr
+{
+ guint16 width, height;
+ guint8 aspect_ratio_info;
+ guint8 frame_rate_code;
+ guint32 bitrate_value;
+ guint16 vbv_buffer_size_value;
+
+ guint8 constrained_parameters_flag;
+
+ guint8 load_intra_quantiser_matrix;
+ guint8 intra_quantizer_matrix[64];
+ guint8 load_non_intra_quantiser_matrix;
+ guint8 non_intra_quantizer_matrix[64];
+
+ /* Calculated values */
+ guint par_w, par_h;
+ guint fps_n, fps_d;
+ guint bitrate;
+};
+
+/**
+ * GstMpegVideoSequenceExt:
+ * @profile: mpeg2 decoder profile
+ * @level: mpeg2 decoder level
+ * @progressive: %TRUE if the frames are progressive %FALSE otherwise
+ * @chroma_format: indicates the chrominance format
+ * @horiz_size_ext: Horizontal size
+ * @vert_size_ext: Vertical size
+ * @bitrate_ext: The bitrate
+ * @vbv_buffer_size_extension: VBV buffer size
+ * @low_delay: %TRUE if the sequence doesn't contain any B-pictures, %FALSE
+ * otherwise
+ * @fps_n_ext: Framerate nominator code
+ * @fps_d_ext: Framerate denominator code
+ * @profile_level_escape_bit: Escape bit. If set, the meaning of the
+ * @profile and @level fields is different.
+ *
+ * The Mpeg2 Video Sequence Extension structure.
+ **/
+struct _GstMpegVideoSequenceExt
+{
+ /* mpeg2 decoder profile */
+ guint8 profile;
+ /* mpeg2 decoder level */
+ guint8 level;
+
+ guint8 progressive;
+ guint8 chroma_format;
+
+ guint8 horiz_size_ext, vert_size_ext;
+
+ guint16 bitrate_ext;
+ guint8 vbv_buffer_size_extension;
+ guint8 low_delay;
+ guint8 fps_n_ext, fps_d_ext;
+
+ /* Additional information */
+ guint8 profile_level_escape_bit;
+};
+
+/**
+ * GstMpegVideoSequenceDisplayExt:
+ * @video_format: 3-bit video_format field indicating PAL/NTSC etc.
+ * @colour_description_flag: %TRUE if colour information was provided
+ * @colour_primaries: Valid if colour_description_flag is set
+ * @transfer_characteristics: Valid if colour_description_flag is set
+ * @matrix_coefficients: Valid if colour_description_flag is set
+ * @display_horizontal_size: width of decoded frame sub-region to display
+ * @display_vertical_size: height of decoded frame sub-region to display
+ */
+struct _GstMpegVideoSequenceDisplayExt
+{
+ guint8 video_format;
+ guint8 colour_description_flag;
+
+ /* if colour_description_flag: */
+ guint8 colour_primaries;
+ guint8 transfer_characteristics;
+ guint8 matrix_coefficients;
+
+ guint16 display_horizontal_size;
+ guint16 display_vertical_size;
+};
+
+/**
+ * GstMpegVideoSequenceScalableExt:
+ * @scalable_mode:
+ * @layer_id:
+ * @lower_layer_prediction_horizontal_size:
+ * @lower_layer_prediction_vertical_size:
+ * @horizontal_subsampling_factor_m:
+ * @horizontal_subsampling_factor_n:
+ * @vertical_subsampling_factor_m:
+ * @vertical_subsampling_factor_n:
+ * @picture_mux_enable:
+ * @mux_to_progressive_sequence:
+ * @picture_mux_order:
+ * @picture_mux_factor:
+ *
+ * The Sequence Scalable Extension structure.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoSequenceScalableExt
+{
+ guint8 scalable_mode;
+ guint8 layer_id;
+
+ /* if spatial scalability */
+ guint16 lower_layer_prediction_horizontal_size;
+ guint16 lower_layer_prediction_vertical_size;
+ guint8 horizontal_subsampling_factor_m;
+ guint8 horizontal_subsampling_factor_n;
+ guint8 vertical_subsampling_factor_m;
+ guint8 vertical_subsampling_factor_n;
+
+ /* if temporal scalability */
+ guint8 picture_mux_enable;
+ guint8 mux_to_progressive_sequence;
+ guint8 picture_mux_order;
+ guint8 picture_mux_factor;
+};
+
+/**
+ * GstMpegVideoQuantMatrixExt:
+ * @load_intra_quantiser_matrix:
+ * @intra_quantiser_matrix:
+ * @load_non_intra_quantiser_matrix:
+ * @non_intra_quantiser_matrix:
+ * @load_chroma_intra_quantiser_matrix:
+ * @chroma_intra_quantiser_matrix:
+ * @load_chroma_non_intra_quantiser_matrix:
+ * @chroma_non_intra_quantiser_matrix:
+ *
+ * The Quant Matrix Extension structure that exposes quantization
+ * matrices in zigzag scan order. i.e. the original encoded scan
+ * order.
+ */
+struct _GstMpegVideoQuantMatrixExt
+{
+ guint8 load_intra_quantiser_matrix;
+ guint8 intra_quantiser_matrix[64];
+ guint8 load_non_intra_quantiser_matrix;
+ guint8 non_intra_quantiser_matrix[64];
+ guint8 load_chroma_intra_quantiser_matrix;
+ guint8 chroma_intra_quantiser_matrix[64];
+ guint8 load_chroma_non_intra_quantiser_matrix;
+ guint8 chroma_non_intra_quantiser_matrix[64];
+};
+
+/**
+ * GstMpegVideoPictureHdr:
+ * @tsn: Temporal Sequence Number
+ * @pic_type: Type of the frame
+ * @full_pel_forward_vector: the full pel forward flag of
+ * the frame: 0 or 1.
+ * @full_pel_backward_vector: the full pel backward flag
+ * of the frame: 0 or 1.
+ * @f_code: F code
+ *
+ * The Mpeg2 Video Picture Header structure.
+ */
+struct _GstMpegVideoPictureHdr
+{
+ guint16 tsn;
+ guint8 pic_type;
+ guint16 vbv_delay;
+
+ guint8 full_pel_forward_vector, full_pel_backward_vector;
+
+ guint8 f_code[2][2];
+};
+
+/**
+ * GstMpegVideoPictureExt:
+ * @intra_dc_precision: Intra DC precision
+ * @picture_structure: Structure of the picture
+ * @top_field_first: Top field first
+ * @frame_pred_frame_dct: Frame
+ * @concealment_motion_vectors: Concealment Motion Vectors
+ * @q_scale_type: Q Scale Type
+ * @intra_vlc_format: Intra Vlc Format
+ * @alternate_scan: Alternate Scan
+ * @repeat_first_field: Repeat First Field
+ * @chroma_420_type: Chroma 420 Type
+ * @progressive_frame: %TRUE if the frame is progressive %FALSE otherwise
+ *
+ * The Mpeg2 Video Picture Extension structure.
+ */
+struct _GstMpegVideoPictureExt
+{
+ guint8 f_code[2][2];
+
+ guint8 intra_dc_precision;
+ guint8 picture_structure;
+ guint8 top_field_first;
+ guint8 frame_pred_frame_dct;
+ guint8 concealment_motion_vectors;
+ guint8 q_scale_type;
+ guint8 intra_vlc_format;
+ guint8 alternate_scan;
+ guint8 repeat_first_field;
+ guint8 chroma_420_type;
+ guint8 progressive_frame;
+ guint8 composite_display;
+ guint8 v_axis;
+ guint8 field_sequence;
+ guint8 sub_carrier;
+ guint8 burst_amplitude;
+ guint8 sub_carrier_phase;
+};
+
+/**
+ * GstMpegVideoGop:
+ * @drop_frame_flag: Drop Frame Flag
+ * @hour: Hour (0-23)
+ * @minute: Minute (O-59)
+ * @second: Second (0-59)
+ * @frame: Frame (0-59)
+ * @closed_gop: Closed Gop
+ * @broken_link: Broken link
+ *
+ * The Mpeg Video Group of Picture structure.
+ */
+struct _GstMpegVideoGop
+{
+ guint8 drop_frame_flag;
+
+ guint8 hour, minute, second, frame;
+
+ guint8 closed_gop;
+ guint8 broken_link;
+};
+
+/**
+ * GstMpegVideoSliceHdr:
+ * @vertical_position: slice vertical position
+ * @vertical_position_extension: Extension to slice_vertical_position
+ * @priority_breakpoint: Point where the bitstream shall be partitioned
+ * @quantiser_scale_code: Quantiser value (range: 1-31)
+ * @slice_ext_flag: Slice Extension flag
+ * @intra_slice: Equal to one if all the macroblocks are intra macro blocks.
+ * @slice_picture_id_enable: controls the semantics of slice_picture_id
+ * @slice_picture_id: Intended to aid recovery on severe bursts of
+ * errors for certain types of applications
+ *
+ * The Mpeg2 Video Slice Header structure.
+ *
+ * Since: 1.2
+ */
+struct _GstMpegVideoSliceHdr
+{
+ guint8 vertical_position;
+ guint8 vertical_position_ext;
+
+ guint8 priority_breakpoint;
+ guint8 quantiser_scale_code;
+ guint8 slice_ext_flag;
+ guint8 intra_slice;
+ guint8 slice_picture_id_enable;
+ guint8 slice_picture_id;
+
+ /* Calculated values */
+ guint header_size; /* slice_header size in bits */
+ gint mb_row; /* macroblock row */
+ gint mb_column; /* macroblock column */
+};
+
+/**
+ * GstMpegVideoPacket:
+ * @type: the type of the packet that start at @offset, as a #GstMpegVideoPacketTypeCode
+ * @data: the data containing the packet starting at @offset
+ * @offset: the offset of the packet start in bytes from @data. This is the
+ * start of the packet itself without the sync code
+ * @size: The size in bytes of the packet or -1 if the end wasn't found. This
+ * is the size of the packet itself without the sync code
+ *
+ * A structure that contains the type of a packet, its offset and its size
+ */
+struct _GstMpegVideoPacket
+{
+ const guint8 *data;
+ guint8 type;
+ guint offset;
+ gint size;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_parse (GstMpegVideoPacket * packet,
+ const guint8 * data, gsize size, guint offset);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceHdr * seqhdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceExt * seqext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_display_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceDisplayExt * seqdisplayext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_sequence_scalable_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoSequenceScalableExt * seqscaleext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_picture_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoPictureHdr* pichdr);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_picture_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoPictureExt *picext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_gop (const GstMpegVideoPacket * packet,
+ GstMpegVideoGop * gop);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_slice_header (const GstMpegVideoPacket * packet,
+ GstMpegVideoSliceHdr * slice_hdr,
+ GstMpegVideoSequenceHdr * seq_hdr,
+ GstMpegVideoSequenceScalableExt * seqscaleext);
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_packet_parse_quant_matrix_extension (const GstMpegVideoPacket * packet,
+ GstMpegVideoQuantMatrixExt * quant);
+
+/* seqext and displayext may be NULL if not received */
+
+GST_CODEC_PARSERS_API
+gboolean gst_mpeg_video_finalise_mpeg2_sequence_header (GstMpegVideoSequenceHdr *hdr,
+ GstMpegVideoSequenceExt *seqext, GstMpegVideoSequenceDisplayExt *displayext);
+
+GST_CODEC_PARSERS_API
+void gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+GST_CODEC_PARSERS_API
+void gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8 out_quant[64],
+ const guint8 quant[64]);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/codecparsers/gstvc1parser.h b/include/gst/codecparsers/gstvc1parser.h
new file mode 100644
index 0000000000..47bfbd12b1
--- /dev/null
+++ b/include/gst/codecparsers/gstvc1parser.h
@@ -0,0 +1,656 @@
+/* Gstreamer
+ * Copyright (C) <2011> Intel
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VC1_PARSER_H__
+#define __GST_VC1_PARSER_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VC1 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define MAX_HRD_NUM_LEAKY_BUCKETS 31
+
+/**
+ * GST_VC1_BFRACTION_BASIS:
+ * The @bfraction variable should be divided
+ * by this constant to have the actual value.
+ */
+#define GST_VC1_BFRACTION_BASIS 840
+
+#define GST_VC1_BFRACTION_RESERVED (GST_VC1_BFRACTION_BASIS + 1)
+#define GST_VC1_BFRACTION_PTYPE_BI (GST_VC1_BFRACTION_BASIS + 2)
+
+typedef enum {
+ GST_VC1_END_OF_SEQ = 0x0A,
+ GST_VC1_SLICE = 0x0B,
+ GST_VC1_FIELD = 0x0C,
+ GST_VC1_FRAME = 0x0D,
+ GST_VC1_ENTRYPOINT = 0x0E,
+ GST_VC1_SEQUENCE = 0x0F,
+ GST_VC1_SLICE_USER = 0x1B,
+ GST_VC1_FIELD_USER = 0x1C,
+ GST_VC1_FRAME_USER = 0x1D,
+ GST_VC1_ENTRY_POINT_USER = 0x1E,
+ GST_VC1_SEQUENCE_USER = 0x1F
+} GstVC1StartCode;
+
+typedef enum {
+ GST_VC1_PROFILE_SIMPLE,
+ GST_VC1_PROFILE_MAIN,
+ GST_VC1_PROFILE_RESERVED,
+ GST_VC1_PROFILE_ADVANCED
+} GstVC1Profile;
+
+typedef enum {
+ GST_VC1_PARSER_OK,
+ GST_VC1_PARSER_BROKEN_DATA,
+ GST_VC1_PARSER_NO_BDU,
+ GST_VC1_PARSER_NO_BDU_END,
+ GST_VC1_PARSER_ERROR,
+} GstVC1ParserResult;
+
+typedef enum
+{
+ GST_VC1_PICTURE_TYPE_P,
+ GST_VC1_PICTURE_TYPE_B,
+ GST_VC1_PICTURE_TYPE_I,
+ GST_VC1_PICTURE_TYPE_BI,
+ GST_VC1_PICTURE_TYPE_SKIPPED
+} GstVC1PictureType;
+
+typedef enum
+{
+ GST_VC1_LEVEL_LOW = 0, /* Simple/Main profile low level */
+ GST_VC1_LEVEL_MEDIUM = 2, /* Simple/Main profile medium level */
+ GST_VC1_LEVEL_HIGH = 4, /* Main profile high level */
+
+ GST_VC1_LEVEL_L0 = 0, /* Advanced profile level 0 */
+ GST_VC1_LEVEL_L1 = 1, /* Advanced profile level 1 */
+ GST_VC1_LEVEL_L2 = 2, /* Advanced profile level 2 */
+ GST_VC1_LEVEL_L3 = 3, /* Advanced profile level 3 */
+ GST_VC1_LEVEL_L4 = 4, /* Advanced profile level 4 */
+
+ /* 5 to 7 reserved */
+ GST_VC1_LEVEL_UNKNOWN = 255 /* Unknown profile */
+} GstVC1Level;
+
+typedef enum
+{
+ GST_VC1_QUANTIZER_IMPLICITLY,
+ GST_VC1_QUANTIZER_EXPLICITLY,
+ GST_VC1_QUANTIZER_NON_UNIFORM,
+ GST_VC1_QUANTIZER_UNIFORM
+} GstVC1QuantizerSpec;
+
+typedef enum {
+ GST_VC1_DQPROFILE_FOUR_EDGES,
+ GST_VC1_DQPROFILE_DOUBLE_EDGES,
+ GST_VC1_DQPROFILE_SINGLE_EDGE,
+ GST_VC1_DQPROFILE_ALL_MBS
+} GstVC1DQProfile;
+
+typedef enum {
+ GST_VC1_CONDOVER_NONE,
+ GST_VC1_CONDOVER_ALL,
+ GST_VC1_CONDOVER_SELECT
+} GstVC1Condover;
+
+/**
+ * GstVC1MvMode:
+ *
+ */
+typedef enum
+{
+ GST_VC1_MVMODE_1MV_HPEL_BILINEAR,
+ GST_VC1_MVMODE_1MV,
+ GST_VC1_MVMODE_1MV_HPEL,
+ GST_VC1_MVMODE_MIXED_MV,
+ GST_VC1_MVMODE_INTENSITY_COMP
+} GstVC1MvMode;
+
+typedef enum
+{
+ GST_VC1_FRAME_PROGRESSIVE = 0x0,
+ GST_VC1_FRAME_INTERLACE = 0x10,
+ GST_VC1_FIELD_INTERLACE = 0x11
+} GstVC1FrameCodingMode;
+
+typedef struct _GstVC1SeqHdr GstVC1SeqHdr;
+typedef struct _GstVC1AdvancedSeqHdr GstVC1AdvancedSeqHdr;
+typedef struct _GstVC1HrdParam GstVC1HrdParam;
+typedef struct _GstVC1EntryPointHdr GstVC1EntryPointHdr;
+
+typedef struct _GstVC1SeqLayer GstVC1SeqLayer;
+
+typedef struct _GstVC1SeqStructA GstVC1SeqStructA;
+typedef struct _GstVC1SeqStructB GstVC1SeqStructB;
+typedef struct _GstVC1SeqStructC GstVC1SeqStructC;
+
+/* Pictures Structures */
+typedef struct _GstVC1FrameLayer GstVC1FrameLayer;
+typedef struct _GstVC1FrameHdr GstVC1FrameHdr;
+typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
+typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
+typedef struct _GstVC1Picture GstVC1Picture;
+typedef struct _GstVC1SliceHdr GstVC1SliceHdr;
+
+typedef struct _GstVC1VopDquant GstVC1VopDquant;
+
+typedef struct _GstVC1BitPlanes GstVC1BitPlanes;
+
+typedef struct _GstVC1BDU GstVC1BDU;
+
+struct _GstVC1HrdParam
+{
+ guint8 hrd_num_leaky_buckets;
+ guint8 bit_rate_exponent;
+ guint8 buffer_size_exponent;
+ guint16 hrd_rate[MAX_HRD_NUM_LEAKY_BUCKETS];
+ guint16 hrd_buffer[MAX_HRD_NUM_LEAKY_BUCKETS];
+};
+
+/**
+ * GstVC1EntryPointHdr:
+ *
+ * Structure for entrypoint header, this will be used only in advanced profiles
+ */
+struct _GstVC1EntryPointHdr
+{
+ guint8 broken_link;
+ guint8 closed_entry;
+ guint8 panscan_flag;
+ guint8 refdist_flag;
+ guint8 loopfilter;
+ guint8 fastuvmc;
+ guint8 extended_mv;
+ guint8 dquant;
+ guint8 vstransform;
+ guint8 overlap;
+ guint8 quantizer;
+ guint8 coded_size_flag;
+ guint16 coded_width;
+ guint16 coded_height;
+ guint8 extended_dmv;
+ guint8 range_mapy_flag;
+ guint8 range_mapy;
+ guint8 range_mapuv_flag;
+ guint8 range_mapuv;
+
+ guint8 hrd_full[MAX_HRD_NUM_LEAKY_BUCKETS];
+};
+
+/**
+ * GstVC1AdvancedSeqHdr:
+ *
+ * Structure for the advanced profile sequence headers specific parameters.
+ */
+struct _GstVC1AdvancedSeqHdr
+{
+ GstVC1Level level;
+
+ guint8 frmrtq_postproc;
+ guint8 bitrtq_postproc;
+ guint8 postprocflag;
+ guint16 max_coded_width;
+ guint16 max_coded_height;
+ guint8 pulldown;
+ guint8 interlace;
+ guint8 tfcntrflag;
+ guint8 finterpflag;
+ guint8 psf;
+ guint8 display_ext;
+ guint16 disp_horiz_size;
+ guint16 disp_vert_size;
+ guint8 aspect_ratio_flag;
+ guint8 aspect_ratio;
+ guint8 aspect_horiz_size;
+ guint8 aspect_vert_size;
+ guint8 framerate_flag;
+ guint8 framerateind;
+ guint8 frameratenr;
+ guint8 frameratedr;
+ guint16 framerateexp;
+ guint8 color_format_flag;
+ guint8 color_prim;
+ guint8 transfer_char;
+ guint8 matrix_coef;
+ guint8 hrd_param_flag;
+ guint8 colordiff_format;
+
+ GstVC1HrdParam hrd_param;
+
+ /* computed */
+ guint framerate; /* Around in fps, 0 if unknown*/
+ guint bitrate; /* Around in kpbs, 0 if unknown*/
+ guint par_n;
+ guint par_d;
+ guint fps_n;
+ guint fps_d;
+
+ /* The last parsed entry point */
+ GstVC1EntryPointHdr entrypoint;
+};
+
+struct _GstVC1SeqStructA
+{
+ guint32 vert_size;
+ guint32 horiz_size;
+};
+
+struct _GstVC1SeqStructB
+{
+ GstVC1Level level;
+
+ guint8 cbr;
+ guint32 framerate;
+
+ /* In simple and main profiles only */
+ guint32 hrd_buffer;
+ guint32 hrd_rate;
+};
+
+struct _GstVC1SeqStructC
+{
+ GstVC1Profile profile;
+
+ /* Only in simple and main profiles */
+ guint8 frmrtq_postproc;
+ guint8 bitrtq_postproc;
+ guint8 res_sprite;
+ guint8 loop_filter;
+ guint8 multires;
+ guint8 fastuvmc;
+ guint8 extended_mv;
+ guint8 dquant;
+ guint8 vstransform;
+ guint8 overlap;
+ guint8 syncmarker;
+ guint8 rangered;
+ guint8 maxbframes;
+ guint8 quantizer;
+ guint8 finterpflag;
+
+ /* Computed */
+ guint framerate; /* Around in fps, 0 if unknown*/
+ guint bitrate; /* Around in kpbs, 0 if unknown*/
+
+ /* This should be filled by user if previously known */
+ guint16 coded_width;
+ /* This should be filled by user if previously known */
+ guint16 coded_height;
+
+ /* Wmvp specific */
+ guint8 wmvp; /* Specify if the stream is wmp or not */
+ /* In the wmvp case, the framerate is not computed but in the bitstream */
+ guint8 slice_code;
+};
+
+struct _GstVC1SeqLayer
+{
+ guint32 numframes;
+
+ GstVC1SeqStructA struct_a;
+ GstVC1SeqStructB struct_b;
+ GstVC1SeqStructC struct_c;
+};
+
+/**
+ * GstVC1SeqHdr:
+ *
+ * Structure for sequence headers in any profile.
+ */
+struct _GstVC1SeqHdr
+{
+ GstVC1Profile profile;
+
+ GstVC1SeqStructC struct_c;
+
+ /* calculated */
+ guint mb_height;
+ guint mb_width;
+ guint mb_stride;
+
+ GstVC1AdvancedSeqHdr advanced;
+
+};
+
+/**
+ * GstVC1PicSimpleMain:
+ * @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value.
+ */
+struct _GstVC1PicSimpleMain
+{
+ guint8 frmcnt;
+ guint8 mvrange;
+ guint8 rangeredfrm;
+
+ /* I and P pic simple and main profiles only */
+ guint8 respic;
+
+ /* I and BI pic simple and main profiles only */
+ guint8 transacfrm2;
+ guint8 bf;
+
+ /* B and P pic simple and main profiles only */
+ guint8 mvmode;
+ guint8 mvtab;
+ guint8 ttmbf;
+
+ /* P pic simple and main profiles only */
+ guint8 mvmode2;
+ guint8 lumscale;
+ guint8 lumshift;
+
+ guint8 cbptab;
+ guint8 ttfrm;
+
+ /* B and BI picture only
+ * Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value. */
+ guint16 bfraction;
+
+ /* Biplane value, those fields only mention the fact
+ * that the bitplane is in raw mode or not */
+ guint8 mvtypemb;
+ guint8 skipmb;
+ guint8 directmb; /* B pic main profile only */
+};
+
+/**
+ * GstVC1PicAdvanced:
+ * @bfaction: Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value.
+ */
+struct _GstVC1PicAdvanced
+{
+ GstVC1FrameCodingMode fcm;
+ guint8 tfcntr;
+
+ guint8 rptfrm;
+ guint8 tff;
+ guint8 rff;
+ guint8 ps_present;
+ guint32 ps_hoffset;
+ guint32 ps_voffset;
+ guint16 ps_width;
+ guint16 ps_height;
+ guint8 rndctrl;
+ guint8 uvsamp;
+ guint8 postproc;
+
+ /* B and P picture specific */
+ guint8 mvrange;
+ guint8 mvmode;
+ guint8 mvtab;
+ guint8 cbptab;
+ guint8 ttmbf;
+ guint8 ttfrm;
+
+ /* B and BI picture only
+ * Should be divided by #GST_VC1_BFRACTION_BASIS
+ * to get the real value. */
+ guint16 bfraction;
+
+ /* ppic */
+ guint8 mvmode2;
+ guint8 lumscale;
+ guint8 lumshift;
+
+ /* bipic */
+ guint8 bf;
+ guint8 condover;
+ guint8 transacfrm2;
+
+ /* Biplane value, those fields only mention the fact
+ * that the bitplane is in raw mode or not */
+ guint8 acpred;
+ guint8 overflags;
+ guint8 mvtypemb;
+ guint8 skipmb;
+ guint8 directmb;
+ guint8 forwardmb; /* B pic interlace field only */
+
+ /* For interlaced pictures only */
+ guint8 fieldtx;
+
+ /* P and B pictures */
+ guint8 intcomp;
+ guint8 dmvrange;
+ guint8 mbmodetab;
+ guint8 imvtab;
+ guint8 icbptab;
+ guint8 mvbptab2;
+ guint8 mvbptab4; /* If 4mvswitch in ppic */
+
+ /* P picture */
+ guint8 mvswitch4;
+
+ /* For interlaced fields only */
+ guint16 refdist;
+ guint8 fptype; /* Raw value */
+
+ /* P pic */
+ guint8 numref;
+ guint8 reffield;
+ guint8 lumscale2;
+ guint8 lumshift2;
+ guint8 intcompfield;
+
+};
+
+struct _GstVC1BitPlanes
+{
+ guint8 *acpred;
+ guint8 *fieldtx;
+ guint8 *overflags;
+ guint8 *mvtypemb;
+ guint8 *skipmb;
+ guint8 *directmb;
+ guint8 *forwardmb;
+
+ guint size; /* Size of the arrays */
+};
+
+struct _GstVC1VopDquant
+{
+ guint8 pqdiff;
+ guint8 abspq;
+
+ /* Computed */
+ guint8 altpquant;
+
+ /* if dqant != 2*/
+ guint8 dquantfrm;
+ guint8 dqprofile;
+
+ /* Boundary edge selection. This represents DQSBEDGE
+ * if dqprofile == GST_VC1_DQPROFILE_SINGLE_EDGE or
+ * DQDBEDGE if dqprofile == GST_VC1_DQPROFILE_DOUBLE_EDGE */
+ guint8 dqbedge;
+
+ /* FIXME: remove */
+ guint8 unused;
+
+ /* if dqprofile == GST_VC1_DQPROFILE_ALL_MBS */
+ guint8 dqbilevel;
+
+};
+
+struct _GstVC1FrameLayer
+{
+ guint8 key;
+ guint32 framesize;
+
+ guint32 timestamp;
+
+ /* calculated */
+ guint32 next_framelayer_offset;
+ guint8 skiped_p_frame;
+};
+
+/**
+ * GstVC1FrameHdr:
+ *
+ * Structure that represent picture in any profile or mode.
+ * You should look at @ptype and @profile to know what is currently
+ * in use.
+ */
+struct _GstVC1FrameHdr
+{
+ /* common fields */
+ GstVC1PictureType ptype;
+ guint8 interpfrm;
+ guint8 halfqp;
+ guint8 transacfrm;
+ guint8 transdctab;
+ guint8 pqindex;
+ guint8 pquantizer;
+
+ /* Computed */
+ guint8 pquant;
+
+ /* Convenience fields */
+ guint8 profile;
+ guint8 dquant;
+
+ /* If dquant */
+ GstVC1VopDquant vopdquant;
+
+ union {
+ GstVC1PicSimpleMain simple;
+ GstVC1PicAdvanced advanced;
+ } pic;
+
+ /* Size of the picture layer in bits */
+ guint header_size;
+};
+
+/**
+ * GstVC1SliceHdr:
+ *
+ * Structure that represents slice layer in advanced profile.
+ */
+struct _GstVC1SliceHdr
+{
+ guint16 slice_addr;
+
+ /* Size of the slice layer in bits */
+ guint header_size;
+};
+
+/**
+ * GstVC1BDU:
+ *
+ * Structure that represents a Bitstream Data Unit.
+ */
+struct _GstVC1BDU
+{
+ GstVC1StartCode type;
+ guint size;
+ guint sc_offset;
+ guint offset;
+ guint8 * data;
+};
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_identify_next_bdu (const guint8 *data,
+ gsize size,
+ GstVC1BDU *bdu);
+
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_sequence_header (const guint8 *data,
+ gsize size,
+ GstVC1SeqHdr * seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_entry_point_header (const guint8 *data,
+ gsize size,
+ GstVC1EntryPointHdr * entrypoint,
+ GstVC1SeqHdr *seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_sequence_layer (const guint8 *data,
+ gsize size,
+ GstVC1SeqLayer * seqlayer);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_a (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructA *structa);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_b (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructB *structb);
+GST_CODEC_PARSERS_API
+GstVC1ParserResult
+gst_vc1_parse_sequence_header_struct_c (const guint8 *data,
+ gsize size,
+ GstVC1SeqStructC *structc);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_frame_layer (const guint8 *data,
+ gsize size,
+ GstVC1FrameLayer * framelayer);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_frame_header (const guint8 *data,
+ gsize size,
+ GstVC1FrameHdr * framehdr,
+ GstVC1SeqHdr *seqhdr,
+ GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_field_header (const guint8 *data,
+ gsize size,
+ GstVC1FrameHdr * fieldhdr,
+ GstVC1SeqHdr *seqhdr,
+ GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+GstVC1ParserResult gst_vc1_parse_slice_header (const guint8 *data,
+ gsize size,
+ GstVC1SliceHdr *slicehdr,
+ GstVC1SeqHdr *seqhdr);
+
+GST_CODEC_PARSERS_API
+GstVC1BitPlanes * gst_vc1_bitplanes_new (void);
+
+GST_CODEC_PARSERS_API
+void gst_vc1_bitplanes_free (GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+void gst_vc1_bitplanes_free_1 (GstVC1BitPlanes *bitplanes);
+
+GST_CODEC_PARSERS_API
+gboolean gst_vc1_bitplanes_ensure_size (GstVC1BitPlanes *bitplanes,
+ GstVC1SeqHdr *seqhdr);
+
+G_END_DECLS
+#endif
diff --git a/include/gst/codecparsers/gstvp8parser.h b/include/gst/codecparsers/gstvp8parser.h
new file mode 100644
index 0000000000..2e56e6fb29
--- /dev/null
+++ b/include/gst/codecparsers/gstvp8parser.h
@@ -0,0 +1,346 @@
+/*
+ * gstvp8parser.h - VP8 parser
+ *
+ * Copyright (C) 2013-2014 Intel Corporation
+ * Author: Halley Zhao <halley.zhao@intel.com>
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP8_PARSER_H
+#define GST_VP8_PARSER_H
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VP8 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _GstVp8FrameHdr GstVp8FrameHdr;
+typedef struct _GstVp8QuantIndices GstVp8QuantIndices;
+typedef struct _GstVp8Segmentation GstVp8Segmentation;
+typedef struct _GstVp8MbLfAdjustments GstVp8MbLfAdjustments;
+typedef struct _GstVp8TokenProbs GstVp8TokenProbs;
+typedef struct _GstVp8MvProbs GstVp8MvProbs;
+typedef struct _GstVp8ModeProbs GstVp8ModeProbs;
+typedef struct _GstVp8Parser GstVp8Parser;
+
+/**
+ * GstVp8ParserResult:
+ * @GST_VP8_PARSER_OK: The parsing succeeded
+ * @GST_VP8_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_VP8_PARSER_ERROR: An error accured when parsing
+ *
+ * The result of parsing VP8 data.
+ */
+typedef enum {
+ GST_VP8_PARSER_OK,
+ GST_VP8_PARSER_BROKEN_DATA,
+ GST_VP8_PARSER_ERROR,
+} GstVp8ParserResult;
+
+/**
+ * GstVpQuantIndices:
+ * @y_ac_qi: indicates the dequantization table index used for the
+ * luma AC coefficients
+ * @y_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the luma DC coefficient dequantization
+ * index
+ * @y2_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the Y2 block DC coefficient dequantization
+ * index
+ * @y2_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the Y2 block AC coefficient dequantization
+ * index
+ * @uv_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma DC coefficient dequantization
+ * index
+ * @uv_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma AC coefficient dequantization
+ * index
+ *
+ * Dequantization indices.
+ */
+struct _GstVp8QuantIndices
+{
+ guint8 y_ac_qi;
+ gint8 y_dc_delta;
+ gint8 y2_dc_delta;
+ gint8 y2_ac_delta;
+ gint8 uv_dc_delta;
+ gint8 uv_ac_delta;
+};
+
+/**
+ * GstVp8Segmentation:
+ * @segmentation_enabled: enables the segmentation feature for the
+ * current frame
+ * @update_mb_segmentation_map: determines if the MB segmentation map
+ * is updated in the current frame
+ * @update_segment_feature_data: indicates if the segment feature data
+ * is updated in the current frame
+ * @segment_feature_mode: indicates the feature data update mode (0:
+ * delta, 1: absolute value)
+ * @quantizer_update_value: indicates the update value for the segment
+ * quantizer
+ * @lf_update_value: indicates the update value for the loop filter level
+ * @segment_prob: indicates the branch probabilities of the segment_id
+ * decoding tree
+ *
+ * Segmentation feature data.
+ */
+struct _GstVp8Segmentation
+{
+ guint8 segmentation_enabled;
+ guint8 update_mb_segmentation_map;
+ guint8 update_segment_feature_data;
+
+ /* if update_segment_feature_data == 1 */
+ guint8 segment_feature_mode;
+ gint8 quantizer_update_value[4];
+ gint8 lf_update_value[4];
+
+ /* if update_mb_segmentation_map == 1 */
+ guint8 segment_prob[3];
+};
+
+/**
+ * GstVp8MbLfAdjustments:
+ * @loop_filter_adj_enable: indicates if the MB-level loop filter
+ * adjustment is on for the current frame
+ * @mode_ref_lf_delta_update: indicates if the delta values used in an
+ * adjustment are updated in the current frame
+ * @ref_frame_delta: indicates the adjustment delta value
+ * corresponding to a certain used reference frame
+ * @mb_mode_delta: indicates the adjustment delta value corresponding
+ * to a certain MB prediction mode
+ *
+ * MB-level loop filter adjustments.
+ */
+struct _GstVp8MbLfAdjustments
+{
+ guint8 loop_filter_adj_enable;
+ guint8 mode_ref_lf_delta_update;
+
+ /* if mode_ref_lf_delta_update == 1 */
+ gint8 ref_frame_delta[4];
+ gint8 mb_mode_delta[4];
+};
+
+/**
+ * GstVp8TokenProbs:
+ * @prob: token probability
+ *
+ * Token probabilities, with cumulative updates applied.
+ *
+ * Each probability value in this matrix is live across frames, until
+ * they are reset to their default values on key frame.
+ */
+struct _GstVp8TokenProbs
+{
+ guint8 prob[4][8][3][11];
+};
+
+/**
+ * GstVp8MvProbs:
+ * @prob: MV probability
+ *
+ * Probabilities used for motion vector decoding, with cumulative
+ * updates applied.
+ *
+ * Each probability value in this matrix is live across frames, until
+ * they are reset to their default values on key frame.
+ */
+struct _GstVp8MvProbs
+{
+ guint8 prob[2][19];
+};
+
+/**
+ * GstVp8ModeProbs:
+ * @y_prob: indicates the branch probabilities of the luma
+ * intra-prediction mode decoding tree
+ * @uv_prob: indicates the branch probabilities of the chroma
+ * intra-prediction mode decoding tree
+ *
+ * Probabilities used for intra-prediction mode decoding tree.
+ *
+ * Each probability value in thie structure is live across frames,
+ * until they are reset to their default values on key frame.
+ */
+struct _GstVp8ModeProbs
+{
+ guint8 y_prob[4];
+ guint8 uv_prob[3];
+};
+
+/**
+ * GstVp8FrameHdr:
+ * @key_frame: indicates whether the frame is a key frame (1), or an
+ * inter frame (0)
+ * @version: version number
+ * @show_frame: indicates whether the frame is meant to be displayed (1),
+ * or not (0)
+ * @data_chunk_size: the size in bytes of the Uncompressed Data Chunk
+ * @first_part_size: the size in bytes of the first partition (control
+ * partition), excluding the uncompressed data chunk
+ * @width: the frame width in pixels
+ * @height: the frame height in pixels
+ * @horiz_scale_code: horizontal scale code value
+ * @vert_scale_code: vertical scale code value
+ * @color_space: defines the YUV color space of the sequence
+ * @clamping_type: specifies if the decoder is required to clamp the
+ * reconstructed pixel values
+ * @filter_type: determines whether the normal or the simple loop
+ * filter is used
+ * @loop_filter_level: controls the deblocking filter
+ * @sharpness_level: controls the deblocking filter
+ * @log2_nbr_of_dct_partitions: determines the number of separate
+ * partitions containing the DCT coefficients of the macroblocks
+ * @partition_size: determines the size of each separate partition
+ * containing the DCT coefficients of the macroblocks, including the
+ * very last one (calculated size)
+ * @quant_indices: dequantization indices (see #GstVp8QuantIndices)
+ * @token_probs: token probabilities (see #GstVp8TokenProbs)
+ * @mv_probs: probabilities used for motion vector decoding
+ * (see #GstVp8MvProbs)
+ * @mode_probs: probabilities used for intra-prediction mode decoding
+ * tree (see #GstVp8ModeProbs)
+ * @refresh_entropy_probs: determines whether updated token
+ * probabilities are used only for this frame or until further update
+ * @refresh_golden_frame: determines if the current decoded frame
+ * refreshes the golden frame
+ * @refresh_alternate_frame: determines if the current decoded frame
+ * refreshes the alternate reference frame
+ * @copy_buffer_to_golden: determines if the golden reference is
+ * replaced by another reference
+ * @copy_buffer_to_alternate: determines if the alternate reference is
+ * replaced by another reference
+ * @sign_bias_golden: controls the sign of motion vectors when the
+ * golden frame is referenced
+ * @sign_bias_alternate: controls the sign of motion vectors when the
+ * alternate frame is referenced
+ * @refresh_last: determines if the current decoded frame refreshes
+ * the last frame reference buffer
+ * @mb_no_skip_coeff: enables (0) or disables (1) the skipping of
+ * macroblocks containing no non-zero coefficients
+ * @prob_skip_false: indicates the probability that the macroblock is
+ * not skipped
+ * @prob_intra: indicates the probability of an intra macroblock
+ * @prob_last: indicates the probability that the last reference frame
+ * is used for inter-prediction
+ * @prob_gf: indicates the probability that the golden reference frame
+ * is used for inter-prediction
+ * @rd_range: last range decoder value for "Range"
+ * @rd_value: last range decoder value for "Value"
+ * @rd_count: number of bits left in range decoder "Value" (@rd_value)
+ * @header_size: the size in bits of the Frame Header, thus excluding
+ * any Uncompressed Data Chunk bytes
+ *
+ * Frame header.
+ */
+struct _GstVp8FrameHdr
+{
+ guint8 key_frame;
+ guint8 version;
+ guint8 show_frame;
+ guint8 data_chunk_size;
+ guint32 first_part_size;
+
+ /* if key_frame == 1 */
+ guint16 width;
+ guint16 height;
+ guint8 horiz_scale_code;
+ guint8 vert_scale_code;
+ guint8 color_space;
+ guint8 clamping_type;
+
+ guint8 filter_type;
+ guint8 loop_filter_level;
+ guint8 sharpness_level;
+ guint8 log2_nbr_of_dct_partitions;
+ guint partition_size[8];
+
+ GstVp8QuantIndices quant_indices;
+ GstVp8TokenProbs token_probs;
+ GstVp8MvProbs mv_probs;
+ GstVp8ModeProbs mode_probs;
+
+ guint8 refresh_entropy_probs;
+ guint8 refresh_last;
+ /* if key_frame != 1 */
+ guint8 refresh_golden_frame;
+ guint8 refresh_alternate_frame;
+ guint8 copy_buffer_to_golden;
+ guint8 copy_buffer_to_alternate;
+ guint8 sign_bias_golden;
+ guint8 sign_bias_alternate;
+
+ guint8 mb_no_skip_coeff;
+ guint8 prob_skip_false;
+
+ /* if key_frame != 1 */
+ guint8 prob_intra;
+ guint8 prob_last;
+ guint8 prob_gf;
+
+ /* Range decoder state */
+ guint8 rd_range;
+ guint8 rd_value;
+ guint8 rd_count;
+
+ /* Size of the Frame Header in bits */
+ guint header_size;
+};
+
+/**
+ * GstVp8Parser:
+ * @segmentation: segmentation feature data
+ * @mb_lf_adjust: MB-level loop filter adjustments
+ * @token_probs: token probabilities
+ * @mv_probs: probabilities used for motion vector decoding
+ * @mode_probs: probabilities used for intra-prediction mode decoding tree.
+ *
+ * Parser context that needs to be live across frames. For instance
+ * the probabilities tables stored in #GstVp8FrameHdr may depend on
+ * the previous frames.
+ */
+struct _GstVp8Parser
+{
+ GstVp8Segmentation segmentation;
+ GstVp8MbLfAdjustments mb_lf_adjust;
+ GstVp8TokenProbs token_probs;
+ GstVp8MvProbs mv_probs;
+ GstVp8ModeProbs mode_probs;
+};
+
+GST_CODEC_PARSERS_API
+void gst_vp8_parser_init (GstVp8Parser * parser);
+
+GST_CODEC_PARSERS_API
+GstVp8ParserResult gst_vp8_parser_parse_frame_header (GstVp8Parser * parser,
+ GstVp8FrameHdr * frame_hdr,
+ const guint8 * data,
+ gsize size);
+
+G_END_DECLS
+
+#endif /* GST_VP8_PARSER_H */
diff --git a/include/gst/codecparsers/gstvp8rangedecoder.h b/include/gst/codecparsers/gstvp8rangedecoder.h
new file mode 100644
index 0000000000..510cff26d0
--- /dev/null
+++ b/include/gst/codecparsers/gstvp8rangedecoder.h
@@ -0,0 +1,80 @@
+/*
+ * gstvp8rangedecoder.h - VP8 range decoder interface
+ *
+ * Copyright (C) 2014 Intel Corporation
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP8_RANGE_DECODER_H
+#define GST_VP8_RANGE_DECODER_H
+
+#include <glib.h>
+#include <gst/gstconfig.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+typedef struct _GstVp8RangeDecoder GstVp8RangeDecoder;
+typedef struct _GstVp8RangeDecoderState GstVp8RangeDecoderState;
+
+/**
+* GstVp8RangeDecoder:
+* @buf: the original bitstream buffer start
+* @buf_size: the original bitstream buffer size
+*
+* Range decoder.
+*/
+struct _GstVp8RangeDecoder {
+ const guchar *buf;
+ guint buf_size;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+* GstVp8RangeDecoderState:
+* @range: current "Range" value
+* @value: current "Value" value
+* @count: number of bits left in "Value" for decoding
+*
+* Range decoder state.
+*/
+struct _GstVp8RangeDecoderState {
+ guint8 range;
+ guint8 value;
+ guint8 count;
+};
+
+GST_CODEC_PARSERS_API
+gboolean gst_vp8_range_decoder_init (GstVp8RangeDecoder * rd,
+ const guchar * buf,
+ guint buf_size);
+
+GST_CODEC_PARSERS_API
+gint gst_vp8_range_decoder_read (GstVp8RangeDecoder * rd, guint8 prob);
+
+GST_CODEC_PARSERS_API
+gint gst_vp8_range_decoder_read_literal (GstVp8RangeDecoder * rd, gint bits);
+
+GST_CODEC_PARSERS_API
+guint gst_vp8_range_decoder_get_pos (GstVp8RangeDecoder * rd);
+
+GST_CODEC_PARSERS_API
+void gst_vp8_range_decoder_get_state (GstVp8RangeDecoder * rd,
+ GstVp8RangeDecoderState * state);
+
+#endif /* GST_VP8_RANGE_DECODER_H */
diff --git a/include/gst/codecparsers/gstvp9parser.h b/include/gst/codecparsers/gstvp9parser.h
new file mode 100644
index 0000000000..3a0d67c08d
--- /dev/null
+++ b/include/gst/codecparsers/gstvp9parser.h
@@ -0,0 +1,521 @@
+/*
+ * gstvp9parser.h
+ *
+ * Copyright (C) 2013-2014 Intel Corporation
+ * Copyright (C) 2015 Intel Corporation
+ * Author: XuGuangxin<Guangxin.Xu@intel.com>
+ * Author: Sreerenj Balachandran<sreerenj.balachandran@intel.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VP9_PARSER_H
+#define GST_VP9_PARSER_H
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The VP9 parsing library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/codecparsers/codecparsers-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_VP9_FRAME_MARKER 0x02
+#define GST_VP9_SYNC_CODE 0x498342
+#define GST_VP9_SUPERFRAME_MARKER 0x06
+
+#define GST_VP9_MAX_LOOP_FILTER 63
+#define GST_VP9_MAX_PROB 255
+
+#define GST_VP9_REFS_PER_FRAME 3
+#define GST_VP9_REF_FRAMES_LOG2 3
+#define GST_VP9_REF_FRAMES (1 << GST_VP9_REF_FRAMES_LOG2)
+
+#define GST_VP9_FRAME_CONTEXTS_LOG2 2
+
+#define GST_VP9_MAX_SHARPNESS 7
+
+#define GST_VP9_MAX_REF_LF_DELTAS 4
+#define GST_VP9_MAX_MODE_LF_DELTAS 2
+
+#define GST_VP9_SEGMENT_DELTADATA 0
+#define GST_VP9_SEGMENT_ABSDATA 1
+
+#define GST_VP9_MAX_SEGMENTS 8
+#define GST_VP9_SEG_TREE_PROBS (GST_VP9_MAX_SEGMENTS-1)
+
+#define GST_VP9_PREDICTION_PROBS 3
+
+#define GST_VP9_MAX_FRAMES_IN_SUPERFRAME 8
+
+typedef struct _GstVp9Parser GstVp9Parser;
+typedef struct _GstVp9FrameHdr GstVp9FrameHdr;
+typedef struct _GstVp9LoopFilter GstVp9LoopFilter;
+typedef struct _GstVp9QuantIndices GstVp9QuantIndices;
+typedef struct _GstVp9Segmentation GstVp9Segmentation;
+typedef struct _GstVp9SegmentationInfo GstVp9SegmentationInfo;
+typedef struct _GstVp9SegmentationInfoData GstVp9SegmentationInfoData;
+typedef struct _GstVp9SuperframeInfo GstVp9SuperframeInfo;
+
+/**
+ * GstVp9ParseResult:
+ * @GST_VP9_PARSER_OK: The parsing went well
+ * @GST_VP9_PARSER_BROKEN_DATA: The data to parse is broken
+ * @GST_VP9_PARSER_NO_PACKET_ERROR: An error occurred during the parsing
+ *
+ * Result type of any parsing function.
+ *
+ * Since: 1.8
+ */
+typedef enum
+{
+ GST_VP9_PARSER_OK,
+ GST_VP9_PARSER_BROKEN_DATA,
+ GST_VP9_PARSER_ERROR,
+} GstVp9ParserResult;
+
+/**
+ * GstVp9Profile: Bitstream profiles indicated by 2-3 bits in the uncompressed header
+ * @GST_VP9_PROFILE_0: Profile 0, 8-bit 4:2:0 only.
+ * @GST_VP9_PROFILE_1: Profile 1, 8-bit 4:4:4, 4:2:2, and 4:4:0.
+ * @GST_VP9_PROFILE_2: Profile 2, 10-bit and 12-bit color only, with 4:2:0 sampling.
+ * @GST_VP9_PROFILE_3: Profile 3, 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0 sampling.
+ * @GST_VP9_PROFILE_UNDEFINED: Undefined profile
+ *
+ * VP9 Profiles
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_PROFILE_0,
+ GST_VP9_PROFILE_1,
+ GST_VP9_PROFILE_2,
+ GST_VP9_PROFILE_3,
+ GST_VP9_PROFILE_UNDEFINED
+} GstVP9Profile;
+
+/**
+ * GstVp9FrameType:
+ * @GST_VP9_KEY_FRAME: Key frame, only have intra blocks
+ * @GST_VP9_INTER_FRAME: Inter frame, both intra and inter blocks
+ *
+ * VP9 frame types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_KEY_FRAME = 0,
+ GST_VP9_INTER_FRAME = 1
+} GstVp9FrameType;
+
+/**
+ * GstVp9BitDepth:
+ * @GST_VP9_BIT_DEPTH_8: Bit depth is 8
+ * @GST_VP9_BIT_DEPTH_10 Bit depth is 10
+ * @GST_VP9_BIT_DEPTH_12:Bit depth is 12
+ *
+ * Bit depths of encoded frames
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_BIT_DEPTH_8 = 8,
+ GST_VP9_BIT_DEPTH_10 = 10,
+ GST_VP9_BIT_DEPTH_12 = 12
+} GstVp9BitDepth;
+
+/**
+ * GstVp9ColorSpace:
+ * @GST_VP9_CS_UNKNOWN: Unknown color space
+ * @GST_VP9_CS_BT_601: BT.601
+ * @GST_VP9_CS_BT_709: BT.709
+ * @GST_VP9_CS_SMPTE_170: SMPTE.170
+ * @GST_VP9_CS_SMPTE_240: SMPTE.240
+ * @GST_VP9_CS_BT_2020: BT.2020
+ * @GST_VP9_CS_RESERVED: Reserved
+ * @GST_VP9_CS_SRGB: sRGB
+ *
+ * Supported ColorSpace standards
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_CS_UNKNOWN = 0,
+ GST_VP9_CS_BT_601 = 1,
+ GST_VP9_CS_BT_709 = 2,
+ GST_VP9_CS_SMPTE_170 = 3,
+ GST_VP9_CS_SMPTE_240 = 4,
+ GST_VP9_CS_BT_2020 = 5,
+ GST_VP9_CS_RESERVED_2 = 6,
+ GST_VP9_CS_SRGB = 7
+} GstVp9ColorSpace;
+
+/**
+ * GstVp9ColorRange:
+ * @GST_VP9_CR_LIMITED: Y range is [16-235], UV range is [16-240]
+ * @GST_VP9_CR_FULL: Full range for Y,U and V [0-255]
+ *
+ * Possible color value ranges
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_CR_LIMITED,
+ GST_VP9_CR_FULL
+} GstVp9ColorRange;
+
+/**
+ * GstVp9InterpolationFilter:
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP: EightTap interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH: Smooth interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP: Shart interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_BILINEAR: Bilinear interpolation filter
+ * @GST_VP9_INTERPOLATION_FILTER_SWITCHABLE: Selectable interpolation filter
+ *
+ * Interpolation Filters Types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP = 0,
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
+ GST_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
+ GST_VP9_INTERPOLATION_FILTER_BILINEAR = 3,
+ GST_VP9_INTERPOLATION_FILTER_SWITCHABLE = 4
+} GstVp9InterpolationFilter;
+
+/**
+ * GstVp9RefFrameType:
+ * @GST_VP9_REF_FRAME_INTRA: Intra reference frame
+ * @GST_VP9_REF_FRAME_LAST: Last Reference frame
+ * @GST_VP9_REF_FRAME_GOLDEN: Golden Reference frame
+ * @GST_VP9_REF_FRAME_ALTREF: Alternate Reference frame
+ * @GST_VP9_REF_FRAME_MAX:
+ *
+ * Reference Frame types
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_VP9_REF_FRAME_INTRA = 0,
+ GST_VP9_REF_FRAME_LAST = 1,
+ GST_VP9_REF_FRAME_GOLDEN = 2,
+ GST_VP9_REF_FRAME_ALTREF = 3,
+ GST_VP9_REF_FRAME_MAX = 4
+} GstVp9RefFrameType;
+
+/**
+ * GstVp9QuantIndices:
+ * @y_ac_qi: indicates the dequantization table index used for the
+ * luma AC coefficients
+ * @y_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the luma DC coefficient dequantization
+ * index
+ * @uv_dc_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma DC coefficient dequantization
+ * index
+ * @uv_ac_delta: indicates the delta value that is added to the
+ * baseline index to obtain the chroma AC coefficient dequantization
+ * index
+ *
+ * Dequantization indices.
+ *
+ * Since: 1.8
+ */
+struct _GstVp9QuantIndices
+{
+ guint8 y_ac_qi;
+ gint8 y_dc_delta;
+ gint8 uv_dc_delta;
+ gint8 uv_ac_delta;
+};
+
+/**
+ * GstVp9LoopFilter:
+ * @filter_level: indicates loop filter level for the current frame
+ * @sharpness_level: indicates sharpness level for thecurrent frame
+ * @mode_ref_delta_enabled: indicate if filter adjust is on
+ * @mode_ref_delta_update: indicates if the delta values used in an
+ * adjustment are updated in the current frame
+ * @update_ref_deltas: indicate which ref deltas are updated
+ * @ref_deltas: Loop filter strength adjustments based on
+ * frame type (intra, inter)
+ * @update_mode_deltas: indicate with mode deltas are updated
+ * @mode_deltas: Loop filter strength adjustments based on
+ * mode (zero, new mv)
+ *
+ * Loop filter values
+ *
+ * Since: 1.8
+ */
+struct _GstVp9LoopFilter {
+ gint filter_level;
+ gint sharpness_level;
+
+ guint8 mode_ref_delta_enabled;
+ guint8 mode_ref_delta_update;
+ guint8 update_ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
+ gint8 ref_deltas[GST_VP9_MAX_REF_LF_DELTAS];
+ guint8 update_mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
+ gint8 mode_deltas[GST_VP9_MAX_MODE_LF_DELTAS];
+};
+
+/**
+ * GstVp9SegmentationInfoData:
+ * @alternate_quantizer_enabled: indicate alternate quantizer enabled at segment level
+ * @alternate_quantizer: alternate quantizer value
+ * @alternate_loop_filter_enabled: indicate alternate loop filter enabled at segment level
+ * @alternate_loop_filter: alternate loop filter
+ * @reference_frame_enabled: indicate alternate reference frame at segment level
+ * @reference_frame: alternate reference frame
+ * @reference_skip: a block skip mode that implies both the use of a (0,0)
+ * motion vector and that no residual will be coded.
+ *
+ * Segmentation info for each segment
+ *
+ * Since: 1.8
+ */
+struct _GstVp9SegmentationInfoData {
+ /* SEG_LVL_ALT_Q */
+ guint8 alternate_quantizer_enabled;
+ gint16 alternate_quantizer;
+
+ /* SEG_LVL_ALT_LF */
+ guint8 alternate_loop_filter_enabled;
+ gint8 alternate_loop_filter;
+
+ /* SEG_LVL_REF_FRAME */
+ guint8 reference_frame_enabled;
+ gint reference_frame;
+
+ guint8 reference_skip;
+};
+
+/**
+ * GstVp9SegmentationInfo:
+ * @enabled: enables the segmentation feature for the current frame
+ * @update_map: determines if segmentation is updated in the current frame
+ * @update_tree_probs: determines if tree probabilities updated or not
+ * @tree_probs: segment tree probabilities
+ * @update_pred_probs:determines if prediction probabilities updated or not
+ * @pred_probs: prediction probabilities
+ * @abs_delta: interpretation of segment data values
+ * @temporal_update: type of map update
+ * @update_data: indicates if the segment feature data
+ * is updated in the current frame
+ * @data: segment feature data
+ *
+ * Segmentation info
+ *
+ * Since: 1.8
+ */
+struct _GstVp9SegmentationInfo {
+ /* enable in setup_segmentation*/
+ guint8 enabled;
+ /* update_map in setup_segmentation*/
+ guint8 update_map;
+ /* tree_probs exist or not*/
+ guint8 update_tree_probs[GST_VP9_SEG_TREE_PROBS];
+ guint8 tree_probs[GST_VP9_SEG_TREE_PROBS];
+ /* pred_probs exist or not*/
+ guint8 update_pred_probs[GST_VP9_PREDICTION_PROBS];
+ guint8 pred_probs[GST_VP9_PREDICTION_PROBS];
+
+ /* abs_delta in setup_segmentation */
+ guint8 abs_delta;
+ /* temporal_update in setup_segmentation */
+ guint8 temporal_update;
+
+ /* update_data in setup_segmentation*/
+ guint8 update_data;
+ GstVp9SegmentationInfoData data[GST_VP9_MAX_SEGMENTS];
+};
+
+/**
+ * GstVp9FrameHdr:
+ * @profile: encoded profile
+ * @show_existing_frame: display already decoded frame instead of doing the decoding
+ * @frame_to_show: which frame to show if show_existing_frame is true
+ * @frame_type: frame type
+ * @show_frame: indicate whether it is a displayable frame or not
+ * @error_resilient_mode: error resilent mode
+ * @width: frame width
+ * @height: frame height
+ * @display_size_enabled: display size enabled (cropping)
+ * @display_width: display width
+ * @display_height: display height
+ * @frame_context_idx: frame context index
+ * @intra_only: intra only frame
+ * @reset_frame_context: reset frame context
+ * @refresh_frame_flags: refresh reference frame flags
+ * @ref_frame_indices: reference frame index
+ * @ref_frame_sign_bias: sign bias for selecting altref,last and golden frames
+ * @allow_high_precision_mv: allow hight precision motion vector
+ * @mcomp_filter_type: interpolation filter type
+ * @refresh_frame_context: refresh frame context indicator
+ * @frame_parallel_decoding_mode: enable or disable parallel decoding support.
+ * @loopfilter: loopfilter values
+ * @quant_indices: quantization indices
+ * @segmentation: segmentation info
+ * @log2_tile_rows: tile row indicator
+ * @log2_tile_columns: tile column indicator
+ * @first_partition_size: first partition size (after the uncompressed header)
+ * @lossless_flag: lossless mode decode
+ * @frame_header_length_in_bytes: length of uncompressed header
+ *
+ * Frame header
+ *
+ * Since: 1.8
+ */
+struct _GstVp9FrameHdr
+{
+ guint profile;
+ guint8 show_existing_frame;
+ gint frame_to_show;
+ guint frame_type;
+ guint8 show_frame;
+ guint8 error_resilient_mode;
+ guint32 width;
+ guint32 height;
+ guint8 display_size_enabled;
+ guint32 display_width;
+ guint32 display_height;
+ guint frame_context_idx;
+
+ guint8 intra_only;
+ gint reset_frame_context;
+ gint refresh_frame_flags;
+
+ gint ref_frame_indices[GST_VP9_REFS_PER_FRAME];
+ gint ref_frame_sign_bias[GST_VP9_REFS_PER_FRAME];
+ gint allow_high_precision_mv;
+ guint8 mcomp_filter_type;
+
+ gint refresh_frame_context;
+ /* frame_parallel_decoding_mode in vp9 code*/
+ gint frame_parallel_decoding_mode;
+
+ GstVp9LoopFilter loopfilter;
+ GstVp9QuantIndices quant_indices;
+ GstVp9SegmentationInfo segmentation;
+
+ gint log2_tile_rows;
+ gint log2_tile_columns;
+
+ guint32 first_partition_size;
+
+ /* calculated values */
+ guint lossless_flag;
+ guint32 frame_header_length_in_bytes;
+};
+
+/**
+ * GstVp9SuperframeInfo:
+ * @bytes_per_framesize: indicates the number of bytes needed to code each frame size
+ * @frames_in_superframe: indicates the number of frames within this superframe
+ * @frame_sizes: specifies the size in bytes of frame number i (zero indexed) within this superframe
+ * @superframe_index_size: indicates the total size of the superframe_index
+ *
+ * Superframe info
+ *
+ * Since: 1.18
+ */
+struct _GstVp9SuperframeInfo {
+ guint32 bytes_per_framesize;
+ guint32 frames_in_superframe;
+ guint32 frame_sizes[GST_VP9_MAX_FRAMES_IN_SUPERFRAME];
+ guint32 superframe_index_size;
+};
+
+/**
+ * GstVp9Segmentation:
+ * @filter_level: loop filter level
+ * @luma_ac_quant_scale: AC quant scale for luma(Y) component
+ * @luma_dc_quant_scale: DC quant scale for luma(Y) component
+ * @chroma_ac_quant_scale AC quant scale for chroma(U/V) component
+ * @chroma_dc_quant_scale: DC quant scale for chroma (U/V) component
+ * @reference_frame_enabled: alternate reference frame enablement
+ * @reference_frame: alternate reference frame
+ * @reference_skip: a block skip mode that implies both the use of a (0,0)
+ * motion vector and that no residual will be coded
+ *
+ * Segmentation info kept across multiple frames
+ *
+ * Since: 1.8
+ */
+struct _GstVp9Segmentation
+{
+ guint8 filter_level[GST_VP9_MAX_REF_LF_DELTAS][GST_VP9_MAX_MODE_LF_DELTAS];
+ gint16 luma_ac_quant_scale;
+ gint16 luma_dc_quant_scale;
+ gint16 chroma_ac_quant_scale;
+ gint16 chroma_dc_quant_scale;
+
+ guint8 reference_frame_enabled;
+ gint reference_frame;
+
+ guint8 reference_skip;
+};
+
+/**
+ * GstVp9Parser:
+ * @priv: GstVp9ParserPrivate struct to keep track of state variables
+ * @subsampling_x: horizontal subsampling
+ * @subsampling_y: vertical subsampling
+ * @bit_depth: bit depth of the stream
+ * @color_space: color space standard
+ * @color_range: color range standard
+ * @mb_segment_tree_probs: decoding tree probabilities
+ * @segment_pred_probs: segment prediction probabiilties
+ * @segmentation: Segmentation info
+ *
+ * Parser context that needs to be live across frames
+ *
+ * Since: 1.8
+ */
+struct _GstVp9Parser
+{
+ /* private struct for tracking state variables across frames */
+ void *priv;
+
+ gint subsampling_x;
+ gint subsampling_y;
+ guint bit_depth;
+ guint color_space;
+ guint color_range;
+
+ guint8 mb_segment_tree_probs[GST_VP9_SEG_TREE_PROBS];
+ guint8 segment_pred_probs[GST_VP9_PREDICTION_PROBS];
+ GstVp9Segmentation segmentation[GST_VP9_MAX_SEGMENTS];
+};
+
+GST_CODEC_PARSERS_API
+GstVp9Parser * gst_vp9_parser_new (void);
+
+GST_CODEC_PARSERS_API
+GstVp9ParserResult gst_vp9_parser_parse_frame_header (GstVp9Parser* parser, GstVp9FrameHdr * frame_hdr, const guint8 * data, gsize size);
+
+GST_CODEC_PARSERS_API
+GstVp9ParserResult gst_vp9_parser_parse_superframe_info (GstVp9Parser* parser, GstVp9SuperframeInfo * superframe_info, const guint8 * data, gsize size);
+
+GST_CODEC_PARSERS_API
+void gst_vp9_parser_free (GstVp9Parser * parser);
+
+G_END_DECLS
+
+#endif /* GST_VP9_PARSER_H */
diff --git a/include/gst/controller/controller-enumtypes.h b/include/gst/controller/controller-enumtypes.h
new file mode 100644
index 0000000000..be00d2490b
--- /dev/null
+++ b/include/gst/controller/controller-enumtypes.h
@@ -0,0 +1,26 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/controller/controller-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gstinterpolationcontrolsource.h" */
+
+GST_CONTROLLER_API
+GType gst_interpolation_mode_get_type (void);
+#define GST_TYPE_INTERPOLATION_MODE (gst_interpolation_mode_get_type())
+
+/* enumerations from "gstlfocontrolsource.h" */
+
+GST_CONTROLLER_API
+GType gst_lfo_waveform_get_type (void);
+#define GST_TYPE_LFO_WAVEFORM (gst_lfo_waveform_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/controller/controller-prelude.h b/include/gst/controller/controller-prelude.h
new file mode 100644
index 0000000000..cd7f0c9196
--- /dev/null
+++ b/include/gst/controller/controller-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Controller Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * controller-prelude.h: prelude include header for gst-controller library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONTROLLER_PRELUDE_H__
+#define __GST_CONTROLLER_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_CONTROLLER_API
+#ifdef BUILDING_GST_CONTROLLER
+#define GST_CONTROLLER_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_CONTROLLER_API GST_API_IMPORT
+#endif
+#endif
+
+#endif /* __GST_CONTROLLER_PRELUDE_H__ */
diff --git a/include/gst/controller/controller.h b/include/gst/controller/controller.h
new file mode 100644
index 0000000000..79ae8ce6da
--- /dev/null
+++ b/include/gst/controller/controller.h
@@ -0,0 +1,35 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstcontroller.h: single include header for gst-controller library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONTROLLER_H__
+#define __GST_CONTROLLER_H__
+
+#include <gst/controller/controller-prelude.h>
+
+#include <gst/controller/gstargbcontrolbinding.h>
+#include <gst/controller/gstdirectcontrolbinding.h>
+#include <gst/controller/gstproxycontrolbinding.h>
+#include <gst/controller/gsttimedvaluecontrolsource.h>
+#include <gst/controller/gstinterpolationcontrolsource.h>
+#include <gst/controller/gsttriggercontrolsource.h>
+#include <gst/controller/gstlfocontrolsource.h>
+
+#endif /* __GST_CONTROLLER_H__ */
diff --git a/include/gst/controller/gstargbcontrolbinding.h b/include/gst/controller/gstargbcontrolbinding.h
new file mode 100644
index 0000000000..3d1c8baacd
--- /dev/null
+++ b/include/gst/controller/gstargbcontrolbinding.h
@@ -0,0 +1,103 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gstargbcontrolbinding.h: Attachment for multiple control sources to gargb
+ * properties
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ARGB_CONTROL_BINDING_H__
+#define __GST_ARGB_CONTROL_BINDING_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+#include <gst/gstcontrolsource.h>
+#include <gst/controller/controller-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ARGB_CONTROL_BINDING \
+ (gst_argb_control_binding_get_type())
+#define GST_ARGB_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ARGB_CONTROL_BINDING,GstARGBControlBinding))
+#define GST_ARGB_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ARGB_CONTROL_BINDING,GstARGBControlBindingClass))
+#define GST_IS_ARGB_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ARGB_CONTROL_BINDING))
+#define GST_IS_ARGB_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ARGB_CONTROL_BINDING))
+#define GST_ARGB_CONTROL_BINDING_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstARGBControlBindingClass))
+
+typedef struct _GstARGBControlBinding GstARGBControlBinding;
+typedef struct _GstARGBControlBindingClass GstARGBControlBindingClass;
+
+/**
+ * GstARGBControlBinding:
+ * @name: name of the property of this binding
+ *
+ * The instance structure of #GstARGBControlBinding.
+ */
+struct _GstARGBControlBinding {
+ GstControlBinding parent;
+
+ /*< private >*/
+ GstControlSource *cs_a; /* GstControlSources for this property */
+ GstControlSource *cs_r;
+ GstControlSource *cs_g;
+ GstControlSource *cs_b;
+
+ GValue cur_value;
+ guint32 last_value;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstARGBControlBindingClass:
+ * @parent_class: Parent class
+ * @convert: Class method to convert control-values
+ *
+ * The class structure of #GstARGBControlBinding.
+ */
+
+struct _GstARGBControlBindingClass
+{
+ GstControlBindingClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_argb_control_binding_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GstControlBinding * gst_argb_control_binding_new (GstObject * object, const gchar * property_name,
+ GstControlSource * cs_a, GstControlSource * cs_r,
+ GstControlSource * cs_g, GstControlSource * cs_b);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstARGBControlBinding, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_ARGB_CONTROL_BINDING_H__ */
diff --git a/include/gst/controller/gstdirectcontrolbinding.h b/include/gst/controller/gstdirectcontrolbinding.h
new file mode 100644
index 0000000000..549d1240ed
--- /dev/null
+++ b/include/gst/controller/gstdirectcontrolbinding.h
@@ -0,0 +1,129 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gstdirectcontrolbinding.h: Direct attachment for control sources
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DIRECT_CONTROL_BINDING_H__
+#define __GST_DIRECT_CONTROL_BINDING_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+#include <gst/gstcontrolsource.h>
+#include <gst/controller/controller-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DIRECT_CONTROL_BINDING \
+ (gst_direct_control_binding_get_type())
+#define GST_DIRECT_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBinding))
+#define GST_DIRECT_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBindingClass))
+#define GST_IS_DIRECT_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECT_CONTROL_BINDING))
+#define GST_IS_DIRECT_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECT_CONTROL_BINDING))
+#define GST_DIRECT_CONTROL_BINDING_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstDirectControlBindingClass))
+
+typedef struct _GstDirectControlBinding GstDirectControlBinding;
+typedef struct _GstDirectControlBindingClass GstDirectControlBindingClass;
+
+/**
+ * GstDirectControlBindingConvertValue:
+ * @self: the #GstDirectControlBinding instance
+ * @src_value: the value returned by the cotnrol source
+ * @dest_value: the target location
+ *
+ * Function to map a control-value to the target plain data type.
+ */
+typedef void (* GstDirectControlBindingConvertValue) (GstDirectControlBinding *self, gdouble src_value, gpointer dest_value);
+
+/**
+ * GstDirectControlBindingConvertGValue:
+ * @self: the #GstDirectControlBinding instance
+ * @src_value: the value returned by the cotnrol source
+ * @dest_value: the target GValue
+ *
+ * Function to map a control-value to the target GValue.
+ */
+typedef void (* GstDirectControlBindingConvertGValue) (GstDirectControlBinding *self, gdouble src_value, GValue *dest_value);
+
+/**
+ * GstDirectControlBinding:
+ * @name: name of the property of this binding
+ *
+ * The instance structure of #GstDirectControlBinding.
+ */
+struct _GstDirectControlBinding {
+ GstControlBinding parent;
+
+ /*< private >*/
+ GstControlSource *cs; /* GstControlSource for this property */
+ GValue cur_value;
+ gdouble last_value;
+ gint byte_size;
+
+ GstDirectControlBindingConvertValue convert_value;
+ GstDirectControlBindingConvertGValue convert_g_value;
+
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ gboolean want_absolute;
+ } abi;
+ } ABI;
+};
+
+/**
+ * GstDirectControlBindingClass:
+ * @parent_class: Parent class
+ * @convert: Class method to convert control-values
+ *
+ * The class structure of #GstDirectControlBinding.
+ */
+
+struct _GstDirectControlBindingClass
+{
+ GstControlBindingClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_direct_control_binding_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GstControlBinding * gst_direct_control_binding_new (GstObject * object, const gchar * property_name,
+ GstControlSource * cs);
+GST_CONTROLLER_API
+GstControlBinding * gst_direct_control_binding_new_absolute (GstObject * object, const gchar * property_name,
+ GstControlSource * cs);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDirectControlBinding, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DIRECT_CONTROL_BINDING_H__ */
diff --git a/include/gst/controller/gstinterpolationcontrolsource.h b/include/gst/controller/gstinterpolationcontrolsource.h
new file mode 100644
index 0000000000..a3da267fb5
--- /dev/null
+++ b/include/gst/controller/gstinterpolationcontrolsource.h
@@ -0,0 +1,104 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstinterpolationcontrolsource.h: Control source that provides several
+ * interpolation methods
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_INTERPOLATION_CONTROL_SOURCE_H__
+#define __GST_INTERPOLATION_CONTROL_SOURCE_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/controller/gsttimedvaluecontrolsource.h>
+#include <gst/controller/controller-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_INTERPOLATION_CONTROL_SOURCE \
+ (gst_interpolation_control_source_get_type ())
+#define GST_INTERPOLATION_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSource))
+#define GST_INTERPOLATION_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
+#define GST_IS_INTERPOLATION_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INTERPOLATION_CONTROL_SOURCE))
+#define GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_INTERPOLATION_CONTROL_SOURCE))
+#define GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS(inst) \
+ (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
+
+typedef struct _GstInterpolationControlSource GstInterpolationControlSource;
+typedef struct _GstInterpolationControlSourceClass GstInterpolationControlSourceClass;
+typedef struct _GstInterpolationControlSourcePrivate GstInterpolationControlSourcePrivate;
+
+/**
+ * GstInterpolationMode:
+ * @GST_INTERPOLATION_MODE_NONE: steps-like interpolation, default
+ * @GST_INTERPOLATION_MODE_LINEAR: linear interpolation
+ * @GST_INTERPOLATION_MODE_CUBIC: cubic interpolation (natural), may overshoot
+ * the min or max values set by the control point, but is more 'curvy'
+ * @GST_INTERPOLATION_MODE_CUBIC_MONOTONIC: monotonic cubic interpolation, will not
+ * produce any values outside of the min-max range set by the control points
+ * (Since: 1.8)
+ *
+ * The various interpolation modes available.
+ */
+typedef enum
+{
+ GST_INTERPOLATION_MODE_NONE,
+ GST_INTERPOLATION_MODE_LINEAR,
+ GST_INTERPOLATION_MODE_CUBIC,
+ GST_INTERPOLATION_MODE_CUBIC_MONOTONIC,
+} GstInterpolationMode;
+
+/**
+ * GstInterpolationControlSource:
+ *
+ * The instance structure of #GstControlSource.
+ */
+struct _GstInterpolationControlSource {
+ GstTimedValueControlSource parent;
+
+ /*< private >*/
+ GstInterpolationControlSourcePrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstInterpolationControlSourceClass {
+ GstTimedValueControlSourceClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_interpolation_control_source_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GstControlSource * gst_interpolation_control_source_new (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstInterpolationControlSource, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_INTERPOLATION_CONTROL_SOURCE_H__ */
diff --git a/include/gst/controller/gstlfocontrolsource.h b/include/gst/controller/gstlfocontrolsource.h
new file mode 100644
index 0000000000..cc09d492c0
--- /dev/null
+++ b/include/gst/controller/gstlfocontrolsource.h
@@ -0,0 +1,102 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstlfocontrolsource.h: Control source that provides some periodic waveforms
+ * as control values.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_LFO_CONTROL_SOURCE_H__
+#define __GST_LFO_CONTROL_SOURCE_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include <gst/controller/controller-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_LFO_CONTROL_SOURCE \
+ (gst_lfo_control_source_get_type ())
+#define GST_LFO_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSource))
+#define GST_LFO_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
+#define GST_IS_LFO_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_LFO_CONTROL_SOURCE))
+#define GST_IS_LFO_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_LFO_CONTROL_SOURCE))
+#define GST_LFO_CONTROL_SOURCE_GET_CLASS(inst) \
+ (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
+
+typedef struct _GstLFOControlSource GstLFOControlSource;
+typedef struct _GstLFOControlSourceClass GstLFOControlSourceClass;
+typedef struct _GstLFOControlSourcePrivate GstLFOControlSourcePrivate;
+
+/**
+ * GstLFOWaveform:
+ * @GST_LFO_WAVEFORM_SINE: sine waveform
+ * @GST_LFO_WAVEFORM_SQUARE: square waveform
+ * @GST_LFO_WAVEFORM_SAW: saw waveform
+ * @GST_LFO_WAVEFORM_REVERSE_SAW: reverse saw waveform
+ * @GST_LFO_WAVEFORM_TRIANGLE: triangle waveform
+ *
+ * The various waveform modes available.
+ */
+typedef enum
+{
+ GST_LFO_WAVEFORM_SINE,
+ GST_LFO_WAVEFORM_SQUARE,
+ GST_LFO_WAVEFORM_SAW,
+ GST_LFO_WAVEFORM_REVERSE_SAW,
+ GST_LFO_WAVEFORM_TRIANGLE
+} GstLFOWaveform;
+
+/**
+ * GstLFOControlSource:
+ *
+ * The instance structure of #GstControlSource.
+ */
+struct _GstLFOControlSource {
+ GstControlSource parent;
+
+ /* <private> */
+ GstLFOControlSourcePrivate *priv;
+ GMutex lock;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstLFOControlSourceClass {
+ GstControlSourceClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_lfo_control_source_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GstControlSource *gst_lfo_control_source_new (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstLFOControlSource, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_LFO_CONTROL_SOURCE_H__ */
diff --git a/include/gst/controller/gstproxycontrolbinding.h b/include/gst/controller/gstproxycontrolbinding.h
new file mode 100644
index 0000000000..42e8fd9ff7
--- /dev/null
+++ b/include/gst/controller/gstproxycontrolbinding.h
@@ -0,0 +1,85 @@
+/*
+ * GStreamer
+ * Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PROXY_CONTROL_BINDING_H__
+#define __GST_PROXY_CONTROL_BINDING_H__
+
+#include <gst/gst.h>
+#include <gst/controller/controller-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PROXY_CONTROL_BINDING (gst_proxy_control_binding_get_type())
+#define GST_PROXY_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PROXY_CONTROL_BINDING,GstProxyControlBinding))
+#define GST_PROXY_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PROXY_CONTROL_BINDING,GstProxyControlBindingClass))
+#define GST_IS_PROXY_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PROXY_CONTROL_BINDING))
+#define GST_IS_PROXY_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PROXY_CONTROL_BINDING))
+#define GST_PROXY_CONTROL_BINDING_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstProxyControlBindingClass))
+
+typedef struct _GstProxyControlBinding GstProxyControlBinding;
+typedef struct _GstProxyControlBindingClass GstProxyControlBindingClass;
+
+/**
+ * GstProxyControlBinding:
+ *
+ * Opaque #GstProxyControlBinding struct
+ */
+struct _GstProxyControlBinding
+{
+ /* <private> */
+ GstControlBinding parent;
+
+ GWeakRef ref_object;
+ gchar *property_name;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstProxyControlBindingClass:
+ *
+ * Opaque #GstProxyControlBindingClass struct
+ */
+struct _GstProxyControlBindingClass
+{
+ /* <private> */
+ GstControlBindingClass parent_class;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_proxy_control_binding_get_type (void);
+
+GST_CONTROLLER_API
+GstControlBinding * gst_proxy_control_binding_new (GstObject * object,
+ const gchar * property_name,
+ GstObject * ref_object,
+ const gchar * ref_property_name);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstProxyControlBinding, gst_object_unref)
+G_END_DECLS
+
+#endif /* __GST_PROXY_CONTROL_BINDING_H__ */
diff --git a/include/gst/controller/gsttimedvaluecontrolsource.h b/include/gst/controller/gsttimedvaluecontrolsource.h
new file mode 100644
index 0000000000..2baa369a23
--- /dev/null
+++ b/include/gst/controller/gsttimedvaluecontrolsource.h
@@ -0,0 +1,160 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ * 2011 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gsttimedvaluecontrolsource.h: Base class for timeed value based control
+ * sources
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TIMED_VALUE_CONTROL_SOURCE_H__
+#define __GST_TIMED_VALUE_CONTROL_SOURCE_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include <gst/controller/controller-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TIMED_VALUE_CONTROL_SOURCE \
+ (gst_timed_value_control_source_get_type ())
+#define GST_TIMED_VALUE_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSource))
+#define GST_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
+#define GST_IS_TIMED_VALUE_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
+#define GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
+#define GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS(inst) \
+ (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
+
+typedef struct _GstTimedValueControlSource GstTimedValueControlSource;
+typedef struct _GstTimedValueControlSourceClass GstTimedValueControlSourceClass;
+typedef struct _GstTimedValueControlSourcePrivate GstTimedValueControlSourcePrivate;
+typedef struct _GstControlPoint GstControlPoint;
+
+/**
+ * GstControlPoint:
+ * @timestamp: timestamp of the value change
+ * @value: the new value
+ *
+ * An internal structure for value+time and various temporary
+ * values used for interpolation. This "inherits" from
+ * GstTimedValue.
+ */
+struct _GstControlPoint
+{
+ /* fields from GstTimedValue. DO NOT CHANGE! */
+ GstClockTime timestamp;
+ gdouble value;
+
+ /*< private >*/
+
+ /* Caches for the interpolators */
+ /* FIXME: we should not have this here already ... */
+ union {
+ struct { /* 16 bytes */
+ gdouble h;
+ gdouble z;
+ } cubic;
+ struct { /* 24 bytes */
+ gdouble c1s, c2s, c3s;
+ } cubic_monotonic;
+ guint8 _gst_reserved[64];
+ } cache;
+};
+
+GST_CONTROLLER_API
+GType gst_control_point_get_type (void);
+
+/**
+ * GstTimedValueControlSource:
+ *
+ * The instance structure of #GstControlSource.
+ */
+struct _GstTimedValueControlSource {
+ GstControlSource parent;
+
+ /*< protected >*/
+ GMutex lock;
+
+ GSequence *values; /* List of GstControlPoint */
+ gint nvalues; /* Number of control points */
+ gboolean valid_cache;
+
+ /*< private >*/
+ GstTimedValueControlSourcePrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstTimedValueControlSourceClass {
+ GstControlSourceClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_TIMED_VALUE_CONTROL_SOURCE_LOCK(o) \
+ g_mutex_lock(&((GstTimedValueControlSource *)o)->lock)
+#define GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK(o) \
+ g_mutex_unlock(&((GstTimedValueControlSource *)o)->lock)
+
+GST_CONTROLLER_API
+GType gst_timed_value_control_source_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GSequenceIter * gst_timed_value_control_source_find_control_point_iter (
+ GstTimedValueControlSource * self,
+ GstClockTime timestamp);
+GST_CONTROLLER_API
+gboolean gst_timed_value_control_source_set (GstTimedValueControlSource * self,
+ GstClockTime timestamp,
+ const gdouble value);
+GST_CONTROLLER_API
+gboolean gst_timed_value_control_source_set_from_list (GstTimedValueControlSource * self,
+ const GSList * timedvalues);
+GST_CONTROLLER_API
+gboolean gst_timed_value_control_source_unset (GstTimedValueControlSource * self,
+ GstClockTime timestamp);
+
+GST_CONTROLLER_API
+void gst_timed_value_control_source_unset_all (GstTimedValueControlSource *self);
+
+GST_CONTROLLER_API
+GList * gst_timed_value_control_source_get_all (GstTimedValueControlSource * self);
+
+GST_CONTROLLER_API
+gint gst_timed_value_control_source_get_count (GstTimedValueControlSource * self);
+
+GST_CONTROLLER_API
+void gst_timed_value_control_invalidate_cache (GstTimedValueControlSource * self);
+
+GST_CONTROLLER_API
+void gst_control_point_free (GstControlPoint * cp);
+
+GST_CONTROLLER_API
+GstControlPoint * gst_control_point_copy (GstControlPoint * cp);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTimedValueControlSource, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TIMED_VALUE_CONTROL_SOURCE_H__ */
diff --git a/include/gst/controller/gsttriggercontrolsource.h b/include/gst/controller/gsttriggercontrolsource.h
new file mode 100644
index 0000000000..431456b970
--- /dev/null
+++ b/include/gst/controller/gsttriggercontrolsource.h
@@ -0,0 +1,87 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ * 2011 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gsttriggercontrolsource.h: Control source that provides some values at time-
+ * stamps
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_TRIGGER_CONTROL_SOURCE_H__
+#define __GST_TRIGGER_CONTROL_SOURCE_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/controller/gsttimedvaluecontrolsource.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TRIGGER_CONTROL_SOURCE \
+ (gst_trigger_control_source_get_type ())
+#define GST_TRIGGER_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSource))
+#define GST_TRIGGER_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSourceClass))
+#define GST_IS_TRIGGER_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TRIGGER_CONTROL_SOURCE))
+#define GST_IS_TRIGGER_CONTROL_SOURCE_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TRIGGER_CONTROL_SOURCE))
+#define GST_TRIGGER_CONTROL_SOURCE_GET_CLASS(inst) \
+ (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TRIGGER_CONTROL_SOURCE, GstTriggerControlSourceClass))
+
+#define GST_TYPE_TRIGGER_WAVEFORM (gst_trigger_waveform_get_type ())
+
+typedef struct _GstTriggerControlSource GstTriggerControlSource;
+typedef struct _GstTriggerControlSourceClass GstTriggerControlSourceClass;
+typedef struct _GstTriggerControlSourcePrivate GstTriggerControlSourcePrivate;
+
+/**
+ * GstTriggerControlSource:
+ *
+ * The instance structure of #GstControlSource.
+ */
+struct _GstTriggerControlSource {
+ GstTimedValueControlSource parent;
+
+ /*< private >*/
+ GstTriggerControlSourcePrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstTriggerControlSourceClass {
+ GstTimedValueControlSourceClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_CONTROLLER_API
+GType gst_trigger_control_source_get_type (void);
+
+/* Functions */
+
+GST_CONTROLLER_API
+GstControlSource *gst_trigger_control_source_new (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTriggerControlSource, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TRIGGER_CONTROL_SOURCE_H__ */
diff --git a/include/gst/fft/fft-prelude.h b/include/gst/fft/fft-prelude.h
new file mode 100644
index 0000000000..71a873dbc3
--- /dev/null
+++ b/include/gst/fft/fft-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer FFT Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * fft-prelude.h: prelude include header for gst-fft library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT_PRELUDE_H__
+#define __GST_FFT_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_FFT
+#define GST_FFT_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_FFT_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_FFT_PRELUDE_H__ */
diff --git a/include/gst/fft/fft.h b/include/gst/fft/fft.h
new file mode 100644
index 0000000000..fc78a42cde
--- /dev/null
+++ b/include/gst/fft/fft.h
@@ -0,0 +1,31 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstfft.h: single include header for gst-fft library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT__H__
+#define __GST_FFT__H__
+
+#include <gst/fft/gstfft.h>
+#include <gst/fft/gstffts16.h>
+#include <gst/fft/gstffts32.h>
+#include <gst/fft/gstfftf32.h>
+#include <gst/fft/gstfftf64.h>
+
+#endif /* __GST_FFT__H__ */
diff --git a/include/gst/fft/gstfft.h b/include/gst/fft/gstfft.h
new file mode 100644
index 0000000000..b3ff54aef9
--- /dev/null
+++ b/include/gst/fft/gstfft.h
@@ -0,0 +1,57 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <math.h>
+#include <gst/gst.h>
+
+#ifndef __GST_FFT_H__
+#define __GST_FFT_H__
+
+#include <gst/fft/fft-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstFFTWindow:
+ * @GST_FFT_WINDOW_RECTANGULAR: Rectangular window
+ * @GST_FFT_WINDOW_HAMMING: Hamming window
+ * @GST_FFT_WINDOW_HANN: Hann (sometimes also called Hanning) window
+ * @GST_FFT_WINDOW_BARTLETT: Bartlett window
+ * @GST_FFT_WINDOW_BLACKMAN: Blackman window
+ *
+ * The various window functions available.
+ */
+typedef enum
+{
+ GST_FFT_WINDOW_RECTANGULAR,
+ GST_FFT_WINDOW_HAMMING,
+ GST_FFT_WINDOW_HANN,
+ GST_FFT_WINDOW_BARTLETT,
+ GST_FFT_WINDOW_BLACKMAN
+} GstFFTWindow;
+
+/* Functions */
+
+GST_FFT_API
+gint gst_fft_next_fast_length (gint n) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GST_FFT_H__ */
diff --git a/include/gst/fft/gstfftf32.h b/include/gst/fft/gstfftf32.h
new file mode 100644
index 0000000000..0cd5c41656
--- /dev/null
+++ b/include/gst/fft/gstfftf32.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT_F32_H__
+#define __GST_FFT_F32_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GstFFTF32 GstFFTF32;
+typedef struct _GstFFTF32Complex GstFFTF32Complex;
+
+/* Copy of kiss_fft_f32_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTF32Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * 32 bit float.
+ */
+struct _GstFFTF32Complex
+{
+ gfloat r;
+ gfloat i;
+};
+
+/* Functions */
+
+GST_FFT_API
+GstFFTF32 * gst_fft_f32_new (gint len, gboolean inverse);
+
+GST_FFT_API
+void gst_fft_f32_free (GstFFTF32 *self);
+
+GST_FFT_API
+void gst_fft_f32_fft (GstFFTF32 *self, const gfloat *timedata,
+ GstFFTF32Complex *freqdata);
+
+GST_FFT_API
+void gst_fft_f32_inverse_fft (GstFFTF32 *self, const GstFFTF32Complex *freqdata,
+ gfloat *timedata);
+
+GST_FFT_API
+void gst_fft_f32_window (GstFFTF32 *self, gfloat *timedata, GstFFTWindow window);
+
+G_END_DECLS
+
+#endif /* __GST_FFT_F32_H__ */
diff --git a/include/gst/fft/gstfftf64.h b/include/gst/fft/gstfftf64.h
new file mode 100644
index 0000000000..52700b45e0
--- /dev/null
+++ b/include/gst/fft/gstfftf64.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT_F64_H__
+#define __GST_FFT_F64_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GstFFTF64 GstFFTF64;
+typedef struct _GstFFTF64Complex GstFFTF64Complex;
+
+/* Copy of kiss_fft_f64_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTF64Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * 64 bit float.
+ */
+struct _GstFFTF64Complex
+{
+ gdouble r;
+ gdouble i;
+};
+
+/* Functions */
+
+GST_FFT_API
+GstFFTF64 * gst_fft_f64_new (gint len, gboolean inverse);
+
+GST_FFT_API
+void gst_fft_f64_free (GstFFTF64 *self);
+
+GST_FFT_API
+void gst_fft_f64_fft (GstFFTF64 *self, const gdouble *timedata,
+ GstFFTF64Complex *freqdata);
+
+GST_FFT_API
+void gst_fft_f64_inverse_fft (GstFFTF64 *self, const GstFFTF64Complex *freqdata,
+ gdouble *timedata);
+
+GST_FFT_API
+void gst_fft_f64_window (GstFFTF64 *self, gdouble *timedata, GstFFTWindow window);
+
+G_END_DECLS
+
+#endif /* __GST_FFT_F64_H__ */
diff --git a/include/gst/fft/gstffts16.h b/include/gst/fft/gstffts16.h
new file mode 100644
index 0000000000..b0f9b9271b
--- /dev/null
+++ b/include/gst/fft/gstffts16.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT_S16_H__
+#define __GST_FFT_S16_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GstFFTS16 GstFFTS16;
+typedef struct _GstFFTS16Complex GstFFTS16Complex;
+
+/* Copy of kiss_fft_s16_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTS16Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * signed 16 bit integers.
+ */
+struct _GstFFTS16Complex
+{
+ gint16 r;
+ gint16 i;
+};
+
+/* Functions */
+
+GST_FFT_API
+GstFFTS16 * gst_fft_s16_new (gint len, gboolean inverse);
+
+GST_FFT_API
+void gst_fft_s16_free (GstFFTS16 *self);
+
+GST_FFT_API
+void gst_fft_s16_fft (GstFFTS16 *self, const gint16 *timedata,
+ GstFFTS16Complex *freqdata);
+
+GST_FFT_API
+void gst_fft_s16_inverse_fft (GstFFTS16 *self, const GstFFTS16Complex *freqdata,
+ gint16 *timedata);
+
+GST_FFT_API
+void gst_fft_s16_window (GstFFTS16 *self, gint16 *timedata, GstFFTWindow window);
+
+G_END_DECLS
+
+#endif /* __GST_FFT_S16_H__ */
diff --git a/include/gst/fft/gstffts32.h b/include/gst/fft/gstffts32.h
new file mode 100644
index 0000000000..29505c26ec
--- /dev/null
+++ b/include/gst/fft/gstffts32.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) <2007> Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_FFT_S32_H__
+#define __GST_FFT_S32_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "gstfft.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GstFFTS32 GstFFTS32;
+typedef struct _GstFFTS32Complex GstFFTS32Complex;
+
+/* Copy of kiss_fft_s32_cpx for documentation reasons,
+ * do NOT change! */
+
+/**
+ * GstFFTS32Complex:
+ * @r: Real part
+ * @i: Imaginary part
+ *
+ * Data type for complex numbers composed of
+ * signed 32 bit integers.
+ */
+struct _GstFFTS32Complex
+{
+ gint32 r;
+ gint32 i;
+};
+
+/* Functions */
+
+GST_FFT_API
+GstFFTS32 * gst_fft_s32_new (gint len, gboolean inverse);
+
+GST_FFT_API
+void gst_fft_s32_free (GstFFTS32 *self);
+
+GST_FFT_API
+void gst_fft_s32_fft (GstFFTS32 *self, const gint32 *timedata,
+ GstFFTS32Complex *freqdata);
+
+GST_FFT_API
+void gst_fft_s32_inverse_fft (GstFFTS32 *self, const GstFFTS32Complex *freqdata,
+ gint32 *timedata);
+
+GST_FFT_API
+void gst_fft_s32_window (GstFFTS32 *self, gint32 *timedata, GstFFTWindow window);
+
+G_END_DECLS
+
+#endif /* __GST_FFT_S32_H__ */
diff --git a/include/gst/gl/gl-enumtypes.h b/include/gst/gl/gl-enumtypes.h
new file mode 100644
index 0000000000..5285248e36
--- /dev/null
+++ b/include/gst/gl/gl-enumtypes.h
@@ -0,0 +1,87 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+#include <gst/gst.h>
+#include <gst/gl/gstgl_fwd.h>
+G_BEGIN_DECLS
+
+/* enumerations from "gstgl_enums.h" */
+GST_GL_API
+GType gst_gl_texture_target_get_type (void);
+#define GST_TYPE_GL_TEXTURE_TARGET (gst_gl_texture_target_get_type())
+
+/* enumerations from "gstglapi.h" */
+GST_GL_API
+GType gst_gl_api_get_type (void);
+#define GST_TYPE_GL_API (gst_gl_api_get_type())
+GST_GL_API
+GType gst_gl_platform_get_type (void);
+#define GST_TYPE_GL_PLATFORM (gst_gl_platform_get_type())
+
+/* enumerations from "gstglbasememory.h" */
+GST_GL_API
+GType gst_gl_base_memory_error_get_type (void);
+#define GST_TYPE_GL_BASE_MEMORY_ERROR (gst_gl_base_memory_error_get_type())
+GST_GL_API
+GType gst_gl_base_memory_transfer_get_type (void);
+#define GST_TYPE_GL_BASE_MEMORY_TRANSFER (gst_gl_base_memory_transfer_get_type())
+
+/* enumerations from "gstglcontext.h" */
+GST_GL_API
+GType gst_gl_context_error_get_type (void);
+#define GST_TYPE_GL_CONTEXT_ERROR (gst_gl_context_error_get_type())
+
+/* enumerations from "gstglcontextconfig.h" */
+GST_GL_API
+GType gst_gl_config_caveat_get_type (void);
+#define GST_TYPE_GL_CONFIG_CAVEAT (gst_gl_config_caveat_get_type())
+GST_GL_API
+GType gst_gl_config_surface_type_get_type (void);
+#define GST_TYPE_GL_CONFIG_SURFACE_TYPE (gst_gl_config_surface_type_get_type())
+
+/* enumerations from "gstgldisplay.h" */
+GST_GL_API
+GType gst_gl_display_type_get_type (void);
+#define GST_TYPE_GL_DISPLAY_TYPE (gst_gl_display_type_get_type())
+
+/* enumerations from "gstglformat.h" */
+GST_GL_API
+GType gst_gl_format_get_type (void);
+#define GST_TYPE_GL_FORMAT (gst_gl_format_get_type())
+
+/* enumerations from "gstglquery.h" */
+GST_GL_API
+GType gst_gl_query_type_get_type (void);
+#define GST_TYPE_GL_QUERY_TYPE (gst_gl_query_type_get_type())
+
+/* enumerations from "gstglsl.h" */
+GST_GL_API
+GType gst_glsl_error_get_type (void);
+#define GST_TYPE_GLSL_ERROR (gst_glsl_error_get_type())
+GST_GL_API
+GType gst_glsl_version_get_type (void);
+#define GST_TYPE_GLSL_VERSION (gst_glsl_version_get_type())
+GST_GL_API
+GType gst_glsl_profile_get_type (void);
+#define GST_TYPE_GLSL_PROFILE (gst_glsl_profile_get_type())
+
+/* enumerations from "gstglupload.h" */
+GST_GL_API
+GType gst_gl_upload_return_get_type (void);
+#define GST_TYPE_GL_UPLOAD_RETURN (gst_gl_upload_return_get_type())
+
+/* enumerations from "gstglviewconvert.h" */
+GST_GL_API
+GType gst_gl_stereo_downmix_get_type (void);
+#define GST_TYPE_GL_STEREO_DOWNMIX (gst_gl_stereo_downmix_get_type())
+
+/* enumerations from "gstglwindow.h" */
+GST_GL_API
+GType gst_gl_window_error_get_type (void);
+#define GST_TYPE_GL_WINDOW_ERROR (gst_gl_window_error_get_type())
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/gl/gl-prelude.h b/include/gst/gl/gl-prelude.h
new file mode 100644
index 0000000000..05e1f6229a
--- /dev/null
+++ b/include/gst/gl/gl-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer GL Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * gl-prelude.h: prelude include header for gst-gl library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_PRELUDE_H__
+#define __GST_GL_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_GL
+#define GST_GL_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_GL_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_GL_PRELUDE_H__ */
diff --git a/include/gst/gl/gl.h b/include/gst/gl/gl.h
new file mode 100644
index 0000000000..6c7a37ff64
--- /dev/null
+++ b/include/gst/gl/gl.h
@@ -0,0 +1,56 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Julien Isorce <julien.isorce@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_H__
+#define __GST_GL_H__
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/gl/gl-enumtypes.h>
+#include <gst/gl/gstglapi.h>
+#include <gst/gl/gstglconfig.h>
+#include <gst/gl/gstglcontext.h>
+#include <gst/gl/gstglcontextconfig.h>
+#include <gst/gl/gstgldebug.h>
+#include <gst/gl/gstgldisplay.h>
+#include <gst/gl/gstglfeature.h>
+#include <gst/gl/gstglformat.h>
+#include <gst/gl/gstglutils.h>
+#include <gst/gl/gstglwindow.h>
+#include <gst/gl/gstglslstage.h>
+#include <gst/gl/gstglshader.h>
+#include <gst/gl/gstglshaderstrings.h>
+#include <gst/gl/gstglcolorconvert.h>
+#include <gst/gl/gstglupload.h>
+#include <gst/gl/gstglbasememory.h>
+#include <gst/gl/gstglbuffer.h>
+#include <gst/gl/gstglmemory.h>
+#include <gst/gl/gstglmemorypbo.h>
+#include <gst/gl/gstglrenderbuffer.h>
+#include <gst/gl/gstglbufferpool.h>
+#include <gst/gl/gstglframebuffer.h>
+#include <gst/gl/gstglbasefilter.h>
+#include <gst/gl/gstglbasesrc.h>
+#include <gst/gl/gstglviewconvert.h>
+#include <gst/gl/gstglfilter.h>
+#include <gst/gl/gstglsyncmeta.h>
+#include <gst/gl/gstgloverlaycompositor.h>
+#include <gst/gl/gstglquery.h>
+
+#endif /* __GST_GL_H__ */
diff --git a/include/gst/gl/glprototypes/all_functions.h b/include/gst/gl/glprototypes/all_functions.h
new file mode 100644
index 0000000000..48007e9548
--- /dev/null
+++ b/include/gst/gl/glprototypes/all_functions.h
@@ -0,0 +1,34 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "base.h"
+#include "blending.h"
+#include "eglimage.h"
+#include "fbo.h"
+#include "fixedfunction.h"
+#include "gles.h"
+#include "opengl.h"
+#include "shaders.h"
+#include "debug.h"
+#include "vao.h"
+#include "sync.h"
+#include "buffers.h"
+#include "query.h"
+#include "buffer_storage.h"
diff --git a/include/gst/gl/glprototypes/base.h b/include/gst/gl/glprototypes/base.h
new file mode 100644
index 0000000000..8394a38728
--- /dev/null
+++ b/include/gst/gl/glprototypes/base.h
@@ -0,0 +1,328 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/* These are the core GL functions which we assume will always be
+ available */
+GST_GL_EXT_BEGIN (core,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES1 | GST_GL_API_GLES2,
+ 1, 0,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, BindTexture,
+ (GLenum target, GLuint texture))
+GST_GL_EXT_FUNCTION (void, BlendFunc,
+ (GLenum sfactor, GLenum dfactor))
+GST_GL_EXT_FUNCTION (void, Clear,
+ (GLbitfield mask))
+GST_GL_EXT_FUNCTION (void, ClearColor,
+ (GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha))
+GST_GL_EXT_FUNCTION (void, ClearStencil,
+ (GLint s))
+GST_GL_EXT_FUNCTION (void, ColorMask,
+ (GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha))
+GST_GL_EXT_FUNCTION (void, CopyTexSubImage2D,
+ (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height))
+GST_GL_EXT_FUNCTION (void, DeleteTextures,
+ (GLsizei n, const GLuint* textures))
+GST_GL_EXT_FUNCTION (void, DepthFunc,
+ (GLenum func))
+GST_GL_EXT_FUNCTION (void, DepthMask,
+ (GLboolean flag))
+GST_GL_EXT_FUNCTION (void, Disable,
+ (GLenum cap))
+GST_GL_EXT_FUNCTION (void, DrawArrays,
+ (GLenum mode, GLint first, GLsizei count))
+GST_GL_EXT_FUNCTION (void, DrawElements,
+ (GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid* indices))
+GST_GL_EXT_FUNCTION (void, Enable,
+ (GLenum cap))
+GST_GL_EXT_FUNCTION (void, Finish,
+ (void))
+GST_GL_EXT_FUNCTION (void, Flush,
+ (void))
+GST_GL_EXT_FUNCTION (void, FrontFace,
+ (GLenum mode))
+GST_GL_EXT_FUNCTION (void, CullFace,
+ (GLenum mode))
+GST_GL_EXT_FUNCTION (void, GenTextures,
+ (GLsizei n, GLuint* textures))
+GST_GL_EXT_FUNCTION (GLenum, GetError,
+ (void))
+GST_GL_EXT_FUNCTION (void, GetIntegerv,
+ (GLenum pname, GLint* params))
+GST_GL_EXT_FUNCTION (void, GetBooleanv,
+ (GLenum pname, GLboolean* params))
+GST_GL_EXT_FUNCTION (void, GetFloatv,
+ (GLenum pname, GLfloat* params))
+GST_GL_EXT_FUNCTION (const GLubyte*, GetString,
+ (GLenum name))
+GST_GL_EXT_FUNCTION (void, Hint,
+ (GLenum target, GLenum mode))
+GST_GL_EXT_FUNCTION (GLboolean, IsTexture,
+ (GLuint texture))
+GST_GL_EXT_FUNCTION (void, PixelStorei,
+ (GLenum pname, GLint param))
+GST_GL_EXT_FUNCTION (void, ReadPixels,
+ (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLvoid* pixels))
+GST_GL_EXT_FUNCTION (void, Scissor,
+ (GLint x, GLint y, GLsizei width, GLsizei height))
+GST_GL_EXT_FUNCTION (void, StencilFunc,
+ (GLenum func, GLint ref, GLuint mask))
+GST_GL_EXT_FUNCTION (void, StencilMask,
+ (GLuint mask))
+GST_GL_EXT_FUNCTION (void, StencilOp,
+ (GLenum fail, GLenum zfail, GLenum zpass))
+GST_GL_EXT_FUNCTION (void, TexImage2D,
+ (GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const GLvoid* pixels))
+GST_GL_EXT_FUNCTION (void, TexParameterfv,
+ (GLenum target, GLenum pname, const GLfloat* params))
+GST_GL_EXT_FUNCTION (void, TexParameteri,
+ (GLenum target, GLenum pname, GLint param))
+GST_GL_EXT_FUNCTION (void, TexParameteriv,
+ (GLenum target, GLenum pname, const GLint* params))
+GST_GL_EXT_FUNCTION (void, GetTexParameterfv,
+ (GLenum target, GLenum pname, GLfloat* params))
+GST_GL_EXT_FUNCTION (void, GetTexParameteriv,
+ (GLenum target, GLenum pname, GLint* params))
+GST_GL_EXT_FUNCTION (void, TexSubImage2D,
+ (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid* pixels))
+GST_GL_EXT_FUNCTION (void, CopyTexImage2D,
+ (GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border))
+GST_GL_EXT_FUNCTION (void, Viewport,
+ (GLint x, GLint y, GLsizei width, GLsizei height))
+GST_GL_EXT_FUNCTION (GLboolean, IsEnabled, (GLenum cap))
+GST_GL_EXT_FUNCTION (void, LineWidth, (GLfloat width))
+GST_GL_EXT_FUNCTION (void, PolygonOffset, (GLfloat factor, GLfloat units))
+GST_GL_EXT_FUNCTION (void, TexParameterf,
+ (GLenum target,
+ GLenum pname,
+ GLfloat param))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (texture_3d,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
+ 1, 2,
+ 255, 255, /* not in either GLES */
+ "OES\0",
+ "texture_3D\0")
+GST_GL_EXT_FUNCTION (void, TexImage3D,
+ (GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels))
+GST_GL_EXT_FUNCTION (void, TexSubImage3D,
+ (GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format,
+ GLenum type, const GLvoid *pixels))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_3,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES1 | GST_GL_API_GLES2,
+ 1, 3,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, CompressedTexImage2D,
+ (GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid* data))
+GST_GL_EXT_FUNCTION (void, CompressedTexSubImage2D,
+ (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid* data))
+GST_GL_EXT_FUNCTION (void, SampleCoverage,
+ (GLclampf value, GLboolean invert))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_5,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES1 | GST_GL_API_GLES2,
+ 1, 5,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, GetBufferParameteriv,
+ (GLenum target, GLenum pname, GLint* params))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (vbos,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES1 | GST_GL_API_GLES2,
+ 1, 5,
+ 1, 0,
+ "ARB\0",
+ "vertex_buffer_object\0")
+GST_GL_EXT_FUNCTION (void, GenBuffers,
+ (GLsizei n,
+ GLuint *buffers))
+GST_GL_EXT_FUNCTION (void, BindBuffer,
+ (GLenum target,
+ GLuint buffer))
+GST_GL_EXT_FUNCTION (void, BufferData,
+ (GLenum target,
+ GLsizeiptr size,
+ const GLvoid *data,
+ GLenum usage))
+GST_GL_EXT_FUNCTION (void, BufferSubData,
+ (GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const GLvoid *data))
+GST_GL_EXT_FUNCTION (void, DeleteBuffers,
+ (GLsizei n,
+ const GLuint *buffers))
+GST_GL_EXT_FUNCTION (GLboolean, IsBuffer,
+ (GLuint buffer))
+GST_GL_EXT_END ()
+
+/* Available in GL 1.3, the multitexture extension or GLES. These are
+ required */
+GST_GL_EXT_BEGIN (multitexture_part0,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES1 | GST_GL_API_GLES2,
+ 1, 3,
+ 1, 0,
+ "ARB\0",
+ "multitexture\0")
+GST_GL_EXT_FUNCTION (void, ActiveTexture,
+ (GLenum texture))
+GST_GL_EXT_END ()
+
+
+ /* GLES doesn't support mapping buffers in core so this has to be a
+ separate check */
+GST_GL_EXT_BEGIN (map_vbos,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
+ 1, 5,
+ 255, 255, /* not in GLES core */
+ "ARB\0OES\0",
+ "vertex_buffer_object\0mapbuffer\0")
+GST_GL_EXT_FUNCTION (void *, MapBuffer,
+ (GLenum target,
+ GLenum access))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (unmap_buffer,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
+ 1, 5,
+ 3, 0,
+ "ARB\0OES\0",
+ "vertex_buffer_object\0mapbuffer\0")
+GST_GL_EXT_FUNCTION (GLboolean, UnmapBuffer,
+ (GLenum target))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (gl3,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 3, 0,
+ 3, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (const GLubyte*, GetStringi,
+ (GLenum name, GLint index))
+GST_GL_EXT_FUNCTION (void *, MapBufferRange,
+ (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/blending.h b/include/gst/gl/glprototypes/blending.h
new file mode 100644
index 0000000000..8ea514880a
--- /dev/null
+++ b/include/gst/gl/glprototypes/blending.h
@@ -0,0 +1,99 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+GST_GL_EXT_BEGIN (blending,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 1, 2,
+ 2, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, BlendEquation,
+ (GLenum mode))
+GST_GL_EXT_FUNCTION (void, BlendColor,
+ (GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha))
+GST_GL_EXT_END ()
+
+/* Optional, declared in 1.4 or GLES 1.2 */
+GST_GL_EXT_BEGIN (blend_func_separate,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 1, 4,
+ 2, 0,
+ "EXT\0",
+ "blend_func_separate\0")
+GST_GL_EXT_FUNCTION (void, BlendFuncSeparate,
+ (GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha))
+GST_GL_EXT_END ()
+
+/* Optional, declared in 2.0 */
+GST_GL_EXT_BEGIN (blend_equation_separate,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 0,
+ 2, 0,
+ "EXT\0",
+ "blend_equation_separate\0")
+GST_GL_EXT_FUNCTION (void, BlendEquationSeparate,
+ (GLenum modeRGB,
+ GLenum modeAlpha))
+GST_GL_EXT_END ()
+
+/* GL and GLES 2.0 apis */
+GST_GL_EXT_BEGIN (two_point_zero_api,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 0,
+ 2, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, StencilFuncSeparate,
+ (GLenum face, GLenum func, GLint ref, GLuint mask))
+GST_GL_EXT_FUNCTION (void, StencilMaskSeparate,
+ (GLenum face, GLuint mask))
+GST_GL_EXT_FUNCTION (void, StencilOpSeparate,
+ (GLenum face, GLenum fail, GLenum zfail, GLenum zpass))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/buffer_storage.h b/include/gst/gl/glprototypes/buffer_storage.h
new file mode 100644
index 0000000000..57a93a0040
--- /dev/null
+++ b/include/gst/gl/glprototypes/buffer_storage.h
@@ -0,0 +1,42 @@
+/*
+ * GStreamer
+ * Copyright (C) 2021 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (buffer_storage,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 4, 4,
+ 255, 255,
+ "EXT\0ARB:\0", /* ARB version doesn't have function suffixes */
+ "buffer_storage\0")
+GST_GL_EXT_FUNCTION (void, BufferStorage,
+ (GLenum target, GLsizeiptr, const void * data, GLbitfield flags))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (flush_mapped,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 3, 0,
+ 3, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, FlushMappedBufferRange,
+ (GLenum target, GLintptr offset, GLsizeiptr length))
+GST_GL_EXT_END ()
+
diff --git a/include/gst/gl/glprototypes/buffers.h b/include/gst/gl/glprototypes/buffers.h
new file mode 100644
index 0000000000..5e73c624fe
--- /dev/null
+++ b/include/gst/gl/glprototypes/buffers.h
@@ -0,0 +1,48 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (buffer_copy_sub_data,
+ GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 3, 1,
+ 3, 0,
+ /* extension is available in GL 3.0 */
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, CopyBufferSubData,
+ (GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (get_buffer_sub_data,
+ GST_GL_API_OPENGL3,
+ 1, 5,
+ 255, 255,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, GetBufferSubData,
+ (GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ void * data))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/debug.h b/include/gst/gl/glprototypes/debug.h
new file mode 100644
index 0000000000..135d4e6720
--- /dev/null
+++ b/include/gst/gl/glprototypes/debug.h
@@ -0,0 +1,117 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (debug,
+ GST_GL_API_OPENGL3,
+ 4, 3,
+ 255, 255,
+ "KHR:\0KHR\0ARB\0",
+ "debug\0debug_output\0")
+GST_GL_EXT_FUNCTION (void, DebugMessageControl,
+ (GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint* ids,
+ gboolean enabled))
+GST_GL_EXT_FUNCTION (void, DebugMessageInsert,
+ (GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const gchar *message))
+GST_GL_EXT_FUNCTION (void, DebugMessageCallback,
+ (GST_GL_DEBUG_PROC callback,
+ gpointer user_data))
+GST_GL_EXT_FUNCTION (GLuint, GetDebugMessageLog,
+ (GLuint count,
+ GLsizei bufSize,
+ GLenum* sources,
+ GLenum* types,
+ GLuint* ids,
+ GLenum* severities,
+ GLsizei* lengths,
+ gchar* messageLog))
+GST_GL_EXT_FUNCTION (void, GetPointerv,
+ (GLenum pname,
+ gpointer * params))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (khr_debug,
+ GST_GL_API_OPENGL3,
+ 4, 3,
+ 255, 255,
+ "KHR:\0KHR\0",
+ "debug\0")
+GST_GL_EXT_FUNCTION (void, PushDebugGroup,
+ (GLenum source,
+ GLuint id,
+ GLsizei length,
+ const gchar * message))
+GST_GL_EXT_FUNCTION (void, PopDebugGroup, (void))
+GST_GL_EXT_FUNCTION (void, ObjectLabel,
+ (GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const gchar *label))
+GST_GL_EXT_FUNCTION (void, GetObjectLabel,
+ (GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ gchar *label))
+GST_GL_EXT_FUNCTION (void, ObjectPtrLabel,
+ (gpointer ptr,
+ GLsizei length,
+ const gchar *label))
+GST_GL_EXT_FUNCTION (void, GetObjectPtrLabel,
+ (gpointer ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ gchar *label))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (ext_debug_marker,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255,
+ "EXT\0",
+ "debug_marker\0")
+GST_GL_EXT_FUNCTION (void, InsertEventMarker,
+ (GLsizei length,
+ const gchar * message))
+GST_GL_EXT_FUNCTION (void, PushGroupMarker,
+ (GLsizei length,
+ const gchar * message))
+GST_GL_EXT_FUNCTION (void, PopGroupMarker,
+ (void))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (gremedy_string_marker,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255,
+ "GREMEDY\0",
+ "string_marker\0")
+GST_GL_EXT_FUNCTION (void, StringMarker,
+ (GLsizei length,
+ const gchar * message))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/eglimage.h b/include/gst/gl/glprototypes/eglimage.h
new file mode 100644
index 0000000000..0256003b06
--- /dev/null
+++ b/include/gst/gl/glprototypes/eglimage.h
@@ -0,0 +1,53 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+GST_GL_EXT_BEGIN (EGL_image,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255, /* not in either GLES */
+ "OES\0",
+ "EGL_image\0")
+GST_GL_EXT_FUNCTION (void, EGLImageTargetTexture2D,
+ (GLenum target,
+ GLeglImageOES image))
+GST_GL_EXT_FUNCTION (void, EGLImageTargetRenderbufferStorage,
+ (GLenum target,
+ GLeglImageOES image))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/fbo.h b/include/gst/gl/glprototypes/fbo.h
new file mode 100644
index 0000000000..f210f997d8
--- /dev/null
+++ b/include/gst/gl/glprototypes/fbo.h
@@ -0,0 +1,157 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+GST_GL_EXT_BEGIN (offscreen,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 3, 0,
+ 2, 0,
+ /* for some reason the ARB version of this
+ extension doesn't have an ARB suffix for the
+ functions */
+ "ARB:\0EXT\0OES\0",
+ "framebuffer_object\0")
+GST_GL_EXT_FUNCTION (void, GenRenderbuffers,
+ (GLsizei n,
+ GLuint *renderbuffers))
+GST_GL_EXT_FUNCTION (void, DeleteRenderbuffers,
+ (GLsizei n,
+ const GLuint *renderbuffers))
+GST_GL_EXT_FUNCTION (void, BindRenderbuffer,
+ (GLenum target,
+ GLuint renderbuffer))
+GST_GL_EXT_FUNCTION (void, RenderbufferStorage,
+ (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height))
+GST_GL_EXT_FUNCTION (void, GenFramebuffers,
+ (GLsizei n,
+ GLuint *framebuffers))
+GST_GL_EXT_FUNCTION (void, BindFramebuffer,
+ (GLenum target,
+ GLuint framebuffer))
+GST_GL_EXT_FUNCTION (void, FramebufferTexture2D,
+ (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level))
+GST_GL_EXT_FUNCTION (void, FramebufferRenderbuffer,
+ (GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer))
+GST_GL_EXT_FUNCTION (GLboolean, IsRenderbuffer,
+ (GLuint renderbuffer))
+GST_GL_EXT_FUNCTION (GLenum, CheckFramebufferStatus,
+ (GLenum target))
+GST_GL_EXT_FUNCTION (void, DeleteFramebuffers,
+ (GLsizei n,
+ const GLuint *framebuffers))
+GST_GL_EXT_FUNCTION (void, GenerateMipmap,
+ (GLenum target))
+GST_GL_EXT_FUNCTION (void, GetFramebufferAttachmentParameteriv,
+ (GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, GetRenderbufferParameteriv,
+ (GLenum target,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer,
+ (GLuint framebuffer))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (offscreen_blit,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 3, 0,
+ 3, 0,
+ "EXT\0ANGLE\0",
+ "framebuffer_blit\0")
+GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
+ (GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (framebuffer_discard,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255, /* not in either GLES */
+ "EXT\0",
+ "framebuffer_discard\0")
+GST_GL_EXT_FUNCTION (void, DiscardFramebuffer,
+ (GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments))
+GST_GL_EXT_END ()
+
+
+GST_GL_EXT_BEGIN (read_buffer,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 1, 0,
+ 3, 0,
+ "NV\0",
+ "read_buffer\0")
+GST_GL_EXT_FUNCTION (void, ReadBuffer,
+ (GLenum mode))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (draw_buffers,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 1,
+ 3, 0,
+ "ARB\0ATI\0NV\0",
+ "draw_buffers\0")
+GST_GL_EXT_FUNCTION (void, DrawBuffers,
+ (GLsizei n, const GLenum *bufs))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/fixedfunction.h b/include/gst/gl/glprototypes/fixedfunction.h
new file mode 100644
index 0000000000..3aecbd227b
--- /dev/null
+++ b/include/gst/gl/glprototypes/fixedfunction.h
@@ -0,0 +1,144 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+GST_GL_EXT_BEGIN (multitexture_part1,
+ GST_GL_API_OPENGL |
+ GST_GL_API_GLES1,
+ 1, 3,
+ 1, 0,
+ "ARB\0",
+ "multitexture\0")
+GST_GL_EXT_FUNCTION (void, ClientActiveTexture,
+ (GLenum texture))
+GST_GL_EXT_END ()
+
+/* These are the core GL functions which are available when the API
+ supports fixed-function (ie, GL and GLES1.1) */
+GST_GL_EXT_BEGIN (fixed_function_core,
+ GST_GL_API_OPENGL |
+ GST_GL_API_GLES1,
+ 0, 0,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, AlphaFunc,
+ (GLenum func, GLclampf ref))
+GST_GL_EXT_FUNCTION (void, Fogf,
+ (GLenum pname, GLfloat param))
+GST_GL_EXT_FUNCTION (void, Fogfv,
+ (GLenum pname, const GLfloat *params))
+GST_GL_EXT_FUNCTION (void, LoadMatrixf,
+ (const GLfloat *m))
+GST_GL_EXT_FUNCTION (void, Materialfv,
+ (GLenum face, GLenum pname, const GLfloat *params))
+GST_GL_EXT_FUNCTION (void, PointSize,
+ (GLfloat size))
+GST_GL_EXT_FUNCTION (void, TexEnvfv,
+ (GLenum target, GLenum pname, const GLfloat *params))
+GST_GL_EXT_FUNCTION (void, Color4ub,
+ (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
+GST_GL_EXT_FUNCTION (void, ColorPointer,
+ (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer))
+GST_GL_EXT_FUNCTION (void, DisableClientState,
+ (GLenum array))
+GST_GL_EXT_FUNCTION (void, EnableClientState,
+ (GLenum array))
+GST_GL_EXT_FUNCTION (void, LoadIdentity,
+ (void))
+GST_GL_EXT_FUNCTION (void, MatrixMode,
+ (GLenum mode))
+GST_GL_EXT_FUNCTION (void, NormalPointer,
+ (GLenum type, GLsizei stride, const GLvoid *pointer))
+GST_GL_EXT_FUNCTION (void, TexCoordPointer,
+ (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer))
+GST_GL_EXT_FUNCTION (void, TexEnvi,
+ (GLenum target,
+ GLenum pname,
+ GLint param))
+GST_GL_EXT_FUNCTION (void, VertexPointer,
+ (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer))
+GST_GL_EXT_FUNCTION (void, PushMatrix,
+ (void))
+GST_GL_EXT_FUNCTION (void, PopMatrix,
+ (void))
+GST_GL_EXT_END ()
+
+/* Eventually we want to remove this category */
+GST_GL_EXT_BEGIN (fixed_function_gl_only,
+ GST_GL_API_OPENGL,
+ 0, 0,
+ 0, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, PushAttrib,
+ (GLbitfield mask))
+GST_GL_EXT_FUNCTION (void, PopAttrib,
+ (void))
+GST_GL_EXT_FUNCTION (void, TexImage1D,
+ (GLenum target,
+ GLint level,
+ GLint internalFormat,
+ GLsizei width,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const GLvoid *data))
+GST_GL_EXT_FUNCTION (void, Rotatef,
+ (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
+GST_GL_EXT_FUNCTION (void, Translatef,
+ (GLfloat x, GLfloat y, GLfloat z))
+GST_GL_EXT_FUNCTION (void, Scalef,
+ (GLfloat x, GLfloat y, GLfloat z))
+GST_GL_EXT_FUNCTION (void, Lightfv,
+ (GLenum light, GLenum pname, const GLfloat *params))
+GST_GL_EXT_FUNCTION (void, ColorMaterial,
+ (GLenum face, GLenum pname))
+GST_GL_EXT_FUNCTION (void, ShadeModel,
+ (GLenum value))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/gles.h b/include/gst/gl/glprototypes/gles.h
new file mode 100644
index 0000000000..f8c833b173
--- /dev/null
+++ b/include/gst/gl/glprototypes/gles.h
@@ -0,0 +1,102 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+GST_GL_EXT_BEGIN (only_in_both_gles,
+ GST_GL_API_GLES1 |
+ GST_GL_API_GLES2,
+ 255, 255,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, DepthRangef,
+ (GLfloat near_val, GLfloat far_val))
+GST_GL_EXT_FUNCTION (void, ClearDepthf,
+ (GLclampf depth))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (only_in_gles1,
+ GST_GL_API_GLES1,
+ 255, 255,
+ 1, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, ClipPlanef, (GLenum plane, const GLfloat *equation))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (gles2_only_api,
+ GST_GL_API_GLES2,
+ 255, 255,
+ 2, 0,
+ "ARB:\0",
+ "ES2_compatibility\0")
+GST_GL_EXT_FUNCTION (void, ReleaseShaderCompiler, (void))
+GST_GL_EXT_FUNCTION (void, GetShaderPrecisionFormat,
+ (GLenum shadertype,
+ GLenum precisiontype,
+ GLint* range,
+ GLint* precision))
+GST_GL_EXT_FUNCTION (void, ShaderBinary,
+ (GLsizei n,
+ const GLuint* shaders,
+ GLenum binaryformat,
+ const GLvoid* binary,
+ GLsizei length))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (IMG_multisampled_render_to_texture,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255, /* not in either GLES */
+ "\0",
+ "IMG_multisampled_render_to_texture\0")
+GST_GL_EXT_FUNCTION (void, RenderbufferStorageMultisampleIMG,
+ (GLenum target,
+ GLsizei samples,
+ GLenum internal_format,
+ GLsizei width,
+ GLsizei height))
+GST_GL_EXT_FUNCTION (void, FramebufferTexture2DMultisampleIMG,
+ (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLsizei samples))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/gstgl_compat.h b/include/gst/gl/glprototypes/gstgl_compat.h
new file mode 100644
index 0000000000..31b1e005d1
--- /dev/null
+++ b/include/gst/gl/glprototypes/gstgl_compat.h
@@ -0,0 +1,67 @@
+ /*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_COMPAT_H__
+#define __GST_GL_COMPAT_H__
+
+#include <gst/gl/gstglconfig.h>
+
+/* undefined typedefs */
+#if !GST_GL_HAVE_GLEGLIMAGEOES
+typedef gpointer GLeglImageOES;
+#endif
+#if !GST_GL_HAVE_GLCHAR
+typedef gchar GLchar;
+#endif
+#if !GST_GL_HAVE_GLSIZEIPTR
+typedef ptrdiff_t GLsizeiptr;
+#endif
+#if !GST_GL_HAVE_GLINTPTR
+typedef ptrdiff_t GLintptr;
+#endif
+#if !GST_GL_HAVE_GLSYNC
+typedef gpointer GLsync;
+#endif
+#if !GST_GL_HAVE_GLUINT64
+typedef guint64 GLuint64;
+#endif
+#if !GST_GL_HAVE_GLINT64
+typedef gint64 GLint64;
+#endif
+
+#if !defined(GST_GL_DEBUG_PROC)
+#if defined(GLDEBUGPROC)
+#define GST_GL_DEBUG_PROC GLDEBUGPROC
+#elif defined(GLDEBUGPROCARB)
+#define GST_GL_DEBUG_PROC GLDEBUGPROCARB
+#elif defined(GLDEBUGPROCKHR)
+#define GST_GL_DEBUG_PROC GLDEBUGPROCKHR
+#else
+typedef void (GSTGLAPI *GST_GL_DEBUG_PROC) (GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const gchar* message,
+ gpointer user_data);
+#endif
+#endif
+
+#endif
diff --git a/include/gst/gl/glprototypes/gstgl_gles2compat.h b/include/gst/gl/glprototypes/gstgl_gles2compat.h
new file mode 100644
index 0000000000..80600b44d1
--- /dev/null
+++ b/include/gst/gl/glprototypes/gstgl_gles2compat.h
@@ -0,0 +1,60 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* Compatibility for OpenGL ES 2.0 */
+
+#ifndef __GST_GL_ES2__
+#define __GST_GL_ES2__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#ifndef GL_RGB16
+#define GL_RGB16 GL_RGB565
+#endif
+#ifndef GL_RGB8
+#define GL_RGB8 GL_RGB
+#endif
+
+/* UNSUPPORTED */
+
+#ifndef GL_COLOR_ATTACHMENT1
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#endif
+#ifndef GL_COLOR_ATTACHMENT2
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#endif
+#ifndef GL_COLOR_ATTACHMENT3
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#endif
+#ifndef GL_TEXTURE_ENV
+#define GL_TEXTURE_ENV 0
+#endif
+#ifndef GL_TEXTURE_ENV_MODE
+#define GL_TEXTURE_ENV_MODE 0
+#endif
+#ifndef GL_DEPTH24_STENCIL8
+#define GL_DEPTH24_STENCIL8 0x88F0
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_GL_ES2__ */
diff --git a/include/gst/gl/glprototypes/opengl.h b/include/gst/gl/glprototypes/opengl.h
new file mode 100644
index 0000000000..ac47d52807
--- /dev/null
+++ b/include/gst/gl/glprototypes/opengl.h
@@ -0,0 +1,72 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* These are the core GL functions which are only available in big
+ GL */
+GST_GL_EXT_BEGIN (only_in_big_gl,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
+ 1, 0,
+ 255, 255, /* not in GLES */
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, GetTexLevelParameteriv,
+ (GLenum target, GLint level,
+ GLenum pname, GLint *params))
+GST_GL_EXT_FUNCTION (void, GetTexImage,
+ (GLenum target, GLint level,
+ GLenum format, GLenum type,
+ GLvoid *pixels))
+GST_GL_EXT_FUNCTION (void, DepthRange,
+ (double near_val, double far_val))
+GST_GL_EXT_FUNCTION (void, DrawBuffer,
+ (GLenum mode))
+GST_GL_EXT_FUNCTION (void, ClearDepth,
+ (double depth))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (only_in_big_gl_compat,
+ GST_GL_API_OPENGL,
+ 1, 0,
+ 255, 255, /* not in GLES */
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, ClipPlane,
+ (GLenum plane, const double *equation))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/query.h b/include/gst/gl/glprototypes/query.h
new file mode 100644
index 0000000000..09f1ba23fb
--- /dev/null
+++ b/include/gst/gl/glprototypes/query.h
@@ -0,0 +1,63 @@
+/*
+ * GStreamer
+ * Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (timer_query,
+ GST_GL_API_OPENGL3,
+ 3, 3,
+ 3, 0,
+ "ARB:\0ANGLE\0EXT\0",
+ "timer_query\0disjoint_timer_query\0")
+GST_GL_EXT_FUNCTION (void, GenQueries,
+ (GLsizei n,
+ GLuint *ids))
+GST_GL_EXT_FUNCTION (void, DeleteQueries,
+ (GLsizei n,
+ GLuint *ids))
+GST_GL_EXT_FUNCTION (GLboolean, IsQuery,
+ (GLuint id))
+GST_GL_EXT_FUNCTION (void, BeginQuery,
+ (GLenum target,
+ GLuint id))
+GST_GL_EXT_FUNCTION (void, EndQuery,
+ (GLenum target))
+GST_GL_EXT_FUNCTION (void, QueryCounter,
+ (GLuint id,
+ GLenum target))
+GST_GL_EXT_FUNCTION (void, GetQueryiv,
+ (GLenum target,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, GetQueryObjectiv,
+ (GLuint id,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, GetQueryObjectuiv,
+ (GLuint id,
+ GLenum pname,
+ GLuint *params))
+GST_GL_EXT_FUNCTION (void, GetQueryObjecti64v,
+ (GLuint id,
+ GLenum pname,
+ GLint64 *params))
+GST_GL_EXT_FUNCTION (void, GetQueryObjectui64v,
+ (GLuint id,
+ GLenum pname,
+ GLuint64 *params))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/shaders.h b/include/gst/gl/glprototypes/shaders.h
new file mode 100644
index 0000000000..6d828dbac2
--- /dev/null
+++ b/include/gst/gl/glprototypes/shaders.h
@@ -0,0 +1,374 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009, 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* This lists functions that are unique to GL 2.0 or GLES 2.0 and are
+ * not in the old GLSL extensions */
+GST_GL_EXT_BEGIN (shaders_glsl_2_only,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 0,
+ 2, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (GLuint, CreateProgram,
+ (void))
+GST_GL_EXT_FUNCTION (GLuint, CreateShader,
+ (GLenum shaderType))
+GST_GL_EXT_FUNCTION (void, DeleteShader,
+ (GLuint shader))
+GST_GL_EXT_FUNCTION (void, AttachShader,
+ (GLuint program,
+ GLuint shader))
+GST_GL_EXT_FUNCTION (void, UseProgram,
+ (GLuint program))
+GST_GL_EXT_FUNCTION (void, DeleteProgram,
+ (GLuint program))
+GST_GL_EXT_FUNCTION (void, GetShaderInfoLog,
+ (GLuint shader,
+ GLsizei maxLength,
+ GLsizei *length,
+ char *infoLog))
+GST_GL_EXT_FUNCTION (void, GetProgramInfoLog,
+ (GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ char *infoLog))
+GST_GL_EXT_FUNCTION (void, GetShaderiv,
+ (GLuint shader,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, GetProgramiv,
+ (GLuint program,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, DetachShader,
+ (GLuint program, GLuint shader))
+GST_GL_EXT_FUNCTION (void, GetAttachedShaders,
+ (GLuint program,
+ GLsizei maxcount,
+ GLsizei* count,
+ GLuint* shaders))
+GST_GL_EXT_FUNCTION (GLboolean, IsShader,
+ (GLuint shader))
+GST_GL_EXT_FUNCTION (GLboolean, IsProgram,
+ (GLuint program))
+GST_GL_EXT_END ()
+
+/* These functions are provided by GL_ARB_shader_objects or are in GL
+ * 2.0 core */
+GST_GL_EXT_BEGIN (shader_objects_or_gl2,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 0,
+ 2, 0,
+ "ARB\0",
+ "shader_objects\0")
+GST_GL_EXT_FUNCTION (void, ShaderSource,
+ (GLuint shader,
+ GLsizei count,
+ const char **string,
+ const GLint *length))
+GST_GL_EXT_FUNCTION (void, CompileShader,
+ (GLuint shader))
+GST_GL_EXT_FUNCTION (void, LinkProgram,
+ (GLuint program))
+GST_GL_EXT_FUNCTION (GLint, GetUniformLocation,
+ (GLuint program,
+ const char *name))
+GST_GL_EXT_FUNCTION (void, Uniform1f,
+ (GLint location,
+ GLfloat v0))
+GST_GL_EXT_FUNCTION (void, Uniform2f,
+ (GLint location,
+ GLfloat v0,
+ GLfloat v1))
+GST_GL_EXT_FUNCTION (void, Uniform3f,
+ (GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2))
+GST_GL_EXT_FUNCTION (void, Uniform4f,
+ (GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3))
+GST_GL_EXT_FUNCTION (void, Uniform1fv,
+ (GLint location,
+ GLsizei count,
+ const GLfloat * value))
+GST_GL_EXT_FUNCTION (void, Uniform2fv,
+ (GLint location,
+ GLsizei count,
+ const GLfloat * value))
+GST_GL_EXT_FUNCTION (void, Uniform3fv,
+ (GLint location,
+ GLsizei count,
+ const GLfloat * value))
+GST_GL_EXT_FUNCTION (void, Uniform4fv,
+ (GLint location,
+ GLsizei count,
+ const GLfloat * value))
+GST_GL_EXT_FUNCTION (void, Uniform1i,
+ (GLint location,
+ GLint v0))
+GST_GL_EXT_FUNCTION (void, Uniform2i,
+ (GLint location,
+ GLint v0,
+ GLint v1))
+GST_GL_EXT_FUNCTION (void, Uniform3i,
+ (GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2))
+GST_GL_EXT_FUNCTION (void, Uniform4i,
+ (GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3))
+GST_GL_EXT_FUNCTION (void, Uniform1iv,
+ (GLint location,
+ GLsizei count,
+ const GLint * value))
+GST_GL_EXT_FUNCTION (void, Uniform2iv,
+ (GLint location,
+ GLsizei count,
+ const GLint * value))
+GST_GL_EXT_FUNCTION (void, Uniform3iv,
+ (GLint location,
+ GLsizei count,
+ const GLint * value))
+GST_GL_EXT_FUNCTION (void, Uniform4iv,
+ (GLint location,
+ GLsizei count,
+ const GLint * value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix2fv,
+ (GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix3fv,
+ (GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix4fv,
+ (GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value))
+
+GST_GL_EXT_FUNCTION (void, GetUniformfv,
+ (GLuint program,
+ GLint location,
+ GLfloat *params))
+GST_GL_EXT_FUNCTION (void, GetUniformiv,
+ (GLuint program,
+ GLint location,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, GetActiveUniform,
+ (GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei* length,
+ GLint* size,
+ GLenum* type,
+ GLchar* name))
+GST_GL_EXT_FUNCTION (void, GetShaderSource,
+ (GLuint shader,
+ GLsizei bufsize,
+ GLsizei* length,
+ GLchar* source))
+GST_GL_EXT_FUNCTION (void, ValidateProgram, (GLuint program))
+GST_GL_EXT_END ()
+
+/* These functions are provided by GL_ARB_vertex_shader or are in GL
+ * 2.0 core */
+GST_GL_EXT_BEGIN (vertex_shaders,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 0,
+ 2, 0,
+ "ARB\0",
+ "vertex_shader\0")
+GST_GL_EXT_FUNCTION (void, VertexAttribPointer,
+ (GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const GLvoid *pointer))
+GST_GL_EXT_FUNCTION (void, EnableVertexAttribArray,
+ (GLuint index))
+GST_GL_EXT_FUNCTION (void, DisableVertexAttribArray,
+ (GLuint index))
+GST_GL_EXT_FUNCTION (void, VertexAttrib1f, (GLuint indx, GLfloat x))
+GST_GL_EXT_FUNCTION (void, VertexAttrib1fv,
+ (GLuint indx, const GLfloat* values))
+GST_GL_EXT_FUNCTION (void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y))
+GST_GL_EXT_FUNCTION (void, VertexAttrib2fv,
+ (GLuint indx, const GLfloat* values))
+GST_GL_EXT_FUNCTION (void, VertexAttrib3f,
+ (GLuint indx, GLfloat x, GLfloat y, GLfloat z))
+GST_GL_EXT_FUNCTION (void, VertexAttrib3fv,
+ (GLuint indx, const GLfloat* values))
+GST_GL_EXT_FUNCTION (void, VertexAttrib4f,
+ (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+GST_GL_EXT_FUNCTION (void, VertexAttrib4fv,
+ (GLuint indx, const GLfloat* values))
+GST_GL_EXT_FUNCTION (void, GetVertexAttribfv,
+ (GLuint index, GLenum pname, GLfloat* params))
+GST_GL_EXT_FUNCTION (void, GetVertexAttribiv,
+ (GLuint index, GLenum pname, GLint* params))
+GST_GL_EXT_FUNCTION (void, GetVertexAttribPointerv,
+ (GLuint index, GLenum pname, GLvoid** pointer))
+GST_GL_EXT_FUNCTION (GLint, GetAttribLocation,
+ (GLuint program, const char *name))
+GST_GL_EXT_FUNCTION (void, BindAttribLocation,
+ (GLuint program,
+ GLuint index,
+ const GLchar* name))
+GST_GL_EXT_FUNCTION (void, GetActiveAttrib,
+ (GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei* length,
+ GLint* size,
+ GLenum* type,
+ GLchar* name))
+GST_GL_EXT_END ()
+
+/* These only list functions that come from the old GLSL extensions.
+ * Functions that are common to the extensions and GLSL 2.0 should
+ * instead be listed in cogl-glsl-functions.h */
+GST_GL_EXT_BEGIN (shader_objects,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255, /* not in either GLES */
+ "ARB\0",
+ "shader_objects\0")
+GST_GL_EXT_FUNCTION (GLuint, CreateProgramObject,
+ (void))
+GST_GL_EXT_FUNCTION (GLuint, CreateShaderObject,
+ (GLenum shaderType))
+GST_GL_EXT_FUNCTION (void, DeleteObject,
+ (GLuint obj))
+GST_GL_EXT_FUNCTION (void, AttachObject,
+ (GLuint container, GLuint obj))
+GST_GL_EXT_FUNCTION (void, UseProgramObject,
+ (GLuint programObj))
+GST_GL_EXT_FUNCTION (void, GetInfoLog,
+ (GLuint obj,
+ GLsizei maxLength,
+ GLsizei *length,
+ char *infoLog))
+GST_GL_EXT_FUNCTION (void, GetObjectParameteriv,
+ (GLuint obj,
+ GLenum pname,
+ GLint *params))
+GST_GL_EXT_FUNCTION (void, DetachObject,
+ (GLuint container, GLuint obj))
+GST_GL_EXT_FUNCTION (void, GetAttachedObjects,
+ (GLuint program,
+ GLsizei maxcount,
+ GLsizei* count,
+ GLuint* shaders))
+GST_GL_EXT_END ()
+
+/* ARB_fragment_program */
+GST_GL_EXT_BEGIN (arbfp,
+ GST_GL_API_NONE,
+ 255, 255,
+ 255, 255, /* not in either GLES */
+ "ARB\0",
+ "fragment_program\0")
+GST_GL_EXT_FUNCTION (void, GenPrograms,
+ (GLsizei n,
+ GLuint *programs))
+GST_GL_EXT_FUNCTION (void, DeletePrograms,
+ (GLsizei n,
+ GLuint *programs))
+GST_GL_EXT_FUNCTION (void, BindProgram,
+ (GLenum target,
+ GLuint program))
+GST_GL_EXT_FUNCTION (void, ProgramString,
+ (GLenum target,
+ GLenum format,
+ GLsizei len,
+ const void *program))
+GST_GL_EXT_FUNCTION (void, ProgramLocalParameter4fv,
+ (GLenum target,
+ GLuint index,
+ GLfloat *params))
+GST_GL_EXT_END ()
+
+/* This lists functions that are unique to GL 2.1 or GLES 3.0 and are
+ * not in the old GLSL extensions */
+GST_GL_EXT_BEGIN (shaders_2_1,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
+ GST_GL_API_GLES2,
+ 2, 1,
+ 3, 0,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, UniformMatrix2x3fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix3x2fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix2x4fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix4x2fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix3x4fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_FUNCTION (void, UniformMatrix4x3fv,
+ (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (bind_frag_data,
+ GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
+ 3, 0,
+ 255, 255,
+ "\0",
+ "\0")
+GST_GL_EXT_FUNCTION (void, BindFragDataLocation,
+ (GLuint program, GLuint index, const GLchar * name))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/sync.h b/include/gst/gl/glprototypes/sync.h
new file mode 100644
index 0000000000..d6620478db
--- /dev/null
+++ b/include/gst/gl/glprototypes/sync.h
@@ -0,0 +1,49 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014-2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (sync,
+ GST_GL_API_OPENGL3 | GST_GL_API_OPENGL |
+ GST_GL_API_GLES2,
+ 3, 2,
+ 3, 0,
+ "APPLE\0",
+ "sync\0")
+GST_GL_EXT_FUNCTION (GLsync, FenceSync,
+ (GLenum condition,
+ GLbitfield flags))
+GST_GL_EXT_FUNCTION (GLboolean, IsSync,
+ (GLsync sync))
+GST_GL_EXT_FUNCTION (void, DeleteSync,
+ (GLsync sync))
+GST_GL_EXT_FUNCTION (GLenum, ClientWaitSync,
+ (GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout))
+GST_GL_EXT_FUNCTION (void, WaitSync,
+ (GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout))
+GST_GL_EXT_FUNCTION (void, GetSynciv,
+ (GLsync sync,
+ GLenum name,
+ GLsizei buf_size,
+ GLsizei *length,
+ GLint *values))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/glprototypes/vao.h b/include/gst/gl/glprototypes/vao.h
new file mode 100644
index 0000000000..32d11599fd
--- /dev/null
+++ b/include/gst/gl/glprototypes/vao.h
@@ -0,0 +1,37 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (vao,
+ GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
+ 3, 0,
+ 3, 0,
+ "ARB:\0OES\0",
+ "vertex_array_object\0")
+GST_GL_EXT_FUNCTION (void, GenVertexArrays,
+ (GLsizei n,
+ GLuint *arrays))
+GST_GL_EXT_FUNCTION (void, DeleteVertexArrays,
+ (GLsizei n,
+ GLuint *arrays))
+GST_GL_EXT_FUNCTION (void, BindVertexArray,
+ (GLuint array))
+GST_GL_EXT_FUNCTION (GLboolean, IsVertexArray,
+ (GLuint array))
+GST_GL_EXT_END ()
diff --git a/include/gst/gl/gstgl_enums.h b/include/gst/gl/gstgl_enums.h
new file mode 100644
index 0000000000..93d9fed64e
--- /dev/null
+++ b/include/gst/gl/gstgl_enums.h
@@ -0,0 +1,49 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_ENUMS_H_
+#define _GST_GL_ENUMS_H_
+
+/**
+ * GstGLTextureTarget:
+ * @GST_GL_TEXTURE_TARGET_NONE: no texture target
+ * @GST_GL_TEXTURE_TARGET_2D: 2D texture target (`GL_TEXTURE_2D`)
+ * @GST_GL_TEXTURE_TARGET_RECTANGLE: rectangle texture target
+ * (`GL_TEXTURE_RECTANGLE`)
+ * @GST_GL_TEXTURE_TARGET_EXTERNAL_OES: external oes texture target
+ * (`GL_TEXTURE_EXTERNAL_OES`)
+ *
+ * The OpenGL texture target that an OpenGL texture can be bound to. The
+ * gst_gl_value_set_texture_target_from_mask(),
+ * gst_gl_value_get_texture_target_mask(), and
+ * gst_gl_value_set_texture_target() functions can be used for handling texture
+ * targets with #GValue's when e.g. dealing with #GstCaps.
+ *
+ * Since: 1.8
+ */
+typedef enum
+{
+ GST_GL_TEXTURE_TARGET_NONE,
+ GST_GL_TEXTURE_TARGET_2D,
+ GST_GL_TEXTURE_TARGET_RECTANGLE,
+ GST_GL_TEXTURE_TARGET_EXTERNAL_OES,
+} GstGLTextureTarget;
+
+#endif /* _GST_GL_ENUMS_H_ */
diff --git a/include/gst/gl/gstgl_fwd.h b/include/gst/gl/gstgl_fwd.h
new file mode 100644
index 0000000000..28af5c4a43
--- /dev/null
+++ b/include/gst/gl/gstgl_fwd.h
@@ -0,0 +1,147 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Julien Isorce <julien.isorce@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_FWD_H__
+#define __GST_GL_FWD_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstglapi.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstGLDisplay GstGLDisplay;
+typedef struct _GstGLDisplayClass GstGLDisplayClass;
+typedef struct _GstGLDisplayPrivate GstGLDisplayPrivate;
+
+typedef struct _GstGLContext GstGLContext;
+typedef struct _GstGLContextClass GstGLContextClass;
+typedef struct _GstGLContextPrivate GstGLContextPrivate;
+
+typedef struct _GstGLWindow GstGLWindow;
+typedef struct _GstGLWindowPrivate GstGLWindowPrivate;
+typedef struct _GstGLWindowClass GstGLWindowClass;
+
+typedef struct _GstGLBaseMemory GstGLBaseMemory;
+typedef struct _GstGLBaseMemoryAllocator GstGLBaseMemoryAllocator;
+typedef struct _GstGLBaseMemoryAllocatorClass GstGLBaseMemoryAllocatorClass;
+
+typedef struct _GstGLBuffer GstGLBuffer;
+typedef struct _GstGLBufferAllocator GstGLBufferAllocator;
+typedef struct _GstGLBufferAllocatorClass GstGLBufferAllocatorClass;
+
+typedef struct _GstGLMemory GstGLMemory;
+typedef struct _GstGLMemoryAllocator GstGLMemoryAllocator;
+typedef struct _GstGLMemoryAllocatorClass GstGLMemoryAllocatorClass;
+
+typedef struct _GstGLMemoryPBO GstGLMemoryPBO;
+typedef struct _GstGLMemoryPBOAllocator GstGLMemoryPBOAllocator;
+typedef struct _GstGLMemoryPBOAllocatorClass GstGLMemoryPBOAllocatorClass;
+
+typedef struct _GstGLRenderbuffer GstGLRenderbuffer;
+typedef struct _GstGLRenderbufferAllocator GstGLRenderbufferAllocator;
+typedef struct _GstGLRenderbufferAllocatorClass GstGLRenderbufferAllocatorClass;
+
+typedef struct _GstGLFramebuffer GstGLFramebuffer;
+typedef struct _GstGLFramebufferClass GstGLFramebufferClass;
+
+typedef struct _GstGLSLStage GstGLSLStage;
+typedef struct _GstGLSLStagePrivate GstGLSLStagePrivate;
+typedef struct _GstGLSLStageClass GstGLSLStageClass;
+
+typedef struct _GstGLShader GstGLShader;
+typedef struct _GstGLShaderPrivate GstGLShaderPrivate;
+typedef struct _GstGLShaderClass GstGLShaderClass;
+
+typedef struct _GstGLUpload GstGLUpload;
+typedef struct _GstGLUploadClass GstGLUploadClass;
+typedef struct _GstGLUploadPrivate GstGLUploadPrivate;
+
+typedef struct _GstGLBufferPool GstGLBufferPool;
+typedef struct _GstGLBufferPoolClass GstGLBufferPoolClass;
+typedef struct _GstGLBufferPoolPrivate GstGLBufferPoolPrivate;
+
+typedef struct _GstGLColorConvert GstGLColorConvert;
+typedef struct _GstGLColorConvertClass GstGLColorConvertClass;
+typedef struct _GstGLColorConvertPrivate GstGLColorConvertPrivate;
+
+typedef struct _GstGLBaseFilter GstGLBaseFilter;
+typedef struct _GstGLBaseFilterClass GstGLBaseFilterClass;
+typedef struct _GstGLBaseFilterPrivate GstGLBaseFilterPrivate;
+
+typedef struct _GstGLBaseSrc GstGLBaseSrc;
+typedef struct _GstGLBaseSrcClass GstGLBaseSrcClass;
+typedef struct _GstGLBaseSrcPrivate GstGLBaseSrcPrivate;
+
+typedef struct _GstGLFilter GstGLFilter;
+typedef struct _GstGLFilterClass GstGLFilterClass;
+
+typedef struct _GstGLViewConvert GstGLViewConvert;
+typedef struct _GstGLViewConvertClass GstGLViewConvertClass;
+typedef struct _GstGLViewConvertPrivate GstGLViewConvertPrivate;
+
+typedef struct _GstGLOverlayCompositor GstGLOverlayCompositor;
+typedef struct _GstGLOverlayCompositorClass GstGLOverlayCompositorClass;
+
+typedef struct _GstGLQuery GstGLQuery;
+
+typedef struct _GstGLFuncs GstGLFuncs;
+
+typedef struct _GstGLAsyncDebug GstGLAsyncDebug;
+
+#include <gst/gl/gstgl_enums.h>
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBaseFilter, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBaseMemoryAllocator, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBaseSrc, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBufferAllocator, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBufferPool, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLColorConvert, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLContext, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLDisplay, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLFilter, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLMemoryAllocator, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLMemoryPBOAllocator, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLOverlayCompositor, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLSLStage, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLShader, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLUpload, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLViewConvert, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLWindow, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_GL_FWD_H__ */
diff --git a/include/gst/gl/gstglapi.h b/include/gst/gl/gstglapi.h
new file mode 100644
index 0000000000..a0d82f5342
--- /dev/null
+++ b/include/gst/gl/gstglapi.h
@@ -0,0 +1,114 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_API_H__
+#define __GST_GL_API_H__
+
+#include <gst/gl/gstglconfig.h>
+#include <gst/gl/gl-prelude.h>
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstGLAPI:
+ * @GST_GL_API_NONE: no API
+ * @GST_GL_API_OPENGL: Desktop OpenGL up to and including 3.1. The
+ * compatibility profile when the OpenGL version is >= 3.2
+ * @GST_GL_API_OPENGL3: Desktop OpenGL >= 3.2 core profile
+ * @GST_GL_API_GLES1: OpenGL ES 1.x
+ * @GST_GL_API_GLES2: OpenGL ES 2.x and 3.x
+ * @GST_GL_API_ANY: Any OpenGL API
+ */
+typedef enum /*< underscore_name=gst_gl_api >*/ {
+ GST_GL_API_NONE = 0,
+ GST_GL_API_OPENGL = (1 << 0),
+ GST_GL_API_OPENGL3 = (1 << 1),
+ GST_GL_API_GLES1 = (1 << 15),
+ GST_GL_API_GLES2 = (1 << 16),
+
+ GST_GL_API_ANY = G_MAXUINT32
+} GstGLAPI;
+
+/**
+ * GST_GL_API_OPENGL_NAME:
+ *
+ * The name for %GST_GL_API_OPENGL used in various places
+ */
+#define GST_GL_API_OPENGL_NAME "opengl"
+
+/**
+ * GST_GL_API_OPENGL3_NAME:
+ *
+ * The name for %GST_GL_API_OPENGL3 used in various places
+ */
+#define GST_GL_API_OPENGL3_NAME "opengl3"
+
+/**
+ * GST_GL_API_GLES1_NAME:
+ *
+ * The name for %GST_GL_API_GLES1 used in various places
+ */
+#define GST_GL_API_GLES1_NAME "gles1"
+
+/**
+ * GST_GL_API_GLES2_NAME:
+ *
+ * The name for %GST_GL_API_GLES2 used in various places
+ */
+#define GST_GL_API_GLES2_NAME "gles2"
+
+/**
+ * GstGLPlatform:
+ * @GST_GL_PLATFORM_NONE: no platform
+ * @GST_GL_PLATFORM_EGL: the EGL platform used primarily with the X11, wayland
+ * and android window systems as well as on embedded Linux
+ * @GST_GL_PLATFORM_GLX: the GLX platform used primarily with the X11 window system
+ * @GST_GL_PLATFORM_WGL: the WGL platform used primarily on Windows
+ * @GST_GL_PLATFORM_CGL: the CGL platform used primarily on OS X
+ * @GST_GL_PLATFORM_EAGL: the EAGL platform used primarily on iOS
+ * @GST_GL_PLATFORM_ANY: any OpenGL platform
+ */
+typedef enum
+{
+ GST_GL_PLATFORM_NONE = 0,
+ GST_GL_PLATFORM_EGL = (1 << 0),
+ GST_GL_PLATFORM_GLX = (1 << 1),
+ GST_GL_PLATFORM_WGL = (1 << 2),
+ GST_GL_PLATFORM_CGL = (1 << 3),
+ GST_GL_PLATFORM_EAGL = (1 << 4),
+
+ GST_GL_PLATFORM_ANY = G_MAXUINT32
+} GstGLPlatform;
+
+GST_GL_API
+gchar * gst_gl_api_to_string (GstGLAPI api);
+GST_GL_API
+GstGLAPI gst_gl_api_from_string (const gchar * api_s);
+
+GST_GL_API
+gchar * gst_gl_platform_to_string (GstGLPlatform platform);
+GST_GL_API
+GstGLPlatform gst_gl_platform_from_string (const gchar * platform_s);
+
+G_END_DECLS
+
+#endif /* __GST_GL_API_H__ */
diff --git a/include/gst/gl/gstglbasefilter.h b/include/gst/gl/gstglbasefilter.h
new file mode 100644
index 0000000000..57fb3df5ba
--- /dev/null
+++ b/include/gst/gl/gstglbasefilter.h
@@ -0,0 +1,100 @@
+/*
+ * GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_BASE_FILTER_H_
+#define _GST_GL_BASE_FILTER_H_
+
+#include <gst/base/gstbasetransform.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_base_filter_get_type(void);
+#define GST_TYPE_GL_BASE_FILTER (gst_gl_base_filter_get_type())
+#define GST_GL_BASE_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_FILTER,GstGLBaseFilter))
+#define GST_IS_GL_BASE_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_FILTER))
+#define GST_GL_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
+#define GST_IS_GL_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_BASE_FILTER))
+#define GST_GL_BASE_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
+
+/**
+ * GstGLBaseFilter:
+ * @display: the currently configured #GstGLDisplay
+ * @context: the currently configured #GstGLContext
+ * @in_caps: the currently configured input #GstCaps
+ * @out_caps: the currently configured output #GstCaps
+ *
+ * The parent instance type of a base GStreamer GL Filter.
+ */
+struct _GstGLBaseFilter
+{
+ GstBaseTransform parent;
+
+ /*< public >*/
+ GstGLDisplay *display;
+ GstGLContext *context;
+
+ GstCaps *in_caps;
+ GstCaps *out_caps;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+
+ GstGLBaseFilterPrivate *priv;
+};
+
+/**
+ * GstGLBaseFilterClass:
+ * @supported_gl_api: the logical-OR of #GstGLAPI's supported by this element
+ * @gl_start: called in the GL thread to setup the element GL state.
+ * @gl_stop: called in the GL thread to setup the element GL state.
+ * @gl_set_caps: called in the GL thread when caps are set on @filter.
+ * Note: this will also be called when changing OpenGL contexts
+ * where #GstBaseTransform::set_caps may not.
+ *
+ * The base class for GStreamer GL Filter.
+ */
+struct _GstGLBaseFilterClass
+{
+ GstBaseTransformClass parent_class;
+
+ /*< public >*/
+ GstGLAPI supported_gl_api;
+
+ gboolean (*gl_start) (GstGLBaseFilter *filter);
+ void (*gl_stop) (GstGLBaseFilter *filter);
+ gboolean (*gl_set_caps) (GstGLBaseFilter *filter, GstCaps * incaps, GstCaps * outcaps);
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+gboolean gst_gl_base_filter_find_gl_context (GstGLBaseFilter * filter);
+GST_GL_API
+GstGLContext * gst_gl_base_filter_get_gl_context (GstGLBaseFilter * filter);
+
+G_END_DECLS
+
+#endif /* _GST_GL_BASE_FILTER_H_ */
diff --git a/include/gst/gl/gstglbasememory.h b/include/gst/gl/gstglbasememory.h
new file mode 100644
index 0000000000..7582cf9f66
--- /dev/null
+++ b/include/gst/gl/gstglbasememory.h
@@ -0,0 +1,421 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_BASE_MEMORY_H_
+#define _GST_GL_BASE_MEMORY_H_
+
+#include <gst/gst.h>
+#include <gst/gstallocator.h>
+#include <gst/gstmemory.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_BASE_MEMORY (gst_gl_base_memory_get_type())
+GST_GL_API
+GType gst_gl_base_memory_get_type(void);
+
+#define GST_TYPE_GL_BASE_MEMORY_ALLOCATOR (gst_gl_base_memory_allocator_get_type())
+GST_GL_API
+GType gst_gl_base_memory_allocator_get_type(void);
+
+#define GST_IS_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR))
+#define GST_IS_GL_BASE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR))
+#define GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocatorClass))
+#define GST_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocator))
+#define GST_GL_BASE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocatorClass))
+#define GST_GL_BASE_MEMORY_ALLOCATOR_CAST(obj) ((GstGLBaseMemoryAllocator *)(obj))
+
+#define GST_GL_BASE_MEMORY_CAST(mem) ((GstGLBaseMemory *)mem)
+
+GST_GL_API
+GQuark gst_gl_base_memory_error_quark (void);
+/**
+ * GST_GL_BASE_MEMORY_ERROR:
+ *
+ * Error domain for GStreamer's GL memory module. Errors in this domain will be
+ * from the #GstGLBaseMemoryError enumeration
+ */
+#define GST_GL_BASE_MEMORY_ERROR (gst_gl_base_memory_error_quark ())
+
+/**
+ * GstGLBaseMemoryError:
+ * @GST_GL_BASE_MEMORY_ERROR_FAILED: generic failure
+ * @GST_GL_BASE_MEMORY_ERROR_OLD_LIBS: the implementation is too old and doesn't
+ * implement enough features
+ * @GST_GL_BASE_MEMORY_ERROR_RESOURCE_UNAVAILABLE: a resource could not be found
+ */
+typedef enum
+{
+ GST_GL_BASE_MEMORY_ERROR_FAILED,
+ GST_GL_BASE_MEMORY_ERROR_OLD_LIBS,
+ GST_GL_BASE_MEMORY_ERROR_RESOURCE_UNAVAILABLE,
+} GstGLBaseMemoryError;
+
+/**
+ * GstGLBaseMemoryTransfer:
+ * @GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD: the texture needs downloading
+ * to the data pointer
+ * @GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD: the data pointer needs uploading
+ * to the texture
+ */
+typedef enum
+{
+ GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD = (GST_MEMORY_FLAG_LAST << 0),
+ GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD = (GST_MEMORY_FLAG_LAST << 1)
+} GstGLBaseMemoryTransfer;
+
+/**
+ * GST_MAP_GL:
+ *
+ * Flag indicating that we should map the GL object instead of to system memory.
+ *
+ * Combining #GST_MAP_GL with #GST_MAP_WRITE has the same semantics as though
+ * you are writing to OpenGL. Conversely, combining #GST_MAP_GL with
+ * #GST_MAP_READ has the same semantics as though you are reading from OpenGL.
+ */
+#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)
+
+/**
+ * GstGLBaseMemory:
+ * @mem: the parent object
+ * @context: the #GstGLContext to use for GL operations
+ *
+ * Represents information about a GL memory object
+ */
+struct _GstGLBaseMemory
+{
+ GstMemory mem;
+
+ GstGLContext *context;
+
+ /*< protected >*/
+ GMutex lock;
+
+ GstMapFlags map_flags; /* cumulative map flags */
+ gint map_count;
+ gint gl_map_count;
+
+ gpointer data;
+
+ GstGLQuery *query;
+
+ /*< private >*/
+ gsize alloc_size; /* because maxsize is used for mapping */
+ gpointer alloc_data;
+
+ GDestroyNotify notify;
+ gpointer user_data;
+
+ gpointer _padding[GST_PADDING];
+};
+
+typedef struct _GstGLAllocationParams GstGLAllocationParams;
+/**
+ * GstGLAllocationParamsCopyFunc:
+ * @src: the source #GstGLAllocationParams to copy from
+ * @dest: the source #GstGLAllocationParams to copy
+ *
+ * Copies the parameters from @src into @dest. The subclass must compose copy
+ * functions from the superclass.
+ */
+typedef void (*GstGLAllocationParamsCopyFunc) (GstGLAllocationParams * src, GstGLAllocationParams * dest);
+/**
+ * GstGLAllocationParamsFreeFunc:
+ * @params: a #GstGLAllocationParams
+ *
+ * Free any dynamically allocated data. The subclass must call the superclass'
+ * free.
+ */
+typedef void (*GstGLAllocationParamsFreeFunc) (gpointer params);
+
+#define GST_TYPE_GL_ALLOCATION_PARAMS (gst_gl_allocation_params_get_type())
+GST_GL_API
+GType gst_gl_allocation_params_get_type (void);
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC:
+ *
+ * GL Allocation flag indicating that the implementation should allocate the
+ * necessary resources.
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC (1 << 0)
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM:
+ *
+ * GL Allocation flag for using the provided system memory data as storage.
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM (1 << 1)
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE:
+ *
+ * GL Allocation flag for using the provided GPU handle as storage.
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE (1 << 2)
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER:
+ *
+ * Values >= than #GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER can be used for
+ * user-defined purposes.
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER (1 << 16)
+
+/**
+ * GstGLAllocationParams:
+ * @struct_size: the size of the struct (including and subclass data)
+ * @copy: a #GstGLAllocationParamsCopyFunc
+ * @free: a #GstGLAllocationParamsFreeFunc
+ * @alloc_flags: allocation flags
+ * @alloc_size: the allocation size
+ * @alloc_params: the #GstAllocationParams
+ * @context: a #GstGLContext
+ * @notify: a #GDestroyNotify
+ * @user_data: argument to call @notify with
+ * @wrapped_data: the wrapped data pointer
+ * @gl_handle: the wrapped OpenGL handle
+ */
+/* Because GstAllocationParams is not subclassable, start our own subclass
+ * chain. FIXME: 2.0 make GstAllocationParams subclassable */
+struct _GstGLAllocationParams
+{
+ gsize struct_size;
+ GstGLAllocationParamsCopyFunc copy;
+ GstGLAllocationParamsFreeFunc free;
+
+ guint alloc_flags;
+ gsize alloc_size;
+ GstAllocationParams *alloc_params;
+ GstGLContext *context;
+ GDestroyNotify notify;
+ gpointer user_data;
+
+ /* GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM only */
+ gpointer wrapped_data;
+ /* GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE only */
+ gpointer gl_handle;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+gboolean gst_gl_allocation_params_init (GstGLAllocationParams * params,
+ gsize struct_size,
+ guint alloc_flags,
+ GstGLAllocationParamsCopyFunc copy,
+ GstGLAllocationParamsFreeFunc free,
+ GstGLContext * context,
+ gsize alloc_size,
+ const GstAllocationParams * alloc_params,
+ gpointer wrapped_data,
+ gpointer gl_handle,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+/* free with gst_gl_allocation_params_free */
+GST_GL_API
+GstGLAllocationParams * gst_gl_allocation_params_copy (GstGLAllocationParams * src);
+
+GST_GL_API
+void gst_gl_allocation_params_free (GstGLAllocationParams * params);
+
+/* subclass usage */
+GST_GL_API
+void gst_gl_allocation_params_free_data (GstGLAllocationParams * params);
+
+/* subclass usage */
+GST_GL_API
+void gst_gl_allocation_params_copy_data (GstGLAllocationParams * src,
+ GstGLAllocationParams * dest);
+
+/**
+ * GstGLBaseMemoryAllocatorAllocFunction:
+ * @allocator: a #GstGLBaseMemoryAllocator
+ * @params: the #GstGLAllocationParams to allocate the memory with
+ *
+ * Note: not called with a GL context current
+ *
+ * Returns: a newly allocated #GstGLBaseMemory from @allocator and @params
+ *
+ * Since: 1.8
+ */
+typedef GstGLBaseMemory * (*GstGLBaseMemoryAllocatorAllocFunction) (GstGLBaseMemoryAllocator * allocator,
+ GstGLAllocationParams * params);
+
+/**
+ * GstGLBaseMemoryAllocatorCreateFunction:
+ * @mem: a #GstGLBaseMemory
+ * @error: a #GError to use on failure
+ *
+ * As this virtual method is called with an OpenGL context current, use this
+ * function to allocate and OpenGL resources needed for your application
+ *
+ * Returns: whether the creation succeeded
+ *
+ * Since: 1.8
+ */
+typedef gboolean (*GstGLBaseMemoryAllocatorCreateFunction) (GstGLBaseMemory * mem,
+ GError ** error);
+
+/**
+ * GstGLBaseMemoryAllocatorMapFunction:
+ * @mem: a #GstGLBaseMemory
+ * @info: a #GstMapInfo to map with
+ * @maxsize: the size to map
+ *
+ * Also see gst_memory_map();
+ *
+ * Returns: the mapped pointer
+ *
+ * Since: 1.8
+ */
+typedef gpointer (*GstGLBaseMemoryAllocatorMapFunction) (GstGLBaseMemory * mem,
+ GstMapInfo * info,
+ gsize maxsize);
+/**
+ * GstGLBaseMemoryAllocatorUnmapFunction:
+ * @mem: a #GstGLBaseMemory
+ * @info: a #GstMapInfo to map with
+ *
+ * Also see gst_memory_unmap();
+ *
+ * Since: 1.8
+ */
+typedef void (*GstGLBaseMemoryAllocatorUnmapFunction) (GstGLBaseMemory * mem,
+ GstMapInfo * info);
+
+/**
+ * GstGLBaseMemoryAllocatorCopyFunction:
+ * @mem: a #GstGLBaseMemory
+ * @offset: the offset to copy from
+ * @size: the number of bytes to copy
+ *
+ * Also see gst_memory_copy();
+ *
+ * Returns: the newly copied #GstGLMemory or %NULL
+ *
+ * Since: 1.8
+ */
+typedef GstGLBaseMemory * (*GstGLBaseMemoryAllocatorCopyFunction) (GstGLBaseMemory * mem,
+ gssize offset,
+ gssize size);
+
+/**
+ * GstGLBaseMemoryAllocatorDestroyFunction:
+ * @mem: a #GstGLBaseMemory
+ *
+ * Destroy any resources allocated throughout the lifetime of @mem
+ *
+ * Since: 1.8
+ */
+typedef void (*GstGLBaseMemoryAllocatorDestroyFunction) (GstGLBaseMemory * mem);
+
+/**
+ * GstGLBaseMemoryAllocator:
+ *
+ * Opaque #GstGLBaseMemoryAllocator struct
+ *
+ * Since: 1.8
+ */
+struct _GstGLBaseMemoryAllocator
+{
+ /*< private >*/
+ GstAllocator parent;
+ GstMemoryCopyFunction fallback_mem_copy;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLBaseMemoryAllocatorClass:
+ * @parent_class: the parent class
+ * @alloc: a #GstGLBaseMemoryAllocatorAllocFunction
+ * @create: a #GstGLBaseMemoryAllocatorCreateFunction
+ * @map: a #GstGLBaseMemoryAllocatorMapFunction
+ * @unmap: a #GstGLBaseMemoryAllocatorUnmapFunction
+ * @copy: a #GstGLBaseMemoryAllocatorCopyFunction
+ * @destroy: a #GstGLBaseMemoryAllocatorDestroyFunction
+ *
+ * Since: 1.8
+ */
+struct _GstGLBaseMemoryAllocatorClass
+{
+ GstAllocatorClass parent_class;
+
+ GstGLBaseMemoryAllocatorAllocFunction alloc;
+
+ GstGLBaseMemoryAllocatorCreateFunction create;
+ GstGLBaseMemoryAllocatorMapFunction map;
+ GstGLBaseMemoryAllocatorUnmapFunction unmap;
+ GstGLBaseMemoryAllocatorCopyFunction copy;
+ GstGLBaseMemoryAllocatorDestroyFunction destroy;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+#include <gst/gl/gstglconfig.h>
+#include <gst/gl/gstglformat.h>
+
+/**
+ * GST_GL_BASE_MEMORY_ALLOCATOR_NAME:
+ *
+ * The name of the GL buffer allocator
+ *
+ * Since: 1.8
+ */
+#define GST_GL_BASE_MEMORY_ALLOCATOR_NAME "GLBaseMemory"
+
+GST_GL_API
+void gst_gl_base_memory_init_once (void);
+
+GST_GL_API
+gboolean gst_is_gl_base_memory (GstMemory * mem);
+
+GST_GL_API
+void gst_gl_base_memory_init (GstGLBaseMemory * mem,
+ GstAllocator * allocator,
+ GstMemory * parent,
+ GstGLContext * context,
+ const GstAllocationParams * params,
+ gsize size,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_GL_API
+gboolean gst_gl_base_memory_alloc_data (GstGLBaseMemory * gl_mem);
+
+GST_GL_API
+gboolean gst_gl_base_memory_memcpy (GstGLBaseMemory * src,
+ GstGLBaseMemory * dest,
+ gssize offset,
+ gssize size);
+
+GST_GL_API
+GstGLBaseMemory * gst_gl_base_memory_alloc (GstGLBaseMemoryAllocator * allocator,
+ GstGLAllocationParams * params);
+
+G_END_DECLS
+
+#endif /* _GST_GL_BUFFER_H_ */
diff --git a/include/gst/gl/gstglbasesrc.h b/include/gst/gl/gstglbasesrc.h
new file mode 100644
index 0000000000..4c9d3a435c
--- /dev/null
+++ b/include/gst/gl/gstglbasesrc.h
@@ -0,0 +1,100 @@
+/*
+ * GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2002,2007 David A. Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2019 Philippe Normand <philn@igalia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_BASE_SRC_H__
+#define __GST_GL_BASE_SRC_H__
+
+#include <gst/base/gstpushsrc.h>
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_base_src_get_type(void);
+
+#define GST_TYPE_GL_BASE_SRC (gst_gl_base_src_get_type())
+#define GST_GL_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_SRC,GstGLBaseSrc))
+#define GST_GL_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_BASE_SRC,GstGLBaseSrcClass))
+#define GST_IS_GL_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_SRC))
+#define GST_IS_GL_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_BASE_SRC))
+#define GST_GL_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BASE_SRC,GstGLBaseSrcClass))
+
+/**
+ * GstGLBaseSrc:
+ * @display: the currently configured #GstGLDisplay
+ * @context: the currently configured #GstGLContext
+ * @out_caps: the currently configured output #GstCaps
+ * @out_info: the currently configured output #GstVideoInfo
+ * @running_time: the total running time
+ *
+ * The parent instance type of a base GStreamer GL Video source.
+ *
+ * Since: 1.18
+ */
+struct _GstGLBaseSrc {
+ GstPushSrc parent;
+
+ /*< public >*/
+ GstGLDisplay *display;
+ GstGLContext *context;
+
+ /* video state */
+ GstVideoInfo out_info;
+ GstCaps *out_caps;
+
+ /* total running time */
+ GstClockTime running_time;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+
+ GstGLBaseSrcPrivate *priv;
+};
+
+/**
+ * GstGLBaseSrcClass:
+ * @supported_gl_api: the logical-OR of #GstGLAPI's supported by this element
+ * @gl_start: called in the GL thread to setup the element GL state.
+ * @gl_stop: called in the GL thread to setup the element GL state.
+ * @fill_gl_memory: called in the GL thread to fill the current video texture.
+ *
+ * The base class for GStreamer GL Video sources.
+ *
+ * Since: 1.18
+ */
+struct _GstGLBaseSrcClass {
+ GstPushSrcClass parent_class;
+
+ /*< public >*/
+ GstGLAPI supported_gl_api;
+ gboolean (*gl_start) (GstGLBaseSrc *src);
+ void (*gl_stop) (GstGLBaseSrc *src);
+ gboolean (*fill_gl_memory) (GstGLBaseSrc *src, GstGLMemory *mem);
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+G_END_DECLS
+
+#endif /* __GST_GL_BASE_SRC_H__ */
diff --git a/include/gst/gl/gstglbuffer.h b/include/gst/gl/gstglbuffer.h
new file mode 100644
index 0000000000..4cc7f9b31e
--- /dev/null
+++ b/include/gst/gl/gstglbuffer.h
@@ -0,0 +1,150 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_BUFFER_H_
+#define _GST_GL_BUFFER_H_
+
+#include <gst/gl/gstglbasememory.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_BUFFER_ALLOCATOR (gst_gl_buffer_allocator_get_type())
+GST_GL_API
+GType gst_gl_buffer_allocator_get_type(void);
+
+#define GST_IS_GL_BUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_ALLOCATOR))
+#define GST_IS_GL_BUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_BUFFER_ALLOCATOR))
+#define GST_GL_BUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocatorClass))
+#define GST_GL_BUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocator))
+#define GST_GL_BUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocatorClass))
+#define GST_GL_BUFFER_ALLOCATOR_CAST(obj) ((GstGLBufferAllocator *)(obj))
+
+/**
+ * GstGLBuffer:
+ * @mem: the parent object
+ * @id: the buffer id for this memory
+ * @target: the OpenGL target of this texture for binding purposes
+ * @usage_hints: the OpenGL usage hints this buffer was created with
+ *
+ * Represents information about a GL buffer
+ */
+struct _GstGLBuffer
+{
+ GstGLBaseMemory mem;
+
+ guint id;
+ guint target; /* XXX: put this in the allocator? */
+ guint usage_hints; /* XXX: put this in the allocator? */
+};
+
+typedef struct _GstGLBufferAllocationParams GstGLBufferAllocationParams;
+
+#define GST_TYPE_GL_BUFFER_ALLOCATION_PARAMS (gst_gl_buffer_allocation_params_get_type())
+GST_GL_API
+GType gst_gl_buffer_allocation_params_get_type (void);
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER:
+ *
+ * GL allocation flag indicating the allocation of a GL buffer.
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER (1 << 4)
+
+/**
+ * GstGLBufferAllocationParams:
+ * @parent: parent object
+ * @gl_target: the OpenGL target to bind the buffer to
+ * @gl_usage: the OpenGL usage hint to create the buffer with
+ */
+struct _GstGLBufferAllocationParams
+{
+ GstGLAllocationParams parent;
+
+ guint gl_target;
+ guint gl_usage;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLBufferAllocationParams * gst_gl_buffer_allocation_params_new (GstGLContext * context,
+ gsize alloc_size,
+ const GstAllocationParams * alloc_params,
+ guint gl_target,
+ guint gl_usage);
+
+/**
+ * GstGLBufferAllocator:
+ *
+ * Opaque #GstGLBufferAllocator struct
+ */
+struct _GstGLBufferAllocator
+{
+ GstGLBaseMemoryAllocator parent;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLBufferAllocatorClass:
+ *
+ * The #GstGLBufferAllocatorClass only contains private data
+ */
+struct _GstGLBufferAllocatorClass
+{
+ GstGLBaseMemoryAllocatorClass parent_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GST_CAPS_FEATURE_MEMORY_GL_BUFFER:
+ *
+ * Name of the caps feature indicating the use of GL buffers
+ */
+#define GST_CAPS_FEATURE_MEMORY_GL_BUFFER "memory:GLBuffer"
+
+/**
+ * GST_GL_BUFFER_ALLOCATOR_NAME:
+ *
+ * The name of the GL buffer allocator
+ */
+#define GST_GL_BUFFER_ALLOCATOR_NAME "GLBuffer"
+
+/**
+ * GST_TYPE_GL_BUFFER:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_GL_BUFFER (gst_gl_buffer_get_type())
+GST_GL_API
+GType gst_gl_buffer_get_type(void);
+
+GST_GL_API
+void gst_gl_buffer_init_once (void);
+GST_GL_API
+gboolean gst_is_gl_buffer (GstMemory * mem);
+
+G_END_DECLS
+
+#endif /* _GST_GL_BUFFER_H_ */
diff --git a/include/gst/gl/gstglbufferpool.h b/include/gst/gl/gstglbufferpool.h
new file mode 100644
index 0000000000..595eed53ad
--- /dev/null
+++ b/include/gst/gl/gstglbufferpool.h
@@ -0,0 +1,83 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_BUFFER_POOL_H_
+#define _GST_GL_BUFFER_POOL_H_
+
+#include <gst/video/gstvideometa.h>
+#include <gst/video/gstvideopool.h>
+
+#include <gst/gl/gstglbasememory.h>
+
+G_BEGIN_DECLS
+
+/* buffer pool functions */
+GST_GL_API
+GType gst_gl_buffer_pool_get_type (void);
+#define GST_TYPE_GL_BUFFER_POOL (gst_gl_buffer_pool_get_type())
+#define GST_IS_GL_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BUFFER_POOL))
+#define GST_GL_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BUFFER_POOL, GstGLBufferPool))
+#define GST_GL_BUFFER_POOL_CAST(obj) ((GstGLBufferPool*)(obj))
+
+/**
+ * GstGLBufferPool:
+ *
+ * Opaque GstGLBufferPool struct
+ */
+struct _GstGLBufferPool
+{
+ GstBufferPool bufferpool;
+
+ GstGLContext *context;
+
+ /*< private >*/
+ GstGLBufferPoolPrivate *priv;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLBufferPoolClass:
+ *
+ * The #GstGLBufferPoolClass structure contains only private data
+ */
+struct _GstGLBufferPoolClass
+{
+ GstBufferPoolClass parent_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstBufferPool *gst_gl_buffer_pool_new (GstGLContext * context);
+
+GST_GL_API
+GstGLAllocationParams * gst_gl_buffer_pool_get_gl_allocation_params (GstGLBufferPool * pool);
+
+GST_GL_API
+GstGLAllocationParams * gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config);
+GST_GL_API
+void gst_buffer_pool_config_set_gl_allocation_params (GstStructure * config,
+ const GstGLAllocationParams * params);
+
+G_END_DECLS
+
+#endif /* _GST_GL_BUFFER_POOL_H_ */
diff --git a/include/gst/gl/gstglcolorconvert.h b/include/gst/gl/gstglcolorconvert.h
new file mode 100644
index 0000000000..4512fe17c6
--- /dev/null
+++ b/include/gst/gl/gstglcolorconvert.h
@@ -0,0 +1,156 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystree00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_COLOR_CONVERT_H__
+#define __GST_GL_COLOR_CONVERT_H__
+
+#include <gst/video/video.h>
+#include <gst/gstmemory.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_color_convert_get_type (void);
+#define GST_TYPE_GL_COLOR_CONVERT (gst_gl_color_convert_get_type())
+#define GST_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COLOR_CONVERT,GstGLColorConvert))
+#define GST_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLColorConvertClass))
+#define GST_IS_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_COLOR_CONVERT))
+#define GST_IS_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_COLOR_CONVERT))
+#define GST_GL_COLOR_CONVERT_CAST(obj) ((GstGLColorConvert*)(obj))
+
+/**
+ * GstGLColorConvert
+ *
+ * Opaque #GstGLColorConvert object
+ */
+struct _GstGLColorConvert
+{
+ /*< private >*/
+ GstObject parent;
+
+ GstGLContext *context;
+
+ /* input data */
+ GstVideoInfo in_info;
+ GstVideoInfo out_info;
+
+ gboolean initted;
+ gboolean passthrough;
+
+ GstBuffer * inbuf;
+ GstBuffer * outbuf;
+
+ /* used for the conversion */
+ GstGLFramebuffer *fbo;
+ GstGLShader *shader;
+
+ /*< private >*/
+ GstGLColorConvertPrivate *priv;
+
+ gpointer _reserved[GST_PADDING];
+};
+
+/**
+ * GstGLColorConvertClass:
+ *
+ * The #GstGLColorConvertClass struct only contains private data
+ */
+struct _GstGLColorConvertClass
+{
+ /*< private >*/
+ GstObjectClass object_class;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GST_GL_COLOR_CONVERT_EXT_FORMATS: (skip)
+ *
+ */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_GL_COLOR_CONVERT_EXT_FORMATS \
+ ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE"
+#else
+#define GST_GL_COLOR_CONVERT_EXT_FORMATS \
+ ", P010_10BE, P012_BE, P016_BE, Y212_BE, Y412_BE"
+#endif
+
+/**
+ * GST_GL_COLOR_CONVERT_FORMATS:
+ *
+ * The currently supported formats that can be converted
+ */
+#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
+ "xBGR, ARGB, ABGR, GBRA, GBR, RGBP, BGRP, Y444, I420, YV12, Y42B, " \
+ "Y41B, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, AYUV, " \
+ "VUYA, Y410, GRAY8, GRAY16_LE, GRAY16_BE, " \
+ "RGB16, BGR16, ARGB64, A420, AV12" \
+ GST_GL_COLOR_CONVERT_EXT_FORMATS "}"
+
+/**
+ * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
+ *
+ * The currently supported #GstCaps that can be converted
+ */
+#define GST_GL_COLOR_CONVERT_VIDEO_CAPS \
+ "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " \
+ "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
+ "width = " GST_VIDEO_SIZE_RANGE ", " \
+ "height = " GST_VIDEO_SIZE_RANGE ", " \
+ "framerate = " GST_VIDEO_FPS_RANGE ", " \
+ "texture-target = (string) { 2D, rectangle, external-oes } " \
+ " ; " \
+ "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "," \
+ GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION "), " \
+ "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
+ "width = " GST_VIDEO_SIZE_RANGE ", " \
+ "height = " GST_VIDEO_SIZE_RANGE ", " \
+ "framerate = " GST_VIDEO_FPS_RANGE ", " \
+ "texture-target = (string) { 2D, rectangle, external-oes }"
+
+GST_GL_API
+GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
+
+GST_GL_API
+GstCaps * gst_gl_color_convert_transform_caps (GstGLContext * context,
+ GstPadDirection direction,
+ GstCaps * caps,
+ GstCaps * filter);
+GST_GL_API
+GstCaps * gst_gl_color_convert_fixate_caps (GstGLContext * context,
+ GstPadDirection direction,
+ GstCaps * caps,
+ GstCaps * other);
+GST_GL_API
+gboolean gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
+ GstCaps * in_caps,
+ GstCaps * out_caps);
+GST_GL_API
+gboolean gst_gl_color_convert_decide_allocation (GstGLColorConvert * convert,
+ GstQuery * query);
+
+GST_GL_API
+GstBuffer * gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf);
+
+G_END_DECLS
+
+#endif /* __GST_GL_COLOR_CONVERT_H__ */
diff --git a/include/gst/gl/gstglcontext.h b/include/gst/gl/gstglcontext.h
new file mode 100644
index 0000000000..9c1b5d8eff
--- /dev/null
+++ b/include/gst/gl/gstglcontext.h
@@ -0,0 +1,252 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_CONTEXT_H__
+#define __GST_GL_CONTEXT_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_context_get_type (void);
+#define GST_TYPE_GL_CONTEXT (gst_gl_context_get_type())
+
+#define GST_GL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT, GstGLContext))
+#define GST_GL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_GL_CONTEXT, GstGLContextClass))
+#define GST_IS_GL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT))
+#define GST_IS_GL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT))
+#define GST_GL_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT, GstGLContextClass))
+
+GST_GL_API
+GQuark gst_gl_context_error_quark (void);
+
+/**
+ * GST_GL_CONTEXT_ERROR:
+ *
+ * Error domain for GStreamer's GL context module. Errors in this domain will
+ * be from the #GstGLContextError enumeration
+ */
+#define GST_GL_CONTEXT_ERROR (gst_gl_context_error_quark ())
+
+/**
+ * GstGLContextThreadFunc:
+ * @context: a #GstGLContext
+ * @data: user data
+ *
+ * Represents a function to run in the GL thread with @context and @data
+ */
+typedef void (*GstGLContextThreadFunc) (GstGLContext * context, gpointer data);
+
+#define GST_GL_CONTEXT_TYPE_CGL "gst.gl.context.CGL"
+#define GST_GL_CONTEXT_TYPE_GLX "gst.gl.context.GLX"
+#define GST_GL_CONTEXT_TYPE_EGL "gst.gl.context.EGL"
+#define GST_GL_CONTEXT_TYPE_WGL "gst.gl.context.WGL"
+#define GST_GL_CONTEXT_TYPE_EAGL "gst.gl.context.EAGL"
+
+/**
+ * GstGLContextError:
+ * @GST_GL_CONTEXT_ERROR_FAILED: Failed for an unspecified reason
+ * @GST_GL_CONTEXT_ERROR_WRONG_CONFIG: The configuration requested is not correct
+ * @GST_GL_CONTEXT_ERROR_WRONG_API: The OpenGL API requested is not correct
+ * @GST_GL_CONTEXT_ERROR_OLD_LIBS: The OpenGL libraries are too old
+ * @GST_GL_CONTEXT_ERROR_CREATE_CONTEXT: glXCreateContext (or similar) failed
+ * @GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE: A resource is not available
+ *
+ * OpenGL context errors.
+ */
+typedef enum
+{
+ GST_GL_CONTEXT_ERROR_FAILED,
+ GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
+ GST_GL_CONTEXT_ERROR_WRONG_API,
+ GST_GL_CONTEXT_ERROR_OLD_LIBS,
+ GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
+ GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
+} GstGLContextError;
+
+/**
+ * GstGLContext:
+ * @gl_vtable: a list of OpenGL function pointers
+ *
+ * Opaque #GstGLContext object
+ */
+struct _GstGLContext {
+ /*< private >*/
+ GstObject parent;
+
+ GstGLDisplay *display;
+ GstGLWindow *window;
+
+ /*< public >*/
+ GstGLFuncs *gl_vtable;
+
+ /*< private >*/
+ GstGLContextPrivate *priv;
+
+ gpointer _reserved[GST_PADDING];
+};
+
+/**
+ * GstGLContextClass:
+ * @get_gl_context: get the backing platform specific OpenGL context
+ * @get_gl_api: get the available OpenGL api's that this context can work with
+ * @get_proc_address: get an function pointer to an OpenGL function
+ * @activate: call eglMakeCurrent or similar
+ * @choose_format: choose a format for the framebuffer
+ * @create_context: create the OpenGL context
+ * @destroy_context: destroy the OpenGL context
+ * @swap_buffers: swap the default framebuffer's front/back buffers
+ */
+/**
+ * GstGLContextClass::get_config:
+ * @context: the #GstGLContext
+ *
+ * Retrieve the configuration in use by this context. See also
+ * gst_gl_context_get_config().
+ *
+ * Returns: (transfer full) (nullable): the configuration chosen for this
+ * #GstGLContext
+ *
+ * Since: 1.20
+ */
+/**
+ * GstGLContextClass::request_config:
+ * @context: the #GstGLContext
+ * @gl_config: (nullable) (transfer full): a configuration structure for
+ * configuring on @context
+ *
+ * Request a configuration for this @context to use.
+ *
+ * Unknown fields within @gl_config should be ignored by subclasses.
+ *
+ * See also gst_gl_context_request_config().
+ *
+ * Returns: Whether @gl_config could be successfull set on @context.
+ *
+ * Since: 1.20
+ */
+struct _GstGLContextClass {
+ GstObjectClass parent_class;
+
+ guintptr (*get_current_context) (void);
+ guintptr (*get_gl_context) (GstGLContext *context);
+ GstGLAPI (*get_gl_api) (GstGLContext *context);
+ GstGLPlatform (*get_gl_platform) (GstGLContext *context);
+ gpointer (*get_proc_address) (GstGLAPI gl_api, const gchar *name);
+ gboolean (*activate) (GstGLContext *context, gboolean activate);
+ gboolean (*choose_format) (GstGLContext *context, GError **error);
+ gboolean (*create_context) (GstGLContext *context, GstGLAPI gl_api,
+ GstGLContext *other_context, GError ** error);
+ void (*destroy_context) (GstGLContext *context);
+ void (*swap_buffers) (GstGLContext *context);
+ gboolean (*check_feature) (GstGLContext *context, const gchar *feature);
+ void (*get_gl_platform_version) (GstGLContext *context, gint *major, gint *minor);
+ GstStructure *(*get_config) (GstGLContext * context);
+ gboolean (*request_config) (GstGLContext * context, GstStructure * gl_config);
+
+ /*< private >*/
+ gpointer _reserved[GST_PADDING-2];
+};
+
+/* methods */
+
+GST_GL_API
+GstGLContext * gst_gl_context_new (GstGLDisplay *display);
+GST_GL_API
+GstGLContext * gst_gl_context_new_wrapped (GstGLDisplay *display,
+ guintptr handle,
+ GstGLPlatform context_type,
+ GstGLAPI available_apis);
+
+GST_GL_API
+GstStructure * gst_gl_context_get_config (GstGLContext * context);
+GST_GL_API
+gboolean gst_gl_context_request_config (GstGLContext * context, GstStructure * gl_config);
+
+GST_GL_API
+gboolean gst_gl_context_activate (GstGLContext *context, gboolean activate);
+GST_GL_API
+GThread * gst_gl_context_get_thread (GstGLContext *context);
+GST_GL_API
+GstGLContext * gst_gl_context_get_current (void);
+
+GST_GL_API
+GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
+GST_GL_API
+gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
+GST_GL_API
+GstGLPlatform gst_gl_context_get_gl_platform (GstGLContext *context);
+GST_GL_API
+GstGLAPI gst_gl_context_get_gl_api (GstGLContext *context);
+GST_GL_API
+guintptr gst_gl_context_get_gl_context (GstGLContext *context);
+GST_GL_API
+gboolean gst_gl_context_can_share (GstGLContext * context, GstGLContext *other_context);
+GST_GL_API
+void gst_gl_context_swap_buffers (GstGLContext * context);
+
+GST_GL_API
+gboolean gst_gl_context_create (GstGLContext *context, GstGLContext *other_context, GError ** error);
+GST_GL_API
+void gst_gl_context_destroy (GstGLContext *context);
+
+GST_GL_API
+gpointer gst_gl_context_default_get_proc_address (GstGLAPI gl_api, const gchar *name);
+GST_GL_API
+gpointer gst_gl_context_get_proc_address_with_platform (GstGLPlatform context_type, GstGLAPI gl_api, const gchar *name);
+
+GST_GL_API
+gboolean gst_gl_context_set_window (GstGLContext *context, GstGLWindow *window);
+GST_GL_API
+GstGLWindow * gst_gl_context_get_window (GstGLContext *context);
+
+GST_GL_API
+void gst_gl_context_get_gl_version (GstGLContext *context, gint *maj, gint *min);
+GST_GL_API
+gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min);
+GST_GL_API
+gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
+GST_GL_API
+void gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major, gint * minor);
+
+GST_GL_API
+guintptr gst_gl_context_get_current_gl_context (GstGLPlatform context_type);
+GST_GL_API
+GstGLAPI gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint *major, guint *minor);
+
+GST_GL_API
+gboolean gst_gl_context_is_shared (GstGLContext * context);
+GST_GL_API
+void gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share);
+
+GST_GL_API
+gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error);
+
+/* FIXME: remove */
+GST_GL_API
+void gst_gl_context_thread_add (GstGLContext * context,
+ GstGLContextThreadFunc func, gpointer data);
+
+G_END_DECLS
+
+#endif /* __GST_GL_CONTEXT_H__ */
diff --git a/include/gst/gl/gstglcontextconfig.h b/include/gst/gl/gstglcontextconfig.h
new file mode 100644
index 0000000000..af33013742
--- /dev/null
+++ b/include/gst/gl/gstglcontextconfig.h
@@ -0,0 +1,160 @@
+/*
+ * GStreamer
+ * Copyright (C) 2020 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_CONTEXT_CONFIG_H__
+#define __GST_GL_CONTEXT_CONFIG_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_GL_CONFIG_STRUCTURE_NAME:
+ *
+ * The canonical name of a #GstStructure that contains a configuration for a
+ * #GstGLContext.
+ *
+ * Since: 1.20
+ */
+#define GST_GL_CONFIG_STRUCTURE_NAME "gst-gl-context-config"
+
+/**
+ * GST_GL_CONFIG_ATTRIB_NAME:
+ *
+ * Get a reference to the variable name of a particular configuration field.
+ *
+ * e.g. for `CONFIG_ID`: `GST_GL_CONFIG_ATTRIB_NAME (CONFIG_ID)`
+ *
+ * Since: 1.20
+ */
+#define GST_GL_CONFIG_ATTRIB_NAME(UPPER_NAME) \
+ G_PASTE(G_PASTE(GST_GL_CONFIG_ATTRIB_,UPPER_NAME),_NAME)
+/**
+ * GST_GL_CONFIG_ATTRIB_GTYPE:
+ *
+ * Get a reference to the #GType of a particular configuration field.
+ *
+ * e.g. for `CONFIG_ID`: `GST_GL_CONFIG_ATTRIB_GTYPE (CONFIG_ID)`
+ *
+ * Since: 1.20
+ */
+#define GST_GL_CONFIG_ATTRIB_GTYPE(UPPER_NAME) \
+ G_PASTE(G_PASTE(GST_GL_CONFIG_ATTRIB_,UPPER_NAME),_GTYPE)
+
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_CONFIG_ID_NAME;
+#define GST_GL_CONFIG_ATTRIB_CONFIG_ID_GTYPE G_TYPE_UINT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_PLATFORM_NAME;
+#define GST_GL_CONFIG_ATTRIB_PLATFORM_GTYPE GST_TYPE_GL_PLATFORM
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_CAVEAT_NAME;
+#define GST_GL_CONFIG_ATTRIB_CAVEAT_GTYPE GST_TYPE_GL_CONFIG_CAVEAT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_SURFACE_TYPE_NAME;
+#define GST_GL_CONFIG_ATTRIB_SURFACE_TYPE_GTYPE GST_TYPE_GL_CONFIG_SURFACE_TYPE
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_CONFORMANT_API_NAME;
+#define GST_GL_CONFIG_ATTRIB_CONFORMANT_API_GTYPE GST_TYPE_GL_API
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_RENDERABLE_API_NAME;
+#define GST_GL_CONFIG_ATTRIB_RENDERABLE_API_GTYPE GST_TYPE_GL_API
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_RED_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_RED_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_GREEN_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_GREEN_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_BLUE_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_BLUE_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_ALPHA_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_ALPHA_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_LUMINANCE_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_LUMINANCE_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_DEPTH_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_DEPTH_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_STENCIL_SIZE_NAME;
+#define GST_GL_CONFIG_ATTRIB_STENCIL_SIZE_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_WIDTH_NAME;
+#define GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_WIDTH_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_HEIGHT_NAME;
+#define GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_HEIGHT_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_PIXELS_NAME;
+#define GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_PIXELS_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_SAMPLE_BUFFERS_NAME;
+#define GST_GL_CONFIG_ATTRIB_SAMPLE_BUFFERS_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_SAMPLES_NAME;
+#define GST_GL_CONFIG_ATTRIB_SAMPLES_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_NATIVE_RENDERABLE_NAME;
+#define GST_GL_CONFIG_ATTRIB_NATIVE_RENDERABLE_GTYPE G_TYPE_BOOLEAN
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_NATIVE_VISUAL_ID_NAME;
+#define GST_GL_CONFIG_ATTRIB_NATIVE_VISUAL_ID_GTYPE G_TYPE_UINT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_LEVEL_NAME;
+#define GST_GL_CONFIG_ATTRIB_LEVEL_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_MIN_SWAP_INTERVAL_NAME;
+#define GST_GL_CONFIG_ATTRIB_MIN_SWAP_INTERVAL_GTYPE G_TYPE_INT
+GST_GL_API const char * GST_GL_CONFIG_ATTRIB_MAX_SWAP_INTERVAL_NAME;
+#define GST_GL_CONFIG_ATTRIB_MAX_SWAP_INTERVAL_GTYPE G_TYPE_INT
+
+/**
+ * GST_GL_CONFIG_STRUCTURE_SET_ARGS:
+ *
+ * Since: 1.20
+ */
+#define GST_GL_CONFIG_STRUCTURE_SET_ARGS(def_name,ctype,val) \
+ GST_GL_CONFIG_ATTRIB_NAME(def_name), \
+ GST_GL_CONFIG_ATTRIB_GTYPE(def_name), \
+ (ctype) (val)
+
+/**
+ * GstGLConfigCaveat:
+ * @GST_GL_CONFIG_CAVEAT_NONE: none
+ * @GST_GL_CONFIG_CAVEAT_SLOW: slow
+ * @GST_GL_CONFIG_CAVEAT_NON_CONFORMANT: non-conformant
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_GL_CONFIG_CAVEAT_NONE,
+ GST_GL_CONFIG_CAVEAT_SLOW,
+ GST_GL_CONFIG_CAVEAT_NON_CONFORMANT,
+} GstGLConfigCaveat;
+
+GST_GL_API
+const gchar * gst_gl_config_caveat_to_string (GstGLConfigCaveat caveat);
+
+/**
+ * GstGLConfigSurfaceType:
+ * @GST_GL_CONFIG_SURFACE_TYPE_NONE: none
+ * @GST_GL_CONFIG_SURFACE_TYPE_WINDOW: window
+ * @GST_GL_CONFIG_SURFACE_TYPE_PBUFFER: pbuffer
+ * @GST_GL_CONFIG_SURFACE_TYPE_PIXMAP: pixmap
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_GL_CONFIG_SURFACE_TYPE_NONE = 0,
+ GST_GL_CONFIG_SURFACE_TYPE_WINDOW = (1 << 0),
+ GST_GL_CONFIG_SURFACE_TYPE_PBUFFER = (1 << 1),
+ GST_GL_CONFIG_SURFACE_TYPE_PIXMAP = (1 << 2),
+} GstGLConfigSurfaceType;
+
+GST_GL_API
+const gchar * gst_gl_config_surface_type_to_string (GstGLConfigSurfaceType surface_type);
+
+G_END_DECLS
+
+#endif /* __GST_GL_CONTEXT_CONFIG_H__ */
diff --git a/include/gst/gl/gstgldebug.h b/include/gst/gl/gstgldebug.h
new file mode 100644
index 0000000000..543335605f
--- /dev/null
+++ b/include/gst/gl/gstgldebug.h
@@ -0,0 +1,182 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_DEBUG_H__
+#define __GST_GL_DEBUG_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+typedef gchar * (*GstGLAsyncDebugLogGetMessage) (gpointer user_data);
+
+/**
+ * GstGLAsyncDebug:
+ *
+ * #GstGLAsyncDebug an opaque structure and should only be accessed through the
+ * provided API.
+ */
+struct _GstGLAsyncDebug
+{
+ /*< private >*/
+ guint state_flags;
+ GstDebugCategory *cat;
+ GstDebugLevel level;
+ const gchar *file;
+ const gchar *function;
+ gint line;
+ GObject *object;
+ gchar *debug_msg;
+
+ /*< protected >*/
+ GstGLAsyncDebugLogGetMessage callback;
+ gpointer user_data;
+ GDestroyNotify notify;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLAsyncDebug * gst_gl_async_debug_new (void);
+GST_GL_API
+void gst_gl_async_debug_free (GstGLAsyncDebug * ad);
+GST_GL_API
+void gst_gl_async_debug_init (GstGLAsyncDebug * ad);
+GST_GL_API
+void gst_gl_async_debug_unset (GstGLAsyncDebug * ad);
+GST_GL_API
+void gst_gl_async_debug_freeze (GstGLAsyncDebug * ad);
+GST_GL_API
+void gst_gl_async_debug_thaw (GstGLAsyncDebug * ad);
+
+/**
+ * GST_GL_ASYNC_CAT_LEVEL_LOG_valist:
+ * @ad: the #GstGLAsyncDebug to store the message in
+ * @cat: the #GstDebugCategory to output the message in
+ * @level: the #GstDebugLevel
+ * @object: (allow-none): a #GObject to associate with the debug message
+ * @format: a printf style format string
+ * @varargs: the list of arguments for @format
+ *
+ * Stores a debug message in @ad for later output
+ */
+#define GST_GL_ASYNC_CAT_LEVEL_LOG_valist(ad,cat,level,object,format,varargs) \
+ gst_gl_async_debug_store_log_msg_valist (ad, cat, level, __FILE__, \
+ GST_FUNCTION, __LINE__, object, format, varargs)
+
+/**
+ * GST_GL_ASYNC_CAT_LEVEL_LOG:
+ * @ad: the #GstGLAsyncDebug to store the message in
+ * @cat: the #GstDebugCategory to output the message in
+ * @level: the #GstDebugLevel
+ * @object: (allow-none): a #GObject to associate with the debug message
+ * @format: a printf style format string
+ * @...: the list of arguments for @format
+ *
+ * Stores a debug message in @ad for later output
+ */
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,...) \
+ gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
+ __LINE__, object, format, __VA_ARGS__)
+#else /* G_HAVE_ISO_VARARGS */
+#if G_HAVE_GNUC_VARARGS
+#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,args...) \
+ gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
+ __LINE__, object, format, ##args)
+#else /* G_HAVE_GNUC_VARARGS */
+static inline void
+GST_GL_ASYNC_CAT_LEVEL_LOG(GstGLAsyncDebug * ad, GstDebugCategory * cat,
+ GstDebugLevel level, GObject * object, const gchar * format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_GL_ASYNC_CAT_LEVEL_LOG_valist (ad, cat, level, object, format, varargs);
+ va_end (varargs);
+}
+#endif /* G_HAVE_GNUC_VARARGS */
+#endif /* G_HAVE_ISO_VARARGS */
+
+#if !defined(GST_DISABLE_GST_DEBUG)
+
+GST_GL_API
+void gst_gl_insert_debug_marker (GstGLContext * context,
+ const gchar * format, ...) G_GNUC_PRINTF (2, 3);
+GST_GL_API
+void gst_gl_async_debug_output_log_msg (GstGLAsyncDebug * ad);
+GST_GL_API
+void gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
+ GstDebugCategory * cat,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ const gchar * format, ...) G_GNUC_PRINTF (8, 9);
+GST_GL_API
+void gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
+ GstDebugCategory * cat,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ const gchar * format,
+ va_list varargs) G_GNUC_PRINTF (8, 0);
+
+#else /* GST_DISABLE_GST_DEBUG */
+
+#define gst_gl_async_debug_output_log_msg(ad) G_STMT_START{ }G_STMT_END
+#define gst_gl_async_debug_store_log_msg_valist(ad,cat,level,file,function,line,object,format,args) G_STMT_START{ }G_STMT_END
+
+#ifdef G_HAVE_ISO_VARARGS
+
+#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
+#define gst_gl_async_debug_store_log_msg(...) G_STMT_START{ }G_STMT_END
+
+#else /* G_HAVE_ISO_VARARGS */
+#if G_HAVE_GNUC_VARARGS
+
+#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END
+#define gst_gl_async_debug_store_log_msg(args...) G_STMT_START{ }G_STMT_END
+
+#else /* G_HAVE_GNUC_VARARGS */
+
+static inline void
+gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
+{
+}
+
+static inline void
+gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
+ GstDebugCategory * cat, GstDebugLevel level, const gchar * file,
+ const gchar * function, gint line, GstObject * object,
+ const gchar * format, ...)
+{
+}
+
+#endif /* G_HAVE_GNUC_VARARGS */
+#endif /* G_HAVE_ISO_VARARGS */
+#endif /* GST_DISABLE_GST_DEBUG */
+
+G_END_DECLS
+
+#endif /* __GST_GL_DEBUG_H__ */
diff --git a/include/gst/gl/gstgldisplay.h b/include/gst/gl/gstgldisplay.h
new file mode 100644
index 0000000000..9f52d109f8
--- /dev/null
+++ b/include/gst/gl/gstgldisplay.h
@@ -0,0 +1,190 @@
+/*
+ * GStreamer
+ * Copyright (C) 2007 David A. Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
+ * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_DISPLAY_H__
+#define __GST_GL_DISPLAY_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_display_get_type (void);
+
+#define GST_TYPE_GL_DISPLAY (gst_gl_display_get_type())
+#define GST_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY,GstGLDisplay))
+#define GST_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY,GstGLDisplayClass))
+#define GST_IS_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY))
+#define GST_IS_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY))
+#define GST_GL_DISPLAY_CAST(obj) ((GstGLDisplay*)(obj))
+#define GST_GL_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_DISPLAY, GstGLDisplayClass))
+
+/**
+ * GstGLDisplayType:
+ * @GST_GL_DISPLAY_TYPE_NONE: no display type
+ * @GST_GL_DISPLAY_TYPE_X11: X11 display
+ * @GST_GL_DISPLAY_TYPE_WAYLAND: Wayland display
+ * @GST_GL_DISPLAY_TYPE_COCOA: Cocoa display
+ * @GST_GL_DISPLAY_TYPE_WIN32: Win32 display
+ * @GST_GL_DISPLAY_TYPE_DISPMANX: Dispmanx display
+ * @GST_GL_DISPLAY_TYPE_EGL: EGL display
+ * @GST_GL_DISPLAY_TYPE_VIV_FB: Vivante Framebuffer display
+ * @GST_GL_DISPLAY_TYPE_GBM: Mesa3D GBM display
+ * @GST_GL_DISPLAY_TYPE_ANY: any display type
+ */
+/**
+ * GST_GL_DISPLAY_TYPE_EGL_DEVICE:
+ *
+ * EGLDevice display.
+ *
+ * Since: 1.18
+ */
+/**
+ * GST_GL_DISPLAY_TYPE_EAGL:
+ *
+ * EAGL display.
+ *
+ * Since: 1.20
+ */
+/**
+ * GST_GL_DISPLAY_TYPE_WINRT:
+ *
+ * WinRT display.
+ *
+ * Since: 1.20
+ */
+/**
+ * GST_GL_DISPLAY_TYPE_ANDROID:
+ *
+ * Android display.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_GL_DISPLAY_TYPE_NONE = 0,
+ GST_GL_DISPLAY_TYPE_X11 = (1 << 0),
+ GST_GL_DISPLAY_TYPE_WAYLAND = (1 << 1),
+ GST_GL_DISPLAY_TYPE_COCOA = (1 << 2),
+ GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
+ GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
+ GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
+ GST_GL_DISPLAY_TYPE_VIV_FB = (1 << 6),
+ GST_GL_DISPLAY_TYPE_GBM = (1 << 7),
+ GST_GL_DISPLAY_TYPE_EGL_DEVICE = (1 << 8),
+ GST_GL_DISPLAY_TYPE_EAGL = (1 << 9),
+ GST_GL_DISPLAY_TYPE_WINRT = (1 << 10),
+ GST_GL_DISPLAY_TYPE_ANDROID = (1 << 11),
+
+ GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
+} GstGLDisplayType;
+
+/**
+ * GstGLDisplay:
+ *
+ * The contents of a #GstGLDisplay are private and should only be accessed
+ * through the provided API
+ */
+struct _GstGLDisplay
+{
+ /*< private >*/
+ GstObject object;
+
+ GstGLDisplayType type;
+
+ /*< protected >*/
+ GList *windows; /* internal lock, use *_window functions instead */
+ GMainContext *main_context;
+ GMainLoop *main_loop;
+ GSource *event_source;
+
+ GstGLDisplayPrivate *priv;
+};
+
+struct _GstGLDisplayClass
+{
+ GstObjectClass object_class;
+
+ guintptr (*get_handle) (GstGLDisplay * display);
+ GstGLWindow * (*create_window) (GstGLDisplay * display);
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLDisplay *gst_gl_display_new (void);
+GST_GL_API
+GstGLDisplay *gst_gl_display_new_with_type (GstGLDisplayType type);
+
+#define gst_gl_display_lock(display) GST_OBJECT_LOCK (display)
+#define gst_gl_display_unlock(display) GST_OBJECT_UNLOCK (display)
+
+GST_GL_API
+guintptr gst_gl_display_get_handle (GstGLDisplay * display);
+GST_GL_API
+GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display);
+GST_GL_API
+void gst_gl_display_filter_gl_api (GstGLDisplay * display,
+ GstGLAPI gl_api);
+GST_GL_API
+GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display);
+GST_GL_API
+GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display);
+
+/**
+ * GST_GL_DISPLAY_CONTEXT_TYPE:
+ *
+ * The name used in #GstContext queries for requesting a #GstGLDisplay
+ */
+#define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay"
+GST_GL_API
+void gst_context_set_gl_display (GstContext * context, GstGLDisplay * display);
+GST_GL_API
+gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display);
+
+GST_GL_API
+gboolean gst_gl_display_create_context (GstGLDisplay * display,
+ GstGLContext * other_context, GstGLContext ** p_context, GError **error);
+GST_GL_API
+GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
+ GThread * thread);
+GST_GL_API
+gboolean gst_gl_display_add_context (GstGLDisplay * display,
+ GstGLContext * context);
+GST_GL_API
+void gst_gl_display_remove_context (GstGLDisplay * display,
+ GstGLContext * context);
+
+GST_GL_API
+GstGLWindow * gst_gl_display_create_window (GstGLDisplay * display);
+GST_GL_API
+gboolean gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window);
+GST_GL_API G_DEPRECATED_FOR(gst_gl_display_retrieve_window)
+GstGLWindow * gst_gl_display_find_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func);
+GST_GL_API
+GstGLWindow * gst_gl_display_retrieve_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func);
+
+G_END_DECLS
+
+#endif /* __GST_GL_DISPLAY_H__ */
diff --git a/include/gst/gl/gstglfeature.h b/include/gst/gl/gstglfeature.h
new file mode 100644
index 0000000000..780f2594fb
--- /dev/null
+++ b/include/gst/gl/gstglfeature.h
@@ -0,0 +1,62 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2009 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __GST_GL_FEATURE_H__
+#define __GST_GL_FEATURE_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+#define GST_GL_CHECK_GL_VERSION(driver_major, driver_minor, \
+ target_major, target_minor) \
+ ((driver_major) > (target_major) || \
+ ((driver_major) == (target_major) && (driver_minor) >= (target_minor)))
+
+GST_GL_API
+gboolean gst_gl_check_extension (const char *name, const gchar * ext);
+
+G_END_DECLS
+
+#endif /* __GST_GL_FEATURE_H__ */
diff --git a/include/gst/gl/gstglfilter.h b/include/gst/gl/gstglfilter.h
new file mode 100644
index 0000000000..7f8108af42
--- /dev/null
+++ b/include/gst/gl/gstglfilter.h
@@ -0,0 +1,149 @@
+/*
+ * GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_FILTER_H_
+#define _GST_GL_FILTER_H_
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_filter_get_type(void);
+#define GST_TYPE_GL_FILTER (gst_gl_filter_get_type())
+#define GST_GL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FILTER,GstGLFilter))
+#define GST_IS_GL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FILTER))
+#define GST_GL_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER,GstGLFilterClass))
+#define GST_IS_GL_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER))
+#define GST_GL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER,GstGLFilterClass))
+
+/**
+ * GstGLFilterRenderFunc:
+ * @filter: the #GstGLFilter
+ * @in_tex: the input #GstGLMemory to render
+ * @user_data: user data
+ *
+ * Returns: whether the render succeeded
+ *
+ * Since: 1.10
+ */
+typedef gboolean (*GstGLFilterRenderFunc) (GstGLFilter * filter, GstGLMemory * in_tex, gpointer user_data);
+
+/**
+ * GstGLFilter:
+ * @in_info: the video info for input buffers
+ * @out_info: the video info for output buffers
+ * @in_texture_target: The texture target of the input buffers (usually 2D)
+ * @out_texture_target: The texture target of the output buffers (usually 2D)
+ * @out_caps: the output #GstCaps
+ * @fbo: #GstGLFramebuffer object used for transformations (only for subclass usage)
+ */
+struct _GstGLFilter
+{
+ GstGLBaseFilter parent;
+
+ /*< public >*/
+ GstVideoInfo in_info;
+ GstVideoInfo out_info;
+ GstGLTextureTarget in_texture_target;
+ GstGLTextureTarget out_texture_target;
+
+ GstCaps *out_caps;
+
+ /* protected */
+ GstGLFramebuffer *fbo;
+
+ /*< private >*/
+ gboolean gl_result;
+ GstBuffer *inbuf;
+ GstBuffer *outbuf;
+
+ GstGLShader *default_shader;
+ gboolean valid_attributes;
+
+ guint vao;
+ guint vbo_indices;
+ guint vertex_buffer;
+ gint draw_attr_position_loc;
+ gint draw_attr_texture_loc;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLFilterClass:
+ * @set_caps: mirror from #GstBaseTransform
+ * @filter: perform operations on the input and output buffers. In general,
+ * you should avoid using this method if at all possible. One valid
+ * use-case for using this is keeping previous buffers for future calculations.
+ * Note: If @filter exists, then @filter_texture is not run
+ * @filter_texture: given @in_tex, transform it into @out_tex. Not used
+ * if @filter exists
+ * @init_fbo: perform initialization when the Framebuffer object is created
+ * @transform_internal_caps: Perform sub-class specific modifications of the
+ * caps to be processed between upload on input and before download for output.
+ */
+struct _GstGLFilterClass
+{
+ GstGLBaseFilterClass parent_class;
+
+ /*< public >*/
+ gboolean (*set_caps) (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
+ gboolean (*filter) (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
+ gboolean (*filter_texture) (GstGLFilter *filter, GstGLMemory *input, GstGLMemory *output);
+ gboolean (*init_fbo) (GstGLFilter *filter);
+
+ GstCaps *(*transform_internal_caps) (GstGLFilter *filter,
+ GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps);
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+void gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass *klass);
+
+GST_GL_API
+gboolean gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * input,
+ GstBuffer * output);
+
+GST_GL_API
+gboolean gst_gl_filter_render_to_target (GstGLFilter *filter,
+ GstGLMemory * input,
+ GstGLMemory * output,
+ GstGLFilterRenderFunc func,
+ gpointer data);
+
+GST_GL_API
+void gst_gl_filter_draw_fullscreen_quad (GstGLFilter *filter);
+GST_GL_API
+void gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter,
+ GstGLMemory * input,
+ GstGLMemory * output,
+ GstGLShader *shader);
+
+G_END_DECLS
+
+#endif /* _GST_GL_FILTER_H_ */
diff --git a/include/gst/gl/gstglformat.h b/include/gst/gl/gstglformat.h
new file mode 100644
index 0000000000..0db5a1422a
--- /dev/null
+++ b/include/gst/gl/gstglformat.h
@@ -0,0 +1,171 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_FORMAT_H_
+#define _GST_GL_FORMAT_H_
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/video/video.h>
+
+/**
+ * GST_GL_TEXTURE_TARGET_2D_STR:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_2D in things like caps values
+ */
+#define GST_GL_TEXTURE_TARGET_2D_STR "2D"
+
+/**
+ * GST_GL_TEXTURE_TARGET_RECTANGLE_STR:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE in things like caps values
+ */
+#define GST_GL_TEXTURE_TARGET_RECTANGLE_STR "rectangle"
+
+/**
+ * GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES in things like caps values
+ */
+#define GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR "external-oes"
+
+/**
+ * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_2D as a #GstBufferPool pool option
+ */
+#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D "GstBufferPoolOptionGLTextureTarget2D"
+
+/**
+ * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE as a #GstBufferPool pool option
+ */
+#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE "GstBufferPoolOptionGLTextureTargetRectangle"
+
+/**
+ * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES:
+ *
+ * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES as a #GstBufferPool pool option
+ */
+#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES "GstBufferPoolOptionGLTextureTargetExternalOES"
+
+G_BEGIN_DECLS
+
+/**
+ * GstGLFormat:
+ * @GST_GL_LUMINANCE: Single component replicated across R, G, and B textures
+ * components
+ * @GST_GL_ALPHA: Single component stored in the A texture component
+ * @GST_GL_LUMINANCE_ALPHA: Combination of #GST_GL_LUMINANCE and #GST_GL_ALPHA
+ * @GST_GL_RED: Single component stored in the R texture component
+ * @GST_GL_R8: Single 8-bit component stored in the R texture component
+ * @GST_GL_RG: Two components stored in the R and G texture components
+ * @GST_GL_RG8: Two 8-bit components stored in the R and G texture components
+ * @GST_GL_RGB: Three components stored in the R, G, and B texture components
+ * @GST_GL_RGB8: Three 8-bit components stored in the R, G, and B
+ * texture components
+ * @GST_GL_RGB565: Three components of bit depth 5, 6 and 5 stored in the R, G,
+ * and B texture components respectively.
+ * @GST_GL_RGB16: Three 16-bit components stored in the R, G, and B
+ * texture components
+ * @GST_GL_RGBA: Four components stored in the R, G, B, and A texture
+ * components respectively.
+ * @GST_GL_RGBA8: Four 8-bit components stored in the R, G, B, and A texture
+ * components respectively.
+ * @GST_GL_RGBA16: Four 16-bit components stored in the R, G, B, and A texture
+ * components respectively.
+ * @GST_GL_DEPTH_COMPONENT16: A single 16-bit component for depth information.
+ * @GST_GL_DEPTH24_STENCIL8: A 24-bit component for depth information and
+ * a 8-bit component for stencil informat.
+ * @GST_GL_RGBA10_A2: Four components of bit depth 10, 10, 10 and 2 stored in the
+ * R, G, B and A texture components respectively.
+ * @GST_GL_R16: Single 16-bit component stored in the R texture component
+ * @GST_GL_RG16: Two 16-bit components stored in the R and G texture components
+ */
+typedef enum
+{
+ /* values taken from the GL headers */
+ GST_GL_LUMINANCE = 0x1909,
+
+ GST_GL_ALPHA = 0x1906,
+
+ GST_GL_LUMINANCE_ALPHA = 0x190A,
+
+ GST_GL_RED = 0x1903,
+ GST_GL_R8 = 0x8229,
+
+ GST_GL_RG = 0x8227,
+ GST_GL_RG8 = 0x822B,
+
+ GST_GL_RGB = 0x1907,
+ GST_GL_RGB8 = 0x8051,
+ GST_GL_RGB565 = 0x8D62,
+ GST_GL_RGB16 = 0x8054,
+
+ GST_GL_RGBA = 0x1908,
+ GST_GL_RGBA8 = 0x8058,
+ GST_GL_RGBA16 = 0x805B,
+
+ GST_GL_DEPTH_COMPONENT16 = 0x81A5,
+
+ GST_GL_DEPTH24_STENCIL8 = 0x88F0,
+
+ GST_GL_RGB10_A2 = 0x8059,
+
+ GST_GL_R16 = 0x822A,
+ GST_GL_RG16 = 0x822C,
+} GstGLFormat;
+
+GST_GL_API
+guint gst_gl_format_type_n_bytes (guint format,
+ guint type);
+GST_GL_API
+GstGLFormat gst_gl_format_from_video_info (GstGLContext * context,
+ const GstVideoInfo * vinfo,
+ guint plane);
+GST_GL_API
+guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
+ guint format,
+ guint type);
+GST_GL_API
+void gst_gl_format_type_from_sized_gl_format (GstGLFormat format,
+ GstGLFormat * unsized_format,
+ guint * gl_type);
+
+GST_GL_API
+gboolean gst_gl_format_is_supported (GstGLContext * context,
+ GstGLFormat format);
+
+GST_GL_API
+GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str);
+GST_GL_API
+const gchar * gst_gl_texture_target_to_string (GstGLTextureTarget target);
+GST_GL_API
+guint gst_gl_texture_target_to_gl (GstGLTextureTarget target);
+GST_GL_API
+GstGLTextureTarget gst_gl_texture_target_from_gl (guint target);
+GST_GL_API
+const gchar * gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target);
+
+G_END_DECLS
+
+#endif /* _GST_GL_FORMAT_H_ */
diff --git a/include/gst/gl/gstglframebuffer.h b/include/gst/gl/gstglframebuffer.h
new file mode 100644
index 0000000000..5ee4aa0bb7
--- /dev/null
+++ b/include/gst/gl/gstglframebuffer.h
@@ -0,0 +1,119 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_FRAMEBUFFER_H__
+#define __GST_GL_FRAMEBUFFER_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_framebuffer_get_type (void);
+
+#define GST_TYPE_GL_FRAMEBUFFER (gst_gl_framebuffer_get_type())
+#define GST_GL_FRAMEBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FRAMEBUFFER,GstGLFramebuffer))
+#define GST_GL_FRAMEBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_FRAMEBUFFER,GstGLFramebufferClass))
+#define GST_IS_GL_FRAMEBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FRAMEBUFFER))
+#define GST_IS_GL_FRAMEBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_FRAMEBUFFER))
+#define GST_GL_FRAMEBUFFER_CAST(obj) ((GstGLFramebuffer*)(obj))
+
+typedef struct _GstGLFramebufferPrivate GstGLFramebufferPrivate;
+
+/**
+ * GstGLFramebufferFunc:
+ * @stuff: user data
+ *
+ * callback definition for operating through a #GstGLFramebuffer object
+ */
+typedef gboolean (*GstGLFramebufferFunc) (gpointer stuff);
+
+/**
+ * GstGLFramebuffer:
+ *
+ * Opaque #GstGLFramebuffer struct
+ */
+struct _GstGLFramebuffer
+{
+ /*< private >*/
+ GstObject object;
+
+ GstGLContext *context;
+
+ guint fbo_id;
+ GArray *attachments;
+
+ gpointer _padding[GST_PADDING];
+
+ GstGLFramebufferPrivate *priv;
+};
+
+/**
+ * GstGLFramebufferClass:
+ *
+ * Opaque #GstGLFramebufferClass struct
+ */
+struct _GstGLFramebufferClass
+{
+ /*< private >*/
+ GstObjectClass object_class;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLFramebuffer * gst_gl_framebuffer_new (GstGLContext *context);
+GST_GL_API
+GstGLFramebuffer * gst_gl_framebuffer_new_with_default_depth (GstGLContext *context,
+ guint width,
+ guint height);
+
+GST_GL_API
+guint gst_gl_framebuffer_get_id (GstGLFramebuffer * fb);
+
+GST_GL_API
+void gst_gl_framebuffer_attach (GstGLFramebuffer * fb,
+ guint attachment_point,
+ GstGLBaseMemory * mem);
+GST_GL_API
+void gst_gl_framebuffer_bind (GstGLFramebuffer * fb);
+GST_GL_API
+void gst_gl_context_clear_framebuffer (GstGLContext * context);
+
+GST_GL_API
+void gst_gl_framebuffer_get_effective_dimensions (GstGLFramebuffer * fb,
+ guint * width,
+ guint * height);
+
+GST_GL_API
+gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context,
+ guint fbo_target);
+
+GST_GL_API
+gboolean gst_gl_framebuffer_draw_to_texture (GstGLFramebuffer * fb,
+ GstGLMemory * mem,
+ GstGLFramebufferFunc func,
+ gpointer user_data);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLFramebuffer, gst_object_unref)
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/gl/gstglfuncs.h b/include/gst/gl/gstglfuncs.h
new file mode 100644
index 0000000000..81ba4d5f99
--- /dev/null
+++ b/include/gst/gl/gstglfuncs.h
@@ -0,0 +1,111 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_FUNCS_H__
+#define __GST_GL_FUNCS_H__
+
+#include <gst/gl/gstglconfig.h>
+
+/* This mimic GCC behaviour with system headers files even if GL headers may
+ * not be in the system header path. */
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#endif
+
+/* OpenGL 2.0 for Embedded Systems */
+#if GST_GL_HAVE_GLES2
+# if GST_GL_HAVE_PLATFORM_EAGL
+# include <OpenGLES/ES2/gl.h>
+# include <OpenGLES/ES2/glext.h>
+# else
+# if GST_GL_HAVE_GLES3
+# include <GLES3/gl3.h>
+# if GST_GL_HAVE_GLES3EXT3_H
+# include <GLES3/gl3ext.h>
+# endif
+# include <GLES2/gl2ext.h>
+# else
+# include <GLES2/gl2.h>
+# include <GLES2/gl2ext.h>
+# endif
+# endif
+# if !GST_GL_HAVE_OPENGL
+# include <gst/gl/glprototypes/gstgl_gles2compat.h>
+# endif
+#endif
+
+/* OpenGL for desktop systems */
+#if GST_GL_HAVE_OPENGL
+# ifdef __APPLE__
+# if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1014
+# define GL_SILENCE_DEPRECATION
+# endif
+# include <OpenGL/OpenGL.h>
+# include <OpenGL/gl.h>
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+# include <OpenGL/gl3.h>
+# endif
+# else
+# if defined(_MSC_VER)
+# include <windows.h>
+# endif
+# include <GL/gl.h>
+# if defined(__WIN32__) || defined(_WIN32)
+# include <GL/glext.h>
+# endif
+# endif
+#endif
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+#if defined(WINAPI)
+#define GSTGLAPI WINAPI
+#else
+#define GSTGLAPI
+#endif
+#include <gst/gl/glprototypes/gstgl_compat.h>
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \
+ gles_min, ext_suf, ext_name)
+#define GST_GL_EXT_FUNCTION(ret, name, args) \
+ ret (GSTGLAPI *name) args;
+#define GST_GL_EXT_END()
+
+struct _GstGLFuncs
+{
+#include <gst/gl/glprototypes/all_functions.h>
+ gpointer padding[GST_PADDING_LARGE*6-2];
+};
+
+#undef GST_GL_EXT_BEGIN
+#undef GST_GL_EXT_FUNCTION
+#undef GST_GL_EXT_END
+
+G_END_DECLS
+
+#endif /* __GST_GL_API_H__ */
diff --git a/include/gst/gl/gstglmemory.h b/include/gst/gl/gstglmemory.h
new file mode 100644
index 0000000000..daea4d12a7
--- /dev/null
+++ b/include/gst/gl/gstglmemory.h
@@ -0,0 +1,327 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_MEMORY_H_
+#define _GST_GL_MEMORY_H_
+
+#include <gst/gl/gstglbasememory.h>
+#include <gst/gl/gstglformat.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_type())
+GST_GL_API
+GType gst_gl_memory_allocator_get_type(void);
+
+#define GST_IS_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR))
+#define GST_IS_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_ALLOCATOR))
+#define GST_GL_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocatorClass))
+#define GST_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocator))
+#define GST_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocatorClass))
+#define GST_GL_MEMORY_ALLOCATOR_CAST(obj) ((GstGLMemoryAllocator *)(obj))
+
+#define GST_GL_MEMORY_CAST(obj) ((GstGLMemory *) obj)
+
+/**
+ * GST_CAPS_FEATURE_MEMORY_GL_MEMORY:
+ *
+ * Name of the caps feature for indicating the use of #GstGLMemory
+ */
+#define GST_CAPS_FEATURE_MEMORY_GL_MEMORY "memory:GLMemory"
+/**
+ * GST_GL_MEMORY_VIDEO_EXT_FORMATS: (skip)
+ */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_GL_MEMORY_VIDEO_EXT_FORMATS \
+ ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE"
+#else
+#define GST_GL_MEMORY_VIDEO_EXT_FORMATS \
+ ", P010_10BE, P012_BE, P016_BE, Y212_BE, Y412_BE"
+#endif
+
+/**
+ * GST_GL_MEMORY_VIDEO_FORMATS_STR:
+ *
+ * List of video formats that are supported by #GstGLMemory
+ */
+#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
+ "{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, GBRA, GBR, RGBP, BGRP, RGB, BGR, RGB16, BGR16, " \
+ "AYUV, VUYA, Y410, I420, YV12, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, Y41B, " \
+ "Y42B, Y444, GRAY8, GRAY16_LE, GRAY16_BE, ARGB64, A420, AV12" \
+ GST_GL_MEMORY_VIDEO_EXT_FORMATS "}"
+
+/**
+ * GstGLMemory:
+ * @mem: the parent #GstGLBaseMemory object
+ * @tex_id: the GL texture id for this memory
+ * @tex_target: the GL texture target for this memory
+ * @tex_format: the texture type
+ * @info: the texture's #GstVideoInfo
+ * @valign: data alignment for system memory mapping
+ * @plane: data plane in @info
+ * @tex_scaling: GL shader scaling parameters for @valign and/or width/height
+ *
+ * Represents information about a GL texture
+ */
+struct _GstGLMemory
+{
+ GstGLBaseMemory mem;
+
+ guint tex_id;
+ GstGLTextureTarget tex_target;
+ GstGLFormat tex_format;
+ GstVideoInfo info;
+ GstVideoAlignment valign;
+ guint plane;
+ gfloat tex_scaling[2];
+
+ /*< protected >*/
+ gboolean texture_wrapped;
+ guint unpack_length;
+ guint tex_width;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+
+#define GST_TYPE_GL_VIDEO_ALLOCATION_PARAMS (gst_gl_video_allocation_params_get_type())
+GST_GL_API
+GType gst_gl_video_allocation_params_get_type (void);
+
+typedef struct _GstGLVideoAllocationParams GstGLVideoAllocationParams;
+
+/**
+ * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO:
+ *
+ * GL allocation flag indicating the allocation of 2D video frames
+ */
+#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO (1 << 3)
+
+/**
+ * GstGLVideoAllocationParams:
+ * @parent: the parent #GstGLAllocationParams structure
+ * @v_info: the #GstVideoInfo to allocate
+ * @plane: the video plane index to allocate
+ * @valign: the #GstVideoAlignment to align the system representation to (may be %NULL for the default)
+ * @target: the #GstGLTextureTarget to allocate
+ * @tex_format: the #GstGLFormat to allocate
+ */
+struct _GstGLVideoAllocationParams
+{
+ GstGLAllocationParams parent;
+
+ GstVideoInfo *v_info;
+ guint plane;
+ GstVideoAlignment *valign;
+ GstGLTextureTarget target;
+ GstGLFormat tex_format;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
+ gsize struct_size,
+ guint alloc_flags,
+ GstGLAllocationParamsCopyFunc copy,
+ GstGLAllocationParamsFreeFunc free,
+ GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ const GstVideoInfo * v_info,
+ guint plane,
+ const GstVideoAlignment * valign,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ gpointer wrapped_data,
+ gpointer gl_handle,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_GL_API
+GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ const GstVideoInfo * v_info,
+ guint plane,
+ const GstVideoAlignment * valign,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format);
+GST_GL_API
+GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ const GstVideoInfo * v_info,
+ guint plane,
+ const GstVideoAlignment * valign,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ gpointer wrapped_data,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_GL_API
+GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ const GstVideoInfo * v_info,
+ guint plane,
+ const GstVideoAlignment * valign,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ guint tex_id,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_GL_API
+GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ const GstVideoInfo * v_info,
+ guint plane,
+ const GstVideoAlignment * valign,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ gpointer gl_handle,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+/* subclass usage */
+GST_GL_API
+void gst_gl_video_allocation_params_free_data (GstGLVideoAllocationParams * params);
+/* subclass usage */
+GST_GL_API
+void gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
+ GstGLVideoAllocationParams * dest_vid);
+
+/**
+ * GstGLMemoryAllocator
+ *
+ * Opaque #GstGLMemoryAllocator struct
+ */
+struct _GstGLMemoryAllocator
+{
+ /*< private >*/
+ GstGLBaseMemoryAllocator parent;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLMemoryAllocatorClass:
+ * @map: provide a custom map implementation
+ * @copy: provide a custom copy implementation
+ * @unmap: provide a custom unmap implementation
+ */
+struct _GstGLMemoryAllocatorClass
+{
+ /*< private >*/
+ GstGLBaseMemoryAllocatorClass parent_class;
+
+ /*< public >*/
+ GstGLBaseMemoryAllocatorMapFunction map;
+ GstGLBaseMemoryAllocatorCopyFunction copy;
+ GstGLBaseMemoryAllocatorUnmapFunction unmap;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+#include <gst/gl/gstglbasememory.h>
+
+/**
+ * GST_GL_MEMORY_ALLOCATOR_NAME:
+ *
+ * The name of the GL memory allocator
+ */
+#define GST_GL_MEMORY_ALLOCATOR_NAME "GLMemory"
+
+/**
+ * GST_TYPE_GL_MEMORY:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_GL_MEMORY (gst_gl_memory_get_type())
+GST_GL_API
+GType gst_gl_memory_get_type(void);
+
+GST_GL_API
+void gst_gl_memory_init_once (void);
+GST_GL_API
+gboolean gst_is_gl_memory (GstMemory * mem);
+
+GST_GL_API
+void gst_gl_memory_init (GstGLMemory * mem,
+ GstAllocator * allocator,
+ GstMemory * parent,
+ GstGLContext * context,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ const GstAllocationParams *params,
+ const GstVideoInfo * info,
+ guint plane,
+ const GstVideoAlignment *valign,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_GL_API
+gboolean gst_gl_memory_copy_into (GstGLMemory *gl_mem,
+ guint tex_id,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ gint width,
+ gint height);
+GST_GL_API
+gboolean gst_gl_memory_copy_teximage (GstGLMemory * src,
+ guint tex_id,
+ GstGLTextureTarget out_target,
+ GstGLFormat out_tex_format,
+ gint out_width,
+ gint out_height);
+
+GST_GL_API
+gboolean gst_gl_memory_read_pixels (GstGLMemory * gl_mem,
+ gpointer write_pointer);
+GST_GL_API
+void gst_gl_memory_texsubimage (GstGLMemory * gl_mem,
+ gpointer read_pointer);
+
+/* accessors */
+GST_GL_API
+gint gst_gl_memory_get_texture_width (GstGLMemory * gl_mem);
+GST_GL_API
+gint gst_gl_memory_get_texture_height (GstGLMemory * gl_mem);
+GST_GL_API
+GstGLFormat gst_gl_memory_get_texture_format (GstGLMemory * gl_mem);
+GST_GL_API
+GstGLTextureTarget gst_gl_memory_get_texture_target (GstGLMemory * gl_mem);
+GST_GL_API
+guint gst_gl_memory_get_texture_id (GstGLMemory * gl_mem);
+
+GST_GL_API
+gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
+ GstBuffer * buffer,
+ GstGLVideoAllocationParams * params,
+ GstGLFormat *tex_formats,
+ gpointer *wrapped_data,
+ gsize n_wrapped_pointers);
+
+GST_GL_API
+GstGLMemoryAllocator * gst_gl_memory_allocator_get_default (GstGLContext *context);
+
+G_END_DECLS
+
+#endif /* _GST_GL_MEMORY_H_ */
diff --git a/include/gst/gl/gstglmemorypbo.h b/include/gst/gl/gstglmemorypbo.h
new file mode 100644
index 0000000000..f40ca4f5e2
--- /dev/null
+++ b/include/gst/gl/gstglmemorypbo.h
@@ -0,0 +1,119 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_MEMORY_PBO_H_
+#define _GST_GL_MEMORY_PBO_H_
+
+#include <gst/gl/gstglmemory.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_MEMORY_PBO_ALLOCATOR (gst_gl_memory_pbo_allocator_get_type())
+GST_GL_API
+GType gst_gl_memory_pbo_allocator_get_type(void);
+
+#define GST_IS_GL_MEMORY_PBO_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
+#define GST_IS_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
+#define GST_GL_MEMORY_PBO_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocatorClass))
+#define GST_GL_MEMORY_PBO_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocator))
+#define GST_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocatorClass))
+#define GST_GL_MEMORY_PBO_ALLOCATOR_CAST(obj) ((GstGLMemoryPBOAllocator *)(obj))
+
+/**
+ * GstGLMemoryPBO:
+ *
+ * Private instance
+ */
+struct _GstGLMemoryPBO
+{
+ /*< private >*/
+ GstGLMemory mem;
+
+ GstGLBuffer *pbo;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GST_GL_MEMORY_PBO_ALLOCATOR_NAME:
+ *
+ * The name of the GL Memory PBO allocator
+ */
+#define GST_GL_MEMORY_PBO_ALLOCATOR_NAME "GLMemoryPBO"
+
+/**
+ * GST_TYPE_GL_MEMORY_PBO
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_GL_MEMORY_PBO (gst_gl_memory_pbo_get_type())
+GST_GL_API
+GType gst_gl_memory_pbo_get_type(void);
+
+GST_GL_API
+void gst_gl_memory_pbo_init_once (void);
+GST_GL_API
+gboolean gst_is_gl_memory_pbo (GstMemory * mem);
+
+GST_GL_API
+void gst_gl_memory_pbo_download_transfer (GstGLMemoryPBO * gl_mem);
+GST_GL_API
+void gst_gl_memory_pbo_upload_transfer (GstGLMemoryPBO * gl_mem);
+
+GST_GL_API
+gboolean gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO *gl_mem,
+ guint tex_id,
+ GstGLTextureTarget target,
+ GstGLFormat tex_format,
+ gint width,
+ gint height,
+ gint stride,
+ gboolean respecify);
+
+/**
+ * GstGLMemoryPBOAllocator:
+ *
+ * Opaque #GstGLMemoryPBOAllocator struct
+ */
+struct _GstGLMemoryPBOAllocator
+{
+ GstGLMemoryAllocator parent;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLMemoryPBOAllocatorClass:
+ *
+ * Only contains private data
+ */
+struct _GstGLMemoryPBOAllocatorClass
+{
+ GstGLMemoryAllocatorClass parent_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+G_END_DECLS
+
+#endif /* _GST_GL_MEMORY_PBO_H_ */
diff --git a/include/gst/gl/gstgloverlaycompositor.h b/include/gst/gl/gstgloverlaycompositor.h
new file mode 100644
index 0000000000..705963ee97
--- /dev/null
+++ b/include/gst/gl/gstgloverlaycompositor.h
@@ -0,0 +1,92 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_OVERLAY_COMPOSITOR_H__
+#define __GST_GL_OVERLAY_COMPOSITOR_H__
+
+#include <gst/video/video.h>
+#include <gst/gl/gstgl_fwd.h>
+
+#define GST_TYPE_GL_OVERLAY_COMPOSITOR (gst_gl_overlay_compositor_get_type())
+#define GST_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositor))
+#define GST_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositorClass))
+#define GST_IS_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR))
+#define GST_IS_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR))
+#define GST_GL_OVERLAY_COMPOSITOR_CAST(obj) ((GstGLOverlayCompositor*)(obj))
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_overlay_compositor_get_type (void);
+
+/**
+ * GstGLOverlayCompositor:
+ *
+ * Opaque #GstGLOverlayCompositor object
+ */
+struct _GstGLOverlayCompositor
+{
+ /*< private >*/
+ GstObject parent;
+
+ GstGLContext *context;
+
+ guint last_window_width;
+ guint last_window_height;
+
+ GList * overlays;
+
+ GstGLShader *shader;
+ gint position_attrib;
+ gint texcoord_attrib;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLOverlayCompositorClass:
+ *
+ */
+struct _GstGLOverlayCompositorClass
+{
+ GstObjectClass object_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLOverlayCompositor *gst_gl_overlay_compositor_new (GstGLContext * context);
+
+GST_GL_API
+void gst_gl_overlay_compositor_free_overlays (GstGLOverlayCompositor * compositor);
+
+GST_GL_API
+void gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor,
+ GstBuffer * buf);
+
+GST_GL_API
+void gst_gl_overlay_compositor_draw_overlays (GstGLOverlayCompositor * compositor);
+
+GST_GL_API
+GstCaps * gst_gl_overlay_compositor_add_caps(GstCaps * caps);
+
+G_END_DECLS
+#endif /* __GST_GL_OVERLAY_COMPOSITOR_H__ */
diff --git a/include/gst/gl/gstglquery.h b/include/gst/gl/gstglquery.h
new file mode 100644
index 0000000000..5c3d4b280a
--- /dev/null
+++ b/include/gst/gl/gstglquery.h
@@ -0,0 +1,162 @@
+/*
+ * GStreamer
+ * Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_QUERY_H__
+#define __GST_GL_QUERY_H__
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/gl/gstgldebug.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstGLQueryType:
+ * @GST_GL_QUERY_NONE: no query
+ * @GST_GL_QUERY_TIME_ELAPSED: query the time elapsed
+ * @GST_GL_QUERY_TIMESTAMP: query the current time
+ */
+typedef enum
+{
+ GST_GL_QUERY_NONE,
+ GST_GL_QUERY_TIME_ELAPSED,
+ GST_GL_QUERY_TIMESTAMP,
+} GstGLQueryType;
+
+/**
+ * GstGLQuery:
+ *
+ * Opaque #GstGLQuery struct
+ */
+struct _GstGLQuery
+{
+ /*< private >*/
+ GstGLContext * context;
+ guint query_type;
+ guint query_id;
+ gboolean supported;
+
+ gboolean start_called;
+ GstGLAsyncDebug debug;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+void gst_gl_query_init (GstGLQuery * query,
+ GstGLContext * context,
+ GstGLQueryType query_type);
+GST_GL_API
+void gst_gl_query_unset (GstGLQuery * query);
+GST_GL_API
+GstGLQuery * gst_gl_query_new (GstGLContext * context,
+ GstGLQueryType query_type);
+GST_GL_API
+void gst_gl_query_free (GstGLQuery * query);
+
+GST_GL_API
+void gst_gl_query_start (GstGLQuery * query);
+GST_GL_API
+void gst_gl_query_end (GstGLQuery * query);
+GST_GL_API
+void gst_gl_query_counter (GstGLQuery * query);
+GST_GL_API
+guint64 gst_gl_query_result (GstGLQuery * query);
+
+#define gst_gl_query_start_log_valist(query,cat,level,object,format,varargs) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_start (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+
+#define gst_gl_query_counter_log_valist(query,cat,level,object,format,varargs) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_counter (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+
+#ifdef G_HAVE_ISO_VARARGS
+
+#define gst_gl_query_start_log(query,cat,level,object,format,...) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_start (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+#define gst_gl_query_counter_log(query,cat,level,object,format,...) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_counter (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+
+#else /* G_HAVE_ISO_VARARGS */
+#if G_HAVE_GNUC_VARARGS
+
+#define gst_gl_query_start_log(query,cat,level,object,format,args...) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_start (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+#define gst_gl_query_counter_log(query,cat,level,object,format,args...) \
+ G_STMT_START { \
+ GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
+ gst_gl_async_debug_freeze (&(query)->debug); \
+ gst_gl_query_counter (query); \
+ gst_gl_async_debug_thaw (&(query)->debug); \
+ } G_STMT_END
+
+#else /* G_HAVE_GNUC_VARARGS */
+
+static inline void
+gst_gl_query_start_log(GstGLQuery * query, GstDebugCategory * cat,
+ GstDebugLevel level, GObject * object, const gchar * format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ gst_gl_query_start_log_valist (query, cat, level, object, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+gst_gl_query_counter_log(GstGLQuery * query, GstDebugCategory * cat,
+ GstDebugLevel level, GObject * object, const gchar * format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ gst_gl_query_counter_log_valist (query, cat, level, object, format, varargs);
+ va_end (varargs);
+}
+
+#endif /* G_HAVE_GNUC_VARARGS */
+#endif /* G_HAVE_ISO_VARARGS */
+
+G_END_DECLS
+
+#endif /* __GST_GL_QUERY_H__ */
diff --git a/include/gst/gl/gstglrenderbuffer.h b/include/gst/gl/gstglrenderbuffer.h
new file mode 100644
index 0000000000..f77528760d
--- /dev/null
+++ b/include/gst/gl/gstglrenderbuffer.h
@@ -0,0 +1,176 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_RENDERBUFFER_H_
+#define _GST_GL_RENDERBUFFER_H_
+
+#include <gst/gl/gstglbasememory.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_RENDERBUFFER_ALLOCATOR (gst_gl_renderbuffer_allocator_get_type())
+GST_GL_API GType gst_gl_renderbuffer_allocator_get_type(void);
+
+#define GST_IS_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
+#define GST_IS_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
+#define GST_GL_RENDERBUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
+#define GST_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocator))
+#define GST_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
+#define GST_GL_RENDERBUFFER_ALLOCATOR_CAST(obj) ((GstGLRenderbufferAllocator *)(obj))
+
+#define GST_GL_RENDERBUFFER_CAST(obj) ((GstGLRenderbuffer *) obj)
+
+/**
+ * GST_GL_RENDERBUFFER_ALLOCATOR_NAME:
+ *
+ * The name of the GL renderbuffer allocator
+ */
+#define GST_GL_RENDERBUFFER_ALLOCATOR_NAME "GLRenderbuffer"
+
+/**
+ * GstGLRenderbuffer:
+ * @renderbuffer_id: the GL texture id for this memory
+ * @renderbuffer_format: the texture type
+ * @width: the width
+ * @height: the height
+ *
+ * Represents information about a GL renderbuffer
+ */
+struct _GstGLRenderbuffer
+{
+ /*< private >*/
+ GstGLBaseMemory mem;
+
+ /*< public >*/
+ guint renderbuffer_id;
+ GstGLFormat renderbuffer_format;
+ guint width;
+ guint height;
+
+ /*< protected >*/
+ gboolean renderbuffer_wrapped;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLRenderbufferAllocator:
+ *
+ * Opaque #GstGLRenderbufferAllocator struct
+ */
+struct _GstGLRenderbufferAllocator
+{
+ GstGLBaseMemoryAllocator parent;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLRenderbufferAllocatorClass:
+ *
+ * The #GstGLRenderbufferAllocatorClass only contains private data
+ */
+struct _GstGLRenderbufferAllocatorClass
+{
+ GstGLBaseMemoryAllocatorClass parent_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+#include <gst/gl/gstglbasememory.h>
+
+typedef struct _GstGLRenderbufferAllocationParams GstGLRenderbufferAllocationParams;
+
+GST_GL_API GType gst_gl_renderbuffer_allocation_params_get_type (void);
+#define GST_TYPE_RENDERBUFFER_ALLOCATION_PARAMS (gst_gl_renderbuffer_allocation_params_get_type)
+
+/**
+ * GstGLRenderbufferAllocationParams:
+ * @renderbuffer_format: the #GstGLFormat
+ * @width: the width
+ * @height: the height
+ *
+ * Allocation parameters
+ */
+struct _GstGLRenderbufferAllocationParams
+{
+ /*< private >*/
+ GstGLAllocationParams parent;
+
+ /*< public >*/
+ GstGLFormat renderbuffer_format;
+ guint width;
+ guint height;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ GstGLFormat renderbuffer_format,
+ guint width,
+ guint height);
+
+GST_GL_API
+GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
+ const GstAllocationParams * alloc_params,
+ GstGLFormat renderbuffer_format,
+ guint width,
+ guint height,
+ gpointer gl_handle,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+/**
+ * GST_TYPE_GL_RENDERBUFFER:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_GL_RENDERBUFFER (gst_gl_renderbuffer_get_type())
+GST_GL_API
+GType gst_gl_renderbuffer_get_type(void);
+
+GST_GL_API
+void gst_gl_renderbuffer_init_once (void);
+
+GST_GL_API
+gboolean gst_is_gl_renderbuffer (GstMemory * mem);
+
+/* accessors */
+GST_GL_API
+gint gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem);
+
+GST_GL_API
+gint gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem);
+
+GST_GL_API
+GstGLFormat gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem);
+
+GST_GL_API
+guint gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem);
+
+G_END_DECLS
+
+#endif /* _GST_GL_RENDERBUFFER_H_ */
diff --git a/include/gst/gl/gstglshader.h b/include/gst/gl/gstglshader.h
new file mode 100644
index 0000000000..4f96f91b3c
--- /dev/null
+++ b/include/gst/gl/gstglshader.h
@@ -0,0 +1,156 @@
+/*
+ * GStreamer
+ * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
+ * Copyright (C) 2014 Julien Isorce <julien.isorce@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_SHADER_H__
+#define __GST_GL_SHADER_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_shader_get_type (void);
+#define GST_TYPE_GL_SHADER (gst_gl_shader_get_type())
+
+#define GST_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_SHADER, GstGLShader))
+#define GST_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_SHADER, GstGLShaderClass))
+#define GST_IS_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_SHADER))
+#define GST_IS_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_SHADER))
+#define GST_GL_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_SHADER, GstGLShaderClass))
+
+struct _GstGLShader
+{
+ GstObject parent;
+
+ GstGLContext *context;
+
+ /*< private >*/
+ GstGLShaderPrivate *priv;
+
+ gpointer _padding[GST_PADDING];
+};
+
+struct _GstGLShaderClass {
+ /*< private >*/
+ GstObjectClass parent_class;
+};
+
+GST_GL_API
+GstGLShader * gst_gl_shader_new (GstGLContext *context);
+GST_GL_API
+GstGLShader * gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...);
+GST_GL_API
+GstGLShader * gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error, ...);
+GST_GL_API
+GstGLShader * gst_gl_shader_new_default (GstGLContext * context, GError ** error);
+
+GST_GL_API
+gboolean gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage);
+GST_GL_API
+gboolean gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
+
+GST_GL_API
+void gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage);
+GST_GL_API
+void gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
+
+GST_GL_API
+gboolean gst_gl_shader_compile_attach_stage (GstGLShader * shader,
+ GstGLSLStage *stage,
+ GError ** error);
+GST_GL_API
+gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error);
+GST_GL_API
+gboolean gst_gl_shader_is_linked (GstGLShader *shader);
+
+GST_GL_API
+int gst_gl_shader_get_program_handle (GstGLShader * shader);
+
+GST_GL_API
+void gst_gl_shader_release (GstGLShader *shader);
+GST_GL_API
+void gst_gl_shader_release_unlocked (GstGLShader * shader);
+GST_GL_API
+void gst_gl_shader_use (GstGLShader *shader);
+GST_GL_API
+void gst_gl_context_clear_shader (GstGLContext *context);
+
+GST_GL_API
+void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
+GST_GL_API
+void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
+GST_GL_API
+void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
+GST_GL_API
+void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
+GST_GL_API
+void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
+GST_GL_API
+void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, const gint * value);
+GST_GL_API
+void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
+GST_GL_API
+void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
+GST_GL_API
+void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
+GST_GL_API
+void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+GST_GL_API
+void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
+
+GST_GL_API
+gint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name);
+GST_GL_API
+void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const gchar * name);
+GST_GL_API
+void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, guint index, const gchar * name);
+
+G_END_DECLS
+
+#endif /* __GST_GL_SHADER_H__ */
diff --git a/include/gst/gl/gstglshaderstrings.h b/include/gst/gl/gstglshaderstrings.h
new file mode 100644
index 0000000000..eba1b9e472
--- /dev/null
+++ b/include/gst/gl/gstglshaderstrings.h
@@ -0,0 +1,63 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_SHADER_STRINGS_H__
+#define __GST_GL_SHADER_STRINGS_H__
+
+#include <gst/gst.h>
+#include <gst/gl/gl-prelude.h>
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+const gchar *gst_gl_shader_string_fragment_highp_precision;
+GST_GL_API
+const gchar *gst_gl_shader_string_fragment_mediump_precision;
+
+GST_GL_API
+const gchar *gst_gl_shader_string_vertex_default;
+GST_GL_API G_DEPRECATED_FOR(gst_gl_shader_string_fragment_get_default)
+const gchar *gst_gl_shader_string_fragment_default;
+
+GST_GL_API
+const gchar *gst_gl_shader_string_vertex_mat4_texture_transform;
+GST_GL_API
+const gchar *gst_gl_shader_string_vertex_mat4_vertex_transform;
+GST_GL_API G_DEPRECATED_FOR(gst_gl_shader_string_fragment_external_oes_get_default)
+const gchar *gst_gl_shader_string_fragment_external_oes_default;
+
+GST_GL_API
+const gchar * gst_gl_shader_string_get_highest_precision (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+
+GST_GL_API
+gchar * gst_gl_shader_string_fragment_get_default (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+GST_GL_API
+gchar * gst_gl_shader_string_fragment_external_oes_get_default (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+
+G_END_DECLS
+
+#endif /* __GST_GL_SHADER_STRINGS_H__ */
diff --git a/include/gst/gl/gstglsl.h b/include/gst/gl/gstglsl.h
new file mode 100644
index 0000000000..2cd0526afc
--- /dev/null
+++ b/include/gst/gl/gstglsl.h
@@ -0,0 +1,169 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GLSL_H__
+#define __GST_GLSL_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GQuark gst_glsl_error_quark (void);
+
+/**
+ * GST_GLSL_ERROR:
+ *
+ * Error domain for GStreamer's GLSL module. Errors in this domain will be
+ * from the #GstGLSLError enumeration
+ */
+#define GST_GLSL_ERROR (gst_glsl_error_quark ())
+
+/**
+ * GstGLSLError:
+ * @GST_GLSL_ERROR_COMPILE: Compilation error occurred
+ * @GST_GLSL_ERROR_LINK: Link error occurred
+ * @GST_GLSL_ERROR_PROGRAM: General program error occurred
+ *
+ * Compilation stage that caused an error
+ *
+ * Since: 1.8
+ */
+typedef enum {
+ GST_GLSL_ERROR_COMPILE,
+ GST_GLSL_ERROR_LINK,
+ GST_GLSL_ERROR_PROGRAM,
+} GstGLSLError;
+
+/**
+ * GstGLSLVersion:
+ * @GST_GLSL_VERSION_NONE: no version
+ * @GST_GLSL_VERSION_100: version 100 (only valid for ES)
+ * @GST_GLSL_VERSION_110: version 110 (only valid for compatibility desktop GL)
+ * @GST_GLSL_VERSION_120: version 120 (only valid for compatibility desktop GL)
+ * @GST_GLSL_VERSION_130: version 130 (only valid for compatibility desktop GL)
+ * @GST_GLSL_VERSION_140: version 140 (only valid for compatibility desktop GL)
+ * @GST_GLSL_VERSION_150: version 150 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_300: version 300 (only valid for ES)
+ * @GST_GLSL_VERSION_310: version 310 (only valid for ES)
+ * @GST_GLSL_VERSION_320: version 320 (only valid for ES)
+ * @GST_GLSL_VERSION_330: version 330 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_400: version 400 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_410: version 410 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_420: version 420 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_430: version 430 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_440: version 440 (valid for compatibility/core desktop GL)
+ * @GST_GLSL_VERSION_450: version 450 (valid for compatibility/core desktop GL)
+ *
+ * GLSL version list
+ *
+ * Since: 1.8
+ */
+typedef enum
+{
+ GST_GLSL_VERSION_NONE = 0,
+
+ GST_GLSL_VERSION_100 = 100, /* ES */
+ GST_GLSL_VERSION_110 = 110, /* GL */
+ GST_GLSL_VERSION_120 = 120, /* GL */
+ GST_GLSL_VERSION_130 = 130, /* GL */
+ GST_GLSL_VERSION_140 = 140, /* GL */
+ GST_GLSL_VERSION_150 = 150, /* GL */
+ GST_GLSL_VERSION_300 = 300, /* ES */
+ GST_GLSL_VERSION_310 = 310, /* ES */
+ GST_GLSL_VERSION_320 = 320, /* ES */
+ GST_GLSL_VERSION_330 = 330, /* GL */
+ GST_GLSL_VERSION_400 = 400, /* GL */
+ GST_GLSL_VERSION_410 = 410, /* GL */
+ GST_GLSL_VERSION_420 = 420, /* GL */
+ GST_GLSL_VERSION_430 = 430, /* GL */
+ GST_GLSL_VERSION_440 = 440, /* GL */
+ GST_GLSL_VERSION_450 = 450, /* GL */
+} GstGLSLVersion;
+
+/**
+ * GstGLSLProfile:
+ * @GST_GLSL_PROFILE_NONE: no profile supported/available
+ * @GST_GLSL_PROFILE_ES: OpenGL|ES profile
+ * @GST_GLSL_PROFILE_CORE: OpenGL core profile
+ * @GST_GLSL_PROFILE_COMPATIBILITY: OpenGL compatibility profile
+ * @GST_GLSL_PROFILE_ANY: any OpenGL/OpenGL|ES profile
+ *
+ * GLSL profiles
+ *
+ * Since: 1.8
+ */
+/* FIXME: For GST_GLSL_PROFILE_ANY ~0 -> 0xffffffff see
+ * https://bugzilla.gnome.org/show_bug.cgi?id=732633
+*/
+typedef enum
+{
+ /* XXX: maybe make GstGLAPI instead */
+ GST_GLSL_PROFILE_NONE = 0,
+
+ GST_GLSL_PROFILE_ES = (1 << 0),
+ GST_GLSL_PROFILE_CORE = (1 << 1),
+ GST_GLSL_PROFILE_COMPATIBILITY = (1 << 2),
+
+ GST_GLSL_PROFILE_ANY = (gint) (0xffffffff),
+} GstGLSLProfile;
+
+GST_GL_API
+GstGLSLVersion gst_glsl_version_from_string (const gchar * string);
+GST_GL_API
+const gchar * gst_glsl_version_to_string (GstGLSLVersion version);
+
+GST_GL_API
+GstGLSLProfile gst_glsl_profile_from_string (const gchar * string);
+GST_GL_API
+const gchar * gst_glsl_profile_to_string (GstGLSLProfile profile);
+
+GST_GL_API
+gchar * gst_glsl_version_profile_to_string (GstGLSLVersion version,
+ GstGLSLProfile profile);
+GST_GL_API
+gboolean gst_glsl_version_profile_from_string (const gchar * string,
+ GstGLSLVersion * version_ret,
+ GstGLSLProfile * profile_ret);
+
+GST_GL_API
+gboolean gst_glsl_string_get_version_profile (const gchar *s,
+ GstGLSLVersion * version,
+ GstGLSLProfile * profile);
+
+GST_GL_API
+GstGLSLVersion gst_gl_version_to_glsl_version (GstGLAPI gl_api, gint maj, gint min);
+GST_GL_API
+gboolean gst_gl_context_supports_glsl_profile_version (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+
+GST_GL_API
+gboolean gst_gl_context_supports_precision (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+GST_GL_API
+gboolean gst_gl_context_supports_precision_highp (GstGLContext * context,
+ GstGLSLVersion version,
+ GstGLSLProfile profile);
+
+G_END_DECLS
+
+#endif /* __GST_GLSL_H__ */
diff --git a/include/gst/gl/gstglslstage.h b/include/gst/gl/gstglslstage.h
new file mode 100644
index 0000000000..7f4aabba9b
--- /dev/null
+++ b/include/gst/gl/gstglslstage.h
@@ -0,0 +1,108 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GLSL_STAGE_H__
+#define __GST_GLSL_STAGE_H__
+
+#include <gst/gl/gstglsl.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GLSL_STAGE (gst_glsl_stage_get_type())
+#define GST_GLSL_STAGE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GLSL_STAGE, GstGLSLStage))
+#define GST_GLSL_STAGE_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GLSL_STAGE, GstGLSLStageClass))
+#define GST_IS_GLSL_STAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GLSL_STAGE))
+#define GST_IS_GLSL_STAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GLSL_STAGE))
+#define GST_GLSL_STAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GLSL_STAGE, GstGLSLStageClass))
+
+/**
+ * GstGLSLStage:
+ *
+ * Opaque #GstGLSLStage struct
+ */
+struct _GstGLSLStage
+{
+ /*< private >*/
+ GstObject parent;
+
+ GstGLContext *context;
+
+ GstGLSLStagePrivate *priv;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLSLStageClass:
+ *
+ * Opaque #GstGLSLStageClass struct
+ */
+struct _GstGLSLStageClass
+{
+ /*< private >*/
+ GstObjectClass parent;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GType gst_glsl_stage_get_type (void);
+GST_GL_API
+GstGLSLStage * gst_glsl_stage_new (GstGLContext * context, guint type);
+GST_GL_API
+GstGLSLStage * gst_glsl_stage_new_with_string (GstGLContext * context,
+ guint type,
+ GstGLSLVersion version,
+ GstGLSLProfile profile,
+ const gchar * str);
+GST_GL_API
+GstGLSLStage * gst_glsl_stage_new_with_strings (GstGLContext * context,
+ guint type,
+ GstGLSLVersion version,
+ GstGLSLProfile profile,
+ gint n_strings,
+ const gchar ** str);
+
+GST_GL_API
+GstGLSLStage * gst_glsl_stage_new_default_fragment (GstGLContext * context);
+GST_GL_API
+GstGLSLStage * gst_glsl_stage_new_default_vertex (GstGLContext * context);
+
+GST_GL_API
+guint gst_glsl_stage_get_handle (GstGLSLStage * stage);
+GST_GL_API
+GstGLSLProfile gst_glsl_stage_get_profile (GstGLSLStage * stage);
+GST_GL_API
+GstGLSLVersion gst_glsl_stage_get_version (GstGLSLStage * stage);
+GST_GL_API
+guint gst_glsl_stage_get_shader_type (GstGLSLStage * stage);
+GST_GL_API
+gboolean gst_glsl_stage_set_strings (GstGLSLStage * stage,
+ GstGLSLVersion version,
+ GstGLSLProfile profile,
+ gint n_strings,
+ const gchar ** str);
+GST_GL_API
+gboolean gst_glsl_stage_compile (GstGLSLStage * stage,
+ GError ** error);
+
+G_END_DECLS
+
+#endif /* __GST_GLSL_STAGE_H__ */
diff --git a/include/gst/gl/gstglsyncmeta.h b/include/gst/gl/gstglsyncmeta.h
new file mode 100644
index 0000000000..6daee86ca0
--- /dev/null
+++ b/include/gst/gl/gstglsyncmeta.h
@@ -0,0 +1,95 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_SYNC_META_H__
+#define __GST_GL_SYNC_META_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+#define GST_GL_SYNC_META_API_TYPE (gst_gl_sync_meta_api_get_type())
+#define GST_GL_SYNC_META_INFO (gst_gl_sync_meta_get_info())
+typedef struct _GstGLSyncMeta GstGLSyncMeta;
+
+/**
+ * GST_BUFFER_POOL_OPTION_GL_SYNC_META:
+ *
+ * An option that can be activated on bufferpools to request OpenGL
+ * synchronization metadata on buffers from the pool.
+ */
+#define GST_BUFFER_POOL_OPTION_GL_SYNC_META "GstBufferPoolOptionGLSyncMeta"
+
+/**
+ * GstGLSyncMeta:
+ * @parent: the parent #GstMeta
+ * @context: the #GstGLContext used to allocate the meta
+ * @data: a custom data pointer for the implementation
+ * @set_sync: set a sync point in the OpenGL command stream
+ * @set_sync_gl: the same as @set_sync but called from @context's thread
+ * @wait: execute a wait on the previously set sync point into the OpenGL command stream
+ * @wait_gl: the same as @wait but called from @context's thread
+ * @wait_cpu: wait for the previously set sync point to pass from the CPU
+ * @wait_cpu_gl: the same as @wait_cpu but called from @context's thread
+ * @copy: copy @data into a new #GstGLSyncMeta
+ * @free: free @data
+ * @free_gl: free @data in @context's thread
+ */
+struct _GstGLSyncMeta
+{
+ GstMeta parent;
+
+ GstGLContext *context;
+
+ gpointer data;
+
+ void (*set_sync) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*set_sync_gl) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*wait) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*wait_gl) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*wait_cpu) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*wait_cpu_gl) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*copy) (GstGLSyncMeta * src, GstBuffer * sbuffer, GstGLSyncMeta * dest, GstBuffer * dbuffer);
+ void (*free) (GstGLSyncMeta * sync, GstGLContext * context);
+ void (*free_gl) (GstGLSyncMeta * sync, GstGLContext * context);
+};
+
+GST_GL_API
+GType gst_gl_sync_meta_api_get_type (void);
+GST_GL_API
+const GstMetaInfo * gst_gl_sync_meta_get_info (void);
+
+#define gst_buffer_get_gl_sync_meta(b) ((GstGLSyncMeta*)gst_buffer_get_meta((b),GST_GL_SYNC_META_API_TYPE))
+
+GST_GL_API
+GstGLSyncMeta * gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer *buffer);
+GST_GL_API
+GstGLSyncMeta * gst_buffer_add_gl_sync_meta_full (GstGLContext * context, GstBuffer * buffer,
+ gpointer data);
+GST_GL_API
+void gst_gl_sync_meta_set_sync_point (GstGLSyncMeta * sync_meta, GstGLContext * context);
+GST_GL_API
+void gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta, GstGLContext * context);
+GST_GL_API
+void gst_gl_sync_meta_wait_cpu (GstGLSyncMeta * sync_meta, GstGLContext * context);
+
+G_END_DECLS
+
+#endif /* __GST_GL_SYNC_META_H__ */
diff --git a/include/gst/gl/gstglupload.h b/include/gst/gl/gstglupload.h
new file mode 100644
index 0000000000..5911584222
--- /dev/null
+++ b/include/gst/gl/gstglupload.h
@@ -0,0 +1,124 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystree00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_UPLOAD_H__
+#define __GST_GL_UPLOAD_H__
+
+#include <gst/video/video.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_upload_get_type (void);
+#define GST_TYPE_GL_UPLOAD (gst_gl_upload_get_type())
+#define GST_GL_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_UPLOAD,GstGLUpload))
+#define GST_GL_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_UPLOAD,GstGLUploadClass))
+#define GST_IS_GL_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_UPLOAD))
+#define GST_IS_GL_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_UPLOAD))
+#define GST_GL_UPLOAD_CAST(obj) ((GstGLUpload*)(obj))
+
+/**
+ * GstGLUploadReturn:
+ * @GST_GL_UPLOAD_DONE: No further processing required
+ * @GST_GL_UPLOAD_ERROR: An unspecified error occurred
+ * @GST_GL_UPLOAD_UNSUPPORTED: The configuration is unsupported.
+ * @GST_GL_UPLOAD_RECONFIGURE: This element requires a reconfiguration.
+ * @GST_GL_UPLOAD_UNSHARED_GL_CONTEXT: private return value.
+ */
+typedef enum
+{
+ GST_GL_UPLOAD_DONE = 1,
+
+ GST_GL_UPLOAD_ERROR = -1,
+ GST_GL_UPLOAD_UNSUPPORTED = -2,
+ GST_GL_UPLOAD_RECONFIGURE = -3,
+
+ GST_GL_UPLOAD_UNSHARED_GL_CONTEXT = -100,
+} GstGLUploadReturn;
+
+/**
+ * GstGLUpload
+ *
+ * Opaque #GstGLUpload object
+ */
+struct _GstGLUpload
+{
+ GstObject parent;
+
+ GstGLContext *context;
+
+ /*< private >*/
+ GstGLUploadPrivate *priv;
+
+ gpointer _reserved[GST_PADDING];
+};
+
+/**
+ * GstGLUploadClass:
+ *
+ * The #GstGLUploadClass struct only contains private data
+ */
+struct _GstGLUploadClass
+{
+ GstObjectClass object_class;
+
+ /*< private >*/
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GstCaps * gst_gl_upload_get_input_template_caps (void);
+
+GST_GL_API
+GstGLUpload * gst_gl_upload_new (GstGLContext * context);
+
+GST_GL_API
+void gst_gl_upload_set_context (GstGLUpload * upload,
+ GstGLContext * context);
+
+GST_GL_API
+GstCaps * gst_gl_upload_transform_caps (GstGLUpload * upload,
+ GstGLContext * context,
+ GstPadDirection direction,
+ GstCaps * caps,
+ GstCaps * filter);
+GST_GL_API
+gboolean gst_gl_upload_set_caps (GstGLUpload * upload,
+ GstCaps * in_caps,
+ GstCaps * out_caps);
+GST_GL_API
+void gst_gl_upload_get_caps (GstGLUpload * upload,
+ GstCaps ** in_caps,
+ GstCaps ** out_caps);
+GST_GL_API
+void gst_gl_upload_propose_allocation (GstGLUpload * upload,
+ GstQuery * decide_query,
+ GstQuery * query);
+
+GST_GL_API
+GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
+ GstBuffer * buffer,
+ GstBuffer ** outbuf_ptr);
+
+G_END_DECLS
+
+#endif /* __GST_GL_UPLOAD_H__ */
diff --git a/include/gst/gl/gstglutils.h b/include/gst/gl/gstglutils.h
new file mode 100644
index 0000000000..b27145489f
--- /dev/null
+++ b/include/gst/gl/gstglutils.h
@@ -0,0 +1,73 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_UTILS_H__
+#define __GST_GL_UTILS_H__
+
+#include <gst/video/video.h>
+#include <gst/video/gstvideoaffinetransformationmeta.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+gboolean gst_gl_ensure_element_data (gpointer element,
+ GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
+GST_GL_API
+gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
+ GstGLDisplay ** display, GstGLContext ** other_context);
+GST_GL_API
+gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
+ GstGLDisplay * display, GstGLContext * context, GstGLContext * other_context);
+GST_GL_API
+gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
+ GstGLContext ** context_ptr);
+
+GST_GL_API
+void gst_gl_element_propagate_display_context (GstElement * element, GstGLDisplay * display);
+
+GST_GL_API
+gsize gst_gl_get_plane_data_size (const GstVideoInfo * info, const GstVideoAlignment * align,
+ guint plane);
+GST_GL_API
+gsize gst_gl_get_plane_start (const GstVideoInfo * info, const GstVideoAlignment * valign,
+ guint plane);
+
+GST_GL_API
+gboolean gst_gl_value_set_texture_target_from_mask (GValue * value,
+ GstGLTextureTarget target_mask);
+GST_GL_API
+gboolean gst_gl_value_set_texture_target (GValue * value, GstGLTextureTarget target);
+GST_GL_API
+GstGLTextureTarget gst_gl_value_get_texture_target_mask (const GValue * value);
+
+GST_GL_API
+void gst_gl_get_affine_transformation_meta_as_ndc (GstVideoAffineTransformationMeta * meta, gfloat * matrix);
+GST_GL_API
+void gst_gl_set_affine_transformation_meta_from_ndc (GstVideoAffineTransformationMeta * meta, const gfloat * matrix);
+
+GST_GL_API
+void gst_gl_multiply_matrix4 (const gfloat * a, const gfloat * b, gfloat * result);
+
+
+G_END_DECLS
+
+#endif /* __GST_GL_UTILS_H__ */
diff --git a/include/gst/gl/gstglviewconvert.h b/include/gst/gl/gstglviewconvert.h
new file mode 100644
index 0000000000..6d4802d169
--- /dev/null
+++ b/include/gst/gl/gstglviewconvert.h
@@ -0,0 +1,139 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Jan Schmidt <jan@centricular.com>
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_VIEW_CONVERT_H_
+#define _GST_GL_VIEW_CONVERT_H_
+
+#include <gst/gstmemory.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_GL_VIEW_CONVERT (gst_gl_view_convert_get_type())
+#define GST_GL_VIEW_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvert))
+#define GST_IS_GL_VIEW_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_VIEW_CONVERT))
+#define GST_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
+#define GST_IS_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_VIEW_CONVERT))
+#define GST_GL_VIEW_CONVERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
+
+/**
+ * GstGLStereoDownmix:
+ * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS: Dubois optimised Green-Magenta anaglyph
+ * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS: Dubois optimised Red-Cyan anaglyph
+ * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS: Dubois optimised Amber-Blue anaglyph
+ *
+ * Output anaglyph type to generate when downmixing to mono
+ */
+typedef enum {
+ GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
+ GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
+ GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
+} GstGLStereoDownmix;
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE GST_TYPE_GL_STEREO_DOWNMIX
+
+GST_GL_API
+GType gst_gl_stereo_downmix_mode_get_type (void);
+#endif
+
+/**
+ * GstGLViewConvert:
+ *
+ * #GstGLViewConvert is an opaque struct and should only be accessed through the
+ * provided api.
+ */
+struct _GstGLViewConvert
+{
+ GstObject object;
+
+ GstGLContext *context;
+
+ GstGLShader *shader;
+
+ GstVideoMultiviewMode input_mode_override;
+ GstVideoMultiviewFlags input_flags_override;
+ GstVideoMultiviewMode output_mode_override;
+ GstVideoMultiviewFlags output_flags_override;
+
+ GstGLStereoDownmix downmix_mode;
+
+ GstVideoInfo in_info;
+ GstVideoInfo out_info;
+
+ GstGLTextureTarget from_texture_target;
+ GstGLTextureTarget to_texture_target;
+ gboolean caps_passthrough;
+
+ gboolean initted;
+ gboolean reconfigure;
+
+ GstGLFramebuffer *fbo;
+
+ /*< private >*/
+ GstGLViewConvertPrivate *priv;
+
+ gpointer _padding[GST_PADDING];
+};
+
+/**
+ * GstGLViewConvertClass:
+ *
+ * Opaque #GstGLViewConvertClass struct
+ */
+struct _GstGLViewConvertClass
+{
+ /*< private >*/
+ GstObjectClass object_class;
+
+ gpointer _padding[GST_PADDING];
+};
+
+GST_GL_API
+GType gst_gl_view_convert_get_type (void);
+GST_GL_API
+GstGLViewConvert * gst_gl_view_convert_new (void);
+
+GST_GL_API
+gboolean gst_gl_view_convert_set_caps (GstGLViewConvert * viewconvert, GstCaps * in_caps, GstCaps * out_caps);
+GST_GL_API
+GstCaps * gst_gl_view_convert_transform_caps (GstGLViewConvert * viewconvert,
+ GstPadDirection direction, GstCaps * caps, GstCaps * filter);
+GST_GL_API
+GstCaps * gst_gl_view_convert_fixate_caps (GstGLViewConvert *viewconvert,
+ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
+GST_GL_API
+GstFlowReturn gst_gl_view_convert_submit_input_buffer (GstGLViewConvert *viewconvert,
+ gboolean is_discont, GstBuffer * input);
+GST_GL_API
+GstFlowReturn gst_gl_view_convert_get_output (GstGLViewConvert *viewconvert,
+ GstBuffer ** outbuf_ptr);
+
+GST_GL_API
+GstBuffer * gst_gl_view_convert_perform (GstGLViewConvert * viewconvert, GstBuffer *inbuf);
+GST_GL_API
+void gst_gl_view_convert_reset (GstGLViewConvert * viewconvert);
+GST_GL_API
+void gst_gl_view_convert_set_context (GstGLViewConvert *viewconvert, GstGLContext * context);
+
+G_END_DECLS
+#endif /* _GST_GL_VIEW_CONVERT_H_ */
diff --git a/include/gst/gl/gstglwindow.h b/include/gst/gl/gstglwindow.h
new file mode 100644
index 0000000000..6e70597584
--- /dev/null
+++ b/include/gst/gl/gstglwindow.h
@@ -0,0 +1,282 @@
+/*
+ * GStreamer
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_WINDOW_H__
+#define __GST_GL_WINDOW_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/gl/gstglcontext.h>
+#include <gst/gl/gstgldisplay.h>
+
+G_BEGIN_DECLS
+
+GST_GL_API
+GType gst_gl_window_get_type (void);
+#define GST_TYPE_GL_WINDOW (gst_gl_window_get_type())
+
+#define GST_GL_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW, GstGLWindow))
+#define GST_GL_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_GL_WINDOW, GstGLWindowClass))
+#define GST_IS_GL_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW))
+#define GST_IS_GL_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW))
+#define GST_GL_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW, GstGLWindowClass))
+
+#define GST_GL_WINDOW_LOCK(w) g_mutex_lock(&GST_GL_WINDOW(w)->lock)
+#define GST_GL_WINDOW_UNLOCK(w) g_mutex_unlock(&GST_GL_WINDOW(w)->lock)
+#define GST_GL_WINDOW_GET_LOCK(w) (&GST_GL_WINDOW(w)->lock)
+
+GST_GL_API
+GQuark gst_gl_window_error_quark (void);
+/**
+ * GST_GL_WINDOW_ERROR:
+ *
+ * Error domain for GStreamer's GL window module. Errors in this domain will be
+ * from the #GstGLWindowError enumeration
+ */
+#define GST_GL_WINDOW_ERROR (gst_gl_window_error_quark ())
+
+/**
+ * GstGLWindowError:
+ * @GST_GL_WINDOW_ERROR_FAILED: failed for a unspecified reason
+ * @GST_GL_WINDOW_ERROR_OLD_LIBS: the implementation is too old
+ * @GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE: no such resource was found
+ */
+typedef enum
+{
+ GST_GL_WINDOW_ERROR_FAILED,
+ GST_GL_WINDOW_ERROR_OLD_LIBS,
+ GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
+} GstGLWindowError;
+
+typedef void (*GstGLWindowCB) (gpointer data);
+typedef void (*GstGLWindowResizeCB) (gpointer data, guint width, guint height);
+
+/**
+ * GST_GL_WINDOW_CB:
+ * @f: the function to cast
+ *
+ * Cast to the current function type for generic window callbacks
+ */
+#define GST_GL_WINDOW_CB(f) ((GstGLWindowCB) (f))
+
+/**
+ * GST_GL_WINDOW_RESIZE_CB:
+ * @f: the function to cast
+ *
+ * Cast to the current function type for window resize callbacks
+ */
+#define GST_GL_WINDOW_RESIZE_CB(f) ((GstGLWindowResizeCB) (f))
+
+/**
+ * GstGLWindow:
+ *
+ * #GstGLWindow is an opaque struct and should only be accessed through the
+ * provided api.
+ */
+struct _GstGLWindow {
+ /*< private >*/
+ GstObject parent;
+
+ GMutex lock;
+
+ GstGLDisplay *display;
+ GWeakRef context_ref;
+
+ /*< protected >*/
+ gboolean is_drawing;
+
+ GstGLWindowCB draw;
+ gpointer draw_data;
+ GDestroyNotify draw_notify;
+ GstGLWindowCB close;
+ gpointer close_data;
+ GDestroyNotify close_notify;
+ GstGLWindowResizeCB resize;
+ gpointer resize_data;
+ GDestroyNotify resize_notify;
+
+ gboolean queue_resize;
+
+ GMainContext *main_context; /* default main_context */
+
+ /*< private >*/
+ GstGLWindowPrivate *priv;
+
+ gpointer _reserved[GST_PADDING];
+};
+
+/**
+ * GstGLWindowClass:
+ * @parent_class: Parent class
+ * @get_display: Gets the current windowing system display connection
+ * @set_window_handle: Set a window handle to render into
+ * @get_window_handle: Gets the current window handle that this #GstGLWindow is
+ * rendering into. This may return a different value to
+ * what is passed into @set_window_handle
+ * @draw: redraw the window with the specified dimensions
+ * @run: run the mainloop
+ * @quit: send a quit to the mainloop
+ * @send_message: invoke a function on the window thread. Required to be reentrant.
+ * @send_message_async: invoke a function on the window thread. @run may or may
+ * not have been called. Required to be reentrant.
+ * @open: open the connection to the display
+ * @close: close the connection to the display
+ * @handle_events: whether to handle 'extra' events from the windowing system.
+ * Basic events like surface moves and resizes are still valid
+ * things to listen for.
+ * @set_preferred_size: request that the window change surface size. The
+ * implementation is free to ignore this information.
+ * @show: request that the window be shown to the user
+ * @set_render_rectangle: request a rectangle to render into. See #GstVideoOverlay
+ * @queue_resize: request a resize to occur when possible
+ * @controls_viewport: Whether the window takes care of glViewport setup.
+ * and the user does not need to deal with viewports
+ * @has_output_surface: Whether the window has output surface or not. (Since: 1.18)
+ */
+struct _GstGLWindowClass {
+ GstObjectClass parent_class;
+
+ guintptr (*get_display) (GstGLWindow *window);
+ void (*set_window_handle) (GstGLWindow *window, guintptr handle);
+ guintptr (*get_window_handle) (GstGLWindow *window);
+ void (*draw) (GstGLWindow *window);
+ void (*run) (GstGLWindow *window);
+ void (*quit) (GstGLWindow *window);
+ void (*send_message) (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
+ void (*send_message_async) (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
+
+ gboolean (*open) (GstGLWindow *window, GError **error);
+ void (*close) (GstGLWindow *window);
+ void (*handle_events) (GstGLWindow *window, gboolean handle_events);
+ void (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
+ void (*show) (GstGLWindow *window);
+ gboolean (*set_render_rectangle)(GstGLWindow *window, gint x, gint y, gint width, gint height);
+ void (*queue_resize) (GstGLWindow *window);
+ gboolean (*controls_viewport) (GstGLWindow *window);
+ gboolean (*has_output_surface) (GstGLWindow *window);
+
+ /*< private >*/
+ gpointer _reserved[GST_PADDING-2];
+};
+
+GST_GL_API
+GstGLWindow * gst_gl_window_new (GstGLDisplay *display);
+
+/* callbacks */
+GST_GL_API
+void gst_gl_window_set_draw_callback (GstGLWindow *window,
+ GstGLWindowCB callback,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+GST_GL_API
+void gst_gl_window_set_resize_callback (GstGLWindow *window,
+ GstGLWindowResizeCB callback,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+GST_GL_API
+void gst_gl_window_set_close_callback (GstGLWindow *window,
+ GstGLWindowCB callback,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+
+GST_GL_API
+void gst_gl_window_set_window_handle (GstGLWindow *window, guintptr handle);
+GST_GL_API
+guintptr gst_gl_window_get_window_handle (GstGLWindow *window);
+
+/* loop/events */
+GST_GL_API
+void gst_gl_window_run (GstGLWindow *window);
+GST_GL_API
+void gst_gl_window_quit (GstGLWindow *window);
+GST_GL_API
+void gst_gl_window_send_message (GstGLWindow *window,
+ GstGLWindowCB callback,
+ gpointer data);
+GST_GL_API
+void gst_gl_window_send_message_async (GstGLWindow *window,
+ GstGLWindowCB callback,
+ gpointer data,
+ GDestroyNotify destroy);
+
+/* navigation */
+GST_GL_API
+void gst_gl_window_handle_events (GstGLWindow * window,
+ gboolean handle_events);
+
+GST_GL_API
+void gst_gl_window_send_key_event (GstGLWindow * window,
+ const char * event_type,
+ const char * key_str);
+GST_GL_API
+void gst_gl_window_send_mouse_event (GstGLWindow * window,
+ const char * event_type,
+ int button,
+ double posx,
+ double posy);
+
+GST_GL_API
+void gst_gl_window_send_scroll_event (GstGLWindow * window,
+ double posx,
+ double posy,
+ double delta_x,
+ double delta_y);
+
+/* surfaces/rendering */
+GST_GL_API
+void gst_gl_window_queue_resize (GstGLWindow *window);
+GST_GL_API
+void gst_gl_window_draw (GstGLWindow *window);
+GST_GL_API
+void gst_gl_window_show (GstGLWindow *window);
+GST_GL_API
+void gst_gl_window_set_preferred_size (GstGLWindow * window,
+ gint width,
+ gint height);
+GST_GL_API
+void gst_gl_window_get_surface_dimensions (GstGLWindow * window,
+ guint * width,
+ guint * height);
+GST_GL_API
+gboolean gst_gl_window_set_render_rectangle (GstGLWindow * window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+GST_GL_API
+gboolean gst_gl_window_controls_viewport (GstGLWindow * window);
+
+/* subclass usage only */
+GST_GL_API
+void gst_gl_window_resize (GstGLWindow *window, guint width, guint height);
+
+GST_GL_API
+GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
+GST_GL_API
+guintptr gst_gl_window_get_display (GstGLWindow *window);
+
+GST_GL_API
+gboolean gst_gl_window_has_output_surface (GstGLWindow *window);
+
+G_END_DECLS
+
+#endif /* __GST_GL_WINDOW_H__ */
diff --git a/include/gst/glib-compat.h b/include/gst/glib-compat.h
new file mode 100644
index 0000000000..5fb267b6c6
--- /dev/null
+++ b/include/gst/glib-compat.h
@@ -0,0 +1,39 @@
+/* GStreamer
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * glib-compat.h: Public GLib compatibility shims
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS file from
+ * glib-2.8.0 for a list of people on the GLib Team. See the ChangeLog files
+ * from glib-2.8.0 for a list of changes. These files are distributed with GLib
+ * at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GST_GLIB_COMPAT_H__
+#define __GST_GLIB_COMPAT_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+G_END_DECLS
+
+#endif /* __GST_GLIB_COMPAT_H__ */
diff --git a/include/gst/gst.h b/include/gst/gst.h
new file mode 100644
index 0000000000..4423813aec
--- /dev/null
+++ b/include/gst/gst.h
@@ -0,0 +1,141 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gst.h: Main header for GStreamer, apps should include this
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_H__
+#define __GST_H__
+
+#include <glib.h>
+
+#include <gst/glib-compat.h>
+
+#include <gst/gstenumtypes.h>
+#include <gst/gstversion.h>
+
+#include <gst/gstatomicqueue.h>
+#include <gst/gstbin.h>
+#include <gst/gstbuffer.h>
+#include <gst/gstbufferlist.h>
+#include <gst/gstbufferpool.h>
+#include <gst/gstcaps.h>
+#include <gst/gstcapsfeatures.h>
+#include <gst/gstchildproxy.h>
+#include <gst/gstclock.h>
+#include <gst/gstcontrolsource.h>
+#include <gst/gstdatetime.h>
+#include <gst/gstdebugutils.h>
+#include <gst/gstdevice.h>
+#include <gst/gstdevicemonitor.h>
+#include <gst/gstdeviceprovider.h>
+#include <gst/gstdynamictypefactory.h>
+#include <gst/gstelement.h>
+#include <gst/gstelementmetadata.h>
+#include <gst/gsterror.h>
+#include <gst/gstevent.h>
+#include <gst/gstghostpad.h>
+#include <gst/gstinfo.h>
+#include <gst/gstiterator.h>
+#include <gst/gstmessage.h>
+#include <gst/gstmemory.h>
+#include <gst/gstmeta.h>
+#include <gst/gstminiobject.h>
+#include <gst/gstobject.h>
+#include <gst/gststreamcollection.h>
+#include <gst/gstpad.h>
+#include <gst/gstparamspecs.h>
+#include <gst/gstpipeline.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpoll.h>
+#include <gst/gstpreset.h>
+#include <gst/gstprotection.h>
+#include <gst/gstquery.h>
+#include <gst/gstregistry.h>
+#include <gst/gstpromise.h>
+#include <gst/gstsample.h>
+#include <gst/gstsegment.h>
+#include <gst/gststreams.h>
+#include <gst/gststructure.h>
+#include <gst/gstsystemclock.h>
+#include <gst/gsttaglist.h>
+#include <gst/gsttagsetter.h>
+#include <gst/gsttask.h>
+#include <gst/gsttaskpool.h>
+#include <gst/gsttoc.h>
+#include <gst/gsttocsetter.h>
+#include <gst/gsttracer.h>
+#include <gst/gsttracerfactory.h>
+#include <gst/gsttracerrecord.h>
+#include <gst/gsttypefind.h>
+#include <gst/gsttypefindfactory.h>
+#include <gst/gsturi.h>
+#include <gst/gstutils.h>
+#include <gst/gstvalue.h>
+
+#include <gst/gstparse.h>
+
+/* API compatibility stuff */
+#include <gst/gstcompat.h>
+
+G_BEGIN_DECLS
+
+GST_API
+void gst_init (int *argc, char **argv[]);
+
+GST_API
+gboolean gst_init_check (int *argc, char **argv[],
+ GError ** error);
+GST_API
+gboolean gst_is_initialized (void);
+
+GST_API
+GOptionGroup * gst_init_get_option_group (void);
+
+GST_API
+void gst_deinit (void);
+
+GST_API
+void gst_version (guint *major, guint *minor,
+ guint *micro, guint *nano);
+GST_API
+gchar * gst_version_string (void);
+
+GST_API
+gboolean gst_segtrap_is_enabled (void);
+
+GST_API
+void gst_segtrap_set_enabled (gboolean enabled);
+
+GST_API
+gboolean gst_registry_fork_is_enabled (void);
+
+GST_API
+void gst_registry_fork_set_enabled (gboolean enabled);
+
+GST_API
+gboolean gst_update_registry (void);
+
+GST_API
+const gchar * gst_get_main_executable_path (void);
+
+G_END_DECLS
+
+#endif /* __GST_H__ */
diff --git a/include/gst/gstallocator.h b/include/gst/gstallocator.h
new file mode 100644
index 0000000000..0989dd8db1
--- /dev/null
+++ b/include/gst/gstallocator.h
@@ -0,0 +1,201 @@
+/* GStreamer
+ * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
+ *
+ * gstallocator.h: Header for memory allocation
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_ALLOCATOR_H__
+#define __GST_ALLOCATOR_H__
+
+#include <gst/gstmemory.h>
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstAllocatorPrivate GstAllocatorPrivate;
+typedef struct _GstAllocatorClass GstAllocatorClass;
+
+#define GST_TYPE_ALLOCATOR (gst_allocator_get_type())
+#define GST_IS_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ALLOCATOR))
+#define GST_IS_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ALLOCATOR))
+#define GST_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ALLOCATOR, GstAllocatorClass))
+#define GST_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ALLOCATOR, GstAllocator))
+#define GST_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ALLOCATOR, GstAllocatorClass))
+#define GST_ALLOCATOR_CAST(obj) ((GstAllocator *)(obj))
+
+#define GST_TYPE_ALLOCATION_PARAMS (gst_allocation_params_get_type())
+
+GST_API
+GType gst_allocation_params_get_type(void);
+
+typedef struct _GstAllocationParams GstAllocationParams;
+
+/**
+ * gst_memory_alignment:
+ *
+ * The default memory alignment in bytes - 1
+ * an alignment of 7 would be the same as what malloc() guarantees.
+ */
+
+GST_API gsize gst_memory_alignment;
+
+/**
+ * GST_ALLOCATOR_SYSMEM:
+ *
+ * The allocator name for the default system memory allocator
+ */
+#define GST_ALLOCATOR_SYSMEM "SystemMemory"
+
+/**
+ * GstAllocationParams:
+ * @flags: flags to control allocation
+ * @align: the desired alignment of the memory
+ * @prefix: the desired prefix
+ * @padding: the desired padding
+ *
+ * Parameters to control the allocation of memory
+ */
+struct _GstAllocationParams {
+ GstMemoryFlags flags;
+ gsize align;
+ gsize prefix;
+ gsize padding;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAllocatorFlags:
+ * @GST_ALLOCATOR_FLAG_CUSTOM_ALLOC: The allocator has a custom alloc function.
+ * @GST_ALLOCATOR_FLAG_LAST: first flag that can be used for custom purposes
+ *
+ * Flags for allocators.
+ */
+typedef enum {
+ GST_ALLOCATOR_FLAG_CUSTOM_ALLOC = (GST_OBJECT_FLAG_LAST << 0),
+
+ GST_ALLOCATOR_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
+} GstAllocatorFlags;
+
+/**
+ * GstAllocator:
+ * @mem_map: the implementation of the GstMemoryMapFunction
+ * @mem_unmap: the implementation of the GstMemoryUnmapFunction
+ * @mem_copy: the implementation of the GstMemoryCopyFunction
+ * @mem_share: the implementation of the GstMemoryShareFunction
+ * @mem_is_span: the implementation of the GstMemoryIsSpanFunction
+ * @mem_map_full: the implementation of the GstMemoryMapFullFunction.
+ * Will be used instead of @mem_map if present. (Since: 1.6)
+ * @mem_unmap_full: the implementation of the GstMemoryUnmapFullFunction.
+ * Will be used instead of @mem_unmap if present. (Since: 1.6)
+ *
+ * The #GstAllocator is used to create new memory.
+ */
+struct _GstAllocator
+{
+ GstObject object;
+
+ const gchar *mem_type;
+
+ /*< public >*/
+ GstMemoryMapFunction mem_map;
+ GstMemoryUnmapFunction mem_unmap;
+
+ GstMemoryCopyFunction mem_copy;
+ GstMemoryShareFunction mem_share;
+ GstMemoryIsSpanFunction mem_is_span;
+
+ GstMemoryMapFullFunction mem_map_full;
+ GstMemoryUnmapFullFunction mem_unmap_full;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 2];
+
+ GstAllocatorPrivate *priv;
+};
+
+/**
+ * GstAllocatorClass:
+ * @object_class: Object parent class
+ * @alloc: implementation that acquires memory
+ * @free: implementation that releases memory
+ *
+ * The #GstAllocator is used to create new memory.
+ */
+struct _GstAllocatorClass {
+ GstObjectClass object_class;
+
+ /*< public >*/
+ GstMemory * (*alloc) (GstAllocator *allocator, gsize size,
+ GstAllocationParams *params);
+ void (*free) (GstAllocator *allocator, GstMemory *memory);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_allocator_get_type (void);
+
+/* allocators */
+
+GST_API
+void gst_allocator_register (const gchar *name, GstAllocator *allocator);
+
+GST_API
+GstAllocator * gst_allocator_find (const gchar *name);
+
+GST_API
+void gst_allocator_set_default (GstAllocator * allocator);
+
+/* allocation parameters */
+
+GST_API
+GstAllocationParams * gst_allocation_params_new (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_allocation_params_init (GstAllocationParams *params);
+
+GST_API
+GstAllocationParams *
+ gst_allocation_params_copy (const GstAllocationParams *params) G_GNUC_MALLOC;
+
+GST_API
+void gst_allocation_params_free (GstAllocationParams *params);
+
+/* allocating memory blocks */
+
+GST_API
+GstMemory * gst_allocator_alloc (GstAllocator * allocator, gsize size,
+ GstAllocationParams *params);
+
+GST_API
+void gst_allocator_free (GstAllocator * allocator, GstMemory *memory);
+
+GST_API
+GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags, gpointer data, gsize maxsize,
+ gsize offset, gsize size, gpointer user_data,
+ GDestroyNotify notify);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAllocationParams, gst_allocation_params_free)
+
+G_END_DECLS
+
+#endif /* __GST_ALLOCATOR_H__ */
diff --git a/include/gst/gstatomicqueue.h b/include/gst/gstatomicqueue.h
new file mode 100644
index 0000000000..2bf1e7ded9
--- /dev/null
+++ b/include/gst/gstatomicqueue.h
@@ -0,0 +1,72 @@
+/* GStreamer
+ * Copyright (C) 2009-2010 Edward Hervey <bilboed@bilboed.com>
+ * (C) 2011 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstatomicqueue.h:
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gstconfig.h>
+
+#ifndef __GST_ATOMIC_QUEUE_H__
+#define __GST_ATOMIC_QUEUE_H__
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ATOMIC_QUEUE (gst_atomic_queue_get_type())
+
+/**
+ * GstAtomicQueue:
+ *
+ * Opaque atomic data queue.
+ *
+ * Use the accessor functions to get the stored values.
+ */
+typedef struct _GstAtomicQueue GstAtomicQueue;
+
+
+GST_API
+GType gst_atomic_queue_get_type (void);
+
+GST_API
+GstAtomicQueue * gst_atomic_queue_new (guint initial_size) G_GNUC_MALLOC;
+
+GST_API
+void gst_atomic_queue_ref (GstAtomicQueue * queue);
+
+GST_API
+void gst_atomic_queue_unref (GstAtomicQueue * queue);
+
+GST_API
+void gst_atomic_queue_push (GstAtomicQueue* queue, gpointer data);
+
+GST_API
+gpointer gst_atomic_queue_pop (GstAtomicQueue* queue);
+
+GST_API
+gpointer gst_atomic_queue_peek (GstAtomicQueue* queue);
+
+GST_API
+guint gst_atomic_queue_length (GstAtomicQueue * queue);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAtomicQueue, gst_atomic_queue_unref)
+
+G_END_DECLS
+
+#endif /* __GST_ATOMIC_QUEUE_H__ */
diff --git a/include/gst/gstbin.h b/include/gst/gstbin.h
new file mode 100644
index 0000000000..ed6f29dfd9
--- /dev/null
+++ b/include/gst/gstbin.h
@@ -0,0 +1,333 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstbin.h: Header for GstBin container object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_BIN_H__
+#define __GST_BIN_H__
+
+#include <gst/gstelement.h>
+#include <gst/gstiterator.h>
+#include <gst/gstbus.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_BIN (gst_bin_get_type ())
+#define GST_IS_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BIN))
+#define GST_IS_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BIN))
+#define GST_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BIN, GstBinClass))
+#define GST_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BIN, GstBin))
+#define GST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BIN, GstBinClass))
+#define GST_BIN_CAST(obj) ((GstBin*)(obj))
+
+/**
+ * GstBinFlags:
+ * @GST_BIN_FLAG_LAST: the last enum in the series of flags for bins.
+ * Derived classes can use this as first value in a list of flags.
+ *
+ * GstBinFlags are a set of flags specific to bins. Most are set/used
+ * internally. They can be checked using the GST_OBJECT_FLAG_IS_SET() macro,
+ * and (un)set using GST_OBJECT_FLAG_SET() and GST_OBJECT_FLAG_UNSET().
+ */
+typedef enum {
+ /**
+ * GST_BIN_FLAG_NO_RESYNC:
+ *
+ * Don't resync a state change when elements are added or linked in the bin
+ *
+ * Since: 1.0.5
+ */
+ GST_BIN_FLAG_NO_RESYNC = (GST_ELEMENT_FLAG_LAST << 0),
+
+ /**
+ * GST_BIN_FLAG_STREAMS_AWARE:
+ *
+ * Indicates whether the bin can handle elements that add/remove source pads
+ * at any point in time without first posting a no-more-pads signal.
+ *
+ * Since: 1.10
+ */
+ GST_BIN_FLAG_STREAMS_AWARE = (GST_ELEMENT_FLAG_LAST << 1),
+
+ /* padding */
+
+ /**
+ * GST_BIN_FLAG_LAST:
+ *
+ * The last enum in the series of flags for bins. Derived classes can use this
+ * as first value in a list of flags.
+ */
+ GST_BIN_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 5)
+} GstBinFlags;
+
+/**
+ * GST_BIN_IS_NO_RESYNC:
+ * @bin: A #GstBin
+ *
+ * Check if @bin will resync its state change when elements are added and
+ * removed.
+ *
+ * Since: 1.0.5
+ */
+#define GST_BIN_IS_NO_RESYNC(bin) (GST_OBJECT_FLAG_IS_SET(bin,GST_BIN_FLAG_NO_RESYNC))
+
+typedef struct _GstBin GstBin;
+typedef struct _GstBinClass GstBinClass;
+typedef struct _GstBinPrivate GstBinPrivate;
+
+/**
+ * GST_BIN_NUMCHILDREN:
+ * @bin: a #GstBin
+ *
+ * Gets the number of children in a bin.
+ */
+#define GST_BIN_NUMCHILDREN(bin) (GST_BIN_CAST(bin)->numchildren)
+/**
+ * GST_BIN_CHILDREN:
+ * @bin: a #GstBin
+ *
+ * Gets the list of children in a bin.
+ */
+#define GST_BIN_CHILDREN(bin) (GST_BIN_CAST(bin)->children)
+/**
+ * GST_BIN_CHILDREN_COOKIE:
+ * @bin: a #GstBin
+ *
+ * Gets the children cookie that watches the children list.
+ */
+#define GST_BIN_CHILDREN_COOKIE(bin) (GST_BIN_CAST(bin)->children_cookie)
+
+/**
+ * GstBin:
+ * @numchildren: the number of children in this bin
+ * @children: (element-type Gst.Element): the list of children in this bin
+ * @children_cookie: updated whenever @children changes
+ * @child_bus: internal bus for handling child messages
+ * @messages: (element-type Gst.Message): queued and cached messages
+ * @polling: the bin is currently calculating its state
+ * @state_dirty: the bin needs to recalculate its state (deprecated)
+ * @clock_dirty: the bin needs to select a new clock
+ * @provided_clock: the last clock selected
+ * @clock_provider: the element that provided @provided_clock
+ *
+ * The GstBin base class. Subclasses can access these fields provided
+ * the LOCK is taken.
+ */
+struct _GstBin {
+ GstElement element;
+
+ /*< public >*/ /* with LOCK */
+ /* our children, subclass are supposed to update these
+ * fields to reflect their state with _iterate_*() */
+ gint numchildren;
+ GList *children;
+ guint32 children_cookie;
+
+ GstBus *child_bus;
+ GList *messages;
+
+ gboolean polling;
+ gboolean state_dirty;
+
+ gboolean clock_dirty;
+ GstClock *provided_clock;
+ GstElement *clock_provider;
+
+ /*< private >*/
+ GstBinPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstBinClass:
+ * @parent_class: bin parent class
+ *
+ * Subclasses can override #GstBinClass::add_element and #GstBinClass::remove_element
+ * to update the list of children in the bin.
+ *
+ * The #GstBinClass::handle_message method can be overridden to implement custom
+ * message handling.
+ *
+ * #GstBinClass::deep_element_added will be called when a new element has been
+ * added to any bin inside this bin, so it will also be called if a new child
+ * was added to a sub-bin of this bin. #GstBin implementations that override
+ * this message should chain up to the parent class implementation so the
+ * #GstBin::deep-element-added signal is emitted on all parents.
+ */
+struct _GstBinClass {
+ GstElementClass parent_class;
+
+ /*< private >*/
+ GThreadPool *pool; /* deprecated */
+
+ /* signals */
+
+ /**
+ * GstBinClass::element_added:
+ * @bin: the #GstBin
+ * @child: the element that was added
+ *
+ * Method called when an element was added to the bin.
+ */
+ void (*element_added) (GstBin *bin, GstElement *child);
+
+ /**
+ * GstBinClass::element_removed:
+ * @bin: the #GstBin
+ * @child: the element that was removed
+ *
+ * Method called when an element was removed from the bin.
+ */
+ void (*element_removed) (GstBin *bin, GstElement *child);
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ /**
+ * GstBinClass::add_element:
+ * @bin: the #GstBin
+ * @element: the element to be added
+ *
+ * Method to add an element to the bin.
+ *
+ * Returns: %TRUE if the @element was added
+ */
+ gboolean (*add_element) (GstBin *bin, GstElement *element);
+
+ /**
+ * GstBinClass::remove_element:
+ * @bin: the #GstBin
+ * @element: the element to be removed
+ *
+ * Method to remove an element from the bin.
+ *
+ * Returns: %TRUE if the @element was removed
+ */
+ gboolean (*remove_element) (GstBin *bin, GstElement *element);
+
+ /**
+ * GstBinClass::handle_message:
+ * @bin: the #GstBin
+ * @message: (transfer full): the message to be handled
+ *
+ * Method to handle a message from the children.
+ */
+ void (*handle_message) (GstBin *bin, GstMessage *message);
+
+ /*< private >*/
+ /* signal */
+ gboolean (*do_latency) (GstBin *bin);
+
+ /*< public >*/
+ /* signal */
+
+ /**
+ * GstBinClass::deep_element_added:
+ * @bin: the top level #GstBin
+ * @sub_bin: the #GstBin to which the element was added
+ * @child: the element that was added
+ *
+ * Method called when an element was added somewhere in the bin hierarchy.
+ */
+ void (*deep_element_added) (GstBin *bin, GstBin *sub_bin, GstElement *child);
+
+ /**
+ * GstBinClass::deep_element_removed:
+ * @bin: the top level #GstBin
+ * @sub_bin: the #GstBin from which the element was removed
+ * @child: the element that was removed
+ *
+ * Method called when an element was removed somewhere in the bin hierarchy.
+ */
+ void (*deep_element_removed) (GstBin *bin, GstBin *sub_bin, GstElement *child);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING-2];
+};
+
+GST_API
+GType gst_bin_get_type (void);
+
+GST_API
+GstElement* gst_bin_new (const gchar *name);
+
+/* add and remove elements from the bin */
+
+GST_API
+gboolean gst_bin_add (GstBin *bin, GstElement *element);
+
+GST_API
+gboolean gst_bin_remove (GstBin *bin, GstElement *element);
+
+/* retrieve a single child */
+
+GST_API
+GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name);
+
+GST_API
+GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name);
+
+GST_API
+GstElement* gst_bin_get_by_interface (GstBin *bin, GType iface);
+
+/* retrieve multiple children */
+
+GST_API
+GstIterator* gst_bin_iterate_elements (GstBin *bin);
+
+GST_API
+GstIterator* gst_bin_iterate_sorted (GstBin *bin);
+
+GST_API
+GstIterator* gst_bin_iterate_recurse (GstBin *bin);
+
+GST_API
+GstIterator* gst_bin_iterate_sinks (GstBin *bin);
+
+GST_API
+GstIterator* gst_bin_iterate_sources (GstBin *bin);
+
+GST_API
+GstIterator* gst_bin_iterate_all_by_interface (GstBin *bin, GType iface);
+
+GST_API
+GstIterator* gst_bin_iterate_all_by_element_factory_name (GstBin * bin, const gchar * factory_name);
+
+/* latency */
+
+GST_API
+gboolean gst_bin_recalculate_latency (GstBin * bin);
+
+/* set and get suppressed flags */
+
+GST_API
+void gst_bin_set_suppressed_flags (GstBin * bin, GstElementFlags flags);
+
+GST_API
+GstElementFlags gst_bin_get_suppressed_flags (GstBin * bin);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBin, gst_object_unref)
+
+G_END_DECLS
+
+
+#endif /* __GST_BIN_H__ */
diff --git a/include/gst/gstbuffer.h b/include/gst/gstbuffer.h
new file mode 100644
index 0000000000..ee352d9f5e
--- /dev/null
+++ b/include/gst/gstbuffer.h
@@ -0,0 +1,793 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstbuffer.h: Header for GstBuffer object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_BUFFER_H__
+#define __GST_BUFFER_H__
+
+#include <gst/gstminiobject.h>
+#include <gst/gstclock.h>
+#include <gst/gstallocator.h>
+#include <gst/gstcaps.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_buffer_type;
+
+typedef struct _GstBuffer GstBuffer;
+typedef struct _GstBufferPool GstBufferPool;
+
+#include <gst/gstmeta.h>
+
+#define GST_TYPE_BUFFER (_gst_buffer_type)
+#define GST_IS_BUFFER(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER))
+#define GST_BUFFER_CAST(obj) ((GstBuffer *)(obj))
+#define GST_BUFFER(obj) (GST_BUFFER_CAST(obj))
+
+/**
+ * GST_BUFFER_FLAGS:
+ * @buf: a #GstBuffer.
+ *
+ * Returns a flags word containing #GstBufferFlags flags set on this buffer.
+ */
+#define GST_BUFFER_FLAGS(buf) GST_MINI_OBJECT_FLAGS(buf)
+/**
+ * GST_BUFFER_FLAG_IS_SET:
+ * @buf: a #GstBuffer.
+ * @flag: the #GstBufferFlags flag to check.
+ *
+ * Gives the status of a specific flag on a buffer.
+ */
+#define GST_BUFFER_FLAG_IS_SET(buf,flag) GST_MINI_OBJECT_FLAG_IS_SET (buf, flag)
+/**
+ * GST_BUFFER_FLAG_SET:
+ * @buf: a #GstBuffer.
+ * @flag: the #GstBufferFlags flag to set.
+ *
+ * Sets a buffer flag on a buffer.
+ */
+#define GST_BUFFER_FLAG_SET(buf,flag) GST_MINI_OBJECT_FLAG_SET (buf, flag)
+/**
+ * GST_BUFFER_FLAG_UNSET:
+ * @buf: a #GstBuffer.
+ * @flag: the #GstBufferFlags flag to clear.
+ *
+ * Clears a buffer flag.
+ */
+#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_MINI_OBJECT_FLAG_UNSET (buf, flag)
+
+
+/**
+ * GST_BUFFER_PTS:
+ * @buf: a #GstBuffer.:
+ *
+ * Gets the presentation timestamp (pts) in nanoseconds (as a #GstClockTime)
+ * of the data in the buffer. This is the timestamp when the media should be
+ * presented to the user.
+ *
+ * Value will be %GST_CLOCK_TIME_NONE if the pts is unknown.
+ */
+#define GST_BUFFER_PTS(buf) (GST_BUFFER_CAST(buf)->pts)
+/**
+ * GST_BUFFER_DTS:
+ * @buf: a #GstBuffer.
+ *
+ * Gets the decoding timestamp (dts) in nanoseconds (as a #GstClockTime)
+ * of the data in the buffer. This is the timestamp when the media should be
+ * decoded or processed otherwise.
+ *
+ * Value will be %GST_CLOCK_TIME_NONE if the dts is unknown.
+ */
+#define GST_BUFFER_DTS(buf) (GST_BUFFER_CAST(buf)->dts)
+/**
+ * GST_BUFFER_DTS_OR_PTS:
+ * @buf: a #GstBuffer.
+ *
+ * Returns the buffer decoding timestamp (dts) if valid, else the buffer
+ * presentation time (pts)
+ *
+ * Since: 1.8
+ */
+#define GST_BUFFER_DTS_OR_PTS(buf) (GST_BUFFER_DTS_IS_VALID(buf) ? GST_BUFFER_DTS(buf) : GST_BUFFER_PTS (buf))
+/**
+ * GST_BUFFER_DURATION:
+ * @buf: a #GstBuffer.
+ *
+ * Gets the duration in nanoseconds (as a #GstClockTime) of the data in the buffer.
+ *
+ * Value will be %GST_CLOCK_TIME_NONE if the duration is unknown.
+ */
+#define GST_BUFFER_DURATION(buf) (GST_BUFFER_CAST(buf)->duration)
+/**
+ * GST_BUFFER_OFFSET:
+ * @buf: a #GstBuffer.
+ *
+ * Gets the offset in the source file of the beginning of this buffer.
+ */
+#define GST_BUFFER_OFFSET(buf) (GST_BUFFER_CAST(buf)->offset)
+/**
+ * GST_BUFFER_OFFSET_END:
+ * @buf: a #GstBuffer.
+ *
+ * Gets the offset in the source file of the end of this buffer.
+ */
+#define GST_BUFFER_OFFSET_END(buf) (GST_BUFFER_CAST(buf)->offset_end)
+
+/**
+ * GST_BUFFER_OFFSET_NONE:
+ *
+ * Constant for no-offset return results.
+ */
+#define GST_BUFFER_OFFSET_NONE ((guint64)-1)
+
+/**
+ * GST_BUFFER_DURATION_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the duration is known.
+ */
+#define GST_BUFFER_DURATION_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
+/**
+ * GST_BUFFER_PTS_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the pts is known.
+ */
+#define GST_BUFFER_PTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))
+/**
+ * GST_BUFFER_DTS_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the dts is known.
+ */
+#define GST_BUFFER_DTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer)))
+/**
+ * GST_BUFFER_OFFSET_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the start offset is known.
+ */
+#define GST_BUFFER_OFFSET_IS_VALID(buffer) (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE)
+/**
+ * GST_BUFFER_OFFSET_END_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the end offset is known.
+ */
+#define GST_BUFFER_OFFSET_END_IS_VALID(buffer) (GST_BUFFER_OFFSET_END (buffer) != GST_BUFFER_OFFSET_NONE)
+/**
+ * GST_BUFFER_IS_DISCONT:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the buffer marks a discontinuity in the stream.
+ */
+#define GST_BUFFER_IS_DISCONT(buffer) (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))
+
+/**
+ * GstBufferFlags:
+ * @GST_BUFFER_FLAG_LIVE: the buffer is live data and should be discarded in
+ * the PAUSED state.
+ * @GST_BUFFER_FLAG_DECODE_ONLY: the buffer contains data that should be dropped
+ * because it will be clipped against the segment
+ * boundaries or because it does not contain data
+ * that should be shown to the user.
+ * @GST_BUFFER_FLAG_DISCONT: the buffer marks a data discontinuity in the stream.
+ * This typically occurs after a seek or a dropped buffer
+ * from a live or network source.
+ * @GST_BUFFER_FLAG_RESYNC: the buffer timestamps might have a discontinuity
+ * and this buffer is a good point to resynchronize.
+ * @GST_BUFFER_FLAG_CORRUPTED: the buffer data is corrupted.
+ * @GST_BUFFER_FLAG_MARKER: the buffer contains a media specific marker. for
+ * video this is the end of a frame boundary, for audio
+ * this is the start of a talkspurt.
+ * @GST_BUFFER_FLAG_HEADER: the buffer contains header information that is
+ * needed to decode the following data.
+ * @GST_BUFFER_FLAG_GAP: the buffer has been created to fill a gap in the
+ * stream and contains media neutral data (elements can
+ * switch to optimized code path that ignores the buffer
+ * content).
+ * @GST_BUFFER_FLAG_DROPPABLE: the buffer can be dropped without breaking the
+ * stream, for example to reduce bandwidth.
+ * @GST_BUFFER_FLAG_DELTA_UNIT: this unit cannot be decoded independently.
+ * @GST_BUFFER_FLAG_TAG_MEMORY: this flag is set when memory of the buffer
+ * is added/removed
+ * @GST_BUFFER_FLAG_LAST: additional media specific flags can be added starting from
+ * this flag.
+ *
+ * A set of buffer flags used to describe properties of a #GstBuffer.
+ */
+typedef enum {
+ GST_BUFFER_FLAG_LIVE = (GST_MINI_OBJECT_FLAG_LAST << 0),
+ GST_BUFFER_FLAG_DECODE_ONLY = (GST_MINI_OBJECT_FLAG_LAST << 1),
+ GST_BUFFER_FLAG_DISCONT = (GST_MINI_OBJECT_FLAG_LAST << 2),
+ GST_BUFFER_FLAG_RESYNC = (GST_MINI_OBJECT_FLAG_LAST << 3),
+ GST_BUFFER_FLAG_CORRUPTED = (GST_MINI_OBJECT_FLAG_LAST << 4),
+ GST_BUFFER_FLAG_MARKER = (GST_MINI_OBJECT_FLAG_LAST << 5),
+ GST_BUFFER_FLAG_HEADER = (GST_MINI_OBJECT_FLAG_LAST << 6),
+ GST_BUFFER_FLAG_GAP = (GST_MINI_OBJECT_FLAG_LAST << 7),
+ GST_BUFFER_FLAG_DROPPABLE = (GST_MINI_OBJECT_FLAG_LAST << 8),
+ GST_BUFFER_FLAG_DELTA_UNIT = (GST_MINI_OBJECT_FLAG_LAST << 9),
+ GST_BUFFER_FLAG_TAG_MEMORY = (GST_MINI_OBJECT_FLAG_LAST << 10),
+
+ /**
+ * GST_BUFFER_FLAG_SYNC_AFTER:
+ *
+ * Elements which write to disk or permanent storage should ensure the data
+ * is synced after writing the contents of this buffer.
+ *
+ * Since: 1.6
+ */
+ GST_BUFFER_FLAG_SYNC_AFTER = (GST_MINI_OBJECT_FLAG_LAST << 11),
+
+ /**
+ * GST_BUFFER_FLAG_NON_DROPPABLE:
+ *
+ * This buffer is important and should not be dropped.
+ *
+ * This can be used to mark important buffers, e.g. to flag RTP packets
+ * carrying keyframes or codec setup data for RTP Forward Error Correction
+ * purposes, or to prevent still video frames from being dropped by elements
+ * due to QoS.
+ *
+ * Since: 1.14
+ */
+ GST_BUFFER_FLAG_NON_DROPPABLE = (GST_MINI_OBJECT_FLAG_LAST << 12),
+
+ GST_BUFFER_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 16)
+} GstBufferFlags;
+
+/**
+ * GstBuffer:
+ * @mini_object: the parent structure
+ * @pool: pointer to the pool owner of the buffer
+ * @pts: presentation timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
+ * pts is not known or relevant. The pts contains the timestamp when the
+ * media should be presented to the user.
+ * @dts: decoding timestamp of the buffer, can be #GST_CLOCK_TIME_NONE when the
+ * dts is not known or relevant. The dts contains the timestamp when the
+ * media should be processed.
+ * @duration: duration in time of the buffer data, can be #GST_CLOCK_TIME_NONE
+ * when the duration is not known or relevant.
+ * @offset: a media specific offset for the buffer data.
+ * For video frames, this is the frame number of this buffer.
+ * For audio samples, this is the offset of the first sample in this buffer.
+ * For file data or compressed data this is the byte offset of the first
+ * byte in this buffer.
+ * @offset_end: the last offset contained in this buffer. It has the same
+ * format as @offset.
+ *
+ * The structure of a #GstBuffer. Use the associated macros to access the public
+ * variables.
+ */
+struct _GstBuffer {
+ GstMiniObject mini_object;
+
+ /*< public >*/ /* with COW */
+ GstBufferPool *pool;
+
+ /* timestamp */
+ GstClockTime pts;
+ GstClockTime dts;
+ GstClockTime duration;
+
+ /* media specific offset */
+ guint64 offset;
+ guint64 offset_end;
+};
+
+GST_API
+GType gst_buffer_get_type (void);
+
+GST_API
+guint gst_buffer_get_max_memory (void);
+
+/* allocation */
+
+GST_API
+GstBuffer * gst_buffer_new (void);
+
+GST_API
+GstBuffer * gst_buffer_new_allocate (GstAllocator * allocator, gsize size,
+ GstAllocationParams * params);
+GST_API
+GstBuffer * gst_buffer_new_wrapped_full (GstMemoryFlags flags, gpointer data, gsize maxsize,
+ gsize offset, gsize size, gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+GstBuffer * gst_buffer_new_wrapped (gpointer data, gsize size);
+
+GST_API
+GstBuffer * gst_buffer_new_wrapped_bytes (GBytes * bytes);
+
+GST_API
+GstBuffer * gst_buffer_new_memdup (gconstpointer data, gsize size);
+
+/* memory blocks */
+
+GST_API
+guint gst_buffer_n_memory (GstBuffer *buffer);
+
+GST_API
+void gst_buffer_insert_memory (GstBuffer *buffer, gint idx, GstMemory *mem);
+
+GST_API
+void gst_buffer_replace_memory_range (GstBuffer *buffer, guint idx, gint length, GstMemory *mem);
+
+GST_API
+GstMemory * gst_buffer_peek_memory (GstBuffer *buffer, guint idx);
+
+GST_API
+GstMemory * gst_buffer_get_memory_range (GstBuffer *buffer, guint idx, gint length);
+
+GST_API
+void gst_buffer_remove_memory_range (GstBuffer *buffer, guint idx, gint length);
+
+GST_API
+void gst_buffer_prepend_memory (GstBuffer *buffer, GstMemory *mem);
+
+GST_API
+void gst_buffer_append_memory (GstBuffer *buffer, GstMemory *mem);
+
+GST_API
+void gst_buffer_replace_memory (GstBuffer *buffer, guint idx, GstMemory *mem);
+
+GST_API
+void gst_buffer_replace_all_memory (GstBuffer *buffer, GstMemory *mem);
+
+GST_API
+GstMemory * gst_buffer_get_memory (GstBuffer *buffer, guint idx);
+
+GST_API
+GstMemory * gst_buffer_get_all_memory (GstBuffer *buffer);
+
+GST_API
+void gst_buffer_remove_memory (GstBuffer *buffer, guint idx);
+
+GST_API
+void gst_buffer_remove_all_memory (GstBuffer *buffer);
+
+GST_API
+gboolean gst_buffer_find_memory (GstBuffer *buffer, gsize offset, gsize size,
+ guint *idx, guint *length, gsize *skip);
+GST_API
+gboolean gst_buffer_is_memory_range_writable (GstBuffer *buffer, guint idx, gint length);
+
+GST_API
+gboolean gst_buffer_is_all_memory_writable (GstBuffer *buffer);
+
+GST_API
+gsize gst_buffer_fill (GstBuffer *buffer, gsize offset,
+ gconstpointer src, gsize size);
+GST_API
+gsize gst_buffer_extract (GstBuffer *buffer, gsize offset,
+ gpointer dest, gsize size);
+GST_API
+gint gst_buffer_memcmp (GstBuffer *buffer, gsize offset,
+ gconstpointer mem, gsize size);
+GST_API
+gsize gst_buffer_memset (GstBuffer *buffer, gsize offset,
+ guint8 val, gsize size);
+GST_API
+gsize gst_buffer_get_sizes_range (GstBuffer *buffer, guint idx, gint length,
+ gsize *offset, gsize *maxsize);
+GST_API
+gboolean gst_buffer_resize_range (GstBuffer *buffer, guint idx, gint length,
+ gssize offset, gssize size);
+GST_API
+gsize gst_buffer_get_sizes (GstBuffer *buffer, gsize *offset, gsize *maxsize);
+
+GST_API
+gsize gst_buffer_get_size (GstBuffer *buffer);
+
+GST_API
+void gst_buffer_resize (GstBuffer *buffer, gssize offset, gssize size);
+
+GST_API
+void gst_buffer_set_size (GstBuffer *buffer, gssize size);
+
+GST_API
+gboolean gst_buffer_map_range (GstBuffer *buffer, guint idx, gint length,
+ GstMapInfo *info, GstMapFlags flags);
+GST_API
+gboolean gst_buffer_map (GstBuffer *buffer, GstMapInfo *info, GstMapFlags flags);
+
+GST_API
+void gst_buffer_unmap (GstBuffer *buffer, GstMapInfo *info);
+
+GST_API
+void gst_buffer_extract_dup (GstBuffer *buffer, gsize offset,
+ gsize size, gpointer *dest,
+ gsize *dest_size);
+GST_API
+GstBufferFlags gst_buffer_get_flags (GstBuffer * buffer);
+
+GST_API
+gboolean gst_buffer_has_flags (GstBuffer * buffer, GstBufferFlags flags);
+
+GST_API
+gboolean gst_buffer_set_flags (GstBuffer * buffer, GstBufferFlags flags);
+
+GST_API
+gboolean gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags flags);
+
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstBuffer *
+gst_buffer_ref (GstBuffer * buf)
+{
+ return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
+}
+
+static inline void
+gst_buffer_unref (GstBuffer * buf)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
+}
+
+static inline void
+gst_clear_buffer (GstBuffer ** buf_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) buf_ptr);
+}
+
+/* copy buffer */
+static inline GstBuffer *
+gst_buffer_copy (const GstBuffer * buf)
+{
+ return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstBuffer * gst_buffer_ref (GstBuffer * buf);
+
+GST_API
+void gst_buffer_unref (GstBuffer * buf);
+
+GST_API
+void gst_clear_buffer (GstBuffer ** buf_ptr);
+
+GST_API
+GstBuffer * gst_buffer_copy (const GstBuffer * buf);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+GST_API
+GstBuffer * gst_buffer_copy_deep (const GstBuffer * buf);
+
+/**
+ * GstBufferCopyFlags:
+ * @GST_BUFFER_COPY_NONE: copy nothing
+ * @GST_BUFFER_COPY_FLAGS: flag indicating that buffer flags should be copied
+ * @GST_BUFFER_COPY_TIMESTAMPS: flag indicating that buffer pts, dts,
+ * duration, offset and offset_end should be copied
+ * @GST_BUFFER_COPY_MEMORY: flag indicating that buffer memory should be reffed
+ * and appended to already existing memory. Unless the memory is marked as
+ * NO_SHARE, no actual copy of the memory is made but it is simply reffed.
+ * Add @GST_BUFFER_COPY_DEEP to force a real copy.
+ * @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be
+ * merged
+ * @GST_BUFFER_COPY_META: flag indicating that buffer meta should be
+ * copied
+ *
+ * A set of flags that can be provided to the gst_buffer_copy_into()
+ * function to specify which items should be copied.
+ */
+typedef enum {
+ GST_BUFFER_COPY_NONE = 0,
+ GST_BUFFER_COPY_FLAGS = (1 << 0),
+ GST_BUFFER_COPY_TIMESTAMPS = (1 << 1),
+ GST_BUFFER_COPY_META = (1 << 2),
+ GST_BUFFER_COPY_MEMORY = (1 << 3),
+ GST_BUFFER_COPY_MERGE = (1 << 4),
+
+ /**
+ * GST_BUFFER_COPY_DEEP:
+ *
+ * flag indicating that memory should always be copied instead of reffed
+ *
+ * Since: 1.2
+ */
+ GST_BUFFER_COPY_DEEP = (1 << 5)
+} GstBufferCopyFlags;
+
+/**
+ * GST_BUFFER_COPY_METADATA: (value 7) (type GstBufferCopyFlags)
+ *
+ * Combination of all possible metadata fields that can be copied with
+ * gst_buffer_copy_into().
+ */
+#define GST_BUFFER_COPY_METADATA ((GstBufferCopyFlags) (GST_BUFFER_COPY_FLAGS |\
+ GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_META))
+
+/**
+ * GST_BUFFER_COPY_ALL: (value 15) (type GstBufferCopyFlags)
+ *
+ * Combination of all possible fields that can be copied with
+ * gst_buffer_copy_into().
+ */
+#define GST_BUFFER_COPY_ALL ((GstBufferCopyFlags)(GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY))
+
+/* copies memory or metadata into newly allocated buffer */
+
+GST_API
+gboolean gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src,
+ GstBufferCopyFlags flags,
+ gsize offset, gsize size);
+
+/**
+ * gst_buffer_is_writable:
+ * @buf: a #GstBuffer
+ *
+ * Tests if you can safely write to a buffer's metadata or its memory array.
+ * It is only safe to change buffer metadata when the current reference is
+ * writable, i.e. nobody can see the modifications you will make.
+ */
+#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (buf))
+/**
+ * gst_buffer_make_writable:
+ * @buf: (transfer full): a #GstBuffer
+ *
+ * Returns a writable copy of @buf. If the source buffer is
+ * already writable, this will simply return the same buffer.
+ *
+ * Use this function to ensure that a buffer can be safely modified before
+ * making changes to it, including changing the metadata such as PTS/DTS.
+ *
+ * If the reference count of the source buffer @buf is exactly one, the caller
+ * is the sole owner and this function will return the buffer object unchanged.
+ *
+ * If there is more than one reference on the object, a copy will be made using
+ * gst_buffer_copy(). The passed-in @buf will be unreffed in that case, and the
+ * caller will now own a reference to the new returned buffer object. Note
+ * that this just copies the buffer structure itself, the underlying memory is
+ * not copied if it can be shared amongst multiple buffers.
+ *
+ * In short, this function unrefs the buf in the argument and refs the buffer
+ * that it returns. Don't access the argument after calling this function unless
+ * you have an additional reference to it.
+ *
+ * Returns: (transfer full): a writable buffer which may or may not be the
+ * same as @buf
+ */
+#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf)
+{
+ return gst_mini_object_replace ((GstMiniObject **) obuf, (GstMiniObject *) nbuf);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_buffer_replace (GstBuffer ** obuf,
+ GstBuffer * nbuf);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/* creating a region */
+
+GST_API
+GstBuffer* gst_buffer_copy_region (GstBuffer *parent, GstBufferCopyFlags flags,
+ gsize offset, gsize size);
+
+/* append two buffers */
+
+GST_API
+GstBuffer* gst_buffer_append_region (GstBuffer *buf1, GstBuffer *buf2,
+ gssize offset, gssize size);
+GST_API
+GstBuffer* gst_buffer_append (GstBuffer *buf1, GstBuffer *buf2);
+
+/* metadata */
+#include <gst/gstmeta.h>
+
+/**
+ * GstBufferForeachMetaFunc:
+ * @buffer: a #GstBuffer
+ * @meta: (out) (nullable): a pointer to a #GstMeta
+ * @user_data: user data passed to gst_buffer_foreach_meta()
+ *
+ * A function that will be called from gst_buffer_foreach_meta(). The @meta
+ * field will point to a the reference of the meta.
+ *
+ * @buffer should not be modified from this callback.
+ *
+ * When this function returns %TRUE, the next meta will be
+ * returned. When %FALSE is returned, gst_buffer_foreach_meta() will return.
+ *
+ * When @meta is set to %NULL, the item will be removed from the buffer.
+ *
+ * Returns: %FALSE when gst_buffer_foreach_meta() should stop
+ */
+typedef gboolean (*GstBufferForeachMetaFunc) (GstBuffer *buffer, GstMeta **meta,
+ gpointer user_data);
+
+GST_API
+GstMeta * gst_buffer_get_meta (GstBuffer *buffer, GType api);
+
+GST_API
+guint gst_buffer_get_n_meta (GstBuffer *buffer, GType api_type);
+
+GST_API
+GstMeta * gst_buffer_add_meta (GstBuffer *buffer, const GstMetaInfo *info,
+ gpointer params);
+GST_API
+gboolean gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta);
+
+GST_API
+GstMeta * gst_buffer_iterate_meta (GstBuffer *buffer, gpointer *state);
+
+GST_API
+GstMeta * gst_buffer_iterate_meta_filtered (GstBuffer * buffer,
+ gpointer * state,
+ GType meta_api_type);
+GST_API
+gboolean gst_buffer_foreach_meta (GstBuffer *buffer,
+ GstBufferForeachMetaFunc func,
+ gpointer user_data);
+
+GST_API
+GstCustomMeta * gst_buffer_add_custom_meta (GstBuffer *buffer,
+ const gchar *name);
+
+GST_API
+GstCustomMeta * gst_buffer_get_custom_meta (GstBuffer *buffer,
+ const gchar *name);
+
+/**
+ * gst_value_set_buffer:
+ * @v: a #GValue to receive the data
+ * @b: (transfer none): a #GstBuffer to assign to the GstValue
+ *
+ * Sets @b as the value of @v. Caller retains reference to buffer.
+ */
+#define gst_value_set_buffer(v,b) g_value_set_boxed((v),(b))
+/**
+ * gst_value_take_buffer:
+ * @v: a #GValue to receive the data
+ * @b: (transfer full): a #GstBuffer to assign to the GstValue
+ *
+ * Sets @b as the value of @v. Caller gives away reference to buffer.
+ */
+#define gst_value_take_buffer(v,b) g_value_take_boxed(v,(b))
+/**
+ * gst_value_get_buffer:
+ * @v: a #GValue to query
+ *
+ * Receives a #GstBuffer as the value of @v. Does not return a reference to
+ * the buffer, so the pointer is only valid for as long as the caller owns
+ * a reference to @v.
+ *
+ * Returns: (transfer none): buffer
+ */
+#define gst_value_get_buffer(v) GST_BUFFER_CAST (g_value_get_boxed(v))
+
+typedef struct _GstParentBufferMeta GstParentBufferMeta;
+
+/**
+ * GstParentBufferMeta:
+ * @parent: the parent #GstMeta structure
+ * @buffer: the #GstBuffer on which a reference is being held.
+ *
+ * The #GstParentBufferMeta is a #GstMeta which can be attached to a #GstBuffer
+ * to hold a reference to another buffer that is only released when the child
+ * #GstBuffer is released.
+ *
+ * Typically, #GstParentBufferMeta is used when the child buffer is directly
+ * using the #GstMemory of the parent buffer, and wants to prevent the parent
+ * buffer from being returned to a buffer pool until the #GstMemory is available
+ * for re-use.
+ *
+ * Since: 1.6
+ */
+struct _GstParentBufferMeta
+{
+ GstMeta parent;
+
+ /*< public >*/
+ GstBuffer *buffer;
+};
+
+GST_API
+GType gst_parent_buffer_meta_api_get_type (void);
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_TYPE_PARENT_BUFFER_META_API_TYPE GST_PARENT_BUFFER_META_API_TYPE
+#endif
+#define GST_PARENT_BUFFER_META_API_TYPE (gst_parent_buffer_meta_api_get_type())
+
+/**
+ * gst_buffer_get_parent_buffer_meta:
+ * @b: a #GstBuffer
+ *
+ * Finds and returns a #GstParentBufferMeta if one exists on the
+ * buffer
+ */
+#define gst_buffer_get_parent_buffer_meta(b) \
+ ((GstParentBufferMeta*)gst_buffer_get_meta((b),GST_PARENT_BUFFER_META_API_TYPE))
+
+GST_API
+const GstMetaInfo *gst_parent_buffer_meta_get_info (void);
+#define GST_PARENT_BUFFER_META_INFO (gst_parent_buffer_meta_get_info())
+
+/* implementation */
+
+GST_API
+GstParentBufferMeta *gst_buffer_add_parent_buffer_meta (GstBuffer *buffer,
+ GstBuffer *ref);
+
+typedef struct _GstReferenceTimestampMeta GstReferenceTimestampMeta;
+
+/**
+ * GstReferenceTimestampMeta:
+ * @parent: the parent #GstMeta structure
+ * @reference: identifier for the timestamp reference.
+ * @timestamp: timestamp
+ * @duration: duration, or %GST_CLOCK_TIME_NONE
+ *
+ * #GstReferenceTimestampMeta can be used to attach alternative timestamps and
+ * possibly durations to a #GstBuffer. These are generally not according to
+ * the pipeline clock and could be e.g. the NTP timestamp when the media was
+ * captured.
+ *
+ * The reference is stored as a #GstCaps in @reference. Examples of valid
+ * references would be `timestamp/x-drivername-stream` for timestamps that are locally
+ * generated by some driver named `drivername` when generating the stream,
+ * e.g. based on a frame counter, or `timestamp/x-ntp, host=pool.ntp.org,
+ * port=123` for timestamps based on a specific NTP server.
+ *
+ * Since: 1.14
+ */
+struct _GstReferenceTimestampMeta
+{
+ GstMeta parent;
+
+ /*< public >*/
+ GstCaps *reference;
+ GstClockTime timestamp, duration;
+};
+
+GST_API
+GType gst_reference_timestamp_meta_api_get_type (void);
+#define GST_REFERENCE_TIMESTAMP_META_API_TYPE (gst_reference_timestamp_meta_api_get_type())
+
+GST_API
+const GstMetaInfo *gst_reference_timestamp_meta_get_info (void);
+#define GST_REFERENCE_TIMESTAMP_META_INFO (gst_reference_timestamp_meta_get_info())
+
+/* implementation */
+
+GST_API
+GstReferenceTimestampMeta * gst_buffer_add_reference_timestamp_meta (GstBuffer * buffer,
+ GstCaps * reference,
+ GstClockTime timestamp,
+ GstClockTime duration);
+
+GST_API
+GstReferenceTimestampMeta * gst_buffer_get_reference_timestamp_meta (GstBuffer * buffer,
+ GstCaps * reference);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBuffer, gst_buffer_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBufferPool, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BUFFER_H__ */
diff --git a/include/gst/gstbufferlist.h b/include/gst/gstbufferlist.h
new file mode 100644
index 0000000000..607771731f
--- /dev/null
+++ b/include/gst/gstbufferlist.h
@@ -0,0 +1,187 @@
+/* GStreamer
+ * Copyright (C) 2009 Axis Communications <dev-gstreamer at axis dot com>
+ * @author Jonas Holmberg <jonas dot holmberg at axis dot com>
+ *
+ * gstbufferlist.h: Header for GstBufferList object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BUFFER_LIST_H__
+#define __GST_BUFFER_LIST_H__
+
+#include <gst/gstbuffer.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_buffer_list_type;
+
+#define GST_TYPE_BUFFER_LIST (_gst_buffer_list_type)
+#define GST_IS_BUFFER_LIST(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER_LIST))
+#define GST_BUFFER_LIST_CAST(obj) ((GstBufferList *)obj)
+#define GST_BUFFER_LIST(obj) (GST_BUFFER_LIST_CAST(obj))
+
+typedef struct _GstBufferList GstBufferList;
+
+/**
+ * GstBufferListFunc:
+ * @buffer: (out) (nullable): pointer to the buffer
+ * @idx: the index of @buffer
+ * @user_data: user data passed to gst_buffer_list_foreach()
+ *
+ * A function that will be called from gst_buffer_list_foreach(). The @buffer
+ * field will point to a the reference of the buffer at @idx.
+ *
+ * When this function returns %TRUE, the next buffer will be
+ * returned. When %FALSE is returned, gst_buffer_list_foreach() will return.
+ *
+ * When @buffer is set to %NULL, the item will be removed from the bufferlist.
+ * When @buffer has been made writable, the new buffer reference can be assigned
+ * to @buffer. This function is responsible for unreffing the old buffer when
+ * removing or modifying.
+ *
+ * Returns: %FALSE when gst_buffer_list_foreach() should stop
+ */
+typedef gboolean (*GstBufferListFunc) (GstBuffer **buffer, guint idx,
+ gpointer user_data);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstBufferList *
+gst_buffer_list_ref (GstBufferList * list)
+{
+ return GST_BUFFER_LIST_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (
+ list)));
+}
+
+static inline void
+gst_buffer_list_unref(GstBufferList* list)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
+}
+
+static inline void
+gst_clear_buffer_list (GstBufferList ** list_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) list_ptr);
+}
+
+/* copy */
+static inline GstBufferList *
+gst_buffer_list_copy (const GstBufferList * list)
+{
+ return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (list)));
+}
+
+static inline gboolean
+gst_buffer_list_replace (GstBufferList **old_list, GstBufferList *new_list)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_list,
+ (GstMiniObject *) new_list);
+}
+
+static inline gboolean
+gst_buffer_list_take (GstBufferList **old_list, GstBufferList *new_list)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_list,
+ (GstMiniObject *) new_list);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstBufferList * gst_buffer_list_ref (GstBufferList * list);
+
+GST_API
+void gst_buffer_list_unref (GstBufferList * list);
+
+GST_API
+void gst_clear_buffer_list (GstBufferList ** list_ptr);
+
+GST_API
+GstBufferList * gst_buffer_list_copy (const GstBufferList * list);
+
+GST_API
+gboolean gst_buffer_list_replace (GstBufferList ** old_list,
+ GstBufferList * new_list);
+
+GST_API
+gboolean gst_buffer_list_take (GstBufferList ** old_list,
+ GstBufferList * new_list);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_buffer_list_is_writable:
+ * @list: a #GstBufferList
+ *
+ * Tests if you can safely add buffers and groups into a buffer list.
+ */
+#define gst_buffer_list_is_writable(list) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (list))
+
+/**
+ * gst_buffer_list_make_writable:
+ * @list: (transfer full): a #GstBufferList
+ *
+ * Makes a writable buffer list from the given buffer list. If the source buffer
+ * list is already writable, this will simply return the same buffer list. A
+ * copy will otherwise be made using gst_buffer_list_copy().
+ *
+ * Returns: (transfer full): a writable list, which may or may not be the
+ * same as @list
+ */
+#define gst_buffer_list_make_writable(list) GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (list)))
+
+GST_API
+GType gst_buffer_list_get_type (void);
+
+/* allocation */
+
+GST_API
+GstBufferList * gst_buffer_list_new (void) G_GNUC_MALLOC;
+
+GST_API
+GstBufferList * gst_buffer_list_new_sized (guint size) G_GNUC_MALLOC;
+
+GST_API
+guint gst_buffer_list_length (GstBufferList *list);
+
+GST_API
+GstBuffer * gst_buffer_list_get (GstBufferList *list, guint idx);
+
+GST_API
+GstBuffer * gst_buffer_list_get_writable (GstBufferList *list, guint idx);
+
+GST_API
+void gst_buffer_list_insert (GstBufferList *list, gint idx, GstBuffer *buffer);
+
+GST_API
+void gst_buffer_list_remove (GstBufferList *list, guint idx, guint length);
+
+GST_API
+gboolean gst_buffer_list_foreach (GstBufferList *list,
+ GstBufferListFunc func,
+ gpointer user_data);
+GST_API
+GstBufferList * gst_buffer_list_copy_deep (const GstBufferList * list);
+
+GST_API
+gsize gst_buffer_list_calculate_size (GstBufferList * list);
+
+#define gst_buffer_list_add(l,b) gst_buffer_list_insert((l),-1,(b));
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBufferList, gst_buffer_list_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BUFFER_LIST_H__ */
diff --git a/include/gst/gstbufferpool.h b/include/gst/gstbufferpool.h
new file mode 100644
index 0000000000..18b73a0b37
--- /dev/null
+++ b/include/gst/gstbufferpool.h
@@ -0,0 +1,350 @@
+/* GStreamer
+ * Copyright (C) 2010 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstbufferpool.h: Header for GstBufferPool object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_BUFFER_POOL_H__
+#define __GST_BUFFER_POOL_H__
+
+#include <gst/gstminiobject.h>
+#include <gst/gstpad.h>
+#include <gst/gstbuffer.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstBufferPoolPrivate GstBufferPoolPrivate;
+typedef struct _GstBufferPoolClass GstBufferPoolClass;
+
+#define GST_TYPE_BUFFER_POOL (gst_buffer_pool_get_type())
+#define GST_IS_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BUFFER_POOL))
+#define GST_IS_BUFFER_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BUFFER_POOL))
+#define GST_BUFFER_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BUFFER_POOL, GstBufferPoolClass))
+#define GST_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BUFFER_POOL, GstBufferPool))
+#define GST_BUFFER_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER_POOL, GstBufferPoolClass))
+#define GST_BUFFER_POOL_CAST(obj) ((GstBufferPool *)(obj))
+
+/**
+ * GstBufferPoolAcquireFlags:
+ * @GST_BUFFER_POOL_ACQUIRE_FLAG_NONE: no flags
+ * @GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT: buffer is keyframe
+ * @GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT: when the bufferpool is empty, acquire_buffer
+ * will by default block until a buffer is released into the pool again. Setting
+ * this flag makes acquire_buffer return #GST_FLOW_EOS instead of blocking.
+ * @GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT: buffer is discont
+ * @GST_BUFFER_POOL_ACQUIRE_FLAG_LAST: last flag, subclasses can use private flags
+ * starting from this value.
+ *
+ * Additional flags to control the allocation of a buffer
+ */
+typedef enum {
+ GST_BUFFER_POOL_ACQUIRE_FLAG_NONE = 0,
+ GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT = (1 << 0),
+ GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT = (1 << 1),
+ GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT = (1 << 2),
+ GST_BUFFER_POOL_ACQUIRE_FLAG_LAST = (1 << 16),
+} GstBufferPoolAcquireFlags;
+
+typedef struct _GstBufferPoolAcquireParams GstBufferPoolAcquireParams;
+
+/**
+ * GstBufferPoolAcquireParams:
+ * @format: the format of @start and @stop
+ * @start: the start position
+ * @stop: the stop position
+ * @flags: additional flags
+ *
+ * Parameters passed to the gst_buffer_pool_acquire_buffer() function to control the
+ * allocation of the buffer.
+ *
+ * The default implementation ignores the @start and @stop members but other
+ * implementations can use this extra information to decide what buffer to
+ * return.
+ */
+struct _GstBufferPoolAcquireParams {
+ GstFormat format;
+ gint64 start;
+ gint64 stop;
+ GstBufferPoolAcquireFlags flags;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GST_BUFFER_POOL_IS_FLUSHING:
+ * @pool: a GstBufferPool
+ *
+ * Check if the bufferpool is flushing. Subclasses might want to check the
+ * state of the pool in the acquire function.
+ */
+#define GST_BUFFER_POOL_IS_FLUSHING(pool) (g_atomic_int_get (&pool->flushing))
+
+/**
+ * GstBufferPool:
+ * @object: the parent structure
+ * @flushing: whether the pool is currently gathering back outstanding buffers
+ *
+ * The structure of a #GstBufferPool. Use the associated macros to access the public
+ * variables.
+ */
+struct _GstBufferPool {
+ GstObject object;
+
+ /*< protected >*/
+ gint flushing;
+
+ /*< private >*/
+ GstBufferPoolPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstBufferPoolClass:
+ * @object_class: Object parent class
+ *
+ * The #GstBufferPool class.
+ */
+struct _GstBufferPoolClass {
+ GstObjectClass object_class;
+
+ /*< public >*/
+
+ /**
+ * GstBufferPoolClass::get_options:
+ * @pool: the #GstBufferPool
+ *
+ * Get a list of options supported by this pool
+ *
+ * Returns: (array zero-terminated=1) (transfer none): a %NULL terminated array
+ * of strings.
+ */
+ const gchar ** (*get_options) (GstBufferPool *pool);
+
+ /**
+ * GstBufferPoolClass::set_config:
+ * @pool: the #GstBufferPool
+ * @config: the required configuration
+ *
+ * Apply the bufferpool configuration. The default configuration will parse
+ * the default config parameters.
+ *
+ * Returns: whether the configuration could be set.
+ */
+ gboolean (*set_config) (GstBufferPool *pool, GstStructure *config);
+
+ /**
+ * GstBufferPoolClass::start:
+ * @pool: the #GstBufferPool
+ *
+ * Start the bufferpool. The default implementation will preallocate
+ * min-buffers buffers and put them in the queue.
+ *
+ * Returns: whether the pool could be started.
+ */
+ gboolean (*start) (GstBufferPool *pool);
+
+ /**
+ * GstBufferPoolClass::stop:
+ * @pool: the #GstBufferPool
+ *
+ * Stop the bufferpool. the default implementation will free the
+ * preallocated buffers. This function is called when all the buffers are
+ * returned to the pool.
+ *
+ * Returns: whether the pool could be stopped.
+ */
+ gboolean (*stop) (GstBufferPool *pool);
+
+ /**
+ * GstBufferPoolClass::acquire_buffer:
+ * @pool: the #GstBufferPool
+ * @buffer: (out): a location for a #GstBuffer
+ * @params: (transfer none) (allow-none): parameters.
+ *
+ * Get a new buffer from the pool. The default implementation
+ * will take a buffer from the queue and optionally wait for a buffer to
+ * be released when there are no buffers available.
+ *
+ * Returns: a #GstFlowReturn such as %GST_FLOW_FLUSHING when the pool is
+ * inactive.
+ */
+ GstFlowReturn (*acquire_buffer) (GstBufferPool *pool, GstBuffer **buffer,
+ GstBufferPoolAcquireParams *params);
+
+ /**
+ * GstBufferPoolClass::alloc_buffer:
+ * @pool: the #GstBufferPool
+ * @buffer: (out): a location for a #GstBuffer
+ * @params: (transfer none) (allow-none): parameters.
+ *
+ * Allocate a buffer. the default implementation allocates
+ * buffers from the configured memory allocator and with the configured
+ * parameters. All metadata that is present on the allocated buffer will
+ * be marked as #GST_META_FLAG_POOLED and #GST_META_FLAG_LOCKED and will
+ * not be removed from the buffer in #GstBufferPoolClass::reset_buffer.
+ * The buffer should have the #GST_BUFFER_FLAG_TAG_MEMORY cleared.
+ *
+ * Returns: a #GstFlowReturn to indicate whether the allocation was
+ * successful.
+ */
+ GstFlowReturn (*alloc_buffer) (GstBufferPool *pool, GstBuffer **buffer,
+ GstBufferPoolAcquireParams *params);
+
+ /**
+ * GstBufferPoolClass::reset_buffer:
+ * @pool: the #GstBufferPool
+ * @buffer: the #GstBuffer to reset
+ *
+ * Reset the buffer to its state when it was freshly allocated.
+ * The default implementation will clear the flags, timestamps and
+ * will remove the metadata without the #GST_META_FLAG_POOLED flag (even
+ * the metadata with #GST_META_FLAG_LOCKED). If the
+ * #GST_BUFFER_FLAG_TAG_MEMORY was set, this function can also try to
+ * restore the memory and clear the #GST_BUFFER_FLAG_TAG_MEMORY again.
+ */
+ void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer);
+
+ /**
+ * GstBufferPoolClass::release_buffer:
+ * @pool: the #GstBufferPool
+ * @buffer: the #GstBuffer to release
+ *
+ * Release a buffer back in the pool. The default implementation
+ * will put the buffer back in the queue and notify any
+ * blocking #GstBufferPoolClass::acquire_buffer calls when the
+ * #GST_BUFFER_FLAG_TAG_MEMORY is not set on the buffer.
+ * If #GST_BUFFER_FLAG_TAG_MEMORY is set, the buffer will be freed with
+ * #GstBufferPoolClass::free_buffer.
+ */
+ void (*release_buffer) (GstBufferPool *pool, GstBuffer *buffer);
+
+ /**
+ * GstBufferPoolClass::free_buffer:
+ * @pool: the #GstBufferPool
+ * @buffer: the #GstBuffer to free
+ *
+ * Free a buffer. The default implementation unrefs the buffer.
+ */
+ void (*free_buffer) (GstBufferPool *pool, GstBuffer *buffer);
+
+ /**
+ * GstBufferPoolClass::flush_start:
+ * @pool: the #GstBufferPool
+ *
+ * Enter the flushing state.
+ *
+ * Since: 1.4
+ */
+ void (*flush_start) (GstBufferPool *pool);
+
+ /**
+ * GstBufferPoolClass::flush_stop:
+ * @pool: the #GstBufferPool
+ *
+ * Leave the flushing state.
+ *
+ * Since: 1.4
+ */
+ void (*flush_stop) (GstBufferPool *pool);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 2];
+};
+
+GST_API
+GType gst_buffer_pool_get_type (void);
+
+/* allocation */
+
+GST_API
+GstBufferPool * gst_buffer_pool_new (void);
+
+/* state management */
+
+GST_API
+gboolean gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active);
+
+GST_API
+gboolean gst_buffer_pool_is_active (GstBufferPool *pool);
+
+GST_API
+gboolean gst_buffer_pool_set_config (GstBufferPool *pool, GstStructure *config);
+
+GST_API
+GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool);
+
+GST_API
+const gchar ** gst_buffer_pool_get_options (GstBufferPool *pool);
+
+GST_API
+gboolean gst_buffer_pool_has_option (GstBufferPool *pool, const gchar *option);
+
+GST_API
+void gst_buffer_pool_set_flushing (GstBufferPool *pool, gboolean flushing);
+
+/* helpers for configuring the config structure */
+
+GST_API
+void gst_buffer_pool_config_set_params (GstStructure *config, GstCaps *caps,
+ guint size, guint min_buffers, guint max_buffers);
+
+GST_API
+gboolean gst_buffer_pool_config_get_params (GstStructure *config, GstCaps **caps,
+ guint *size, guint *min_buffers, guint *max_buffers);
+
+GST_API
+void gst_buffer_pool_config_set_allocator (GstStructure *config, GstAllocator *allocator,
+ const GstAllocationParams *params);
+
+GST_API
+gboolean gst_buffer_pool_config_get_allocator (GstStructure *config, GstAllocator **allocator,
+ GstAllocationParams *params);
+
+/* options */
+
+GST_API
+guint gst_buffer_pool_config_n_options (GstStructure *config);
+
+GST_API
+void gst_buffer_pool_config_add_option (GstStructure *config, const gchar *option);
+
+GST_API
+const gchar * gst_buffer_pool_config_get_option (GstStructure *config, guint index);
+
+GST_API
+gboolean gst_buffer_pool_config_has_option (GstStructure *config, const gchar *option);
+
+GST_API
+gboolean gst_buffer_pool_config_validate_params (GstStructure *config, GstCaps *caps,
+ guint size, guint min_buffers, guint max_buffers);
+
+/* buffer management */
+
+GST_API
+GstFlowReturn gst_buffer_pool_acquire_buffer (GstBufferPool *pool, GstBuffer **buffer,
+ GstBufferPoolAcquireParams *params);
+
+GST_API
+void gst_buffer_pool_release_buffer (GstBufferPool *pool, GstBuffer *buffer);
+
+G_END_DECLS
+
+#endif /* __GST_BUFFER_POOL_H__ */
diff --git a/include/gst/gstbus.h b/include/gst/gstbus.h
new file mode 100644
index 0000000000..d8e7583bc7
--- /dev/null
+++ b/include/gst/gstbus.h
@@ -0,0 +1,253 @@
+/* GStreamer
+ * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstbus.h: Header for GstBus subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_BUS_H__
+#define __GST_BUS_H__
+
+typedef struct _GstBus GstBus;
+typedef struct _GstBusPrivate GstBusPrivate;
+typedef struct _GstBusClass GstBusClass;
+
+#include <gst/gstmessage.h>
+#include <gst/gstclock.h>
+
+G_BEGIN_DECLS
+
+/* --- standard type macros --- */
+#define GST_TYPE_BUS (gst_bus_get_type ())
+#define GST_BUS(bus) (G_TYPE_CHECK_INSTANCE_CAST ((bus), GST_TYPE_BUS, GstBus))
+#define GST_IS_BUS(bus) (G_TYPE_CHECK_INSTANCE_TYPE ((bus), GST_TYPE_BUS))
+#define GST_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_CAST ((bclass), GST_TYPE_BUS, GstBusClass))
+#define GST_IS_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_TYPE ((bclass), GST_TYPE_BUS))
+#define GST_BUS_GET_CLASS(bus) (G_TYPE_INSTANCE_GET_CLASS ((bus), GST_TYPE_BUS, GstBusClass))
+#define GST_BUS_CAST(bus) ((GstBus*)(bus))
+
+/**
+ * GstBusFlags:
+ * @GST_BUS_FLUSHING: The bus is currently dropping all messages
+ * @GST_BUS_FLAG_LAST: offset to define more flags
+ *
+ * The standard flags that a bus may have.
+ */
+typedef enum {
+ GST_BUS_FLUSHING = (GST_OBJECT_FLAG_LAST << 0),
+ /* padding */
+ GST_BUS_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 1)
+} GstBusFlags;
+
+/**
+ * GstBusSyncReply:
+ * @GST_BUS_DROP: drop the message
+ * @GST_BUS_PASS: pass the message to the async queue
+ * @GST_BUS_ASYNC: pass message to async queue, continue if message is handled
+ *
+ * The result values for a GstBusSyncHandler.
+ */
+typedef enum
+{
+ GST_BUS_DROP = 0,
+ GST_BUS_PASS = 1,
+ GST_BUS_ASYNC = 2
+} GstBusSyncReply;
+
+/**
+ * GstBusSyncHandler:
+ * @bus: the #GstBus that sent the message
+ * @message: the #GstMessage
+ * @user_data: user data that has been given, when registering the handler
+ *
+ * Handler will be invoked synchronously, when a new message has been injected
+ * into the bus. This function is mostly used internally. Only one sync handler
+ * can be attached to a given bus.
+ *
+ * If the handler returns %GST_BUS_DROP, it should unref the message, else the
+ * message should not be unreffed by the sync handler.
+ *
+ * Returns: #GstBusSyncReply stating what to do with the message
+ */
+typedef GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer user_data);
+
+/**
+ * GstBusFunc:
+ * @bus: the #GstBus that sent the message
+ * @message: the #GstMessage
+ * @user_data: user data that has been given, when registering the handler
+ *
+ * Specifies the type of function passed to gst_bus_add_watch() or
+ * gst_bus_add_watch_full(), which is called from the mainloop when a message
+ * is available on the bus.
+ *
+ * The message passed to the function will be unreffed after execution of this
+ * function so it should not be freed in the function.
+ *
+ * Note that this function is used as a #GSourceFunc which means that returning
+ * %FALSE will remove the #GSource from the mainloop.
+ *
+ * Returns: %FALSE if the event source should be removed.
+ */
+typedef gboolean (*GstBusFunc) (GstBus * bus, GstMessage * message, gpointer user_data);
+
+/**
+ * GstBus:
+ * @object: the parent structure
+ *
+ * The opaque #GstBus data structure.
+ */
+struct _GstBus
+{
+ GstObject object;
+
+ /*< private >*/
+ GstBusPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstBusClass:
+ * @parent_class: the parent class structure
+ *
+ * GStreamer bus class.
+ */
+struct _GstBusClass
+{
+ GstObjectClass parent_class;
+
+ /* signals */
+
+ /**
+ * GstBusClass::message:
+ * @bus: the #GstBus
+ * @message: the message that has been posted asynchronously
+ *
+ * A message has been posted on the bus.
+ */
+ void (*message) (GstBus *bus, GstMessage *message);
+
+ /**
+ * GstBusClass::sync_message:
+ * @bus: the #GstBus
+ * @message: the message that has been posted synchronously
+ *
+ * A message has been posted on the bus.
+ */
+ void (*sync_message) (GstBus *bus, GstMessage *message);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_bus_get_type (void);
+
+GST_API
+GstBus* gst_bus_new (void);
+
+GST_API
+gboolean gst_bus_post (GstBus * bus, GstMessage * message);
+
+GST_API
+gboolean gst_bus_have_pending (GstBus * bus);
+
+GST_API
+GstMessage * gst_bus_peek (GstBus * bus);
+
+GST_API
+GstMessage * gst_bus_pop (GstBus * bus);
+
+GST_API
+GstMessage * gst_bus_pop_filtered (GstBus * bus, GstMessageType types);
+
+GST_API
+GstMessage * gst_bus_timed_pop (GstBus * bus, GstClockTime timeout);
+
+GST_API
+GstMessage * gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, GstMessageType types);
+
+GST_API
+void gst_bus_set_flushing (GstBus * bus, gboolean flushing);
+
+/* synchronous dispatching */
+
+GST_API
+void gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func,
+ gpointer user_data, GDestroyNotify notify);
+
+/* asynchronous message notifications */
+
+GST_API
+void gst_bus_get_pollfd (GstBus * bus, GPollFD *fd);
+
+/* GSource based dispatching */
+
+GST_API
+GSource * gst_bus_create_watch (GstBus * bus);
+
+GST_API
+guint gst_bus_add_watch_full (GstBus * bus,
+ gint priority,
+ GstBusFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+guint gst_bus_add_watch (GstBus * bus,
+ GstBusFunc func,
+ gpointer user_data);
+GST_API
+gboolean gst_bus_remove_watch (GstBus * bus);
+
+/* polling the bus */
+
+GST_API
+GstMessage* gst_bus_poll (GstBus *bus, GstMessageType events,
+ GstClockTime timeout);
+
+/* signal based dispatching helper functions. */
+
+GST_API
+gboolean gst_bus_async_signal_func (GstBus *bus, GstMessage *message,
+ gpointer data);
+GST_API
+GstBusSyncReply gst_bus_sync_signal_handler (GstBus *bus, GstMessage *message,
+ gpointer data);
+
+/* convenience api to add/remove a gsource that emits the async signals */
+
+GST_API
+void gst_bus_add_signal_watch (GstBus * bus);
+
+GST_API
+void gst_bus_add_signal_watch_full (GstBus * bus, gint priority);
+
+GST_API
+void gst_bus_remove_signal_watch (GstBus * bus);
+
+GST_API
+void gst_bus_enable_sync_message_emission (GstBus * bus);
+
+GST_API
+void gst_bus_disable_sync_message_emission (GstBus * bus);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBus, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_BUS_H__ */
diff --git a/include/gst/gstcaps.h b/include/gst/gstcaps.h
new file mode 100644
index 0000000000..d031b6fc78
--- /dev/null
+++ b/include/gst/gstcaps.h
@@ -0,0 +1,543 @@
+/* GStreamer
+ * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CAPS_H__
+#define __GST_CAPS_H__
+
+#include <gst/gstconfig.h>
+#include <gst/gstminiobject.h>
+#include <gst/gststructure.h>
+#include <gst/gstcapsfeatures.h>
+#include <gst/glib-compat.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_caps_type;
+
+#define GST_TYPE_CAPS (_gst_caps_type)
+#define GST_IS_CAPS(obj) (GST_IS_MINI_OBJECT_TYPE((obj), GST_TYPE_CAPS))
+#define GST_CAPS_CAST(obj) ((GstCaps*)(obj))
+#define GST_CAPS(obj) (GST_CAPS_CAST(obj))
+
+#define GST_TYPE_STATIC_CAPS (gst_static_caps_get_type())
+
+/**
+ * GstCapsFlags:
+ * @GST_CAPS_FLAG_ANY: Caps has no specific content, but can contain
+ * anything.
+ *
+ * Extra flags for a caps.
+ */
+typedef enum {
+ GST_CAPS_FLAG_ANY = (GST_MINI_OBJECT_FLAG_LAST << 0)
+} GstCapsFlags;
+
+/**
+ * GstCapsIntersectMode:
+ * @GST_CAPS_INTERSECT_ZIG_ZAG : Zig-zags over both caps.
+ * @GST_CAPS_INTERSECT_FIRST : Keeps the first caps order.
+ *
+ * Modes of caps intersection
+ *
+ * %GST_CAPS_INTERSECT_ZIG_ZAG tries to preserve overall order of both caps
+ * by iterating on the caps' structures as the following matrix shows:
+ *
+ * ```
+ * caps1
+ * +-------------
+ * | 1 2 4 7
+ * caps2 | 3 5 8 10
+ * | 6 9 11 12
+ * ```
+ *
+ * Used when there is no explicit precedence of one caps over the other. e.g.
+ * tee's sink pad getcaps function, it will probe its src pad peers' for their
+ * caps and intersect them with this mode.
+ *
+ * %GST_CAPS_INTERSECT_FIRST is useful when an element wants to preserve
+ * another element's caps priority order when intersecting with its own caps.
+ * Example: If caps1 is `[A, B, C]` and caps2 is `[E, B, D, A]`, the result
+ * would be `[A, B]`, maintaining the first caps priority on the intersection.
+ */
+typedef enum {
+ GST_CAPS_INTERSECT_ZIG_ZAG = 0,
+ GST_CAPS_INTERSECT_FIRST = 1
+} GstCapsIntersectMode;
+
+/**
+ * GST_CAPS_ANY:
+ *
+ * Means that the element/pad can output 'anything'. Useful for elements
+ * that output unknown media, such as filesrc. This macro returns a singleton and
+ * should not be unreffed.
+ */
+#define GST_CAPS_ANY _gst_caps_any
+/**
+ * GST_CAPS_NONE:
+ *
+ * The opposite of %GST_CAPS_ANY: it means that the pad/element outputs an
+ * undefined media type that can not be detected. This macro returns a singleton
+ * and should not be unreffed.
+ */
+#define GST_CAPS_NONE _gst_caps_none
+
+/**
+ * GST_STATIC_CAPS_ANY:
+ *
+ * Creates a new #GstCaps static caps that matches anything.
+ * This can be used in pad templates.
+ */
+#define GST_STATIC_CAPS_ANY GST_STATIC_CAPS("ANY")
+/**
+ * GST_STATIC_CAPS_NONE:
+ *
+ * Creates a new #GstCaps static caps that matches nothing.
+ * This can be used in pad templates.
+ */
+#define GST_STATIC_CAPS_NONE GST_STATIC_CAPS("NONE")
+
+/**
+ * GST_CAPS_IS_SIMPLE:
+ * @caps: the #GstCaps instance to check
+ *
+ * Checks if the number of structures in the given caps is exactly one.
+ */
+#define GST_CAPS_IS_SIMPLE(caps) (gst_caps_get_size(caps) == 1)
+
+/**
+ * GST_STATIC_CAPS:
+ * @string: the string describing the caps
+ *
+ * Creates a new #GstCaps static caps from an input string.
+ * This can be used in pad templates.
+ */
+#define GST_STATIC_CAPS(string) \
+{ \
+ /* caps */ NULL, \
+ /* string */ string, \
+ GST_PADDING_INIT \
+}
+
+typedef struct _GstCaps GstCaps;
+typedef struct _GstStaticCaps GstStaticCaps;
+
+GST_API GstCaps * _gst_caps_any;
+
+GST_API GstCaps * _gst_caps_none;
+/**
+ * GST_CAPS_FLAGS:
+ * @caps: a #GstCaps.
+ *
+ * Gets a flags word containing #GstCapsFlags flags set on this caps.
+ */
+#define GST_CAPS_FLAGS(caps) GST_MINI_OBJECT_FLAGS(caps)
+
+/* refcount */
+/**
+ * GST_CAPS_REFCOUNT:
+ * @caps: a #GstCaps
+ *
+ * Gives access to the reference count field of the caps
+ */
+#define GST_CAPS_REFCOUNT(caps) GST_MINI_OBJECT_REFCOUNT(caps)
+/**
+ * GST_CAPS_REFCOUNT_VALUE:
+ * @caps: a #GstCaps
+ *
+ * Gets the reference count value of the caps.
+ */
+#define GST_CAPS_REFCOUNT_VALUE(caps) GST_MINI_OBJECT_REFCOUNT_VALUE(caps)
+
+/**
+ * GST_CAPS_FLAG_IS_SET:
+ * @caps: a #GstCaps.
+ * @flag: the #GstCapsFlags to check.
+ *
+ * Gives the status of a specific flag on a caps.
+ */
+#define GST_CAPS_FLAG_IS_SET(caps,flag) GST_MINI_OBJECT_FLAG_IS_SET (caps, flag)
+/**
+ * GST_CAPS_FLAG_SET:
+ * @caps: a #GstCaps.
+ * @flag: the #GstCapsFlags to set.
+ *
+ * Sets a caps flag on a caps.
+ */
+#define GST_CAPS_FLAG_SET(caps,flag) GST_MINI_OBJECT_FLAG_SET (caps, flag)
+/**
+ * GST_CAPS_FLAG_UNSET:
+ * @caps: a #GstCaps.
+ * @flag: the #GstCapsFlags to clear.
+ *
+ * Clears a caps flag.
+ */
+#define GST_CAPS_FLAG_UNSET(caps,flag) GST_MINI_OBJECT_FLAG_UNSET (caps, flag)
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstCaps *
+gst_caps_ref (GstCaps * caps)
+{
+ return (GstCaps *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
+}
+
+static inline void
+gst_caps_unref (GstCaps * caps)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
+}
+
+static inline void
+gst_clear_caps (GstCaps ** caps_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) caps_ptr);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstCaps * gst_caps_ref (GstCaps * caps);
+
+GST_API
+void gst_caps_unref (GstCaps * caps);
+
+GST_API
+void gst_clear_caps (GstCaps ** caps_ptr);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/* copy caps */
+GST_API
+GstCaps * gst_caps_copy (const GstCaps * caps);
+
+#define gst_caps_copy(caps) GST_CAPS (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)))
+
+/**
+ * gst_caps_is_writable:
+ * @caps: a #GstCaps
+ *
+ * Tests if you can safely modify @caps. It is only safe to modify caps when
+ * there is only one owner of the caps - ie, the object is writable.
+ */
+#define gst_caps_is_writable(caps) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (caps))
+
+/**
+ * gst_caps_make_writable:
+ * @caps: (transfer full): a #GstCaps
+ *
+ * Returns a writable copy of @caps.
+ *
+ * If there is only one reference count on @caps, the caller must be the owner,
+ * and so this function will return the caps object unchanged. If on the other
+ * hand there is more than one reference on the object, a new caps object will
+ * be returned. The caller's reference on @caps will be removed, and instead the
+ * caller will own a reference to the returned object.
+ *
+ * In short, this function unrefs the caps in the argument and refs the caps
+ * that it returns. Don't access the argument after calling this function. See
+ * also: gst_caps_ref().
+ *
+ * Returns: (transfer full): a writable caps which may or may not be the
+ * same as @caps
+ */
+#define gst_caps_make_writable(caps) GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (caps)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
+}
+
+static inline gboolean
+gst_caps_take (GstCaps **old_caps, GstCaps *new_caps)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_caps_replace (GstCaps ** old_caps,
+ GstCaps * new_caps);
+
+GST_API
+gboolean gst_caps_take (GstCaps ** old_caps,
+ GstCaps * new_caps);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * GstCaps:
+ * @mini_object: the parent type
+ *
+ * Object describing media types.
+ */
+struct _GstCaps {
+ GstMiniObject mini_object;
+};
+
+/**
+ * GstStaticCaps:
+ * @caps: the cached #GstCaps
+ * @string: a string describing a caps
+ *
+ * Data structure to initialize #GstCaps from a string description usually
+ * used in conjunction with GST_STATIC_CAPS() and gst_static_caps_get() to
+ * instantiate a #GstCaps.
+ */
+struct _GstStaticCaps {
+ /*< public >*/
+ GstCaps *caps;
+ const char *string;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstCapsForeachFunc:
+ * @features: the #GstCapsFeatures
+ * @structure: the #GstStructure
+ * @user_data: user data
+ *
+ * A function that will be called in gst_caps_foreach(). The function may
+ * not modify @features or @structure.
+ *
+ * Returns: %TRUE if the foreach operation should continue, %FALSE if
+ * the foreach operation should stop with %FALSE.
+ *
+ * Since: 1.6
+ */
+typedef gboolean (*GstCapsForeachFunc) (GstCapsFeatures *features,
+ GstStructure *structure,
+ gpointer user_data);
+
+/**
+ * GstCapsMapFunc:
+ * @features: the #GstCapsFeatures
+ * @structure: the #GstStructure
+ * @user_data: user data
+ *
+ * A function that will be called in gst_caps_map_in_place(). The function
+ * may modify @features and @structure.
+ *
+ * Returns: %TRUE if the map operation should continue, %FALSE if
+ * the map operation should stop with %FALSE.
+ */
+typedef gboolean (*GstCapsMapFunc) (GstCapsFeatures *features,
+ GstStructure *structure,
+ gpointer user_data);
+
+/**
+ * GstCapsFilterMapFunc:
+ * @features: the #GstCapsFeatures
+ * @structure: the #GstStructure
+ * @user_data: user data
+ *
+ * A function that will be called in gst_caps_filter_and_map_in_place().
+ * The function may modify @features and @structure, and both will be
+ * removed from the caps if %FALSE is returned.
+ *
+ * Returns: %TRUE if the features and structure should be preserved,
+ * %FALSE if it should be removed.
+ */
+typedef gboolean (*GstCapsFilterMapFunc) (GstCapsFeatures *features,
+ GstStructure *structure,
+ gpointer user_data);
+
+
+GST_API
+GType gst_caps_get_type (void);
+
+GST_API
+GstCaps * gst_caps_new_empty (void);
+
+GST_API
+GstCaps * gst_caps_new_any (void);
+
+GST_API
+GstCaps * gst_caps_new_empty_simple (const char *media_type) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+GstCaps * gst_caps_new_simple (const char *media_type,
+ const char *fieldname,
+ ...) G_GNUC_NULL_TERMINATED G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_new_full (GstStructure *struct1,
+ ...) G_GNUC_NULL_TERMINATED G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_new_full_valist (GstStructure *structure,
+ va_list var_args) G_GNUC_WARN_UNUSED_RESULT;
+/**
+ * gst_static_caps_get_type: (attributes doc.skip=true)
+ */
+GST_API
+GType gst_static_caps_get_type (void);
+
+GST_API
+GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
+
+GST_API
+void gst_static_caps_cleanup (GstStaticCaps *static_caps);
+
+/* manipulation */
+
+GST_API
+void gst_caps_append (GstCaps *caps1,
+ GstCaps *caps2);
+GST_API
+void gst_caps_append_structure (GstCaps *caps,
+ GstStructure *structure);
+GST_API
+void gst_caps_append_structure_full (GstCaps *caps,
+ GstStructure *structure,
+ GstCapsFeatures *features);
+GST_API
+void gst_caps_remove_structure (GstCaps *caps, guint idx);
+
+GST_API
+GstCaps * gst_caps_merge (GstCaps *caps1,
+ GstCaps *caps2) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_merge_structure (GstCaps *caps,
+ GstStructure *structure) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_merge_structure_full (GstCaps *caps,
+ GstStructure *structure,
+ GstCapsFeatures *features) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+guint gst_caps_get_size (const GstCaps *caps);
+
+GST_API
+GstStructure * gst_caps_get_structure (const GstCaps *caps,
+ guint index);
+GST_API
+GstStructure * gst_caps_steal_structure (GstCaps *caps,
+ guint index) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+void gst_caps_set_features (GstCaps *caps,
+ guint index,
+ GstCapsFeatures * features);
+GST_API
+void gst_caps_set_features_simple (GstCaps *caps,
+ GstCapsFeatures * features);
+
+GST_API
+GstCapsFeatures * gst_caps_get_features (const GstCaps *caps,
+ guint index);
+GST_API
+GstCaps * gst_caps_copy_nth (const GstCaps *caps, guint nth) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+GstCaps * gst_caps_truncate (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+void gst_caps_set_value (GstCaps *caps,
+ const char *field,
+ const GValue *value);
+GST_API
+void gst_caps_set_simple (GstCaps *caps,
+ const char *field, ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_caps_set_simple_valist (GstCaps *caps,
+ const char *field,
+ va_list varargs);
+GST_API
+gboolean gst_caps_foreach (const GstCaps *caps,
+ GstCapsForeachFunc func,
+ gpointer user_data);
+GST_API
+gboolean gst_caps_map_in_place (GstCaps *caps,
+ GstCapsMapFunc func,
+ gpointer user_data);
+GST_API
+void gst_caps_filter_and_map_in_place (GstCaps *caps,
+ GstCapsFilterMapFunc func,
+ gpointer user_data);
+
+/* tests */
+
+GST_API
+gboolean gst_caps_is_any (const GstCaps *caps);
+
+GST_API
+gboolean gst_caps_is_empty (const GstCaps *caps);
+
+GST_API
+gboolean gst_caps_is_fixed (const GstCaps *caps);
+
+GST_API
+gboolean gst_caps_is_always_compatible (const GstCaps *caps1,
+ const GstCaps *caps2);
+GST_API
+gboolean gst_caps_is_subset (const GstCaps *subset,
+ const GstCaps *superset);
+GST_API
+gboolean gst_caps_is_subset_structure (const GstCaps *caps,
+ const GstStructure *structure);
+GST_API
+gboolean gst_caps_is_subset_structure_full (const GstCaps *caps,
+ const GstStructure *structure,
+ const GstCapsFeatures *features);
+GST_API
+gboolean gst_caps_is_equal (const GstCaps *caps1,
+ const GstCaps *caps2);
+GST_API
+gboolean gst_caps_is_equal_fixed (const GstCaps *caps1,
+ const GstCaps *caps2);
+GST_API
+gboolean gst_caps_can_intersect (const GstCaps * caps1,
+ const GstCaps * caps2);
+GST_API
+gboolean gst_caps_is_strictly_equal (const GstCaps *caps1,
+ const GstCaps *caps2);
+
+
+/* operations */
+
+GST_API
+GstCaps * gst_caps_intersect (GstCaps *caps1,
+ GstCaps *caps2) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_intersect_full (GstCaps *caps1,
+ GstCaps *caps2,
+ GstCapsIntersectMode mode) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_subtract (GstCaps *minuend,
+ GstCaps *subtrahend) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+GstCaps * gst_caps_normalize (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+GstCaps * gst_caps_simplify (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+GstCaps * gst_caps_fixate (GstCaps *caps) G_GNUC_WARN_UNUSED_RESULT;
+
+/* utility */
+
+GST_API
+gchar * gst_caps_to_string (const GstCaps *caps) G_GNUC_MALLOC;
+GST_API
+gchar * gst_caps_serialize (const GstCaps *caps, GstSerializeFlags flags) G_GNUC_MALLOC;
+
+GST_API
+GstCaps * gst_caps_from_string (const gchar *string) G_GNUC_WARN_UNUSED_RESULT;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstCaps, gst_caps_unref)
+
+G_END_DECLS
+
+#endif /* __GST_CAPS_H__ */
diff --git a/include/gst/gstcapsfeatures.h b/include/gst/gstcapsfeatures.h
new file mode 100644
index 0000000000..cdf7755080
--- /dev/null
+++ b/include/gst/gstcapsfeatures.h
@@ -0,0 +1,127 @@
+/* GStreamer
+ * Copyright (C) 2013 Collabora Ltd.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CAPS_FEATURES_H__
+#define __GST_CAPS_FEATURES_H__
+
+#include <gst/gstconfig.h>
+#include <gst/glib-compat.h>
+#include <glib-object.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstCapsFeatures GstCapsFeatures;
+
+GST_API GType _gst_caps_features_type;
+
+#define GST_TYPE_CAPS_FEATURES (_gst_caps_features_type)
+#define GST_IS_CAPS_FEATURES(object) (gst_is_caps_features(object))
+#define GST_CAPS_FEATURES_CAST(object) ((GstCapsFeatures *)(object))
+#define GST_CAPS_FEATURES(object) (GST_CAPS_FEATURES_CAST(object))
+
+#define GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY "memory:SystemMemory"
+
+GST_API GstCapsFeatures *_gst_caps_features_any;
+#define GST_CAPS_FEATURES_ANY (_gst_caps_features_any)
+
+GST_API GstCapsFeatures *_gst_caps_features_memory_system_memory;
+#define GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY (_gst_caps_features_memory_system_memory)
+
+GST_API
+GType gst_caps_features_get_type (void);
+
+GST_API
+gboolean gst_is_caps_features (gconstpointer obj);
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_empty (void);
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_any (void);
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_single (const gchar *feature) G_GNUC_MALLOC;
+
+GST_API
+GstCapsFeatures * gst_caps_features_new (const gchar *feature1, ...) G_GNUC_NULL_TERMINATED;
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_valist (const gchar *feature1, va_list varargs);
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_id (GQuark feature1, ...);
+
+GST_API
+GstCapsFeatures * gst_caps_features_new_id_valist (GQuark feature1, va_list varargs);
+
+GST_API
+gboolean gst_caps_features_set_parent_refcount (GstCapsFeatures *features, gint * refcount);
+
+GST_API
+GstCapsFeatures * gst_caps_features_copy (const GstCapsFeatures * features);
+
+GST_API
+void gst_caps_features_free (GstCapsFeatures * features);
+
+GST_API
+gchar * gst_caps_features_to_string (const GstCapsFeatures * features);
+
+GST_API
+GstCapsFeatures * gst_caps_features_from_string (const gchar * features);
+
+GST_API
+guint gst_caps_features_get_size (const GstCapsFeatures * features);
+
+GST_API
+const gchar * gst_caps_features_get_nth (const GstCapsFeatures * features, guint i);
+
+GST_API
+GQuark gst_caps_features_get_nth_id (const GstCapsFeatures * features, guint i);
+
+GST_API
+gboolean gst_caps_features_contains (const GstCapsFeatures * features, const gchar * feature);
+
+GST_API
+gboolean gst_caps_features_contains_id (const GstCapsFeatures * features, GQuark feature);
+
+GST_API
+gboolean gst_caps_features_is_equal (const GstCapsFeatures * features1, const GstCapsFeatures * features2);
+
+GST_API
+gboolean gst_caps_features_is_any (const GstCapsFeatures * features);
+
+GST_API
+void gst_caps_features_add (GstCapsFeatures * features, const gchar * feature);
+
+GST_API
+void gst_caps_features_add_id ( GstCapsFeatures * features, GQuark feature);
+
+GST_API
+void gst_caps_features_remove (GstCapsFeatures * features, const gchar * feature);
+
+GST_API
+void gst_caps_features_remove_id (GstCapsFeatures * features, GQuark feature);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstCapsFeatures, gst_caps_features_free)
+
+G_END_DECLS
+
+#endif /* __GST_CAPS_FEATURES_H__ */
diff --git a/include/gst/gstchildproxy.h b/include/gst/gstchildproxy.h
new file mode 100644
index 0000000000..deb8f21dcd
--- /dev/null
+++ b/include/gst/gstchildproxy.h
@@ -0,0 +1,162 @@
+/* GStreamer
+ * Copyright (C) 2005 Stefan Kost <ensonic@users.sf.net>
+ *
+ * gstchildproxy.h: interface header for multi child elements
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CHILD_PROXY_H__
+#define __GST_CHILD_PROXY_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+
+#define GST_TYPE_CHILD_PROXY (gst_child_proxy_get_type ())
+#define GST_CHILD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CHILD_PROXY, GstChildProxy))
+#define GST_IS_CHILD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CHILD_PROXY))
+#define GST_CHILD_PROXY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_CHILD_PROXY, GstChildProxyInterface))
+
+/**
+ * GstChildProxy:
+ *
+ * Opaque #GstChildProxy data structure.
+ */
+typedef struct _GstChildProxy GstChildProxy; /* dummy object */
+typedef struct _GstChildProxyInterface GstChildProxyInterface;
+
+/**
+ * GstChildProxyInterface:
+ * @parent: parent interface type.
+ *
+ * #GstChildProxy interface.
+ */
+struct _GstChildProxyInterface
+{
+ GTypeInterface parent;
+
+ /* methods */
+
+ /**
+ * GstChildProxyInterface.get_child_by_name:
+ * @parent: the #GstChildProxy
+ * @name: the name of the child to fetch
+ *
+ * Fetch a child object by name
+ *
+ * Returns: (transfer full) (nullable): the child object
+ */
+ GObject * (*get_child_by_name) (GstChildProxy * parent, const gchar * name);
+
+ /**
+ * GstChildProxyInterface.get_child_by_index:
+ * @parent: the #GstChildProxy
+ * @index: the index of the child to fetch
+ *
+ * Fetch a child object by index
+ *
+ * Returns: (transfer full) (nullable): the child object
+ */
+ GObject * (*get_child_by_index) (GstChildProxy * parent, guint index);
+
+ /**
+ * GstChildProxyInterface.get_children_count:
+ * @parent: the #GstChildProxy
+ *
+ * Get the number of children in @parent
+ *
+ * Returns: the number of children
+ */
+ guint (*get_children_count) (GstChildProxy * parent);
+
+ /*< private >*/
+ /* signals */
+
+ /**
+ * GstChildProxyInterface.child_added:
+ * @parent: the #GstChildProxy
+ * @child: the child object
+ * @name: the name of the child object
+ *
+ * Called when @child is added to @parent
+ */
+ void (*child_added) (GstChildProxy * parent, GObject * child, const gchar * name);
+
+ /**
+ * GstChildProxyInterface.child_removed:
+ * @parent: the #GstChildProxy
+ * @child: the child object
+ * @name: the name of the child object
+ *
+ * Called when @child is removed from @parent
+ */
+ void (*child_removed) (GstChildProxy * parent, GObject * child, const gchar * name);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_child_proxy_get_type (void);
+
+GST_API
+GObject * gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name);
+
+GST_API
+guint gst_child_proxy_get_children_count (GstChildProxy * parent);
+
+GST_API
+GObject * gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index);
+
+GST_API
+gboolean gst_child_proxy_lookup (GstChildProxy *object, const gchar *name,
+ GObject **target, GParamSpec **pspec);
+GST_API
+void gst_child_proxy_get_property (GstChildProxy * object, const gchar *name,
+ GValue *value);
+GST_API
+void gst_child_proxy_get_valist (GstChildProxy * object,
+ const gchar * first_property_name,
+ va_list var_args);
+GST_API
+void gst_child_proxy_get (GstChildProxy * object,
+ const gchar * first_property_name,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_child_proxy_set_property (GstChildProxy * object, const gchar *name,
+ const GValue *value);
+
+GST_API
+void gst_child_proxy_set_valist (GstChildProxy* object,
+ const gchar * first_property_name,
+ va_list var_args);
+GST_API
+void gst_child_proxy_set (GstChildProxy * object,
+ const gchar * first_property_name,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_child_proxy_child_added (GstChildProxy * parent, GObject * child,
+ const gchar *name);
+GST_API
+void gst_child_proxy_child_removed (GstChildProxy * parent, GObject * child,
+ const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GST_CHILD_PROXY_H__ */
diff --git a/include/gst/gstclock.h b/include/gst/gstclock.h
new file mode 100644
index 0000000000..46419c9dd1
--- /dev/null
+++ b/include/gst/gstclock.h
@@ -0,0 +1,712 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstclock.h: Header for clock subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CLOCK_H__
+#define __GST_CLOCK_H__
+
+#include <gst/gstconfig.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* --- standard type macros --- */
+#define GST_TYPE_CLOCK (gst_clock_get_type ())
+#define GST_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
+#define GST_IS_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
+#define GST_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
+#define GST_IS_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
+#define GST_CLOCK_GET_CLASS(clock) (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
+#define GST_CLOCK_CAST(clock) ((GstClock*)(clock))
+
+/**
+ * GstClockTime:
+ *
+ * A datatype to hold a time, measured in nanoseconds.
+ */
+typedef guint64 GstClockTime;
+
+/**
+ * GST_TYPE_CLOCK_TIME:
+ *
+ * The #GType of a #GstClockTime.
+ */
+#define GST_TYPE_CLOCK_TIME G_TYPE_UINT64
+
+/**
+ * GstClockTimeDiff:
+ *
+ * A datatype to hold a time difference, measured in nanoseconds.
+ */
+typedef gint64 GstClockTimeDiff;
+/**
+ * GstClockID:
+ *
+ * A datatype to hold the handle to an outstanding sync or async clock callback.
+ */
+typedef gpointer GstClockID;
+
+/**
+ * GST_CLOCK_TIME_NONE: (value 18446744073709551615) (type GstClockTime)
+ *
+ * Constant to define an undefined clock time.
+ */
+#define GST_CLOCK_TIME_NONE ((GstClockTime) -1)
+/**
+ * GST_CLOCK_TIME_IS_VALID:
+ * @time: clock time to validate
+ *
+ * Tests if a given #GstClockTime represents a valid defined time.
+ */
+#define GST_CLOCK_TIME_IS_VALID(time) (((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)
+
+/**
+ * GST_CLOCK_STIME_NONE: (value -9223372036854775808) (type GstClockTimeDiff)
+ *
+ * Constant to define an undefined clock time.
+ */
+#define GST_CLOCK_STIME_NONE ((GstClockTimeDiff)G_MININT64)
+/**
+ * GST_CLOCK_STIME_IS_VALID:
+ * @time: signed clock time to validate
+ *
+ * Tests if a given #GstClockTimeDiff of #gint64 represents a valid defined time.
+ *
+ * Since: 1.6
+ */
+#define GST_CLOCK_STIME_IS_VALID(time) (((GstClockTimeDiff)(time)) != GST_CLOCK_STIME_NONE)
+
+/**
+ * GST_SECOND: (value 1000000000) (type GstClockTimeDiff)
+ *
+ * Constant that defines one GStreamer second.
+ */
+#define GST_SECOND ((GstClockTimeDiff)(G_USEC_PER_SEC * G_GINT64_CONSTANT (1000)))
+/**
+ * GST_MSECOND: (value 1000000) (type GstClockTimeDiff)
+ *
+ * Constant that defines one GStreamer millisecond.
+ */
+#define GST_MSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000)))
+/**
+ * GST_USECOND: (value 1000) (type GstClockTimeDiff)
+ *
+ * Constant that defines one GStreamer microsecond.
+ */
+#define GST_USECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000)))
+/**
+ * GST_NSECOND: (value 1) (type GstClockTimeDiff)
+ *
+ * Constant that defines one GStreamer nanosecond
+ */
+#define GST_NSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000000)))
+
+
+/**
+ * GST_TIME_AS_SECONDS:
+ * @time: the time
+ *
+ * Converts a #GstClockTime to seconds.
+ */
+#define GST_TIME_AS_SECONDS(time) ((time) / GST_SECOND)
+/**
+ * GST_TIME_AS_MSECONDS:
+ * @time: the time
+ *
+ * Converts a #GstClockTime to milliseconds (1/1000 of a second).
+ */
+#define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))
+/**
+ * GST_TIME_AS_USECONDS:
+ * @time: the time
+ *
+ * Converts a #GstClockTime to microseconds (1/1000000 of a second).
+ */
+#define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))
+/**
+ * GST_TIME_AS_NSECONDS:
+ * @time: the time
+ *
+ * Converts a #GstClockTime to nanoseconds (1/1000000000 of a second).
+ */
+#define GST_TIME_AS_NSECONDS(time) (time)
+
+/**
+ * GST_CLOCK_DIFF:
+ * @s: the first time
+ * @e: the second time
+ *
+ * Calculates a difference between two clock times as a #GstClockTimeDiff.
+ * The difference is calculated as @e - @s.
+ */
+#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((e) - (s))
+
+/**
+ * GST_TIMEVAL_TO_TIME:
+ * @tv: the timeval to convert
+ *
+ * Converts a GTimeVal to a #GstClockTime.
+ */
+#define GST_TIMEVAL_TO_TIME(tv) (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
+
+/**
+ * GST_TIME_TO_TIMEVAL:
+ * @t: The #GstClockTime to convert
+ * @tv: The target timeval
+ *
+ * Converts a #GstClockTime to a GTimeVal
+ *
+ * > on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds,
+ * > which is about 68 years. Expect trouble if you want to schedule stuff
+ * > in your pipeline for 2038.
+ */
+#define GST_TIME_TO_TIMEVAL(t,tv) \
+G_STMT_START { \
+ g_assert ("Value of time " #t " is out of timeval's range" && \
+ ((t) / GST_SECOND) < G_MAXLONG); \
+ (tv).tv_sec = (glong) (((GstClockTime) (t)) / GST_SECOND); \
+ (tv).tv_usec = (glong) ((((GstClockTime) (t)) - \
+ ((GstClockTime) (tv).tv_sec) * GST_SECOND) \
+ / GST_USECOND); \
+} G_STMT_END
+
+/**
+ * GST_TIMESPEC_TO_TIME:
+ * @ts: the timespec to convert
+ *
+ * Converts a struct timespec (see `man pselect`) to a #GstClockTime.
+ */
+#define GST_TIMESPEC_TO_TIME(ts) (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)
+/**
+ * GST_TIME_TO_TIMESPEC:
+ * @t: The #GstClockTime to convert
+ * @ts: The target timespec
+ *
+ * Converts a #GstClockTime to a struct timespec (see `man pselect`)
+ */
+#define GST_TIME_TO_TIMESPEC(t,ts) \
+G_STMT_START { \
+ g_assert ("Value of time " #t " is out of timespec's range" && \
+ ((t) / GST_SECOND) < G_MAXLONG); \
+ (ts).tv_sec = (glong) ((t) / GST_SECOND); \
+ (ts).tv_nsec = (glong) (((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND); \
+} G_STMT_END
+
+/* timestamp debugging macros */
+/**
+ * GST_TIME_FORMAT: (skip):
+ *
+ * A string that can be used in printf-like format strings to display a
+ * #GstClockTime value in `h:m:s` format. Use GST_TIME_ARGS() to construct
+ * the matching arguments.
+ *
+ * Example:
+ *
+ * ``` C
+ * printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));
+ * ```
+ */
+#define GST_TIME_FORMAT "u:%02u:%02u.%09u"
+/**
+ * GST_TIME_ARGS: (skip):
+ * @t: a #GstClockTime
+ *
+ * Formats @t for the #GST_TIME_FORMAT format string. Note: @t will be
+ * evaluated more than once.
+ */
+#define GST_TIME_ARGS(t) \
+ GST_CLOCK_TIME_IS_VALID (t) ? \
+ (guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
+ GST_CLOCK_TIME_IS_VALID (t) ? \
+ (guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
+ GST_CLOCK_TIME_IS_VALID (t) ? \
+ (guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
+ GST_CLOCK_TIME_IS_VALID (t) ? \
+ (guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999
+/**
+ * GST_STIME_FORMAT: (skip):
+ *
+ * A string that can be used in printf-like format strings to display a signed
+ * #GstClockTimeDiff or #gint64 value in `h:m:s` format. Use GST_TIME_ARGS() to
+ * construct the matching arguments.
+ *
+ * Example:
+ *
+ * ``` C
+ * printf("%" GST_STIME_FORMAT "\n", GST_STIME_ARGS(ts));
+ * ```
+ *
+ * Since: 1.6
+ */
+#define GST_STIME_FORMAT "c%" GST_TIME_FORMAT
+/**
+ * GST_STIME_ARGS: (skip):
+ * @t: a #GstClockTimeDiff or #gint64
+ *
+ * Formats @t for the #GST_STIME_FORMAT format string. Note: @t will be
+ * evaluated more than once.
+ *
+ * Since: 1.6
+ */
+#define GST_STIME_ARGS(t) \
+ ((t) == GST_CLOCK_STIME_NONE || (t) >= 0) ? '+' : '-', \
+ GST_CLOCK_STIME_IS_VALID (t) ? \
+ (guint) (((GstClockTime)(ABS(t))) / (GST_SECOND * 60 * 60)) : 99, \
+ GST_CLOCK_STIME_IS_VALID (t) ? \
+ (guint) ((((GstClockTime)(ABS(t))) / (GST_SECOND * 60)) % 60) : 99, \
+ GST_CLOCK_STIME_IS_VALID (t) ? \
+ (guint) ((((GstClockTime)(ABS(t))) / GST_SECOND) % 60) : 99, \
+ GST_CLOCK_STIME_IS_VALID (t) ? \
+ (guint) (((GstClockTime)(ABS(t))) % GST_SECOND) : 999999999
+
+typedef struct _GstClockEntry GstClockEntry;
+typedef struct _GstClock GstClock;
+typedef struct _GstClockClass GstClockClass;
+typedef struct _GstClockPrivate GstClockPrivate;
+
+/* --- prototype for async callbacks --- */
+/**
+ * GstClockCallback:
+ * @clock: The clock that triggered the callback
+ * @time: The time it was triggered
+ * @id: The #GstClockID that expired
+ * @user_data: user data passed in the gst_clock_id_wait_async() function
+ *
+ * The function prototype of the callback.
+ *
+ * Returns: %TRUE or %FALSE (currently unused)
+ */
+typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time,
+ GstClockID id, gpointer user_data);
+/**
+ * GstClockReturn:
+ * @GST_CLOCK_OK: The operation succeeded.
+ * @GST_CLOCK_EARLY: The operation was scheduled too late.
+ * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled
+ * @GST_CLOCK_BUSY: The ClockID is busy
+ * @GST_CLOCK_BADTIME: A bad time was provided to a function.
+ * @GST_CLOCK_ERROR: An error occurred
+ * @GST_CLOCK_UNSUPPORTED: Operation is not supported
+ * @GST_CLOCK_DONE: The ClockID is done waiting
+ *
+ * The return value of a clock operation.
+ */
+typedef enum
+{
+ GST_CLOCK_OK = 0,
+ GST_CLOCK_EARLY = 1,
+ GST_CLOCK_UNSCHEDULED = 2,
+ GST_CLOCK_BUSY = 3,
+ GST_CLOCK_BADTIME = 4,
+ GST_CLOCK_ERROR = 5,
+ GST_CLOCK_UNSUPPORTED = 6,
+ GST_CLOCK_DONE = 7
+} GstClockReturn;
+
+/**
+ * GstClockEntryType:
+ * @GST_CLOCK_ENTRY_SINGLE: a single shot timeout
+ * @GST_CLOCK_ENTRY_PERIODIC: a periodic timeout request
+ *
+ * The type of the clock entry
+ */
+typedef enum {
+ GST_CLOCK_ENTRY_SINGLE,
+ GST_CLOCK_ENTRY_PERIODIC
+} GstClockEntryType;
+
+/**
+ * GST_CLOCK_ENTRY:
+ * @entry: the entry to cast
+ *
+ * Casts to a clock entry
+ */
+#define GST_CLOCK_ENTRY(entry) ((GstClockEntry *)(entry))
+
+#ifndef GST_DISABLE_DEPRECATED
+/**
+ * GST_CLOCK_ENTRY_CLOCK:
+ * @entry: the entry to query
+ *
+ * Gets the owner clock of the entry
+ *
+ * Deprecated: Use gst_clock_id_get_clock() instead.
+ */
+#define GST_CLOCK_ENTRY_CLOCK(entry) ((entry)->clock)
+#endif
+/**
+ * GST_CLOCK_ENTRY_TYPE:
+ * @entry: the entry to query
+ *
+ * Gets the type of the clock entry
+ */
+#define GST_CLOCK_ENTRY_TYPE(entry) ((entry)->type)
+/**
+ * GST_CLOCK_ENTRY_TIME:
+ * @entry: the entry to query
+ *
+ * Gets the requested time of this entry
+ */
+#define GST_CLOCK_ENTRY_TIME(entry) ((entry)->time)
+/**
+ * GST_CLOCK_ENTRY_INTERVAL:
+ * @entry: the entry to query
+ *
+ * Gets the interval of this periodic entry
+ */
+#define GST_CLOCK_ENTRY_INTERVAL(entry) ((entry)->interval)
+/**
+ * GST_CLOCK_ENTRY_STATUS:
+ * @entry: the entry to query
+ *
+ * The status of the entry
+ */
+#define GST_CLOCK_ENTRY_STATUS(entry) ((entry)->status)
+
+/**
+ * GstClockEntry:
+ * @refcount: reference counter (read-only)
+ *
+ * All pending timeouts or periodic notifies are converted into
+ * an entry.
+ * Note that GstClockEntry should be treated as an opaque structure. It must
+ * not be extended or allocated using a custom allocator.
+ */
+struct _GstClockEntry {
+ gint refcount;
+ /*< private >*/
+#ifndef GST_REMOVE_DEPRECATED
+#ifndef GST_DISABLE_DEPRECATED
+ GstClock *clock;
+#else
+ gpointer _clock;
+#endif
+#endif
+ GstClockEntryType type;
+ GstClockTime time;
+ GstClockTime interval;
+ GstClockReturn status;
+ GstClockCallback func;
+ gpointer user_data;
+ GDestroyNotify destroy_data;
+ gboolean unscheduled;
+ gboolean woken_up;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#include <gst/gstobject.h>
+
+/**
+ * GstClockFlags:
+ * @GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC: clock can do a single sync timeout request
+ * @GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC: clock can do a single async timeout request
+ * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
+ * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
+ * @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
+ * @GST_CLOCK_FLAG_CAN_SET_MASTER: clock can be slaved to a master clock
+ * @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
+ *
+ * The capabilities of this clock
+ */
+typedef enum {
+ GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC = (GST_OBJECT_FLAG_LAST << 0),
+ GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC = (GST_OBJECT_FLAG_LAST << 1),
+ GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC = (GST_OBJECT_FLAG_LAST << 2),
+ GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC = (GST_OBJECT_FLAG_LAST << 3),
+ GST_CLOCK_FLAG_CAN_SET_RESOLUTION = (GST_OBJECT_FLAG_LAST << 4),
+ GST_CLOCK_FLAG_CAN_SET_MASTER = (GST_OBJECT_FLAG_LAST << 5),
+
+ /**
+ * GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC:
+ *
+ * clock needs to be synced before it can be used
+ *
+ * Since: 1.6
+ */
+ GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC = (GST_OBJECT_FLAG_LAST << 6),
+ /* padding */
+ GST_CLOCK_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
+} GstClockFlags;
+
+/**
+ * GST_CLOCK_FLAGS:
+ * @clock: the clock to query
+ *
+ * Gets the #GstClockFlags clock flags.
+ */
+#define GST_CLOCK_FLAGS(clock) GST_OBJECT_FLAGS(clock)
+
+/**
+ * GstClock:
+ * @object: the parent structure
+ *
+ * #GstClock base structure.
+ */
+struct _GstClock {
+ GstObject object;
+
+ /*< private >*/
+ GstClockPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstClockClass:
+ * @parent_class: the parent class structure
+ *
+ * GStreamer clock class. Override the vmethods to implement the clock
+ * functionality.
+ */
+struct _GstClockClass {
+ GstObjectClass parent_class;
+
+ /*< public >*/
+ /* vtable */
+
+ /**
+ * GstClockClass::change_resolution:
+ * @clock: the #GstClock
+ * @old_resolution: the previous resolution
+ * @new_resolution: the new resolution
+ *
+ * Change the resolution of the clock. Not all values might
+ * be acceptable.
+ *
+ * Returns: the new resolution
+ */
+ GstClockTime (*change_resolution) (GstClock *clock,
+ GstClockTime old_resolution,
+ GstClockTime new_resolution);
+
+ /**
+ * GstClockClass::get_resolution:
+ * @clock: the #GstClock
+ *
+ * Get the resolution of the clock.
+ *
+ * Returns: the current resolution
+ */
+ GstClockTime (*get_resolution) (GstClock *clock);
+
+ /**
+ * GstClockClass::get_internal_time:
+ * @clock: the #GstClock
+ *
+ * Get the internal unadjusted time of the clock.
+ *
+ * Implement #GstClockClass::wait instead.
+ *
+ * Returns: the internal time
+ */
+ GstClockTime (*get_internal_time) (GstClock *clock);
+
+ /* waiting on an ID */
+
+ /**
+ * GstClockClass::wait:
+ * @clock: the #GstClock
+ * @entry: the entry to wait on
+ * @jitter: (out) (allow-none): a pointer that will contain the jitter
+ *
+ * Perform a blocking wait on the given #GstClockEntry and return
+ * the jitter.
+ *
+ * Returns: the result of the blocking wait. #GST_CLOCK_EARLY will be returned
+ * if the current clock time is past the time of @id, #GST_CLOCK_OK if
+ * @id was scheduled in time. #GST_CLOCK_UNSCHEDULED if @id was
+ * unscheduled with gst_clock_id_unschedule().
+ */
+ GstClockReturn (*wait) (GstClock *clock, GstClockEntry *entry,
+ GstClockTimeDiff *jitter);
+
+ /**
+ * GstClockClass::wait_async:
+ * @clock: the #GstClock
+ * @entry: the entry to wait on
+ *
+ * Perform an asynchronous wait on the given #GstClockEntry.
+ *
+ * Returns: the result of the non blocking wait.
+ */
+ GstClockReturn (*wait_async) (GstClock *clock, GstClockEntry *entry);
+
+ /**
+ * GstClockClass::unschedule:
+ * @clock: the #GstClock
+ * @entry: the entry to unschedule
+ *
+ * Unblock a blocking or async wait operation.
+ */
+ void (*unschedule) (GstClock *clock, GstClockEntry *entry);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_clock_get_type (void);
+
+GST_API
+GstClockTime gst_clock_set_resolution (GstClock *clock,
+ GstClockTime resolution);
+GST_API
+GstClockTime gst_clock_get_resolution (GstClock *clock);
+
+GST_API
+GstClockTime gst_clock_get_time (GstClock *clock);
+
+GST_API
+void gst_clock_set_calibration (GstClock *clock, GstClockTime internal,
+ GstClockTime external,
+ GstClockTime rate_num,
+ GstClockTime rate_denom);
+GST_API
+void gst_clock_get_calibration (GstClock *clock, GstClockTime *internal,
+ GstClockTime *external,
+ GstClockTime *rate_num,
+ GstClockTime *rate_denom);
+
+/* master/slave clocks */
+
+GST_API
+gboolean gst_clock_set_master (GstClock *clock, GstClock *master);
+
+GST_API
+GstClock* gst_clock_get_master (GstClock *clock);
+
+GST_API
+void gst_clock_set_timeout (GstClock *clock,
+ GstClockTime timeout);
+GST_API
+GstClockTime gst_clock_get_timeout (GstClock *clock);
+
+GST_API
+gboolean gst_clock_add_observation (GstClock *clock, GstClockTime slave,
+ GstClockTime master, gdouble *r_squared);
+GST_API
+gboolean gst_clock_add_observation_unapplied (GstClock *clock, GstClockTime slave,
+ GstClockTime master, gdouble *r_squared,
+ GstClockTime *internal,
+ GstClockTime *external,
+ GstClockTime *rate_num,
+ GstClockTime *rate_denom);
+
+/* getting and adjusting internal/external time */
+
+GST_API
+GstClockTime gst_clock_get_internal_time (GstClock *clock);
+
+GST_API
+GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);
+
+GST_API
+GstClockTime gst_clock_adjust_with_calibration (GstClock *clock,
+ GstClockTime internal_target,
+ GstClockTime cinternal,
+ GstClockTime cexternal,
+ GstClockTime cnum,
+ GstClockTime cdenom);
+GST_API
+GstClockTime gst_clock_unadjust_with_calibration (GstClock *clock,
+ GstClockTime external_target,
+ GstClockTime cinternal,
+ GstClockTime cexternal,
+ GstClockTime cnum,
+ GstClockTime cdenom);
+GST_API
+GstClockTime gst_clock_unadjust_unlocked (GstClock * clock, GstClockTime external);
+
+/* waiting for, signalling and checking for synchronization */
+
+GST_API
+gboolean gst_clock_wait_for_sync (GstClock * clock, GstClockTime timeout);
+
+GST_API
+gboolean gst_clock_is_synced (GstClock * clock);
+
+/* to be used by subclasses only */
+
+GST_API
+void gst_clock_set_synced (GstClock * clock, gboolean synced);
+
+/* creating IDs that can be used to get notifications */
+
+GST_API
+GstClockID gst_clock_new_single_shot_id (GstClock *clock,
+ GstClockTime time);
+GST_API
+GstClockID gst_clock_new_periodic_id (GstClock *clock,
+ GstClockTime start_time,
+ GstClockTime interval);
+
+/* reference counting */
+
+GST_API
+GstClockID gst_clock_id_ref (GstClockID id);
+
+GST_API
+void gst_clock_id_unref (GstClockID id);
+
+/* operations on IDs */
+
+GST_API
+gint gst_clock_id_compare_func (gconstpointer id1, gconstpointer id2);
+
+GST_API
+GstClock * gst_clock_id_get_clock (GstClockID id);
+
+GST_API
+gboolean gst_clock_id_uses_clock (GstClockID id, GstClock * clock);
+
+GST_API
+GstClockTime gst_clock_id_get_time (GstClockID id);
+
+GST_API
+GstClockReturn gst_clock_id_wait (GstClockID id,
+ GstClockTimeDiff *jitter);
+GST_API
+GstClockReturn gst_clock_id_wait_async (GstClockID id,
+ GstClockCallback func,
+ gpointer user_data,
+ GDestroyNotify destroy_data);
+GST_API
+void gst_clock_id_unschedule (GstClockID id);
+
+GST_API
+gboolean gst_clock_single_shot_id_reinit (GstClock * clock,
+ GstClockID id,
+ GstClockTime time);
+GST_API
+gboolean gst_clock_periodic_id_reinit (GstClock * clock,
+ GstClockID id,
+ GstClockTime start_time,
+ GstClockTime interval);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstClock, gst_object_unref)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GstClockID, gst_clock_id_unref, 0)
+
+G_END_DECLS
+
+#endif /* __GST_CLOCK_H__ */
diff --git a/include/gst/gstcompat.h b/include/gst/gstcompat.h
new file mode 100644
index 0000000000..1349ab4cd6
--- /dev/null
+++ b/include/gst/gstcompat.h
@@ -0,0 +1,103 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstcompat.h: backwards compatibility stuff
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* API compatibility stuff */
+#ifndef __GSTCOMPAT_H__
+#define __GSTCOMPAT_H__
+/**
+ * SECTION:gstcompat
+ * @title: GstCompat
+ * @short_description: Deprecated API entries
+ *
+ * Please do not use these in new code.
+ * These symbols are only available by defining GST_DISABLE_DEPRECATED.
+ * This can be done in CFLAGS for compiling old code.
+ */
+
+#include <glib.h>
+#include <gst/gstpad.h>
+
+
+G_BEGIN_DECLS
+
+#define gst_buffer_new_and_alloc(s) gst_buffer_new_allocate(NULL, s, NULL)
+
+#define GST_BUFFER_TIMESTAMP GST_BUFFER_PTS
+#define GST_BUFFER_TIMESTAMP_IS_VALID GST_BUFFER_PTS_IS_VALID
+
+static inline gboolean
+gst_pad_set_caps (GstPad * pad, GstCaps * caps)
+{
+ GstEvent *event;
+ gboolean res = TRUE;
+
+ g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
+ g_return_val_if_fail (caps != NULL && gst_caps_is_fixed (caps), FALSE);
+
+ event = gst_event_new_caps (caps);
+
+ if (GST_PAD_IS_SRC (pad))
+ res = gst_pad_push_event (pad, event);
+ else
+ res = gst_pad_send_event (pad, event);
+
+ return res;
+}
+
+
+#ifndef GST_DISABLE_DEPRECATED
+
+/* added to ease the transition to 0.11 */
+#define gst_element_class_set_details_simple gst_element_class_set_metadata
+
+#define gst_element_factory_get_longname(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_LONGNAME)
+#define gst_element_factory_get_klass(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_KLASS)
+#define gst_element_factory_get_description(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DESCRIPTION)
+#define gst_element_factory_get_author(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_AUTHOR)
+#define gst_element_factory_get_documentation_uri(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DOC_URI)
+#define gst_element_factory_get_icon_name(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_ICON_NAME)
+
+#define gst_pad_get_caps_reffed(p) gst_pad_get_caps(p)
+#define gst_pad_peer_get_caps_reffed(p) gst_pad_peer_get_caps(p)
+
+#define gst_adapter_prev_timestamp gst_adapter_prev_pts
+
+#define gst_tag_list_free(taglist) gst_tag_list_unref(taglist)
+
+#define GST_MESSAGE_DURATION GST_MESSAGE_DURATION_CHANGED
+#define gst_message_new_duration(src,fmt,dur) \
+ gst_message_new_duration_changed(src)
+#define gst_message_parse_duration(msg,fmt,dur) \
+G_STMT_START { \
+ GstFormat *p_fmt = fmt; \
+ gint64 *p_dur = dur; \
+ if (p_fmt) \
+ *p_fmt = GST_FORMAT_TIME; \
+ if (p_dur) \
+ *p_dur = GST_CLOCK_TIME_NONE; \
+} G_STMT_END
+
+#endif /* not GST_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __GSTCOMPAT_H__ */
diff --git a/include/gst/gstconfig.h b/include/gst/gstconfig.h
new file mode 100644
index 0000000000..fd041d3525
--- /dev/null
+++ b/include/gst/gstconfig.h
@@ -0,0 +1,204 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2004,2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstconfig.h: GST_DISABLE_* macros for build configuration
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:gstconfig
+ * @short_description: Build configuration options
+ *
+ * This describes the configuration options for GStreamer. When building
+ * GStreamer there are a lot of parts (known internally as "subsystems" ) that
+ * can be disabled for various reasons. The most common reasons are speed and
+ * size, which is important because GStreamer is designed to run on embedded
+ * systems.
+ *
+ * If a subsystem is disabled, most of this changes are done in an API
+ * compatible way, so you don't need to adapt your code in most cases. It is
+ * never done in an ABI compatible way though. So if you want to disable a
+ * subsystem, you have to rebuild all programs depending on GStreamer, too.
+ *
+ * If a subsystem is disabled in GStreamer, a value is defined in
+ * &lt;gst/gst.h&gt;. You can check this if you do subsystem-specific stuff.
+ *
+ * ``` C
+ * #ifndef GST_DISABLE_GST_DEBUG
+ * // do stuff specific to the debugging subsystem
+ * #endif // GST_DISABLE_GST_DEBUG
+ * ```
+ */
+
+#ifndef __GST_CONFIG_H__
+#define __GST_CONFIG_H__
+
+/* trick gtk-doc into believing these symbols are defined (yes, it's ugly) */
+
+#if 0
+#define GST_DISABLE_GST_DEBUG 1
+#define GST_DISABLE_PARSE 1
+#define GST_DISABLE_REGISTRY 1
+#define GST_DISABLE_PLUGIN 1
+#endif
+
+/***** default padding of structures *****/
+#define GST_PADDING 4
+#define GST_PADDING_INIT { NULL }
+
+/***** padding for very extensible base classes *****/
+#define GST_PADDING_LARGE 20
+
+/***** disabling of subsystems *****/
+
+/**
+ * GST_DISABLE_GST_DEBUG:
+ *
+ * Configures the inclusion of the debugging subsystem
+ */
+#undef GST_DISABLE_GST_DEBUG
+
+/**
+ * GST_DISABLE_PARSE:
+ *
+ * Configures the inclusion of the gst-launch parser
+ */
+#undef GST_DISABLE_PARSE
+
+/**
+ * GST_DISABLE_REGISTRY:
+ *
+ * Configures the use of the plugin registry.
+ * If one disables this, required plugins need to be loaded and registered
+ * manually
+ */
+#undef GST_DISABLE_REGISTRY
+
+/**
+ * GST_DISABLE_CAST_CHECKS:
+ *
+ * Disable run-time GObject cast checks
+ */
+#define GST_DISABLE_CAST_CHECKS 0
+
+/**
+ * GST_DISABLE_GLIB_ASSERTS:
+ *
+ * Disable GLib assertion
+ */
+#define GST_DISABLE_GLIB_ASSERTS 0
+
+/**
+ * GST_DISABLE_GLIB_CHECKS:
+ *
+ * Disable GLib checks such as API guards
+ */
+#define GST_DISABLE_GLIB_CHECKS 0
+
+
+/* FIXME: test and document these! */
+/* Configures the use of external plugins */
+#undef GST_DISABLE_PLUGIN
+
+/* Whether or not the CPU supports unaligned access
+ * The macros used are defined consistently by GCC, Clang, MSVC, Sun, and ICC
+ *
+ * References:
+ * https://sourceforge.net/p/predef/wiki/Architectures/
+ * https://msdn.microsoft.com/en-us/library/b0084kay.aspx
+ * http://docs.oracle.com/cd/E19205-01/820-4155/c++_faq.html#Vers6
+ * https://software.intel.com/en-us/node/583402
+ */
+#if defined(__alpha__) || defined(__arc__) || defined(__arm__) || defined(__aarch64__) || defined(__bfin) || defined(__hppa__) || defined(__nios2__) || defined(__MICROBLAZE__) || defined(__mips__) || defined(__or1k__) || defined(__sh__) || defined(__SH4__) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined(_M_ALPHA) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_IA64) || defined(__xtensa__) || defined(__e2k__) || defined(__riscv) || defined(__ARC64__) || defined(__loongarch__)
+# define GST_HAVE_UNALIGNED_ACCESS 0
+#elif defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__m68k__) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || defined(__s390__) || defined(__s390x__) || defined(__zarch__)
+# define GST_HAVE_UNALIGNED_ACCESS 1
+#else
+# error "Could not detect architecture; don't know whether it supports unaligned access! Please file a bug."
+#endif
+
+/**
+ * GST_EXPORT:
+ *
+ * Export the given variable from the built shared object.
+ *
+ * On Windows, this exports the variable from the DLL.
+ * On other platforms, this gets defined to "extern".
+ */
+/**
+ * GST_PLUGIN_EXPORT:
+ *
+ * Export the plugin's definition.
+ *
+ * On Windows, this exports the plugin definition from the DLL.
+ * On other platforms, this gets defined as a no-op.
+ */
+/* Only use __declspec(dllexport/import) when we have been built with MSVC or
+ * the user is linking to us with MSVC. The only remaining case is when we were
+ * built with MinGW and are linking with MinGW in which case we rely on the
+ * linker to auto-export/import symbols. Of course all this is only used when
+ * not linking statically.
+ *
+ * NOTE: To link to GStreamer statically on Windows, you must define
+ * GST_STATIC_COMPILATION or the prototypes will cause the compiler to search
+ * for the symbol inside a DLL.
+ */
+#if (1 || defined(_MSC_VER)) && !defined(GST_STATIC_COMPILATION)
+# define GST_PLUGIN_EXPORT __declspec(dllexport)
+# ifdef GST_EXPORTS
+# define GST_EXPORT __declspec(dllexport)
+# else
+# define GST_EXPORT __declspec(dllimport) extern
+# endif
+#else
+# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define GST_PLUGIN_EXPORT __attribute__ ((visibility ("default")))
+# define GST_EXPORT extern __attribute__ ((visibility ("default")))
+# else
+# define GST_PLUGIN_EXPORT
+# define GST_EXPORT extern
+# endif
+#endif
+
+#if defined(_MSC_VER) && !defined(GST_STATIC_COMPILATION)
+# define GST_API_IMPORT __declspec(dllimport) extern
+#else
+# define GST_API_IMPORT extern
+#endif
+
+#ifndef GST_API
+# ifdef BUILDING_GST
+# define GST_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_API GST_API_IMPORT
+# endif
+#endif
+
+/* These macros are used to mark deprecated functions in GStreamer headers,
+ * and thus have to be exposed in installed headers. But please
+ * do *not* use them in other projects. Instead, use G_DEPRECATED
+ * or define your own wrappers around it. */
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_DEPRECATED GST_API
+#define GST_DEPRECATED_FOR(f) GST_API
+#else
+#define GST_DEPRECATED G_DEPRECATED GST_API
+#define GST_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_API
+#endif
+
+#endif /* __GST_CONFIG_H__ */
diff --git a/include/gst/gstcontext.h b/include/gst/gstcontext.h
new file mode 100644
index 0000000000..92d8502b83
--- /dev/null
+++ b/include/gst/gstcontext.h
@@ -0,0 +1,134 @@
+/* GStreamer
+ * Copyright (C) 2013 Collabora Ltd.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstcontext.h: Header for GstContext subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONTEXT_H__
+#define __GST_CONTEXT_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstContext GstContext;
+
+#include <gst/gstminiobject.h>
+#include <gst/gststructure.h>
+
+GST_API GType _gst_context_type;
+
+#define GST_TYPE_CONTEXT (_gst_context_type)
+#define GST_IS_CONTEXT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_CONTEXT))
+#define GST_CONTEXT_CAST(obj) ((GstContext*)(obj))
+#define GST_CONTEXT(obj) (GST_CONTEXT_CAST(obj))
+
+
+
+GST_API
+GType gst_context_get_type (void);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstContext *
+gst_context_ref (GstContext * context)
+{
+ return (GstContext *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (context));
+}
+
+static inline void
+gst_context_unref (GstContext * context)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (context));
+}
+
+/* copy context */
+static inline GstContext *
+gst_context_copy (const GstContext * context)
+{
+ return GST_CONTEXT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (context)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstContext * gst_context_ref (GstContext * context);
+
+GST_API
+void gst_context_unref (GstContext * context);
+
+GST_API
+GstContext * gst_context_copy (const GstContext * context);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_context_is_writable:
+ * @context: a #GstContext
+ *
+ * Tests if you can safely write into a context's structure or validly
+ * modify the seqnum and timestamp fields.
+ */
+#define gst_context_is_writable(context) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (context))
+/**
+ * gst_context_make_writable:
+ * @context: (transfer full): the context to make writable
+ *
+ * Checks if a context is writable. If not, a writable copy is made and
+ * returned.
+ *
+ * Returns: (transfer full): a context (possibly a duplicate) that is writable.
+ *
+ * MT safe
+ */
+#define gst_context_make_writable(context) GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (context)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_context_replace (GstContext **old_context, GstContext *new_context)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_context, (GstMiniObject *) new_context);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_context_replace (GstContext ** old_context,
+ GstContext * new_context);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+GST_API
+GstContext * gst_context_new (const gchar * context_type,
+ gboolean persistent) G_GNUC_MALLOC;
+GST_API
+const gchar * gst_context_get_context_type (const GstContext * context);
+
+GST_API
+gboolean gst_context_has_context_type (const GstContext * context, const gchar * context_type);
+
+GST_API
+const GstStructure * gst_context_get_structure (const GstContext * context);
+
+GST_API
+GstStructure * gst_context_writable_structure (GstContext * context);
+
+GST_API
+gboolean gst_context_is_persistent (const GstContext * context);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstContext, gst_context_unref)
+
+G_END_DECLS
+
+#endif /* __GST_CONTEXT_H__ */
diff --git a/include/gst/gstcontrolbinding.h b/include/gst/gstcontrolbinding.h
new file mode 100644
index 0000000000..e357669943
--- /dev/null
+++ b/include/gst/gstcontrolbinding.h
@@ -0,0 +1,191 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gstcontrolbinding.h: Attachment for control sources
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONTROL_BINDING_H__
+#define __GST_CONTROL_BINDING_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_CONTROL_BINDING \
+ (gst_control_binding_get_type())
+#define GST_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_BINDING,GstControlBinding))
+#define GST_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_BINDING,GstControlBindingClass))
+#define GST_IS_CONTROL_BINDING(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_BINDING))
+#define GST_IS_CONTROL_BINDING_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_BINDING))
+#define GST_CONTROL_BINDING_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlBindingClass))
+
+typedef struct _GstControlBinding GstControlBinding;
+typedef struct _GstControlBindingClass GstControlBindingClass;
+typedef struct _GstControlBindingPrivate GstControlBindingPrivate;
+
+#include <gst/gstcontrolsource.h>
+
+/**
+ * GstControlBindingConvert: (attributes doc.skip=true)
+ * FIXME(2.0): remove, this is unused
+ */
+typedef void (* GstControlBindingConvert) (GstControlBinding *binding, gdouble src_value, GValue *dest_value);
+
+/**
+ * GstControlBinding:
+ * @parent: the parent structure
+ * @name: name of the property of this binding
+ * @pspec: #GParamSpec for this property
+ *
+ * The instance structure of #GstControlBinding.
+ */
+struct _GstControlBinding {
+ GstObject parent;
+
+ /*< public >*/
+ gchar *name;
+ GParamSpec *pspec;
+
+ /*< private >*/
+#ifndef GST_DISABLE_DEPRECATED
+ GstObject *object; /* GstObject owning the property
+ * (== parent when bound) */
+#else
+ gpointer __object;
+#endif
+ gboolean disabled;
+
+ union {
+ struct {
+ /*< private >*/
+ GstControlBindingPrivate *priv;
+ } abi;
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+ } ABI;
+};
+
+/**
+ * GstControlBindingClass:
+ * @parent_class: Parent class
+ *
+ * The class structure of #GstControlBinding.
+ */
+
+struct _GstControlBindingClass
+{
+ GstObjectClass parent_class;
+
+ /*< public >*/
+
+ /**
+ * GstControlBindingClass::sync_values:
+ * @binding: the control binding
+ * @object: the object that has controlled properties
+ * @timestamp: the time that should be processed
+ * @last_sync: the last time this was called
+ *
+ * Update the target values
+ *
+ * Returns: %TRUE if the controller value could be applied to the object
+ * property, %FALSE otherwise
+ */
+ gboolean (* sync_values) (GstControlBinding *binding, GstObject *object, GstClockTime timestamp, GstClockTime last_sync);
+
+ /**
+ * GstControlBindingClass::get_value:
+ * @binding: the control binding
+ * @timestamp: the time the control-change should be read from
+ *
+ * Fetch a single control-value
+ *
+ * Returns: (nullable): the GValue of the property at the given time,
+ * or %NULL if the property isn't controlled.
+ */
+ GValue * (* get_value) (GstControlBinding *binding, GstClockTime timestamp);
+
+ /**
+ * GstControlBindingClass::get_value_array:
+ * @binding: the control binding
+ * @timestamp: the time that should be processed
+ * @interval: the time spacing between subsequent values
+ * @n_values: the number of values
+ * @values: (array length=n_values): array to put control-values in
+ *
+ * Fetch a series of control-values
+ *
+ * Returns: %TRUE if the given array could be filled, %FALSE otherwise
+ */
+ gboolean (* get_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, gpointer values);
+
+ /**
+ * GstControlBindingClass::get_g_value_array:
+ * @binding: the control binding
+ * @timestamp: the time that should be processed
+ * @interval: the time spacing between subsequent values
+ * @n_values: the number of values
+ * @values: (array length=n_values): array to put control-values in
+ *
+ * Fetch a series of control-values as g_values
+ *
+ * Returns: %TRUE if the given array could be filled, %FALSE otherwise
+ */
+ gboolean (* get_g_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, GValue *values);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_CONTROL_BINDING_PSPEC(cb) (((GstControlBinding *) cb)->pspec)
+
+GST_API
+GType gst_control_binding_get_type (void);
+
+/* Functions */
+
+GST_API
+gboolean gst_control_binding_sync_values (GstControlBinding * binding, GstObject *object,
+ GstClockTime timestamp, GstClockTime last_sync);
+GST_API
+GValue * gst_control_binding_get_value (GstControlBinding *binding,
+ GstClockTime timestamp);
+GST_API
+gboolean gst_control_binding_get_value_array (GstControlBinding *binding, GstClockTime timestamp,
+ GstClockTime interval, guint n_values, gpointer values);
+GST_API
+gboolean gst_control_binding_get_g_value_array (GstControlBinding *binding, GstClockTime timestamp,
+ GstClockTime interval, guint n_values, GValue *values);
+GST_API
+void gst_control_binding_set_disabled (GstControlBinding * binding, gboolean disabled);
+
+GST_API
+gboolean gst_control_binding_is_disabled (GstControlBinding * binding);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstControlBinding, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_CONTROL_BINDING_H__ */
diff --git a/include/gst/gstcontrolsource.h b/include/gst/gstcontrolsource.h
new file mode 100644
index 0000000000..cd2dfafe13
--- /dev/null
+++ b/include/gst/gstcontrolsource.h
@@ -0,0 +1,147 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstcontrolsource.h: Interface declaration for control sources
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_CONTROL_SOURCE_H__
+#define __GST_CONTROL_SOURCE_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+#include <gst/gstclock.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_CONTROL_SOURCE \
+ (gst_control_source_get_type())
+#define GST_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_SOURCE,GstControlSource))
+#define GST_CONTROL_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_SOURCE,GstControlSourceClass))
+#define GST_IS_CONTROL_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_SOURCE))
+#define GST_IS_CONTROL_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_SOURCE))
+#define GST_CONTROL_SOURCE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlSourceClass))
+
+typedef struct _GstControlSource GstControlSource;
+typedef struct _GstControlSourceClass GstControlSourceClass;
+typedef struct _GstTimedValue GstTimedValue;
+typedef struct _GstValueArray GstValueArray;
+
+/**
+ * GstTimedValue:
+ * @timestamp: timestamp of the value change
+ * @value: the corresponding value
+ *
+ * Structure for storing a timestamp and a value.
+ */
+struct _GstTimedValue
+{
+ GstClockTime timestamp;
+ gdouble value;
+};
+
+/**
+ * GstControlSourceGetValue:
+ * @self: the #GstControlSource instance
+ * @timestamp: timestamp for which a value should be calculated
+ * @value: a value which will be set to the result.
+ *
+ * Function for returning a value for a given timestamp.
+ *
+ * Returns: %TRUE if the value was successfully calculated.
+ *
+ */
+typedef gboolean (* GstControlSourceGetValue) (GstControlSource *self,
+ GstClockTime timestamp, gdouble *value);
+
+/**
+ * GstControlSourceGetValueArray:
+ * @self: the #GstControlSource instance
+ * @timestamp: timestamp for which a value should be calculated
+ * @interval: the time spacing between subsequent values
+ * @n_values: the number of values
+ * @values: array to put control-values in
+ *
+ * Function for returning an array of values starting at a given timestamp.
+ *
+ * Returns: %TRUE if the values were successfully calculated.
+ *
+ */
+typedef gboolean (* GstControlSourceGetValueArray) (GstControlSource *self,
+ GstClockTime timestamp, GstClockTime interval, guint n_values, gdouble *values);
+
+/**
+ * GstControlSource:
+ * @parent: the parent structure
+ * @get_value: Function for returning a value for a given timestamp
+ * @get_value_array: Function for returning a values array for a given timestamp
+ *
+ * The instance structure of #GstControlSource.
+ */
+struct _GstControlSource {
+ GstObject parent;
+
+ /*< public >*/
+ GstControlSourceGetValue get_value; /* Returns the value for a property at a given timestamp */
+ GstControlSourceGetValueArray get_value_array; /* Returns values for a property in a given timespan */
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstControlSourceClass:
+ * @parent_class: Parent class
+ *
+ * The class structure of #GstControlSource.
+ */
+
+struct _GstControlSourceClass
+{
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_control_source_get_type (void);
+
+/* Functions */
+
+GST_API
+gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp,
+ gdouble *value);
+GST_API
+gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp,
+ GstClockTime interval, guint n_values,
+ gdouble *values);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstControlSource, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstValueArray, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_CONTROL_SOURCE_H__ */
diff --git a/include/gst/gstdatetime.h b/include/gst/gstdatetime.h
new file mode 100644
index 0000000000..8d2b74770d
--- /dev/null
+++ b/include/gst/gstdatetime.h
@@ -0,0 +1,167 @@
+/* GStreamer
+ * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DATE_TIME_H__
+#define __GST_DATE_TIME_H__
+
+#include <gst/gstconfig.h>
+
+#include <time.h>
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstDateTime:
+ *
+ * Opaque, immutable, refcounted struct that stores date, time and timezone
+ * information. It currently supports ranges from `0001-01-01` to
+ * `9999-12-31` in the Gregorian proleptic calendar.
+ *
+ * Use the accessor functions to get the stored values.
+ */
+typedef struct _GstDateTime GstDateTime;
+
+GST_API GType _gst_date_time_type;
+
+/**
+ * GST_TYPE_DATE_TIME:
+ *
+ * a boxed #GValue type for #GstDateTime that represents a date and time.
+ *
+ * Returns: the #GType of GstDateTime
+ */
+
+#define GST_TYPE_DATE_TIME (_gst_date_time_type)
+
+GST_API
+GType gst_date_time_get_type (void);
+
+/* query which fields are set */
+
+GST_API
+gboolean gst_date_time_has_year (const GstDateTime * datetime);
+
+GST_API
+gboolean gst_date_time_has_month (const GstDateTime * datetime);
+
+GST_API
+gboolean gst_date_time_has_day (const GstDateTime * datetime);
+
+GST_API
+gboolean gst_date_time_has_time (const GstDateTime * datetime);
+
+GST_API
+gboolean gst_date_time_has_second (const GstDateTime * datetime);
+
+/* field getters */
+
+GST_API
+gint gst_date_time_get_year (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_month (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_day (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_hour (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_minute (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_second (const GstDateTime * datetime);
+
+GST_API
+gint gst_date_time_get_microsecond (const GstDateTime * datetime);
+
+GST_API
+gfloat gst_date_time_get_time_zone_offset (const GstDateTime * datetime);
+
+/* constructors */
+
+GST_API
+GstDateTime * gst_date_time_new_from_unix_epoch_local_time (gint64 secs) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_from_unix_epoch_utc (gint64 secs) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_from_unix_epoch_local_time_usecs (gint64 usecs) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_from_unix_epoch_utc_usecs (gint64 usecs) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_local_time (gint year,
+ gint month,
+ gint day,
+ gint hour,
+ gint minute,
+ gdouble seconds) G_GNUC_MALLOC;
+GST_API
+GstDateTime * gst_date_time_new_y (gint year) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_ym (gint year,
+ gint month) G_GNUC_MALLOC;
+GST_API
+GstDateTime * gst_date_time_new_ymd (gint year,
+ gint month,
+ gint day) G_GNUC_MALLOC;
+GST_API
+GstDateTime * gst_date_time_new (gfloat tzoffset,
+ gint year, gint month,
+ gint day, gint hour,
+ gint minute,
+ gdouble seconds) G_GNUC_MALLOC;
+GST_API
+GstDateTime * gst_date_time_new_now_local_time (void) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_now_utc (void) G_GNUC_MALLOC;
+
+GST_API
+gchar * gst_date_time_to_iso8601_string (GstDateTime * datetime) G_GNUC_MALLOC;
+
+GST_API
+GstDateTime * gst_date_time_new_from_iso8601_string (const gchar * string) G_GNUC_MALLOC;
+
+GST_API
+GDateTime * gst_date_time_to_g_date_time (GstDateTime * datetime);
+
+GST_API
+GstDateTime * gst_date_time_new_from_g_date_time (GDateTime * dt);
+
+/* refcounting */
+
+GST_API
+GstDateTime * gst_date_time_ref (GstDateTime * datetime);
+
+GST_API
+void gst_date_time_unref (GstDateTime * datetime);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDateTime, gst_date_time_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DATE_TIME_H__ */
diff --git a/include/gst/gstdebugutils.h b/include/gst/gstdebugutils.h
new file mode 100644
index 0000000000..6a2caa94a8
--- /dev/null
+++ b/include/gst/gstdebugutils.h
@@ -0,0 +1,125 @@
+/* GStreamer
+ * Copyright (C) 2007 Stefan Kost <ensonic@users.sf.net>
+ *
+ * gstdebugutils.h: debugging and analysis utilities
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSTDEBUGUTILS_H__
+#define __GSTDEBUGUTILS_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gstconfig.h>
+#include <gst/gstbin.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstDebugGraphDetails:
+ * @GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE: show caps-name on edges
+ * @GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS: show caps-details on edges
+ * @GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS: show modified parameters on
+ * elements
+ * @GST_DEBUG_GRAPH_SHOW_STATES: show element states
+ * @GST_DEBUG_GRAPH_SHOW_FULL_PARAMS: show full element parameter values even
+ * if they are very long
+ * @GST_DEBUG_GRAPH_SHOW_ALL: show all the typical details that one might want
+ * @GST_DEBUG_GRAPH_SHOW_VERBOSE: show all details regardless of how large or
+ * verbose they make the resulting output
+ *
+ * Available details for pipeline graphs produced by GST_DEBUG_BIN_TO_DOT_FILE()
+ * and GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS().
+ */
+/* FIXME: For GST_DEBUG_GRAPH_SHOW_VERBOSE ~0 -> 0xffffffff see
+ * https://bugzilla.gnome.org/show_bug.cgi?id=732633
+*/
+typedef enum {
+ GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE = (1<<0),
+ GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS = (1<<1),
+ GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS = (1<<2),
+ GST_DEBUG_GRAPH_SHOW_STATES = (1<<3),
+ GST_DEBUG_GRAPH_SHOW_FULL_PARAMS = (1<<4),
+ GST_DEBUG_GRAPH_SHOW_ALL = ((1<<4)-1),
+ GST_DEBUG_GRAPH_SHOW_VERBOSE = (gint) (0xffffffff)
+} GstDebugGraphDetails;
+
+
+/********** pipeline graphs **********/
+
+GST_API
+gchar * gst_debug_bin_to_dot_data (GstBin *bin, GstDebugGraphDetails details);
+
+GST_API
+void gst_debug_bin_to_dot_file (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
+
+GST_API
+void gst_debug_bin_to_dot_file_with_ts (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
+
+#ifndef GST_DISABLE_GST_DEBUG
+
+/**
+ * GST_DEBUG_BIN_TO_DOT_FILE:
+ * @bin: the top-level pipeline that should be analyzed
+ * @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
+ * one or more other #GstDebugGraphDetails flags.
+ * @file_name: output base filename (e.g. "myplayer")
+ *
+ * To aid debugging applications one can use this method to write out the whole
+ * network of gstreamer elements that form the pipeline into a dot file.
+ * This file can be processed with graphviz to get an image, like this:
+ *
+ * ``` shell
+ * dot -Tpng -oimage.png graph_lowlevel.dot
+ * ```
+ *
+ * There is also a utility called [xdot] which allows you to view the dot file
+ * directly without converting it first.
+ *
+ * The macro is only active if the environment variable `GST_DEBUG_DUMP_DOT_DIR`
+ * is set to a basepath (e.g. `/tmp`), and the GStreamer debugging subsystem is
+ * enabled (i.e., no use of `./configure --disable-gst-debug`)
+ *
+ * [xdot]: https://pypi.org/project/xdot/
+ */
+#define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name) gst_debug_bin_to_dot_file (bin, details, file_name)
+
+/**
+ * GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS:
+ * @bin: the top-level pipeline that should be analyzed
+ * @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
+ * one or more other #GstDebugGraphDetails flags.
+ * @file_name: output base filename (e.g. "myplayer")
+ *
+ * This works like GST_DEBUG_BIN_TO_DOT_FILE(), but adds the current timestamp
+ * to the filename, so that it can be used to take multiple snapshots.
+ */
+#define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name) gst_debug_bin_to_dot_file_with_ts (bin, details, file_name)
+
+
+#else /* GST_DISABLE_GST_DEBUG */
+
+
+#define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name)
+#define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name)
+
+#endif /* GST_DISABLE_GST_DEBUG */
+
+G_END_DECLS
+
+#endif /* __GSTDEBUGUTILS_H__ */
+
diff --git a/include/gst/gstdevice.h b/include/gst/gstdevice.h
new file mode 100644
index 0000000000..48c4cda660
--- /dev/null
+++ b/include/gst/gstdevice.h
@@ -0,0 +1,120 @@
+/* GStreamer
+ * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdevice.c: Device discovery
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_DEVICE_H__
+#define __GST_DEVICE_H__
+
+typedef struct _GstDevice GstDevice;
+typedef struct _GstDeviceClass GstDeviceClass;
+
+#include <gst/gstelement.h>
+#include <gst/gstcaps.h>
+
+
+G_BEGIN_DECLS
+
+typedef struct _GstDevicePrivate GstDevicePrivate;
+
+#define GST_TYPE_DEVICE (gst_device_get_type())
+#define GST_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE))
+#define GST_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE))
+#define GST_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE, GstDeviceClass))
+#define GST_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE, GstDevice))
+#define GST_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE, GstDeviceClass))
+#define GST_DEVICE_CAST(obj) ((GstDevice *)(obj))
+
+/**
+ * GstDevice:
+ * @parent: The parent #GstObject structure.
+ *
+ * A device object.
+ *
+ * Since: 1.4
+ */
+
+struct _GstDevice {
+ GstObject parent;
+
+ /*< private >*/
+ GstDevicePrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDeviceClass:
+ * @parent_class: The parent #GstObjectClass structure.
+ * @create_element: Creates the fully configured element to access this device.
+ * Subclasses need to override this and return a new element.
+ * @reconfigure_element: This only needs to be implemented by subclasses if the
+ * element can be reconfigured to use a different device. See the documentation
+ * for gst_device_reconfigure_element().
+ *
+ * The class structure for a #GstDevice object.
+ *
+ * Since: 1.4
+ */
+
+struct _GstDeviceClass {
+ GstObjectClass parent_class;
+
+ GstElement * (*create_element) (GstDevice * device, const gchar * name);
+ gboolean (*reconfigure_element) (GstDevice * device, GstElement * element);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_device_get_type (void);
+
+GST_API
+GstElement * gst_device_create_element (GstDevice * device, const gchar * name);
+
+GST_API
+GstCaps * gst_device_get_caps (GstDevice * device);
+
+GST_API
+gchar * gst_device_get_display_name (GstDevice * device);
+
+GST_API
+gchar * gst_device_get_device_class (GstDevice * device);
+
+GST_API
+GstStructure * gst_device_get_properties (GstDevice * device);
+
+GST_API
+gboolean gst_device_reconfigure_element (GstDevice * device,
+ GstElement * element);
+GST_API
+gboolean gst_device_has_classesv (GstDevice * device,
+ gchar ** classes);
+GST_API
+gboolean gst_device_has_classes (GstDevice * device,
+ const gchar * classes);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDevice, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_H__ */
diff --git a/include/gst/gstdevicemonitor.h b/include/gst/gstdevicemonitor.h
new file mode 100644
index 0000000000..5817cd4ee0
--- /dev/null
+++ b/include/gst/gstdevicemonitor.h
@@ -0,0 +1,118 @@
+/* GStreamer
+ * Copyright (C) 2013 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdevicemonitor.c: Device monitor
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_DEVICE_MONITOR_H__
+#define __GST_DEVICE_MONITOR_H__
+
+#include <gst/gstobject.h>
+#include <gst/gstdevice.h>
+#include <gst/gstdeviceprovider.h>
+#include <gst/gstdeviceproviderfactory.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstDeviceMonitor GstDeviceMonitor;
+typedef struct _GstDeviceMonitorPrivate GstDeviceMonitorPrivate;
+typedef struct _GstDeviceMonitorClass GstDeviceMonitorClass;
+
+#define GST_TYPE_DEVICE_MONITOR (gst_device_monitor_get_type())
+#define GST_IS_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_MONITOR))
+#define GST_IS_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_MONITOR))
+#define GST_DEVICE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
+#define GST_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitor))
+#define GST_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
+#define GST_DEVICE_MONITOR_CAST(obj) ((GstDeviceMonitor *)(obj))
+
+/**
+ * GstDeviceMonitor:
+ * @parent: the parent #GstObject structure
+ *
+ * Opaque device monitor object structure.
+ *
+ * Since: 1.4
+ */
+struct _GstDeviceMonitor {
+ GstObject parent;
+
+ /*< private >*/
+
+ GstDeviceMonitorPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDeviceMonitorClass:
+ * @parent_class: the parent #GstObjectClass structure
+ *
+ * Opaque device monitor class structure.
+ *
+ * Since: 1.4
+ */
+struct _GstDeviceMonitorClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_device_monitor_get_type (void);
+
+GST_API
+GstDeviceMonitor * gst_device_monitor_new (void);
+
+GST_API
+GstBus * gst_device_monitor_get_bus (GstDeviceMonitor * monitor);
+
+GST_API
+GList * gst_device_monitor_get_devices (GstDeviceMonitor * monitor);
+
+
+GST_API
+gboolean gst_device_monitor_start (GstDeviceMonitor * monitor);
+
+GST_API
+void gst_device_monitor_stop (GstDeviceMonitor * monitor);
+
+
+GST_API
+guint gst_device_monitor_add_filter (GstDeviceMonitor * monitor,
+ const gchar * classes,
+ GstCaps * caps);
+GST_API
+gboolean gst_device_monitor_remove_filter (GstDeviceMonitor * monitor,
+ guint filter_id);
+GST_API
+gchar ** gst_device_monitor_get_providers (GstDeviceMonitor * monitor);
+
+GST_API
+void gst_device_monitor_set_show_all_devices (GstDeviceMonitor * monitor, gboolean show_all);
+
+GST_API
+gboolean gst_device_monitor_get_show_all_devices (GstDeviceMonitor * monitor);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceMonitor, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_MONITOR_H__ */
diff --git a/include/gst/gstdeviceprovider.h b/include/gst/gstdeviceprovider.h
new file mode 100644
index 0000000000..1d69a7db97
--- /dev/null
+++ b/include/gst/gstdeviceprovider.h
@@ -0,0 +1,266 @@
+/* GStreamer
+ * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdeviceprovider.h: Device probing and monitoring
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_DEVICE_PROVIDER_H__
+#define __GST_DEVICE_PROVIDER_H__
+
+#include <gst/gstelement.h>
+
+/**
+ * GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM:
+ * @d_p: The device provider name in lower case, with words separated by '_'.
+ * Used to generate `gst_device_provider_register_*(GstPlugin* plugin)`.
+ * @register_func: pointer to a method with the format: `gboolean register_func (GstPlugin* plugin);`
+ *
+ * A convenience macro to define the entry point of a
+ * device provider `gst_device_provider_register_*(GstPlugin* plugin)` which uses
+ * register_func as the main registration method for the device provider.
+ * As an example, you may define the device provider named "device-provider"
+ * with the namespace `my` as following using `device_provider_register_custom`:
+ *
+ * ```
+ *
+ * gboolean my_device_provider_register_custom (GstPlugin * plugin)
+ * {
+ * gboolean ret = FALSE;
+ * ret |= gst_device_provider_register (plugin, "my-device-provider",
+ GST_RANK_PRIMARY, GST_TYPE_MY_DEVICE_PROVIDER);
+ * return TRUE;
+ * }
+ *
+ * GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM (my_device_provider, my_device_provider_register_custom)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM(d_p, register_func) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_device_provider_register_, d_p) (GstPlugin * plugin) \
+{ \
+ return register_func (plugin); \
+} \
+G_END_DECLS
+
+/**
+ * GST_DEVICE_PROVIDER_REGISTER_DEFINE:
+ * @d_p: The device provider name in lower case, with words separated by '_'.
+ * Used to generate `gst_device_provider_register_*(GstPlugin* plugin)`.
+ * @d_p_n: The public name of the device provider
+ * @r: The #GstRank of the device provider (higher rank means more importance when autoplugging, see #GstRank)
+ * @t: The #GType of the device provider.
+ *
+ * A convenience macro to define the entry point of a
+ * device provider `gst_device_provider_register_*(GstPlugin* plugin)`.
+ *
+ * Since: 1.20
+ */
+#define GST_DEVICE_PROVIDER_REGISTER_DEFINE(d_p, d_p_n, r, t) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_device_provider_register_, d_p) (GstPlugin * plugin) \
+{ \
+ return gst_device_provider_register (plugin, d_p_n, r, t); \
+} \
+G_END_DECLS
+
+/**
+ * GST_DEVICE_PROVIDER_REGISTER_DECLARE:
+ * @d_p: The device provider name in lower case, with words separated by '_'.
+ *
+ * This macro can be used to declare a new device provider.
+ * It has to be used in combination with #GST_DEVICE_PROVIDER_REGISTER_DEFINE macro
+ * and must be placed outside any block to declare the device provider registration
+ * function.
+ *
+ * Since: 1.20
+ */
+#define GST_DEVICE_PROVIDER_REGISTER_DECLARE(d_p) \
+G_BEGIN_DECLS \
+gboolean G_PASTE(gst_device_provider_register_, d_p) (GstPlugin * plugin); \
+G_END_DECLS
+
+/**
+ * GST_DEVICE_PROVIDER_REGISTER:
+ * @d_p: The device provider name in lower case, with words separated by '_'.
+ * @plugin: The #GstPlugin where to register the device provider.
+ *
+ * This macro can be used to register a device provider into a #GstPlugin.
+ * This method will be usually called in the plugin init function
+ * but can also be called with a NULL plugin.
+ *
+ * Since: 1.20
+ */
+#define GST_DEVICE_PROVIDER_REGISTER(d_p, plugin) G_PASTE(gst_device_provider_register_, d_p) (plugin)
+
+G_BEGIN_DECLS
+
+typedef struct _GstDeviceProvider GstDeviceProvider;
+typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
+typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
+
+#include <gst/gstdeviceproviderfactory.h>
+
+#define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
+#define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
+#define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
+#define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
+#define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
+#define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
+#define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
+
+
+/**
+ * GstDeviceProvider:
+ * @parent: The parent #GstObject
+ * @devices: a #GList of the #GstDevice objects
+ *
+ * The structure of the base #GstDeviceProvider
+ *
+ * Since: 1.4
+ */
+struct _GstDeviceProvider {
+ GstObject parent;
+
+ /* Protected by the Object lock */
+ GList *devices;
+
+ /*< private >*/
+
+ GstDeviceProviderPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstDeviceProviderClass:
+ * @parent_class: the parent #GstObjectClass structure
+ * @factory: a pointer to the #GstDeviceProviderFactory that creates this
+ * provider
+ * @probe: Returns a list of devices that are currently available.
+ * This should never block. The devices should not have a parent and should
+ * be floating.
+ * @start: Starts monitoring for new devices. Only subclasses that can know
+ * that devices have been added or remove need to implement this method.
+ * @stop: Stops monitoring for new devices. Only subclasses that implement
+ * the start() method need to implement this method.
+ *
+ * The structure of the base #GstDeviceProviderClass
+ *
+ * Since: 1.4
+ */
+
+struct _GstDeviceProviderClass {
+ GstObjectClass parent_class;
+
+ GstDeviceProviderFactory *factory;
+
+ GList* (*probe) (GstDeviceProvider * provider);
+
+ gboolean (*start) (GstDeviceProvider * provider);
+ void (*stop) (GstDeviceProvider * provider);
+
+ /*< private >*/
+ gpointer metadata;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_device_provider_get_type (void);
+
+
+GST_API
+GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
+
+GST_API
+gboolean gst_device_provider_start (GstDeviceProvider * provider);
+
+GST_API
+void gst_device_provider_stop (GstDeviceProvider * provider);
+
+GST_API
+gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
+
+GST_API
+GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
+
+GST_API
+void gst_device_provider_device_add (GstDeviceProvider * provider,
+ GstDevice * device);
+GST_API
+void gst_device_provider_device_remove (GstDeviceProvider * provider,
+ GstDevice * device);
+GST_API
+gchar ** gst_device_provider_get_hidden_providers (GstDeviceProvider * provider);
+
+GST_API
+void gst_device_provider_hide_provider (GstDeviceProvider * provider,
+ const gchar * name);
+GST_API
+void gst_device_provider_unhide_provider (GstDeviceProvider * provider,
+ const gchar * name);
+
+GST_API
+const gchar * gst_device_provider_get_metadata (GstDeviceProvider * provider,
+ const gchar * key);
+
+GST_API
+gboolean gst_device_provider_is_started (GstDeviceProvider * provider);
+
+/* device provider class meta data */
+
+GST_API
+void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+GST_API
+void gst_device_provider_class_set_static_metadata (GstDeviceProviderClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+GST_API
+void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value);
+GST_API
+void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
+ const gchar * key, const gchar * value);
+GST_API
+const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
+ const gchar * key);
+
+GST_API
+void gst_device_provider_device_changed (GstDeviceProvider * provider,
+ GstDevice *device,
+ GstDevice *changed_device);
+
+/* factory management */
+
+GST_API
+GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceProvider, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_PROVIDER_H__ */
diff --git a/include/gst/gstdeviceproviderfactory.h b/include/gst/gstdeviceproviderfactory.h
new file mode 100644
index 0000000000..03f571d45a
--- /dev/null
+++ b/include/gst/gstdeviceproviderfactory.h
@@ -0,0 +1,102 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000,2004 Wim Taymans <wim@fluendo.com>
+ * 2012 Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstdeviceproviderfactory.h: Header for GstDeviceProviderFactory
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __GST_DEVICE_PROVIDER_FACTORY_H__
+#define __GST_DEVICE_PROVIDER_FACTORY_H__
+
+/**
+ * GstDeviceProviderFactory:
+ *
+ * The opaque #GstDeviceProviderFactory data structure.
+ *
+ * Since: 1.4
+ */
+
+/**
+ * GstDeviceProviderFactoryClass:
+ *
+ * The opaque #GstDeviceProviderFactoryClass data structure.
+ *
+ * Since: 1.4
+ */
+typedef struct _GstDeviceProviderFactory GstDeviceProviderFactory;
+typedef struct _GstDeviceProviderFactoryClass GstDeviceProviderFactoryClass;
+
+#include <gst/gstconfig.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+#include <gst/gstdeviceprovider.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DEVICE_PROVIDER_FACTORY (gst_device_provider_factory_get_type())
+#define GST_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
+ GstDeviceProviderFactory))
+#define GST_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
+ GstDeviceProviderFactoryClass))
+#define GST_IS_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY))
+#define GST_IS_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY))
+#define GST_DEVICE_PROVIDER_FACTORY_CAST(obj) ((GstDeviceProviderFactory *)(obj))
+
+GST_API
+GType gst_device_provider_factory_get_type (void);
+
+GST_API
+GstDeviceProviderFactory * gst_device_provider_factory_find (const gchar *name);
+
+GST_API
+GType gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *factory);
+
+GST_API
+const gchar * gst_device_provider_factory_get_metadata (GstDeviceProviderFactory *factory, const gchar *key);
+
+GST_API
+gchar ** gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *factory);
+
+GST_API
+GstDeviceProvider* gst_device_provider_factory_get (GstDeviceProviderFactory *factory) G_GNUC_MALLOC;
+
+GST_API
+GstDeviceProvider* gst_device_provider_factory_get_by_name (const gchar *factoryname) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_device_provider_register (GstPlugin *plugin, const gchar *name,
+ guint rank,
+ GType type);
+GST_API
+gboolean gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
+ gchar ** classes);
+GST_API
+gboolean gst_device_provider_factory_has_classes (GstDeviceProviderFactory *factory,
+ const gchar * classes);
+GST_API
+GList * gst_device_provider_factory_list_get_device_providers (
+ GstRank minrank) G_GNUC_MALLOC;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceProviderFactory, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_DEVICE_PROVIDER_FACTORY_H__ */
diff --git a/include/gst/gstdynamictypefactory.h b/include/gst/gstdynamictypefactory.h
new file mode 100644
index 0000000000..371dafb627
--- /dev/null
+++ b/include/gst/gstdynamictypefactory.h
@@ -0,0 +1,109 @@
+/* GStreamer
+ * Copyright (C) 2015 Jan Schmidt <jan@centricular.com>
+ *
+ * gstdynamictypefactory.h: Header for GstDynamicTypeFactory
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DYNAMIC_TYPE_FACTORY_H__
+#define __GST_DYNAMIC_TYPE_FACTORY_H__
+
+/**
+ * GST_DYNAMIC_TYPE_REGISTER_DEFINE:
+ * @t_n: The dynamic type name in lower case, with words separated by '_'.
+ * Used to generate `gst_dynamic_type_register_*(GstPlugin* plugin)`.
+ * @t: The #GType of the dynamic type
+
+ * A convenience macro to define the entry point of a
+ * dynamic type `gst_dynamic_type_register_*(GstPlugin* plugin)`.
+ *
+ * Since: 1.20
+ */
+#define GST_DYNAMIC_TYPE_REGISTER_DEFINE(t_n, t) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_dynamic_type_register_, t_n) (GstPlugin * plugin) \
+{ \
+ return gst_dynamic_type_register (plugin, t); \
+} \
+G_END_DECLS
+
+/**
+ * GST_DYNAMIC_TYPE_REGISTER_DECLARE:
+ * @t_f: The dynamic type name in lower case, with words separated by '_'.
+ *
+ * This macro can be used to declare a new dynamic type.
+ * It has to be used in combination with #GST_DYNAMIC_TYPE_REGISTER_DEFINE macro
+ * and must be placed outside any block to declare the type find registration
+ * function.
+ *
+ * Since: 1.20
+ */
+#define GST_DYNAMIC_TYPE_REGISTER_DECLARE(t_n) \
+G_BEGIN_DECLS \
+gboolean G_PASTE(gst_dynamic_type_register_, t_n) (GstPlugin * plugin); \
+G_END_DECLS
+
+/**
+ * GST_DYNAMIC_TYPE_REGISTER:
+ * @t_n: The dynamic type name to register
+ * @plugin: The #GstPlugin where to register the dynamic type.
+ *
+ * This macro can be used to register a dynamic type into a #GstPlugin.
+ * This method will be usually called in the plugin init function
+ * but can also be called with a NULL plugin.
+ *
+ * Since: 1.20
+ */
+#define GST_DYNAMIC_TYPE_REGISTER(t_n, plugin) G_PASTE(gst_dynamic_type_register_, t_n) (plugin)
+
+/**
+ * GstDynamicTypeFactory:
+ *
+ * The opaque #GstDynamicTypeFactory data structure.
+ *
+ * Since: 1.12
+ */
+typedef struct _GstDynamicTypeFactory GstDynamicTypeFactory;
+typedef struct _GstDynamicTypeFactoryClass GstDynamicTypeFactoryClass;
+
+#include <gst/gstconfig.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DYNAMIC_TYPE_FACTORY (gst_dynamic_type_factory_get_type())
+#define GST_DYNAMIC_TYPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DYNAMIC_TYPE_FACTORY,\
+ GstDynamicTypeFactory))
+#define GST_DYNAMIC_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DYNAMIC_TYPE_FACTORY,\
+ GstDynamicTypeFactoryClass))
+#define GST_IS_DYNAMIC_TYPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DYNAMIC_TYPE_FACTORY))
+#define GST_IS_DYNAMIC_TYPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DYNAMIC_TYPE_FACTORY))
+#define GST_DYNAMIC_TYPE_FACTORY_CAST(obj) ((GstDynamicTypeFactory *)(obj))
+
+GST_API
+GType gst_dynamic_type_factory_get_type (void);
+
+GST_API
+GType gst_dynamic_type_factory_load (const gchar *factoryname);
+
+GST_API
+gboolean gst_dynamic_type_register (GstPlugin *plugin, GType type);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/gstelement.h b/include/gst/gstelement.h
new file mode 100644
index 0000000000..e690bf0e3f
--- /dev/null
+++ b/include/gst/gstelement.h
@@ -0,0 +1,1209 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000,2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstelement.h: Header for GstElement
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_ELEMENT_H__
+#define __GST_ELEMENT_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * _GST_ELEMENT_REGISTER_DEFINE_BEGIN: (attributes doc.skip=true)
+ */
+#define _GST_ELEMENT_REGISTER_DEFINE_BEGIN(element) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_element_register_, element) (GstPlugin * plugin) \
+{ \
+ {
+
+/**
+ * _GST_ELEMENT_REGISTER_DEFINE_END: (attributes doc.skip=true)
+ */
+#define _GST_ELEMENT_REGISTER_DEFINE_END(element_name, rank, type) \
+ } \
+ return gst_element_register (plugin, element_name, rank, type); \
+} \
+G_END_DECLS
+
+/**
+ * GST_ELEMENT_REGISTER_DEFINE_CUSTOM:
+ * @element: The element name in lower case, with words separated by '_'.
+ * Used to generate `gst_element_register_*(GstPlugin* plugin)`.
+ * @register_func: pointer to a method with the format: `gboolean register_func (GstPlugin* plugin);`
+ *
+ * A convenience macro to define the entry point of an
+ * element `gst_element_register_*(GstPlugin* plugin)` which uses
+ * register_func as the main registration method for the element.
+ * As an example, you may define the element named "streamer-filter"
+ * with the namespace `my` as following using `element_register_custom`:
+ *
+ * ```
+ * GST_ELEMENT_REGISTER_DEFINE_CUSTOM (my_element, element_register_custom)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_ELEMENT_REGISTER_DEFINE_CUSTOM(element, register_func) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_element_register_, element) (GstPlugin * plugin) \
+{ \
+ return register_func (plugin); \
+} \
+G_END_DECLS
+
+/**
+ * GST_ELEMENT_REGISTER_DEFINE:
+ * @e: The element name in lower case, with words separated by '_'.
+ * Used to generate `gst_element_register_*(GstPlugin* plugin)`.
+ * @e_n: The public name of the element
+ * @r: The #GstRank of the element (higher rank means more importance when autoplugging, see #GstRank)
+ * @t: The #GType of the element.
+ *
+ * A convenience macro to define the entry point of an
+ * element `gst_element_register_*(GstPlugin* plugin)`.
+ * As an example, you may define the element named "streamer-filter"
+ * with the namespace `my` as following:
+ *
+ * ```
+ * GST_ELEMENT_REGISTER_REGISTER_DEFINE (stream_filter, "stream-filter", GST_RANK_PRIMARY, MY_TYPE_STREAM_FILTER)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_ELEMENT_REGISTER_DEFINE(e, e_n, r, t) _GST_ELEMENT_REGISTER_DEFINE_BEGIN(e) _GST_ELEMENT_REGISTER_DEFINE_END(e_n, r, t)
+
+/**
+ * GST_ELEMENT_REGISTER_DEFINE_WITH_CODE:
+ * @e: The element name in lower case, with words separated by '_'.
+ * Used to generate `gst_element_register_*(GstPlugin* plugin)`.
+ * @e_n: The public name of the element
+ * @r: The #GstRank of the element (higher rank means more importance when autoplugging, see #GstRank)
+ * @t: The #GType of the element.
+ * @_c_: Custom code that gets inserted in the gst_element_register_*() function.
+ *
+ * A convenience macro to define the entry point of an
+ * element `gst_element_register_*(GstPlugin* plugin)` executing code
+ * before gst_element_register in `gst_element_register_*(GstPlugin* plugin)`.
+
+ * As an example, you may define the element named "stream-filter"
+ * with the namespace `my` as following:
+ *
+ * ```
+ * #define _pre_register_init \
+ * my_stream_filter_pre_register (plugin);
+ * GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (stream_filter, "stream-filter", GST_RANK_PRIMARY, MY_TYPE_STREAM_FILTER, _pre_register_init)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_ELEMENT_REGISTER_DEFINE_WITH_CODE(e, e_n, r, t, _c_) _GST_ELEMENT_REGISTER_DEFINE_BEGIN(e) {_c_;} _GST_ELEMENT_REGISTER_DEFINE_END(e_n, r, t)
+
+/**
+ * GST_ELEMENT_REGISTER_DECLARE:
+ * @element: The element name in lower case, with words separated by '_'.
+ *
+ * This macro can be used to declare a new element.
+ * It has to be used in combination with #GST_ELEMENT_REGISTER_DEFINE macros
+ * and must be placed outside any block to declare the element registration
+ * function.
+ * As an example, you may declare the element named "stream-filter"
+ * with the namespace `my` as following:
+ *
+ * ```
+ * GST_ELEMENT_REGISTER_DECLARE (stream_filter)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_ELEMENT_REGISTER_DECLARE(element) \
+G_BEGIN_DECLS \
+gboolean G_PASTE(gst_element_register_, element) (GstPlugin * plugin); \
+G_END_DECLS
+
+/**
+ * GST_ELEMENT_REGISTER:
+ * @element: The element name in lower case, with words separated by '_'.
+ * @plugin: The #GstPlugin where to register the element.
+ *
+ * This macro can be used to register an element into a #GstPlugin.
+ * This method will be usually called in the plugin init function
+ * but can also be called with a NULL plugin,
+ * for example with a static registration of the element.
+ * It has to be used in combination with #GST_ELEMENT_REGISTER_DECLARE.
+ *
+ * ```
+ * GstPlugin* plugin;
+ *
+ * ...
+ *
+ * GST_ELEMENT_REGISTER (stream_filter, plugin);
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_ELEMENT_REGISTER(element, plugin) G_PASTE(gst_element_register_, element) (plugin)
+
+/* gstelement.h and gstelementfactory.h include each other */
+typedef struct _GstElement GstElement;
+typedef struct _GstElementClass GstElementClass;
+
+/* gstmessage.h needs State */
+/**
+ * GstState:
+ * @GST_STATE_VOID_PENDING: no pending state.
+ * @GST_STATE_NULL : the NULL state or initial state of an element.
+ * @GST_STATE_READY : the element is ready to go to PAUSED.
+ * @GST_STATE_PAUSED : the element is PAUSED, it is ready to accept and
+ * process data. Sink elements however only accept one
+ * buffer and then block.
+ * @GST_STATE_PLAYING : the element is PLAYING, the #GstClock is running and
+ * the data is flowing.
+ *
+ * The possible states an element can be in. States can be changed using
+ * gst_element_set_state() and checked using gst_element_get_state().
+ */
+typedef enum {
+ GST_STATE_VOID_PENDING = 0,
+ GST_STATE_NULL = 1,
+ GST_STATE_READY = 2,
+ GST_STATE_PAUSED = 3,
+ GST_STATE_PLAYING = 4
+} GstState;
+
+#define GST_TYPE_ELEMENT (gst_element_get_type ())
+#define GST_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ELEMENT))
+#define GST_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ELEMENT))
+#define GST_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ELEMENT, GstElementClass))
+#define GST_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ELEMENT, GstElement))
+#define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass))
+#define GST_ELEMENT_CAST(obj) ((GstElement*)(obj))
+
+/**
+ * GstStateChangeReturn:
+ * @GST_STATE_CHANGE_FAILURE : the state change failed
+ * @GST_STATE_CHANGE_SUCCESS : the state change succeeded
+ * @GST_STATE_CHANGE_ASYNC : the state change will happen asynchronously
+ * @GST_STATE_CHANGE_NO_PREROLL: the state change succeeded but the element
+ * cannot produce data in %GST_STATE_PAUSED.
+ * This typically happens with live sources.
+ *
+ * The possible return values from a state change function such as
+ * gst_element_set_state(). Only @GST_STATE_CHANGE_FAILURE is a real failure.
+ */
+typedef enum {
+ GST_STATE_CHANGE_FAILURE = 0,
+ GST_STATE_CHANGE_SUCCESS = 1,
+ GST_STATE_CHANGE_ASYNC = 2,
+ GST_STATE_CHANGE_NO_PREROLL = 3
+} GstStateChangeReturn;
+
+#include <gst/gstconfig.h>
+#include <gst/gstobject.h>
+#include <gst/gstpad.h>
+#include <gst/gstbus.h>
+#include <gst/gstclock.h>
+#include <gst/gstelementfactory.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+#include <gst/gstiterator.h>
+#include <gst/gstmessage.h>
+#include <gst/gstquery.h>
+#include <gst/gsttaglist.h>
+#include <gst/gstcontext.h>
+
+/* NOTE: this probably should be done with an #ifdef to decide
+ * whether to safe-cast or to just do the non-checking cast.
+ */
+
+/**
+ * GST_STATE:
+ * @elem: a #GstElement to return state for.
+ *
+ * This macro returns the current #GstState of the element.
+ */
+#define GST_STATE(elem) (GST_ELEMENT_CAST(elem)->current_state)
+
+/**
+ * GST_STATE_NEXT:
+ * @elem: a #GstElement to return the next state for.
+ *
+ * This macro returns the next #GstState of the element.
+ */
+#define GST_STATE_NEXT(elem) (GST_ELEMENT_CAST(elem)->next_state)
+
+/**
+ * GST_STATE_PENDING:
+ * @elem: a #GstElement to return the pending state for.
+ *
+ * This macro returns the currently pending #GstState of the element.
+ */
+#define GST_STATE_PENDING(elem) (GST_ELEMENT_CAST(elem)->pending_state)
+
+/**
+ * GST_STATE_TARGET:
+ * @elem: a #GstElement to return the target state for.
+ *
+ * This macro returns the target #GstState of the element.
+ */
+#define GST_STATE_TARGET(elem) (GST_ELEMENT_CAST(elem)->target_state)
+
+/**
+ * GST_STATE_RETURN:
+ * @elem: a #GstElement to return the last state result for.
+ *
+ * This macro returns the last #GstStateChangeReturn value.
+ */
+#define GST_STATE_RETURN(elem) (GST_ELEMENT_CAST(elem)->last_return)
+
+#define __GST_SIGN(val) ((val) < 0 ? -1 : ((val) > 0 ? 1 : 0))
+/**
+ * GST_STATE_GET_NEXT:
+ * @cur: A starting #GstState
+ * @pending: A target #GstState
+ *
+ * Given a current state @cur and a target state @pending, calculate the next (intermediate)
+ * #GstState.
+ */
+#define GST_STATE_GET_NEXT(cur,pending) ((GstState)((cur) + __GST_SIGN ((gint)(pending) - (gint)(cur))))
+/**
+ * GST_STATE_TRANSITION:
+ * @cur: A current state
+ * @next: A next state
+ *
+ * Given a current state @cur and a next state @next, calculate the associated
+ * #GstStateChange transition.
+ */
+#define GST_STATE_TRANSITION(cur,next) ((GstStateChange)(((cur)<<3)|(next)))
+/**
+ * GST_STATE_TRANSITION_CURRENT:
+ * @trans: A #GstStateChange
+ *
+ * Given a state transition @trans, extract the current #GstState.
+ */
+#define GST_STATE_TRANSITION_CURRENT(trans) ((GstState)((trans)>>3))
+/**
+ * GST_STATE_TRANSITION_NEXT:
+ * @trans: A #GstStateChange
+ *
+ * Given a state transition @trans, extract the next #GstState.
+ */
+#define GST_STATE_TRANSITION_NEXT(trans) ((GstState)((trans)&0x7))
+
+/**
+ * GstStateChange:
+ * @GST_STATE_CHANGE_NULL_TO_READY : state change from NULL to READY.
+ * * The element must check if the resources it needs are available. Device
+ * sinks and -sources typically try to probe the device to constrain their
+ * caps.
+ * * The element opens the device (in case feature need to be probed).
+ * @GST_STATE_CHANGE_READY_TO_PAUSED : state change from READY to PAUSED.
+ * * The element pads are activated in order to receive data in PAUSED.
+ * Streaming threads are started.
+ * * Some elements might need to return %GST_STATE_CHANGE_ASYNC and complete
+ * the state change when they have enough information. It is a requirement
+ * for sinks to return %GST_STATE_CHANGE_ASYNC and complete the state change
+ * when they receive the first buffer or %GST_EVENT_EOS (preroll).
+ * Sinks also block the dataflow when in PAUSED.
+ * * A pipeline resets the running_time to 0.
+ * * Live sources return %GST_STATE_CHANGE_NO_PREROLL and don't generate data.
+ * @GST_STATE_CHANGE_PAUSED_TO_PLAYING: state change from PAUSED to PLAYING.
+ * * Most elements ignore this state change.
+ * * The pipeline selects a #GstClock and distributes this to all the children
+ * before setting them to PLAYING. This means that it is only allowed to
+ * synchronize on the #GstClock in the PLAYING state.
+ * * The pipeline uses the #GstClock and the running_time to calculate the
+ * base_time. The base_time is distributed to all children when performing
+ * the state change.
+ * * Sink elements stop blocking on the preroll buffer or event and start
+ * rendering the data.
+ * * Sinks can post %GST_MESSAGE_EOS in the PLAYING state. It is not allowed
+ * to post %GST_MESSAGE_EOS when not in the PLAYING state.
+ * * While streaming in PAUSED or PLAYING elements can create and remove
+ * sometimes pads.
+ * * Live sources start generating data and return %GST_STATE_CHANGE_SUCCESS.
+ * @GST_STATE_CHANGE_PLAYING_TO_PAUSED: state change from PLAYING to PAUSED.
+ * * Most elements ignore this state change.
+ * * The pipeline calculates the running_time based on the last selected
+ * #GstClock and the base_time. It stores this information to continue
+ * playback when going back to the PLAYING state.
+ * * Sinks unblock any #GstClock wait calls.
+ * * When a sink does not have a pending buffer to play, it returns
+ * #GST_STATE_CHANGE_ASYNC from this state change and completes the state
+ * change when it receives a new buffer or an %GST_EVENT_EOS.
+ * * Any queued %GST_MESSAGE_EOS items are removed since they will be reposted
+ * when going back to the PLAYING state. The EOS messages are queued in
+ * #GstBin containers.
+ * * Live sources stop generating data and return %GST_STATE_CHANGE_NO_PREROLL.
+ * @GST_STATE_CHANGE_PAUSED_TO_READY : state change from PAUSED to READY.
+ * * Sinks unblock any waits in the preroll.
+ * * Elements unblock any waits on devices
+ * * Chain or get_range functions return %GST_FLOW_FLUSHING.
+ * * The element pads are deactivated so that streaming becomes impossible and
+ * all streaming threads are stopped.
+ * * The sink forgets all negotiated formats
+ * * Elements remove all sometimes pads
+ * @GST_STATE_CHANGE_READY_TO_NULL : state change from READY to NULL.
+ * * Elements close devices
+ * * Elements reset any internal state.
+ * @GST_STATE_CHANGE_NULL_TO_NULL : state change from NULL to NULL. (Since: 1.14)
+ * @GST_STATE_CHANGE_READY_TO_READY : state change from READY to READY,
+ * This might happen when going to PAUSED asynchronously failed, in that case
+ * elements should make sure they are in a proper, coherent READY state. (Since: 1.14)
+ * @GST_STATE_CHANGE_PAUSED_TO_PAUSED : state change from PAUSED to PAUSED.
+ * This might happen when elements were in PLAYING state and 'lost state',
+ * they should make sure to go back to real 'PAUSED' state (prerolling for example). (Since: 1.14)
+ * @GST_STATE_CHANGE_PLAYING_TO_PLAYING : state change from PLAYING to PLAYING. (Since: 1.14)
+ *
+ * These are the different state changes an element goes through.
+ * %GST_STATE_NULL &rArr; %GST_STATE_PLAYING is called an upwards state change
+ * and %GST_STATE_PLAYING &rArr; %GST_STATE_NULL a downwards state change.
+ */
+typedef enum /*< flags=0 >*/
+{
+ GST_STATE_CHANGE_NULL_TO_READY = (GST_STATE_NULL<<3) | GST_STATE_READY,
+ GST_STATE_CHANGE_READY_TO_PAUSED = (GST_STATE_READY<<3) | GST_STATE_PAUSED,
+ GST_STATE_CHANGE_PAUSED_TO_PLAYING = (GST_STATE_PAUSED<<3) | GST_STATE_PLAYING,
+ GST_STATE_CHANGE_PLAYING_TO_PAUSED = (GST_STATE_PLAYING<<3) | GST_STATE_PAUSED,
+ GST_STATE_CHANGE_PAUSED_TO_READY = (GST_STATE_PAUSED<<3) | GST_STATE_READY,
+ GST_STATE_CHANGE_READY_TO_NULL = (GST_STATE_READY<<3) | GST_STATE_NULL,
+ GST_STATE_CHANGE_NULL_TO_NULL = (GST_STATE_NULL<<3) | GST_STATE_NULL,
+ GST_STATE_CHANGE_READY_TO_READY = (GST_STATE_READY<<3) | GST_STATE_READY,
+ GST_STATE_CHANGE_PAUSED_TO_PAUSED = (GST_STATE_PAUSED<<3) | GST_STATE_PAUSED,
+ GST_STATE_CHANGE_PLAYING_TO_PLAYING = (GST_STATE_PLAYING<<3) | GST_STATE_PLAYING
+} GstStateChange;
+
+/**
+ * GstElementFlags:
+ * @GST_ELEMENT_FLAG_LOCKED_STATE: ignore state changes from parent
+ * @GST_ELEMENT_FLAG_SINK: the element is a sink
+ * @GST_ELEMENT_FLAG_SOURCE: the element is a source.
+ * @GST_ELEMENT_FLAG_PROVIDE_CLOCK: the element can provide a clock
+ * @GST_ELEMENT_FLAG_REQUIRE_CLOCK: the element requires a clock
+ * @GST_ELEMENT_FLAG_INDEXABLE: the element can use an index
+ * @GST_ELEMENT_FLAG_LAST: offset to define more flags
+ *
+ * The standard flags that an element may have.
+ */
+typedef enum
+{
+ GST_ELEMENT_FLAG_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 0),
+ GST_ELEMENT_FLAG_SINK = (GST_OBJECT_FLAG_LAST << 1),
+ GST_ELEMENT_FLAG_SOURCE = (GST_OBJECT_FLAG_LAST << 2),
+ GST_ELEMENT_FLAG_PROVIDE_CLOCK = (GST_OBJECT_FLAG_LAST << 3),
+ GST_ELEMENT_FLAG_REQUIRE_CLOCK = (GST_OBJECT_FLAG_LAST << 4),
+ GST_ELEMENT_FLAG_INDEXABLE = (GST_OBJECT_FLAG_LAST << 5),
+ /* padding */
+ GST_ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 10)
+} GstElementFlags;
+
+/**
+ * GST_ELEMENT_IS_LOCKED_STATE:
+ * @elem: A #GstElement to query
+ *
+ * Check if the element is in the locked state and therefore will ignore state
+ * changes from its parent object.
+ */
+#define GST_ELEMENT_IS_LOCKED_STATE(elem) (GST_OBJECT_FLAG_IS_SET(elem,GST_ELEMENT_FLAG_LOCKED_STATE))
+
+/**
+ * GST_ELEMENT_NAME:
+ * @elem: A #GstElement to query
+ *
+ * Gets the name of this element. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_element_get_name() instead.
+ */
+#define GST_ELEMENT_NAME(elem) (GST_OBJECT_NAME(elem))
+
+/**
+ * GST_ELEMENT_PARENT:
+ * @elem: A #GstElement to query
+ *
+ * Get the parent object of this element. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_object_get_parent() instead.
+ */
+#define GST_ELEMENT_PARENT(elem) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(elem)))
+
+/**
+ * GST_ELEMENT_BUS:
+ * @elem: A #GstElement to query
+ *
+ * Get the message bus of this element. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_element_get_bus() instead.
+ */
+#define GST_ELEMENT_BUS(elem) (GST_ELEMENT_CAST(elem)->bus)
+
+/**
+ * GST_ELEMENT_CLOCK:
+ * @elem: A #GstElement to query
+ *
+ * Get the clock of this element.This is not thread-safe by default
+ * (i.e. you will have to make sure it is safe yourself).
+ * If in doubt use gst_element_get_clock() instead.
+ */
+#define GST_ELEMENT_CLOCK(elem) (GST_ELEMENT_CAST(elem)->clock)
+
+/**
+ * GST_ELEMENT_PADS:
+ * @elem: A #GstElement to query
+ *
+ * Get the pads of this elements.
+ */
+#define GST_ELEMENT_PADS(elem) (GST_ELEMENT_CAST(elem)->pads)
+
+/**
+ * GST_ELEMENT_START_TIME:
+ * @elem: a #GstElement to return the start time for.
+ *
+ * This macro returns the start_time of the @elem. The start_time is the
+ * running_time of the pipeline when the element went to PAUSED.
+ */
+#define GST_ELEMENT_START_TIME(elem) (GST_ELEMENT_CAST(elem)->start_time)
+
+GST_API
+GstStructure *gst_make_element_message_details (const char *name, ...) G_GNUC_NULL_TERMINATED;
+
+#define GST_ELEMENT_MESSAGE_MAKE_DETAILS(args) gst_make_element_message_details args
+
+/**
+ * GST_ELEMENT_FLOW_ERROR:
+ * @el: the element that generates the error
+ * @flow_return: the GstFlowReturn leading to that ERROR message
+ *
+ * Utility function that elements can use in case they encountered a fatal
+ * data processing error due to wrong flow processing.
+ *
+ * Since: 1.10
+ */
+#define GST_ELEMENT_FLOW_ERROR(el,flow_return) \
+G_STMT_START { \
+ GST_ELEMENT_ERROR_WITH_DETAILS (el, STREAM, FAILED, \
+ ("Internal data stream error."), \
+ ("streaming stopped, reason %s (%d)", gst_flow_get_name (flow_return), flow_return), \
+ ("flow-return", G_TYPE_INT, flow_return, NULL));\
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_ERROR_WITH_DETAILS:
+ * @el: the element that generates the error
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ * @args: optional name, type, value triplets, which will be stored
+ * in the associated GstStructure. NULL terminator required.
+ * Must be enclosed within parentheses.
+ *
+ * Utility function that elements can use in case they encountered a fatal
+ * data processing error. The pipeline will post an error message and the
+ * application will be requested to stop further media processing.
+ *
+ * Since: 1.10
+ */
+#define GST_ELEMENT_ERROR_WITH_DETAILS(el,domain,code,text,debug,args) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_WARNING_OBJECT (el, "error: %s", __txt); \
+ if (__dbg) \
+ GST_WARNING_OBJECT (el, "error: %s", __dbg); \
+ gst_element_message_full_with_details (GST_ELEMENT(el), \
+ GST_MESSAGE_ERROR, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__, GST_ELEMENT_MESSAGE_MAKE_DETAILS(args)); \
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_ERROR:
+ * @el: the element that generates the error
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ *
+ * Utility function that elements can use in case they encountered a fatal
+ * data processing error. The pipeline will post an error message and the
+ * application will be requested to stop further media processing.
+ */
+#define GST_ELEMENT_ERROR(el,domain,code,text,debug) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_WARNING_OBJECT (el, "error: %s", __txt); \
+ if (__dbg) \
+ GST_WARNING_OBJECT (el, "error: %s", __dbg); \
+ gst_element_message_full (GST_ELEMENT(el), \
+ GST_MESSAGE_ERROR, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__); \
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_WARNING_WITH_DETAILS:
+ * @el: the element that generates the warning
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ * @args: optional name, type, value triplets, which will be stored
+ * in the associated GstStructure. NULL terminator required.
+ * Must be enclosed within parentheses.
+ *
+ * Utility function that elements can use in case they encountered a non-fatal
+ * data processing problem. The pipeline will post a warning message and the
+ * application will be informed.
+ *
+ * Since: 1.10
+ */
+#define GST_ELEMENT_WARNING_WITH_DETAILS(el, domain, code, text, debug, args)\
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_WARNING_OBJECT (el, "warning: %s", __txt); \
+ if (__dbg) \
+ GST_WARNING_OBJECT (el, "warning: %s", __dbg); \
+ gst_element_message_full_with_details (GST_ELEMENT(el), \
+ GST_MESSAGE_WARNING, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__, GST_ELEMENT_MESSAGE_MAKE_DETAILS(args)); \
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_WARNING:
+ * @el: the element that generates the warning
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ *
+ * Utility function that elements can use in case they encountered a non-fatal
+ * data processing problem. The pipeline will post a warning message and the
+ * application will be informed.
+ */
+#define GST_ELEMENT_WARNING(el, domain, code, text, debug) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_WARNING_OBJECT (el, "warning: %s", __txt); \
+ if (__dbg) \
+ GST_WARNING_OBJECT (el, "warning: %s", __dbg); \
+ gst_element_message_full (GST_ELEMENT(el), \
+ GST_MESSAGE_WARNING, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__); \
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_INFO_WITH_DETAILS:
+ * @el: the element that generates the information
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ * @args: optional name, type, value triplets, which will be stored
+ * in the associated GstStructure. NULL terminator required.
+ * Must be enclosed within parentheses.
+ *
+ * Utility function that elements can use in case they want to inform
+ * the application of something noteworthy that is not an error.
+ * The pipeline will post a info message and the
+ * application will be informed.
+ * Optional name, type, value triplets may be supplied, and will be stored
+ * in the associated GstStructure. NULL terminator required.
+ *
+ * Since: 1.10
+ */
+#define GST_ELEMENT_INFO_WITH_DETAILS(el, domain, code, text, debug, args) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_INFO_OBJECT (el, "info: %s", __txt); \
+ if (__dbg) \
+ GST_INFO_OBJECT (el, "info: %s", __dbg); \
+ gst_element_message_full_with_details (GST_ELEMENT(el), \
+ GST_MESSAGE_INFO, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__, GST_ELEMENT_MESSAGE_MAKE_DETAILS(args)); \
+} G_STMT_END
+
+/**
+ * GST_ELEMENT_INFO:
+ * @el: the element that generates the information
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see [GstGError](gsterror))
+ * @code: error code defined for that domain (see [GstGError](gsterror))
+ * @text: the message to display (format string and args enclosed in
+ parentheses)
+ * @debug: debugging information for the message (format string and args
+ enclosed in parentheses)
+ *
+ * Utility function that elements can use in case they want to inform
+ * the application of something noteworthy that is not an error.
+ * The pipeline will post a info message and the
+ * application will be informed.
+ */
+#define GST_ELEMENT_INFO(el, domain, code, text, debug) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ if (__txt) \
+ GST_INFO_OBJECT (el, "info: %s", __txt); \
+ if (__dbg) \
+ GST_INFO_OBJECT (el, "info: %s", __dbg); \
+ gst_element_message_full (GST_ELEMENT(el), \
+ GST_MESSAGE_INFO, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__); \
+} G_STMT_END
+
+/* the state change mutexes and conds */
+/**
+ * GST_STATE_GET_LOCK:
+ * @elem: a #GstElement
+ *
+ * Get a reference to the state lock of @elem.
+ * This lock is used by the core. It is taken while getting or setting
+ * the state, during state changes, and while finalizing.
+ */
+#define GST_STATE_GET_LOCK(elem) (&(GST_ELEMENT_CAST(elem)->state_lock))
+/**
+ * GST_STATE_GET_COND:
+ * @elem: a #GstElement
+ *
+ * Get the conditional used to signal the completion of a state change.
+ */
+#define GST_STATE_GET_COND(elem) (&GST_ELEMENT_CAST(elem)->state_cond)
+
+#define GST_STATE_LOCK(elem) g_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_TRYLOCK(elem) g_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_UNLOCK(elem) g_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), \
+ GST_OBJECT_GET_LOCK (elem))
+#define GST_STATE_WAIT_UNTIL(elem, end_time) g_cond_wait_until (GST_STATE_GET_COND (elem), \
+ GST_OBJECT_GET_LOCK (elem), end_time)
+#define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
+#define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
+
+/**
+ * GstElement:
+ * @state_lock: Used to serialize execution of gst_element_set_state()
+ * @state_cond: Used to signal completion of a state change
+ * @state_cookie: Used to detect concurrent execution of
+ * gst_element_set_state() and gst_element_get_state()
+ * @target_state: the target state of an element as set by the application
+ * @current_state: the current state of an element
+ * @next_state: the next state of an element, can be #GST_STATE_VOID_PENDING if
+ * the element is in the correct state.
+ * @pending_state: the final state the element should go to, can be
+ * #GST_STATE_VOID_PENDING if the element is in the correct state
+ * @last_return: the last return value of an element state change
+ * @bus: the bus of the element. This bus is provided to the element by the
+ * parent element or the application. A #GstPipeline has a bus of its own.
+ * @clock: the clock of the element. This clock is usually provided to the
+ * element by the toplevel #GstPipeline.
+ * @base_time: the time of the clock right before the element is set to
+ * PLAYING. Subtracting @base_time from the current clock time in the PLAYING
+ * state will yield the running_time against the clock.
+ * @start_time: the running_time of the last PAUSED state
+ * @numpads: number of pads of the element, includes both source and sink pads.
+ * @pads: (element-type Gst.Pad): list of pads
+ * @numsrcpads: number of source pads of the element.
+ * @srcpads: (element-type Gst.Pad): list of source pads
+ * @numsinkpads: number of sink pads of the element.
+ * @sinkpads: (element-type Gst.Pad): list of sink pads
+ * @pads_cookie: updated whenever the a pad is added or removed
+ * @contexts: (element-type Gst.Context): list of contexts
+ *
+ * GStreamer element abstract base class.
+ */
+struct _GstElement
+{
+ GstObject object;
+
+ /*< public >*/ /* with LOCK */
+ GRecMutex state_lock;
+
+ /* element state */
+ GCond state_cond;
+ guint32 state_cookie;
+ GstState target_state;
+ GstState current_state;
+ GstState next_state;
+ GstState pending_state;
+ GstStateChangeReturn last_return;
+
+ GstBus *bus;
+
+ /* allocated clock */
+ GstClock *clock;
+ GstClockTimeDiff base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */
+ GstClockTime start_time;
+
+ /* element pads, these lists can only be iterated while holding
+ * the LOCK or checking the cookie after each LOCK. */
+ guint16 numpads;
+ GList *pads;
+ guint16 numsrcpads;
+ GList *srcpads;
+ guint16 numsinkpads;
+ GList *sinkpads;
+ guint32 pads_cookie;
+
+ /* with object LOCK */
+ GList *contexts;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING-1];
+};
+
+/**
+ * GstElementClass:
+ * @parent_class: the parent class structure
+ * @metadata: metadata for elements of this class
+ * @elementfactory: the #GstElementFactory that creates these elements
+ * @padtemplates: a #GList of #GstPadTemplate
+ * @numpadtemplates: the number of padtemplates
+ * @pad_templ_cookie: changed whenever the padtemplates change
+ * @request_new_pad: called when a new pad is requested
+ * @release_pad: called when a request pad is to be released
+ * @get_state: get the state of the element
+ * @set_state: set a new state on the element
+ * @change_state: called by @set_state to perform an incremental state change
+ * @set_bus: set a #GstBus on the element
+ * @provide_clock: gets the #GstClock provided by the element
+ * @set_clock: set the #GstClock on the element
+ * @send_event: send a #GstEvent to the element
+ * @query: perform a #GstQuery on the element
+ * @state_changed: called immediately after a new state was set.
+ * @post_message: called when a message is posted on the element. Chain up to
+ * the parent class' handler to have it posted on the bus.
+ * @set_context: set a #GstContext on the element
+ *
+ * GStreamer element class. Override the vmethods to implement the element
+ * functionality.
+ */
+struct _GstElementClass
+{
+ GstObjectClass parent_class;
+
+ /*< public >*/
+ /* the element metadata */
+ gpointer metadata;
+
+ /* factory that the element was created from */
+ GstElementFactory *elementfactory;
+
+ /* templates for our pads */
+ GList *padtemplates;
+ gint numpadtemplates;
+ guint32 pad_templ_cookie;
+
+ /*< private >*/
+ /* signal callbacks */
+ void (*pad_added) (GstElement *element, GstPad *pad);
+ void (*pad_removed) (GstElement *element, GstPad *pad);
+ void (*no_more_pads) (GstElement *element);
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ /* request/release pads */
+ /* FIXME 2.0 harmonize naming with gst_element_request_pad */
+ GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ,
+ const gchar* name, const GstCaps *caps);
+
+ void (*release_pad) (GstElement *element, GstPad *pad);
+
+ /* state changes */
+ GstStateChangeReturn (*get_state) (GstElement * element, GstState * state,
+ GstState * pending, GstClockTime timeout);
+ GstStateChangeReturn (*set_state) (GstElement *element, GstState state);
+ GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition);
+ void (*state_changed) (GstElement *element, GstState oldstate,
+ GstState newstate, GstState pending);
+
+ /* bus */
+ void (*set_bus) (GstElement * element, GstBus * bus);
+
+ /* set/get clocks */
+ GstClock* (*provide_clock) (GstElement *element);
+ gboolean (*set_clock) (GstElement *element, GstClock *clock);
+
+ /* query functions */
+ gboolean (*send_event) (GstElement *element, GstEvent *event);
+
+ gboolean (*query) (GstElement *element, GstQuery *query);
+
+ gboolean (*post_message) (GstElement *element, GstMessage *message);
+
+ void (*set_context) (GstElement *element, GstContext *context);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-2];
+};
+
+/* element class pad templates */
+
+GST_API
+void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
+
+GST_API
+void gst_element_class_add_static_pad_template (GstElementClass *klass, GstStaticPadTemplate *static_templ);
+
+GST_API
+void gst_element_class_add_static_pad_template_with_gtype (GstElementClass *klass,
+ GstStaticPadTemplate *static_templ,
+ GType pad_type);
+
+GST_API
+GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
+
+GST_API
+GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
+
+/* element class meta data */
+
+GST_API
+void gst_element_class_set_metadata (GstElementClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+GST_API
+void gst_element_class_set_static_metadata (GstElementClass *klass,
+ const gchar *longname,
+ const gchar *classification,
+ const gchar *description,
+ const gchar *author);
+GST_API
+void gst_element_class_add_metadata (GstElementClass * klass,
+ const gchar * key, const gchar * value);
+GST_API
+void gst_element_class_add_static_metadata (GstElementClass * klass,
+ const gchar * key, const gchar * value);
+GST_API
+const gchar * gst_element_class_get_metadata (GstElementClass * klass,
+ const gchar * key);
+
+
+/* element instance */
+
+GST_API
+GType gst_element_get_type (void);
+
+/* basic name and parentage stuff from GstObject */
+
+/**
+ * gst_element_get_name:
+ * @elem: a #GstElement to get the name of @elem.
+ *
+ * Returns a copy of the name of @elem.
+ * Caller should g_free() the return value after usage.
+ * For a nameless element, this returns %NULL, which you can safely g_free()
+ * as well.
+ *
+ * Returns: (transfer full) (nullable): the name of @elem. g_free()
+ * after usage. MT safe.
+ *
+ */
+#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT_CAST(elem))
+
+/**
+ * gst_element_set_name:
+ * @elem: a #GstElement to set the name of.
+ * @name: the new name
+ *
+ * Sets the name of the element, getting rid of the old name if there was one.
+ */
+#define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT_CAST(elem),name)
+
+/**
+ * gst_element_get_parent:
+ * @elem: a #GstElement to get the parent of.
+ *
+ * Get the parent of an element.
+ *
+ * Returns: (transfer full): the parent of an element.
+ */
+#define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT_CAST(elem))
+
+/**
+ * gst_element_set_parent:
+ * @elem: a #GstElement to set the parent of.
+ * @parent: the new parent #GstObject of the element.
+ *
+ * Sets the parent of an element.
+ */
+#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT_CAST(elem),parent)
+
+/* clocking */
+
+GST_API
+GstClock* gst_element_provide_clock (GstElement *element);
+
+GST_API
+GstClock* gst_element_get_clock (GstElement *element);
+
+GST_API
+gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
+
+GST_API
+void gst_element_set_base_time (GstElement *element, GstClockTime time);
+
+GST_API
+GstClockTime gst_element_get_base_time (GstElement *element);
+
+GST_API
+void gst_element_set_start_time (GstElement *element, GstClockTime time);
+
+GST_API
+GstClockTime gst_element_get_start_time (GstElement *element);
+
+GST_API
+GstClockTime gst_element_get_current_running_time (GstElement *element);
+
+GST_API
+GstClockTime gst_element_get_current_clock_time (GstElement *element);
+
+/* bus */
+
+GST_API
+void gst_element_set_bus (GstElement * element, GstBus * bus);
+
+GST_API
+GstBus * gst_element_get_bus (GstElement * element);
+
+/* context */
+
+GST_API
+void gst_element_set_context (GstElement * element, GstContext * context);
+
+GST_API
+GList * gst_element_get_contexts (GstElement * element);
+
+GST_API
+GstContext * gst_element_get_context (GstElement * element, const gchar * context_type);
+
+GST_API
+GstContext * gst_element_get_context_unlocked (GstElement * element, const gchar * context_type);
+
+/* pad management */
+
+GST_API
+gboolean gst_element_add_pad (GstElement *element, GstPad *pad);
+
+GST_API
+gboolean gst_element_remove_pad (GstElement *element, GstPad *pad);
+
+GST_API
+void gst_element_no_more_pads (GstElement *element);
+
+GST_API
+GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
+
+GST_API G_DEPRECATED_FOR(gst_element_request_pad_simple)
+GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
+
+GST_API
+GstPad* gst_element_request_pad_simple (GstElement *element, const gchar *name);
+
+GST_API
+GstPad* gst_element_request_pad (GstElement *element, GstPadTemplate *templ,
+ const gchar * name, const GstCaps *caps);
+GST_API
+void gst_element_release_request_pad (GstElement *element, GstPad *pad);
+
+GST_API
+GstIterator * gst_element_iterate_pads (GstElement * element);
+
+GST_API
+GstIterator * gst_element_iterate_src_pads (GstElement * element);
+
+GST_API
+GstIterator * gst_element_iterate_sink_pads (GstElement * element);
+
+/**
+ * GstElementForeachPadFunc:
+ * @element: the #GstElement
+ * @pad: a #GstPad
+ * @user_data: user data passed to the foreach function
+ *
+ * Function called for each pad when using gst_element_foreach_sink_pad(),
+ * gst_element_foreach_src_pad(), or gst_element_foreach_pad().
+ *
+ * Returns: %FALSE to stop iterating pads, %TRUE to continue
+ *
+ * Since: 1.14
+ */
+typedef gboolean (*GstElementForeachPadFunc) (GstElement * element,
+ GstPad * pad,
+ gpointer user_data);
+
+GST_API
+gboolean gst_element_foreach_sink_pad (GstElement * element,
+ GstElementForeachPadFunc func,
+ gpointer user_data);
+GST_API
+gboolean gst_element_foreach_src_pad (GstElement * element,
+ GstElementForeachPadFunc func,
+ gpointer user_data);
+GST_API
+gboolean gst_element_foreach_pad (GstElement * element,
+ GstElementForeachPadFunc func,
+ gpointer user_data);
+/* event/query/format stuff */
+
+GST_API
+gboolean gst_element_send_event (GstElement *element, GstEvent *event);
+
+GST_API
+gboolean gst_element_seek (GstElement *element, gdouble rate,
+ GstFormat format, GstSeekFlags flags,
+ GstSeekType start_type, gint64 start,
+ GstSeekType stop_type, gint64 stop);
+GST_API
+gboolean gst_element_query (GstElement *element, GstQuery *query);
+
+/* messages */
+
+GST_API
+gboolean gst_element_post_message (GstElement * element, GstMessage * message);
+
+/* error handling */
+/* gcc versions < 3.3 warn about NULL being passed as format to printf */
+#if (!defined(__GNUC__) || (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 3))
+GST_API
+gchar * _gst_element_error_printf (const gchar *format, ...);
+#else
+GST_API
+gchar * _gst_element_error_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
+#endif
+
+GST_API
+void gst_element_message_full (GstElement * element, GstMessageType type,
+ GQuark domain, gint code, gchar * text,
+ gchar * debug, const gchar * file,
+ const gchar * function, gint line);
+GST_API
+void gst_element_message_full_with_details (GstElement * element, GstMessageType type,
+ GQuark domain, gint code, gchar * text,
+ gchar * debug, const gchar * file,
+ const gchar * function, gint line,
+ GstStructure * structure);
+
+/* state management */
+
+GST_API
+gboolean gst_element_is_locked_state (GstElement *element);
+
+GST_API
+gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state);
+
+GST_API
+gboolean gst_element_sync_state_with_parent (GstElement *element);
+
+GST_API
+GstStateChangeReturn gst_element_get_state (GstElement * element,
+ GstState * state,
+ GstState * pending,
+ GstClockTime timeout);
+GST_API
+GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state);
+
+GST_API
+void gst_element_abort_state (GstElement * element);
+
+GST_API
+GstStateChangeReturn gst_element_change_state (GstElement * element,
+ GstStateChange transition);
+
+GST_API
+GstStateChangeReturn gst_element_continue_state (GstElement * element,
+ GstStateChangeReturn ret);
+GST_API
+void gst_element_lost_state (GstElement * element);
+
+
+/**
+ * GstElementCallAsyncFunc:
+ * @element: The #GstElement this function has been called against
+ * @user_data: Data passed in the function where that callback has been passed
+ *
+ * Callback prototype used in #gst_element_call_async
+ */
+typedef void (*GstElementCallAsyncFunc) (GstElement * element,
+ gpointer user_data);
+GST_API
+void gst_element_call_async (GstElement * element,
+ GstElementCallAsyncFunc func, gpointer user_data,
+ GDestroyNotify destroy_notify);
+
+/* factory management */
+
+GST_API
+GstElementFactory* gst_element_get_factory (GstElement *element);
+
+/* utility functions */
+
+GST_API
+gulong gst_element_add_property_notify_watch (GstElement * element,
+ const gchar * property_name,
+ gboolean include_value);
+GST_API
+gulong gst_element_add_property_deep_notify_watch (GstElement * element,
+ const gchar * property_name,
+ gboolean include_value);
+GST_API
+void gst_element_remove_property_notify_watch (GstElement * element,
+ gulong watch_id);
+
+GST_API
+GstPadTemplate* gst_element_get_pad_template (GstElement *element, const gchar *name);
+
+GST_API
+GList* gst_element_get_pad_template_list (GstElement *element);
+GST_API
+const gchar * gst_element_get_metadata (GstElement * element, const gchar * key);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstElement, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_ELEMENT_H__ */
diff --git a/include/gst/gstelementfactory.h b/include/gst/gstelementfactory.h
new file mode 100644
index 0000000000..07f3f81b22
--- /dev/null
+++ b/include/gst/gstelementfactory.h
@@ -0,0 +1,272 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000,2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstelementfactory.h: Header for GstElementFactory
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_ELEMENT_FACTORY_H__
+#define __GST_ELEMENT_FACTORY_H__
+
+/**
+ * GstElementFactory:
+ *
+ * The opaque #GstElementFactory data structure.
+ */
+typedef struct _GstElementFactory GstElementFactory;
+typedef struct _GstElementFactoryClass GstElementFactoryClass;
+
+#include <gst/gstconfig.h>
+#include <gst/gstelement.h>
+#include <gst/gstpad.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+#include <gst/gsturi.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type())
+#define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\
+ GstElementFactory))
+#define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\
+ GstElementFactoryClass))
+#define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY))
+#define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY))
+#define GST_ELEMENT_FACTORY_CAST(obj) ((GstElementFactory *)(obj))
+
+GST_API
+GType gst_element_factory_get_type (void);
+
+GST_API
+GstElementFactory * gst_element_factory_find (const gchar *name);
+
+GST_API
+GType gst_element_factory_get_element_type (GstElementFactory *factory);
+
+GST_API
+const gchar * gst_element_factory_get_metadata (GstElementFactory *factory, const gchar *key);
+
+GST_API
+gchar ** gst_element_factory_get_metadata_keys (GstElementFactory *factory);
+
+GST_API
+guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
+
+GST_API
+const GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
+
+GST_API
+GstURIType gst_element_factory_get_uri_type (GstElementFactory *factory);
+
+GST_API
+const gchar * const * gst_element_factory_get_uri_protocols (GstElementFactory *factory);
+
+GST_API
+gboolean gst_element_factory_has_interface (GstElementFactory *factory,
+ const gchar *interfacename);
+GST_API
+GstElement* gst_element_factory_create (GstElementFactory *factory,
+ const gchar *name) G_GNUC_MALLOC;
+GST_API
+GstElement* gst_element_factory_create_full (GstElementFactory * factory,
+ const gchar * first, ...) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_element_factory_create_valist (GstElementFactory * factory,
+ const gchar * first, va_list properties) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_element_factory_create_with_properties (GstElementFactory * factory,
+ guint n, const gchar *names[], const GValue values[]) G_GNUC_MALLOC;
+GST_API
+GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name) G_GNUC_MALLOC;
+
+GST_API
+GstElement* gst_element_factory_make_full (const gchar *factoryname,
+ const gchar *first, ...) G_GNUC_MALLOC;
+GST_API
+GstElement* gst_element_factory_make_valist (const gchar *factoryname,
+ const gchar *first, va_list properties) G_GNUC_MALLOC;
+GST_API
+GstElement* gst_element_factory_make_with_properties (const gchar *factoryname,
+ guint n, const gchar *names[], const GValue values[]) G_GNUC_MALLOC;
+GST_API
+gboolean gst_element_register (GstPlugin *plugin, const gchar *name,
+ guint rank, GType type);
+
+GST_API
+void gst_element_type_set_skip_documentation (GType type);
+
+GST_API
+gboolean gst_element_factory_get_skip_documentation (GstElementFactory * factory);
+
+/* Factory list functions */
+
+/**
+ * GstFactoryListType:
+ * @GST_ELEMENT_FACTORY_TYPE_DECODER: Decoder elements
+ * @GST_ELEMENT_FACTORY_TYPE_ENCODER: Encoder elements
+ * @GST_ELEMENT_FACTORY_TYPE_SINK: Sink elements
+ * @GST_ELEMENT_FACTORY_TYPE_SRC: Source elements
+ * @GST_ELEMENT_FACTORY_TYPE_MUXER: Muxer elements
+ * @GST_ELEMENT_FACTORY_TYPE_DEMUXER: Demuxer elements
+ * @GST_ELEMENT_FACTORY_TYPE_PARSER: Parser elements
+ * @GST_ELEMENT_FACTORY_TYPE_PAYLOADER: Payloader elements
+ * @GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER: Depayloader elements
+ * @GST_ELEMENT_FACTORY_TYPE_DECRYPTOR: Elements handling decryption (Since: 1.6)
+ * @GST_ELEMENT_FACTORY_TYPE_ENCRYPTOR: Elements handling encryption (Since: 1.6)
+ * @GST_ELEMENT_FACTORY_TYPE_HARDWARE: Hardware based elements (Since: 1.18)
+ * @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS: Private, do not use
+ * @GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO: Elements handling video media types
+ * @GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO: Elements handling audio media types
+ * @GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE: Elements handling image media types
+ * @GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE: Elements handling subtitle media types
+ * @GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA: Elements handling metadata media types
+ *
+ * The type of #GstElementFactory to filter.
+ *
+ * All @GstFactoryListType up to @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS are exclusive.
+ *
+ * If one or more of the MEDIA types are specified, then only elements
+ * matching the specified media types will be selected.
+ */
+
+/**
+ * GstElementFactoryListType:
+ *
+ * A type defining the type of an element factory.
+ */
+typedef guint64 GstElementFactoryListType;
+
+#define GST_ELEMENT_FACTORY_TYPE_DECODER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 0))
+#define GST_ELEMENT_FACTORY_TYPE_ENCODER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 1))
+#define GST_ELEMENT_FACTORY_TYPE_SINK ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 2))
+#define GST_ELEMENT_FACTORY_TYPE_SRC ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 3))
+#define GST_ELEMENT_FACTORY_TYPE_MUXER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 4))
+#define GST_ELEMENT_FACTORY_TYPE_DEMUXER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 5))
+#define GST_ELEMENT_FACTORY_TYPE_PARSER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 6))
+#define GST_ELEMENT_FACTORY_TYPE_PAYLOADER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 7))
+#define GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 8))
+#define GST_ELEMENT_FACTORY_TYPE_FORMATTER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 9))
+#define GST_ELEMENT_FACTORY_TYPE_DECRYPTOR ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 10))
+#define GST_ELEMENT_FACTORY_TYPE_ENCRYPTOR ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 11))
+#define GST_ELEMENT_FACTORY_TYPE_HARDWARE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 12))
+
+#define GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 48))
+
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 49))
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 50))
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 51))
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 52))
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 53))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_ANY: (value 562949953421311) (type GstElementFactoryListType)
+ *
+ * Elements of any of the defined GST_ELEMENT_FACTORY_LIST types
+ */
+#define GST_ELEMENT_FACTORY_TYPE_ANY ((GstElementFactoryListType)((G_GUINT64_CONSTANT (1) << 49) - 1))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY: (value 18446462598732840960) (type GstElementFactoryListType)
+ *
+ * Elements matching any of the defined GST_ELEMENT_FACTORY_TYPE_MEDIA types
+ *
+ * Note: Do not use this if you wish to not filter against any of the defined
+ * media types. If you wish to do this, simply don't specify any
+ * GST_ELEMENT_FACTORY_TYPE_MEDIA flag.
+ */
+#define GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY ((GstElementFactoryListType)(~G_GUINT64_CONSTANT (0) << 48))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER: (value 2814749767106562) (type GstElementFactoryListType)
+ *
+ * All encoders handling video or image media types
+ */
+#define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER: (value 1125899906842626) (type GstElementFactoryListType)
+ *
+ * All encoders handling audio media types
+ */
+#define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS: (value 3940649673949188) (type GstElementFactoryListType)
+ *
+ * All sinks handling audio, video or image media types
+ */
+#define GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE))
+
+/**
+ * GST_ELEMENT_FACTORY_TYPE_DECODABLE: (value 1377) (type GstElementFactoryListType)
+ *
+ * All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders)
+ */
+#define GST_ELEMENT_FACTORY_TYPE_DECODABLE \
+ ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER | GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_DECRYPTOR))
+
+/* Element klass defines */
+#define GST_ELEMENT_FACTORY_KLASS_DECODER "Decoder"
+#define GST_ELEMENT_FACTORY_KLASS_ENCODER "Encoder"
+#define GST_ELEMENT_FACTORY_KLASS_SINK "Sink"
+#define GST_ELEMENT_FACTORY_KLASS_SRC "Source"
+#define GST_ELEMENT_FACTORY_KLASS_MUXER "Muxer"
+#define GST_ELEMENT_FACTORY_KLASS_DEMUXER "Demuxer"
+#define GST_ELEMENT_FACTORY_KLASS_PARSER "Parser"
+#define GST_ELEMENT_FACTORY_KLASS_PAYLOADER "Payloader"
+#define GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER "Depayloader"
+#define GST_ELEMENT_FACTORY_KLASS_FORMATTER "Formatter"
+#define GST_ELEMENT_FACTORY_KLASS_DECRYPTOR "Decryptor"
+#define GST_ELEMENT_FACTORY_KLASS_ENCRYPTOR "Encryptor"
+
+#define GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO "Video"
+#define GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO "Audio"
+#define GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE "Image"
+#define GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE "Subtitle"
+#define GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA "Metadata"
+
+/**
+ * GST_ELEMENT_FACTORY_KLASS_HARDWARE:
+ *
+ * Elements interacting with hardware devices should specify this classifier in
+ * their metadata. You may need to put the element in "READY" state to test if
+ * the hardware is present in the system.
+ *
+ * Since: 1.16
+ */
+#define GST_ELEMENT_FACTORY_KLASS_HARDWARE "Hardware"
+
+GST_API
+gboolean gst_element_factory_list_is_type (GstElementFactory *factory,
+ GstElementFactoryListType type);
+
+GST_API
+GList * gst_element_factory_list_get_elements (GstElementFactoryListType type,
+ GstRank minrank) G_GNUC_MALLOC;
+
+
+GST_API
+GList * gst_element_factory_list_filter (GList *list, const GstCaps *caps,
+ GstPadDirection direction,
+ gboolean subsetonly) G_GNUC_MALLOC;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstElementFactory, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_ELEMENT_FACTORY_H__ */
diff --git a/include/gst/gstelementmetadata.h b/include/gst/gstelementmetadata.h
new file mode 100644
index 0000000000..76a0c04980
--- /dev/null
+++ b/include/gst/gstelementmetadata.h
@@ -0,0 +1,79 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000,2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstelementmetadata.h: Metadata for GstElement classes
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ELEMENT_METADATA_H__
+#define __GST_ELEMENT_METADATA_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_ELEMENT_METADATA_LONGNAME:
+ *
+ * The long English name of the element. E.g. "File Sink"
+ */
+#define GST_ELEMENT_METADATA_LONGNAME "long-name"
+/**
+ * GST_ELEMENT_METADATA_KLASS:
+ *
+ * String describing the type of element, as an unordered list
+ * separated with slashes ('/'). See draft-klass.txt of the design docs
+ * for more details and common types. E.g: "Sink/File"
+ */
+#define GST_ELEMENT_METADATA_KLASS "klass"
+
+/**
+ * GST_ELEMENT_METADATA_DESCRIPTION:
+ *
+ * Sentence describing the purpose of the element.
+ * E.g: "Write stream to a file"
+ */
+#define GST_ELEMENT_METADATA_DESCRIPTION "description"
+/**
+ * GST_ELEMENT_METADATA_AUTHOR:
+ *
+ * Name and contact details of the author(s). Use \n to separate
+ * multiple author details.
+ * E.g: "Joe Bloggs &lt;joe.blogs at foo.com&gt;"
+ */
+#define GST_ELEMENT_METADATA_AUTHOR "author"
+
+/**
+ * GST_ELEMENT_METADATA_DOC_URI:
+ *
+ * Set uri pointing to user documentation. Applications can use this to show
+ * help for e.g. effects to users.
+ */
+#define GST_ELEMENT_METADATA_DOC_URI "doc-uri"
+/**
+ * GST_ELEMENT_METADATA_ICON_NAME:
+ *
+ * Elements that bridge to certain other products can include an icon of that
+ * used product. Application can show the icon in menus/selectors to help
+ * identifying specific elements.
+ */
+#define GST_ELEMENT_METADATA_ICON_NAME "icon-name"
+
+G_END_DECLS
+
+#endif /* __GST_ELEMENT_METADATA_H__ */
diff --git a/include/gst/gstenumtypes.h b/include/gst/gstenumtypes.h
new file mode 100644
index 0000000000..a978cf390d
--- /dev/null
+++ b/include/gst/gstenumtypes.h
@@ -0,0 +1,430 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/gstconfig.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gstallocator.h" */
+
+GST_API
+GType gst_allocator_flags_get_type (void);
+#define GST_TYPE_ALLOCATOR_FLAGS (gst_allocator_flags_get_type())
+
+/* enumerations from "gstbin.h" */
+
+GST_API
+GType gst_bin_flags_get_type (void);
+#define GST_TYPE_BIN_FLAGS (gst_bin_flags_get_type())
+
+/* enumerations from "gstbuffer.h" */
+
+GST_API
+GType gst_buffer_flags_get_type (void);
+#define GST_TYPE_BUFFER_FLAGS (gst_buffer_flags_get_type())
+
+GST_API
+GType gst_buffer_copy_flags_get_type (void);
+#define GST_TYPE_BUFFER_COPY_FLAGS (gst_buffer_copy_flags_get_type())
+
+/* enumerations from "gstbufferpool.h" */
+
+GST_API
+GType gst_buffer_pool_acquire_flags_get_type (void);
+#define GST_TYPE_BUFFER_POOL_ACQUIRE_FLAGS (gst_buffer_pool_acquire_flags_get_type())
+
+/* enumerations from "gstbus.h" */
+
+GST_API
+GType gst_bus_flags_get_type (void);
+#define GST_TYPE_BUS_FLAGS (gst_bus_flags_get_type())
+
+GST_API
+GType gst_bus_sync_reply_get_type (void);
+#define GST_TYPE_BUS_SYNC_REPLY (gst_bus_sync_reply_get_type())
+
+/* enumerations from "gstcaps.h" */
+
+GST_API
+GType gst_caps_flags_get_type (void);
+#define GST_TYPE_CAPS_FLAGS (gst_caps_flags_get_type())
+
+GST_API
+GType gst_caps_intersect_mode_get_type (void);
+#define GST_TYPE_CAPS_INTERSECT_MODE (gst_caps_intersect_mode_get_type())
+
+/* enumerations from "gstclock.h" */
+
+GST_API
+GType gst_clock_return_get_type (void);
+#define GST_TYPE_CLOCK_RETURN (gst_clock_return_get_type())
+
+GST_API
+GType gst_clock_entry_type_get_type (void);
+#define GST_TYPE_CLOCK_ENTRY_TYPE (gst_clock_entry_type_get_type())
+
+GST_API
+GType gst_clock_flags_get_type (void);
+#define GST_TYPE_CLOCK_FLAGS (gst_clock_flags_get_type())
+
+/* enumerations from "gstdebugutils.h" */
+
+GST_API
+GType gst_debug_graph_details_get_type (void);
+#define GST_TYPE_DEBUG_GRAPH_DETAILS (gst_debug_graph_details_get_type())
+
+/* enumerations from "gstelement.h" */
+
+GST_API
+GType gst_state_get_type (void);
+#define GST_TYPE_STATE (gst_state_get_type())
+
+GST_API
+GType gst_state_change_return_get_type (void);
+#define GST_TYPE_STATE_CHANGE_RETURN (gst_state_change_return_get_type())
+
+GST_API
+GType gst_state_change_get_type (void);
+#define GST_TYPE_STATE_CHANGE (gst_state_change_get_type())
+
+GST_API
+GType gst_element_flags_get_type (void);
+#define GST_TYPE_ELEMENT_FLAGS (gst_element_flags_get_type())
+
+/* enumerations from "gsterror.h" */
+
+GST_API
+GType gst_core_error_get_type (void);
+#define GST_TYPE_CORE_ERROR (gst_core_error_get_type())
+
+GST_API
+GType gst_library_error_get_type (void);
+#define GST_TYPE_LIBRARY_ERROR (gst_library_error_get_type())
+
+GST_API
+GType gst_resource_error_get_type (void);
+#define GST_TYPE_RESOURCE_ERROR (gst_resource_error_get_type())
+
+GST_API
+GType gst_stream_error_get_type (void);
+#define GST_TYPE_STREAM_ERROR (gst_stream_error_get_type())
+
+/* enumerations from "gstevent.h" */
+
+GST_API
+GType gst_event_type_flags_get_type (void);
+#define GST_TYPE_EVENT_TYPE_FLAGS (gst_event_type_flags_get_type())
+
+GST_API
+GType gst_event_type_get_type (void);
+#define GST_TYPE_EVENT_TYPE (gst_event_type_get_type())
+
+GST_API
+GType gst_stream_flags_get_type (void);
+#define GST_TYPE_STREAM_FLAGS (gst_stream_flags_get_type())
+
+GST_API
+GType gst_qos_type_get_type (void);
+#define GST_TYPE_QOS_TYPE (gst_qos_type_get_type())
+
+GST_API
+GType gst_gap_flags_get_type (void);
+#define GST_TYPE_GAP_FLAGS (gst_gap_flags_get_type())
+
+/* enumerations from "gstformat.h" */
+
+GST_API
+GType gst_format_get_type (void);
+#define GST_TYPE_FORMAT (gst_format_get_type())
+
+/* enumerations from "gstinfo.h" */
+
+GST_API
+GType gst_debug_level_get_type (void);
+#define GST_TYPE_DEBUG_LEVEL (gst_debug_level_get_type())
+
+GST_API
+GType gst_debug_color_flags_get_type (void);
+#define GST_TYPE_DEBUG_COLOR_FLAGS (gst_debug_color_flags_get_type())
+
+GST_API
+GType gst_stack_trace_flags_get_type (void);
+#define GST_TYPE_STACK_TRACE_FLAGS (gst_stack_trace_flags_get_type())
+
+GST_API
+GType gst_debug_color_mode_get_type (void);
+#define GST_TYPE_DEBUG_COLOR_MODE (gst_debug_color_mode_get_type())
+
+/* enumerations from "gstiterator.h" */
+
+GST_API
+GType gst_iterator_result_get_type (void);
+#define GST_TYPE_ITERATOR_RESULT (gst_iterator_result_get_type())
+
+GST_API
+GType gst_iterator_item_get_type (void);
+#define GST_TYPE_ITERATOR_ITEM (gst_iterator_item_get_type())
+
+/* enumerations from "gstmemory.h" */
+
+GST_API
+GType gst_memory_flags_get_type (void);
+#define GST_TYPE_MEMORY_FLAGS (gst_memory_flags_get_type())
+
+GST_API
+GType gst_map_flags_get_type (void);
+#define GST_TYPE_MAP_FLAGS (gst_map_flags_get_type())
+
+/* enumerations from "gstmessage.h" */
+
+GST_API
+GType gst_message_type_get_type (void);
+#define GST_TYPE_MESSAGE_TYPE (gst_message_type_get_type())
+
+GST_API
+GType gst_structure_change_type_get_type (void);
+#define GST_TYPE_STRUCTURE_CHANGE_TYPE (gst_structure_change_type_get_type())
+
+GST_API
+GType gst_stream_status_type_get_type (void);
+#define GST_TYPE_STREAM_STATUS_TYPE (gst_stream_status_type_get_type())
+
+GST_API
+GType gst_progress_type_get_type (void);
+#define GST_TYPE_PROGRESS_TYPE (gst_progress_type_get_type())
+
+/* enumerations from "gstmeta.h" */
+
+GST_API
+GType gst_meta_flags_get_type (void);
+#define GST_TYPE_META_FLAGS (gst_meta_flags_get_type())
+
+/* enumerations from "gstminiobject.h" */
+
+GST_API
+GType gst_mini_object_flags_get_type (void);
+#define GST_TYPE_MINI_OBJECT_FLAGS (gst_mini_object_flags_get_type())
+
+GST_API
+GType gst_lock_flags_get_type (void);
+#define GST_TYPE_LOCK_FLAGS (gst_lock_flags_get_type())
+
+/* enumerations from "gstobject.h" */
+
+GST_API
+GType gst_object_flags_get_type (void);
+#define GST_TYPE_OBJECT_FLAGS (gst_object_flags_get_type())
+
+/* enumerations from "gstpad.h" */
+
+GST_API
+GType gst_pad_direction_get_type (void);
+#define GST_TYPE_PAD_DIRECTION (gst_pad_direction_get_type())
+
+GST_API
+GType gst_pad_mode_get_type (void);
+#define GST_TYPE_PAD_MODE (gst_pad_mode_get_type())
+
+GST_API
+GType gst_pad_link_return_get_type (void);
+#define GST_TYPE_PAD_LINK_RETURN (gst_pad_link_return_get_type())
+
+GST_API
+GType gst_flow_return_get_type (void);
+#define GST_TYPE_FLOW_RETURN (gst_flow_return_get_type())
+
+GST_API
+GType gst_pad_link_check_get_type (void);
+#define GST_TYPE_PAD_LINK_CHECK (gst_pad_link_check_get_type())
+
+GST_API
+GType gst_pad_probe_type_get_type (void);
+#define GST_TYPE_PAD_PROBE_TYPE (gst_pad_probe_type_get_type())
+
+GST_API
+GType gst_pad_probe_return_get_type (void);
+#define GST_TYPE_PAD_PROBE_RETURN (gst_pad_probe_return_get_type())
+
+GST_API
+GType gst_pad_flags_get_type (void);
+#define GST_TYPE_PAD_FLAGS (gst_pad_flags_get_type())
+
+/* enumerations from "gstpadtemplate.h" */
+
+GST_API
+GType gst_pad_presence_get_type (void);
+#define GST_TYPE_PAD_PRESENCE (gst_pad_presence_get_type())
+
+GST_API
+GType gst_pad_template_flags_get_type (void);
+#define GST_TYPE_PAD_TEMPLATE_FLAGS (gst_pad_template_flags_get_type())
+
+/* enumerations from "gstparse.h" */
+
+GST_API
+GType gst_parse_error_get_type (void);
+#define GST_TYPE_PARSE_ERROR (gst_parse_error_get_type())
+
+GST_API
+GType gst_parse_flags_get_type (void);
+#define GST_TYPE_PARSE_FLAGS (gst_parse_flags_get_type())
+
+/* enumerations from "gstpipeline.h" */
+
+GST_API
+GType gst_pipeline_flags_get_type (void);
+#define GST_TYPE_PIPELINE_FLAGS (gst_pipeline_flags_get_type())
+
+/* enumerations from "gstplugin.h" */
+
+GST_API
+GType gst_plugin_error_get_type (void);
+#define GST_TYPE_PLUGIN_ERROR (gst_plugin_error_get_type())
+
+GST_API
+GType gst_plugin_flags_get_type (void);
+#define GST_TYPE_PLUGIN_FLAGS (gst_plugin_flags_get_type())
+
+GST_API
+GType gst_plugin_dependency_flags_get_type (void);
+#define GST_TYPE_PLUGIN_DEPENDENCY_FLAGS (gst_plugin_dependency_flags_get_type())
+
+/* enumerations from "gstpluginfeature.h" */
+
+GST_API
+GType gst_rank_get_type (void);
+#define GST_TYPE_RANK (gst_rank_get_type())
+
+/* enumerations from "gstpromise.h" */
+
+GST_API
+GType gst_promise_result_get_type (void);
+#define GST_TYPE_PROMISE_RESULT (gst_promise_result_get_type())
+
+/* enumerations from "gstquery.h" */
+
+GST_API
+GType gst_query_type_flags_get_type (void);
+#define GST_TYPE_QUERY_TYPE_FLAGS (gst_query_type_flags_get_type())
+
+GST_API
+GType gst_query_type_get_type (void);
+#define GST_TYPE_QUERY_TYPE (gst_query_type_get_type())
+
+GST_API
+GType gst_buffering_mode_get_type (void);
+#define GST_TYPE_BUFFERING_MODE (gst_buffering_mode_get_type())
+
+GST_API
+GType gst_scheduling_flags_get_type (void);
+#define GST_TYPE_SCHEDULING_FLAGS (gst_scheduling_flags_get_type())
+
+/* enumerations from "gstsegment.h" */
+
+GST_API
+GType gst_seek_type_get_type (void);
+#define GST_TYPE_SEEK_TYPE (gst_seek_type_get_type())
+
+GST_API
+GType gst_seek_flags_get_type (void);
+#define GST_TYPE_SEEK_FLAGS (gst_seek_flags_get_type())
+
+GST_API
+GType gst_segment_flags_get_type (void);
+#define GST_TYPE_SEGMENT_FLAGS (gst_segment_flags_get_type())
+
+/* enumerations from "gststreams.h" */
+
+GST_API
+GType gst_stream_type_get_type (void);
+#define GST_TYPE_STREAM_TYPE (gst_stream_type_get_type())
+
+/* enumerations from "gststructure.h" */
+
+GST_API
+GType gst_serialize_flags_get_type (void);
+#define GST_TYPE_SERIALIZE_FLAGS (gst_serialize_flags_get_type())
+
+/* enumerations from "gstsystemclock.h" */
+
+GST_API
+GType gst_clock_type_get_type (void);
+#define GST_TYPE_CLOCK_TYPE (gst_clock_type_get_type())
+
+/* enumerations from "gsttaglist.h" */
+
+GST_API
+GType gst_tag_merge_mode_get_type (void);
+#define GST_TYPE_TAG_MERGE_MODE (gst_tag_merge_mode_get_type())
+
+GST_API
+GType gst_tag_flag_get_type (void);
+#define GST_TYPE_TAG_FLAG (gst_tag_flag_get_type())
+
+GST_API
+GType gst_tag_scope_get_type (void);
+#define GST_TYPE_TAG_SCOPE (gst_tag_scope_get_type())
+
+/* enumerations from "gsttask.h" */
+
+GST_API
+GType gst_task_state_get_type (void);
+#define GST_TYPE_TASK_STATE (gst_task_state_get_type())
+
+/* enumerations from "gsttoc.h" */
+
+GST_API
+GType gst_toc_scope_get_type (void);
+#define GST_TYPE_TOC_SCOPE (gst_toc_scope_get_type())
+
+GST_API
+GType gst_toc_entry_type_get_type (void);
+#define GST_TYPE_TOC_ENTRY_TYPE (gst_toc_entry_type_get_type())
+
+GST_API
+GType gst_toc_loop_type_get_type (void);
+#define GST_TYPE_TOC_LOOP_TYPE (gst_toc_loop_type_get_type())
+
+/* enumerations from "gsttracerrecord.h" */
+
+GST_API
+GType gst_tracer_value_scope_get_type (void);
+#define GST_TYPE_TRACER_VALUE_SCOPE (gst_tracer_value_scope_get_type())
+
+GST_API
+GType gst_tracer_value_flags_get_type (void);
+#define GST_TYPE_TRACER_VALUE_FLAGS (gst_tracer_value_flags_get_type())
+
+/* enumerations from "gsttypefind.h" */
+
+GST_API
+GType gst_type_find_probability_get_type (void);
+#define GST_TYPE_TYPE_FIND_PROBABILITY (gst_type_find_probability_get_type())
+
+/* enumerations from "gsturi.h" */
+
+GST_API
+GType gst_uri_error_get_type (void);
+#define GST_TYPE_URI_ERROR (gst_uri_error_get_type())
+
+GST_API
+GType gst_uri_type_get_type (void);
+#define GST_TYPE_URI_TYPE (gst_uri_type_get_type())
+
+/* enumerations from "gstutils.h" */
+
+GST_API
+GType gst_search_mode_get_type (void);
+#define GST_TYPE_SEARCH_MODE (gst_search_mode_get_type())
+
+GST_API
+GType gst_plugin_api_flags_get_type (void);
+#define GST_TYPE_PLUGIN_API_FLAGS (gst_plugin_api_flags_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/gsterror.h b/include/gst/gsterror.h
new file mode 100644
index 0000000000..17f7f399c7
--- /dev/null
+++ b/include/gst/gsterror.h
@@ -0,0 +1,273 @@
+/* GStreamer
+ * Copyright (C) 2004 Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ERROR_H__
+#define __GST_ERROR_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <errno.h>
+
+G_BEGIN_DECLS
+/*
+ * we define FIXME error domains:
+ * GST_CORE_ERROR
+ * GST_LIBRARY_ERROR
+ * GST_RESOURCE_ERROR
+ * GST_STREAM_ERROR
+ *
+ * Check GError API docs for rationale for naming.
+ */
+/**
+ * GstCoreError:
+ * @GST_CORE_ERROR_FAILED: a general error which doesn't fit in any other
+ * category. Make sure you add a custom message to the error call.
+ * @GST_CORE_ERROR_TOO_LAZY: do not use this except as a placeholder for
+ * deciding where to go while developing code.
+ * @GST_CORE_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
+ * this functionality yet.
+ * @GST_CORE_ERROR_STATE_CHANGE: used for state change errors.
+ * @GST_CORE_ERROR_PAD: used for pad-related errors.
+ * @GST_CORE_ERROR_THREAD: used for thread-related errors.
+ * @GST_CORE_ERROR_NEGOTIATION: used for negotiation-related errors.
+ * @GST_CORE_ERROR_EVENT: used for event-related errors.
+ * @GST_CORE_ERROR_SEEK: used for seek-related errors.
+ * @GST_CORE_ERROR_CAPS: used for caps-related errors.
+ * @GST_CORE_ERROR_TAG: used for negotiation-related errors.
+ * @GST_CORE_ERROR_MISSING_PLUGIN: used if a plugin is missing.
+ * @GST_CORE_ERROR_CLOCK: used for clock related errors.
+ * @GST_CORE_ERROR_DISABLED: used if functionality has been disabled at
+ * compile time.
+ * @GST_CORE_ERROR_NUM_ERRORS: the number of core error types.
+ *
+ * Core errors are errors inside the core GStreamer library.
+ */
+/* FIXME: should we divide in numerical blocks so we can easily add
+ for example PAD errors later ? */
+typedef enum
+{
+ GST_CORE_ERROR_FAILED = 1,
+ GST_CORE_ERROR_TOO_LAZY,
+ GST_CORE_ERROR_NOT_IMPLEMENTED,
+ GST_CORE_ERROR_STATE_CHANGE,
+ GST_CORE_ERROR_PAD,
+ GST_CORE_ERROR_THREAD,
+ GST_CORE_ERROR_NEGOTIATION,
+ GST_CORE_ERROR_EVENT,
+ GST_CORE_ERROR_SEEK,
+ GST_CORE_ERROR_CAPS,
+ GST_CORE_ERROR_TAG,
+ GST_CORE_ERROR_MISSING_PLUGIN,
+ GST_CORE_ERROR_CLOCK,
+ GST_CORE_ERROR_DISABLED,
+ GST_CORE_ERROR_NUM_ERRORS
+} GstCoreError;
+
+/**
+ * GstLibraryError:
+ * @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
+ * category. Make sure you add a custom message to the error call.
+ * @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
+ * deciding where to go while developing code.
+ * @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
+ * @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
+ * @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
+ * @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
+ * @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
+ *
+ * Library errors are for errors from the library being used by elements
+ * (initializing, finalizing, settings, ...)
+ */
+typedef enum
+{
+ GST_LIBRARY_ERROR_FAILED = 1,
+ GST_LIBRARY_ERROR_TOO_LAZY,
+ GST_LIBRARY_ERROR_INIT,
+ GST_LIBRARY_ERROR_SHUTDOWN,
+ GST_LIBRARY_ERROR_SETTINGS,
+ GST_LIBRARY_ERROR_ENCODE,
+ GST_LIBRARY_ERROR_NUM_ERRORS
+} GstLibraryError;
+
+/**
+ * GstResourceError:
+ * @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
+ * category. Make sure you add a custom message to the error call.
+ * @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
+ * deciding where to go while developing code.
+ * @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
+ * @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
+ * @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
+ * @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
+ * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
+ * both reading and writing, or either (but unspecified which).
+ * @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
+ * @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
+ * @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
+ * @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
+ * @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
+ * @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on.
+ * @GST_RESOURCE_ERROR_NO_SPACE_LEFT: used when the resource has no space left.
+ * @GST_RESOURCE_ERROR_NOT_AUTHORIZED: used when the resource can't be opened
+ * due to missing authorization.
+ * (Since: 1.2.4)
+ * @GST_RESOURCE_ERROR_NUM_ERRORS: the number of resource error types.
+ *
+ * Resource errors are for any resource used by an element:
+ * memory, files, network connections, process space, ...
+ * They're typically used by source and sink elements.
+ */
+typedef enum
+{
+ GST_RESOURCE_ERROR_FAILED = 1,
+ GST_RESOURCE_ERROR_TOO_LAZY,
+ GST_RESOURCE_ERROR_NOT_FOUND,
+ GST_RESOURCE_ERROR_BUSY,
+ GST_RESOURCE_ERROR_OPEN_READ,
+ GST_RESOURCE_ERROR_OPEN_WRITE,
+ GST_RESOURCE_ERROR_OPEN_READ_WRITE,
+ GST_RESOURCE_ERROR_CLOSE,
+ GST_RESOURCE_ERROR_READ,
+ GST_RESOURCE_ERROR_WRITE,
+ GST_RESOURCE_ERROR_SEEK,
+ GST_RESOURCE_ERROR_SYNC,
+ GST_RESOURCE_ERROR_SETTINGS,
+ GST_RESOURCE_ERROR_NO_SPACE_LEFT,
+ GST_RESOURCE_ERROR_NOT_AUTHORIZED,
+ GST_RESOURCE_ERROR_NUM_ERRORS
+} GstResourceError;
+
+/**
+ * GstStreamError:
+ * @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
+ * category. Make sure you add a custom message to the error call.
+ * @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
+ * deciding where to go while developing code.
+ * @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
+ * this functionality yet.
+ * @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
+ * stream's type.
+ * @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
+ * of stream.
+ * @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
+ * stream's type.
+ * @GST_STREAM_ERROR_DECODE: used when decoding fails.
+ * @GST_STREAM_ERROR_ENCODE: used when encoding fails.
+ * @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
+ * @GST_STREAM_ERROR_MUX: used when muxing fails.
+ * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
+ * (for example, wrong caps).
+ * @GST_STREAM_ERROR_DECRYPT: used when the stream is encrypted and can't be
+ * decrypted because this is not supported by the element.
+ * @GST_STREAM_ERROR_DECRYPT_NOKEY: used when the stream is encrypted and
+ * can't be decrypted because no suitable key is available.
+ * @GST_STREAM_ERROR_NUM_ERRORS: the number of stream error types.
+ *
+ * Stream errors are for anything related to the stream being processed:
+ * format errors, media type errors, ...
+ * They're typically used by decoders, demuxers, converters, ...
+ */
+typedef enum
+{
+ GST_STREAM_ERROR_FAILED = 1,
+ GST_STREAM_ERROR_TOO_LAZY,
+ GST_STREAM_ERROR_NOT_IMPLEMENTED,
+ GST_STREAM_ERROR_TYPE_NOT_FOUND,
+ GST_STREAM_ERROR_WRONG_TYPE,
+ GST_STREAM_ERROR_CODEC_NOT_FOUND,
+ GST_STREAM_ERROR_DECODE,
+ GST_STREAM_ERROR_ENCODE,
+ GST_STREAM_ERROR_DEMUX,
+ GST_STREAM_ERROR_MUX,
+ GST_STREAM_ERROR_FORMAT,
+ GST_STREAM_ERROR_DECRYPT,
+ GST_STREAM_ERROR_DECRYPT_NOKEY,
+ GST_STREAM_ERROR_NUM_ERRORS
+} GstStreamError;
+
+/**
+ * GST_LIBRARY_ERROR:
+ *
+ * Error domain for library loading. Errors in this domain will
+ * be from the #GstLibraryError enumeration.
+ * See #GError for information on error domains.
+ */
+#define GST_LIBRARY_ERROR gst_library_error_quark ()
+/**
+ * GST_RESOURCE_ERROR:
+ *
+ * Error domain for resource handling. Errors in this domain will
+ * be from the #GstResourceError enumeration.
+ * See #GError for information on error domains.
+ */
+#define GST_RESOURCE_ERROR gst_resource_error_quark ()
+/**
+ * GST_CORE_ERROR:
+ *
+ * Error domain for core system. Errors in this domain will
+ * be from the #GstCoreError enumeration.
+ * See #GError for information on error domains.
+ */
+#define GST_CORE_ERROR gst_core_error_quark ()
+/**
+ * GST_STREAM_ERROR:
+ *
+ * Error domain for media stream processing. Errors in this domain will
+ * be from the #GstStreamError enumeration.
+ * See #GError for information on error domains.
+ */
+#define GST_STREAM_ERROR gst_stream_error_quark ()
+
+/**
+ * GST_ERROR_SYSTEM: (skip):
+ *
+ * Builds a string using errno describing the previously failed system
+ * call. To be used as the debug argument in #GST_ELEMENT_ERROR.
+ */
+#define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno))
+
+GST_API
+gchar *gst_error_get_message (GQuark domain, gint code);
+
+/**
+ * gst_stream_error_quark: (attributes doc.skip=true)
+ */
+GST_API
+GQuark gst_stream_error_quark (void);
+
+/**
+ * gst_core_error_quark: (attributes doc.skip=true)
+ */
+GST_API
+GQuark gst_core_error_quark (void);
+
+/**
+ * gst_resource_error_quark: (attributes doc.skip=true)
+ */
+GST_API
+GQuark gst_resource_error_quark (void);
+
+/**
+ * gst_library_error_quark: (attributes doc.skip=true)
+ */
+GST_API
+GQuark gst_library_error_quark (void);
+
+G_END_DECLS
+#endif /* __GST_ERROR_H__ */
diff --git a/include/gst/gstevent.h b/include/gst/gstevent.h
new file mode 100644
index 0000000000..e036a34ad4
--- /dev/null
+++ b/include/gst/gstevent.h
@@ -0,0 +1,738 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstevent.h: Header for GstEvent subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_EVENT_H__
+#define __GST_EVENT_H__
+
+typedef struct _GstEvent GstEvent;
+
+/**
+ * GstEventTypeFlags:
+ * @GST_EVENT_TYPE_UPSTREAM: Set if the event can travel upstream.
+ * @GST_EVENT_TYPE_DOWNSTREAM: Set if the event can travel downstream.
+ * @GST_EVENT_TYPE_SERIALIZED: Set if the event should be serialized with data
+ * flow.
+ * @GST_EVENT_TYPE_STICKY: Set if the event is sticky on the pads.
+ * @GST_EVENT_TYPE_STICKY_MULTI: Multiple sticky events can be on a pad, each
+ * identified by the event name.
+ *
+ * #GstEventTypeFlags indicate the aspects of the different #GstEventType
+ * values. You can get the type flags of a #GstEventType with the
+ * gst_event_type_get_flags() function.
+ */
+typedef enum {
+ GST_EVENT_TYPE_UPSTREAM = 1 << 0,
+ GST_EVENT_TYPE_DOWNSTREAM = 1 << 1,
+ GST_EVENT_TYPE_SERIALIZED = 1 << 2,
+ GST_EVENT_TYPE_STICKY = 1 << 3,
+ GST_EVENT_TYPE_STICKY_MULTI = 1 << 4
+} GstEventTypeFlags;
+
+/**
+ * GST_EVENT_TYPE_BOTH: (value 3) (type GstEventTypeFlags)
+ *
+ * The same thing as #GST_EVENT_TYPE_UPSTREAM | #GST_EVENT_TYPE_DOWNSTREAM.
+ */
+#define GST_EVENT_TYPE_BOTH \
+ ((GstEventTypeFlags)(GST_EVENT_TYPE_UPSTREAM | GST_EVENT_TYPE_DOWNSTREAM))
+
+#define GST_EVENT_NUM_SHIFT (8)
+
+/**
+ * GST_EVENT_MAKE_TYPE:
+ * @num: the event number to create
+ * @flags: the event flags
+ *
+ * when making custom event types, use this macro with the num and
+ * the given flags
+ */
+#define GST_EVENT_MAKE_TYPE(num,flags) \
+ (((num) << GST_EVENT_NUM_SHIFT) | (flags))
+
+#define _FLAG(name) GST_EVENT_TYPE_##name
+
+/**
+ * GstEventType:
+ * @GST_EVENT_UNKNOWN: unknown event.
+ * @GST_EVENT_FLUSH_START: Start a flush operation. This event clears all data
+ * from the pipeline and unblock all streaming threads.
+ * @GST_EVENT_FLUSH_STOP: Stop a flush operation. This event resets the
+ * running-time of the pipeline.
+ * @GST_EVENT_SELECT_STREAMS: A request to select one or more streams (Since: 1.10)
+ * @GST_EVENT_STREAM_START: Event to mark the start of a new stream. Sent before any
+ * other serialized event and only sent at the start of a new stream,
+ * not after flushing seeks.
+ * @GST_EVENT_CAPS: #GstCaps event. Notify the pad of a new media type.
+ * @GST_EVENT_SEGMENT: A new media segment follows in the dataflow. The
+ * segment events contains information for clipping buffers and
+ * converting buffer timestamps to running-time and
+ * stream-time.
+ * @GST_EVENT_STREAM_COLLECTION: A new #GstStreamCollection is available (Since: 1.10)
+ * @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
+ * @GST_EVENT_BUFFERSIZE: Notification of buffering requirements. Currently not
+ * used yet.
+ * @GST_EVENT_SINK_MESSAGE: An event that sinks turn into a message. Used to
+ * send messages that should be emitted in sync with
+ * rendering.
+ * @GST_EVENT_STREAM_GROUP_DONE: Indicates that there is no more data for
+ * the stream group ID in the message. Sent before EOS
+ * in some instances and should be handled mostly the same. (Since: 1.10)
+ * @GST_EVENT_EOS: End-Of-Stream. No more data is to be expected to follow
+ * without either a STREAM_START event, or a FLUSH_STOP and a SEGMENT
+ * event.
+ * @GST_EVENT_SEGMENT_DONE: Marks the end of a segment playback.
+ * @GST_EVENT_GAP: Marks a gap in the datastream.
+ * @GST_EVENT_TOC: An event which indicates that a new table of contents (TOC)
+ * was found or updated.
+ * @GST_EVENT_PROTECTION: An event which indicates that new or updated
+ * encryption information has been found in the stream.
+ * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
+ * that the downstream elements should adjust their processing
+ * rate.
+ * @GST_EVENT_SEEK: A request for a new playback position and rate.
+ * @GST_EVENT_NAVIGATION: Navigation events are usually used for communicating
+ * user requests, such as mouse or keyboard movements,
+ * to upstream elements.
+ * @GST_EVENT_LATENCY: Notification of new latency adjustment. Sinks will use
+ * the latency information to adjust their synchronisation.
+ * @GST_EVENT_STEP: A request for stepping through the media. Sinks will usually
+ * execute the step operation.
+ * @GST_EVENT_RECONFIGURE: A request for upstream renegotiating caps and reconfiguring.
+ * @GST_EVENT_TOC_SELECT: A request for a new playback position based on TOC
+ * entry's UID.
+ * @GST_EVENT_INSTANT_RATE_CHANGE: Notify downstream that a playback rate override
+ * should be applied as soon as possible. (Since: 1.18)
+ * @GST_EVENT_INSTANT_RATE_SYNC_TIME: Sent by the pipeline to notify elements that handle the
+ * instant-rate-change event about the running-time when
+ * the rate multiplier should be applied (or was applied). (Since: 1.18)
+ * @GST_EVENT_CUSTOM_UPSTREAM: Upstream custom event
+ * @GST_EVENT_CUSTOM_DOWNSTREAM: Downstream custom event that travels in the
+ * data flow.
+ * @GST_EVENT_CUSTOM_DOWNSTREAM_OOB: Custom out-of-band downstream event.
+ * @GST_EVENT_CUSTOM_DOWNSTREAM_STICKY: Custom sticky downstream event.
+ * @GST_EVENT_CUSTOM_BOTH: Custom upstream or downstream event.
+ * In-band when travelling downstream.
+ * @GST_EVENT_CUSTOM_BOTH_OOB: Custom upstream or downstream out-of-band event.
+ *
+ * #GstEventType lists the standard event types that can be sent in a pipeline.
+ *
+ * The custom event types can be used for private messages between elements
+ * that can't be expressed using normal
+ * GStreamer buffer passing semantics. Custom events carry an arbitrary
+ * #GstStructure.
+ * Specific custom events are distinguished by the name of the structure.
+ */
+/* NOTE: keep in sync with quark registration in gstevent.c */
+typedef enum {
+ GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
+
+ /* bidirectional events */
+ GST_EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (10, _FLAG(BOTH)),
+ GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (20, _FLAG(BOTH) | _FLAG(SERIALIZED)),
+
+ /* downstream serialized events */
+ GST_EVENT_STREAM_START = GST_EVENT_MAKE_TYPE (40, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_CAPS = GST_EVENT_MAKE_TYPE (50, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_SEGMENT = GST_EVENT_MAKE_TYPE (70, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_STREAM_COLLECTION = GST_EVENT_MAKE_TYPE (75, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY) | _FLAG(STICKY_MULTI)),
+ GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (80, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY) | _FLAG(STICKY_MULTI)),
+ GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (90, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (100, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY) | _FLAG(STICKY_MULTI)),
+ GST_EVENT_STREAM_GROUP_DONE = GST_EVENT_MAKE_TYPE (105, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (110, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY)),
+ GST_EVENT_TOC = GST_EVENT_MAKE_TYPE (120, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY) | _FLAG(STICKY_MULTI)),
+ GST_EVENT_PROTECTION = GST_EVENT_MAKE_TYPE (130, _FLAG (DOWNSTREAM) | _FLAG (SERIALIZED) | _FLAG (STICKY) | _FLAG (STICKY_MULTI)),
+
+ /* non-sticky downstream serialized */
+ GST_EVENT_SEGMENT_DONE = GST_EVENT_MAKE_TYPE (150, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED)),
+ GST_EVENT_GAP = GST_EVENT_MAKE_TYPE (160, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED)),
+
+ /* sticky downstream non-serialized */
+ GST_EVENT_INSTANT_RATE_CHANGE = GST_EVENT_MAKE_TYPE (180, _FLAG(DOWNSTREAM) | _FLAG(STICKY)),
+
+ /* upstream events */
+ GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (190, _FLAG(UPSTREAM)),
+ GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (200, _FLAG(UPSTREAM)),
+ GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (210, _FLAG(UPSTREAM)),
+ GST_EVENT_LATENCY = GST_EVENT_MAKE_TYPE (220, _FLAG(UPSTREAM)),
+ GST_EVENT_STEP = GST_EVENT_MAKE_TYPE (230, _FLAG(UPSTREAM)),
+ GST_EVENT_RECONFIGURE = GST_EVENT_MAKE_TYPE (240, _FLAG(UPSTREAM)),
+ GST_EVENT_TOC_SELECT = GST_EVENT_MAKE_TYPE (250, _FLAG(UPSTREAM)),
+ GST_EVENT_SELECT_STREAMS = GST_EVENT_MAKE_TYPE (260, _FLAG(UPSTREAM)),
+ GST_EVENT_INSTANT_RATE_SYNC_TIME = GST_EVENT_MAKE_TYPE (261, _FLAG(UPSTREAM)),
+
+ /* custom events start here */
+ GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (270, _FLAG(UPSTREAM)),
+ GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (280, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED)),
+ GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (290, _FLAG(DOWNSTREAM)),
+ GST_EVENT_CUSTOM_DOWNSTREAM_STICKY = GST_EVENT_MAKE_TYPE (300, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED) | _FLAG(STICKY) | _FLAG(STICKY_MULTI)),
+ GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (310, _FLAG(BOTH) | _FLAG(SERIALIZED)),
+ GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (320, _FLAG(BOTH))
+} GstEventType;
+#undef _FLAG
+
+/**
+ * GstStreamFlags:
+ * @GST_STREAM_FLAG_NONE: This stream has no special attributes
+ * @GST_STREAM_FLAG_SPARSE: This stream is a sparse stream (e.g. a subtitle
+ * stream), data may flow only in irregular intervals with large gaps in
+ * between.
+ * @GST_STREAM_FLAG_SELECT: This stream should be selected by default. This
+ * flag may be used by demuxers to signal that a stream should be selected
+ * by default in a playback scenario.
+ * @GST_STREAM_FLAG_UNSELECT: This stream should not be selected by default.
+ * This flag may be used by demuxers to signal that a stream should not
+ * be selected by default in a playback scenario, but only if explicitly
+ * selected by the user (e.g. an audio track for the hard of hearing or
+ * a director's commentary track).
+ *
+ * Since: 1.2
+ */
+typedef enum {
+ GST_STREAM_FLAG_NONE,
+ GST_STREAM_FLAG_SPARSE = (1 << 0),
+ GST_STREAM_FLAG_SELECT = (1 << 1),
+ GST_STREAM_FLAG_UNSELECT = (1 << 2)
+} GstStreamFlags;
+
+#include <gst/gstminiobject.h>
+#include <gst/gstformat.h>
+#include <gst/gstobject.h>
+#include <gst/gstclock.h>
+#include <gst/gststructure.h>
+#include <gst/gsttaglist.h>
+#include <gst/gstsegment.h>
+#include <gst/gstmessage.h>
+#include <gst/gstcontext.h>
+#include <gst/gststreams.h>
+#include <gst/gsttoc.h>
+#include <gst/gststreamcollection.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_event_type;
+
+#define GST_TYPE_EVENT (_gst_event_type)
+#define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
+#define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
+#define GST_EVENT(obj) (GST_EVENT_CAST(obj))
+
+/**
+ * GST_EVENT_TYPE:
+ * @event: the event to query
+ *
+ * Get the #GstEventType of the event.
+ */
+#define GST_EVENT_TYPE(event) (GST_EVENT_CAST(event)->type)
+
+/**
+ * GST_EVENT_TYPE_NAME:
+ * @event: the event to query
+ *
+ * Get a constant string representation of the #GstEventType of the event.
+ */
+#define GST_EVENT_TYPE_NAME(event) (gst_event_type_get_name(GST_EVENT_TYPE(event)))
+
+/**
+ * GST_EVENT_TIMESTAMP:
+ * @event: the event to query
+ *
+ * Get the #GstClockTime timestamp of the event. This is the time when the event
+ * was created.
+ */
+/* FIXME 2.0: Remove the GstEvent::timestamp field */
+#define GST_EVENT_TIMESTAMP(event) (GST_EVENT_CAST(event)->timestamp)
+
+/**
+ * GST_EVENT_SEQNUM:
+ * @event: the event to query
+ *
+ * The sequence number of @event.
+ */
+#define GST_EVENT_SEQNUM(event) (GST_EVENT_CAST(event)->seqnum)
+
+/**
+ * GST_EVENT_IS_UPSTREAM:
+ * @ev: the event to query
+ *
+ * Check if an event can travel upstream.
+ */
+#define GST_EVENT_IS_UPSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_UPSTREAM)
+/**
+ * GST_EVENT_IS_DOWNSTREAM:
+ * @ev: the event to query
+ *
+ * Check if an event can travel downstream.
+ */
+#define GST_EVENT_IS_DOWNSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_DOWNSTREAM)
+/**
+ * GST_EVENT_IS_SERIALIZED:
+ * @ev: the event to query
+ *
+ * Check if an event is serialized with the data stream.
+ */
+#define GST_EVENT_IS_SERIALIZED(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_SERIALIZED)
+/**
+ * GST_EVENT_IS_STICKY:
+ * @ev: the event to query
+ *
+ * Check if an event is sticky on the pads.
+ */
+#define GST_EVENT_IS_STICKY(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_STICKY)
+
+/**
+ * gst_event_is_writable:
+ * @ev: a #GstEvent
+ *
+ * Tests if you can safely write data into a event's structure or validly
+ * modify the seqnum and timestamp field.
+ */
+#define gst_event_is_writable(ev) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (ev))
+/**
+ * gst_event_make_writable:
+ * @ev: (transfer full): a #GstEvent
+ *
+ * Makes a writable event from the given event. If the source event is
+ * already writable, this will simply return the same event. A copy will
+ * otherwise be made using gst_event_copy().
+ *
+ * Returns: (transfer full): a writable event which may or may not be the
+ * same as @ev
+ */
+#define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_event_replace(GstEvent** old_event, GstEvent* new_event)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
+}
+
+static inline GstEvent *
+gst_event_steal (GstEvent **old_event)
+{
+ return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
+}
+
+static inline gboolean
+gst_event_take (GstEvent **old_event, GstEvent *new_event)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_event_replace (GstEvent ** old_event,
+ GstEvent * new_event);
+
+GST_API
+GstEvent * gst_event_steal (GstEvent ** old_event);
+
+GST_API
+gboolean gst_event_take (GstEvent ** old_event,
+ GstEvent *new_event);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * GstQOSType:
+ * @GST_QOS_TYPE_OVERFLOW: The QoS event type that is produced when upstream
+ * elements are producing data too quickly and the element can't keep up
+ * processing the data. Upstream should reduce their production rate. This
+ * type is also used when buffers arrive early or in time.
+ * @GST_QOS_TYPE_UNDERFLOW: The QoS event type that is produced when upstream
+ * elements are producing data too slowly and need to speed up their
+ * production rate.
+ * @GST_QOS_TYPE_THROTTLE: The QoS event type that is produced when the
+ * application enabled throttling to limit the data rate.
+ *
+ * The different types of QoS events that can be given to the
+ * gst_event_new_qos() method.
+ */
+typedef enum {
+ GST_QOS_TYPE_OVERFLOW = 0,
+ GST_QOS_TYPE_UNDERFLOW = 1,
+ GST_QOS_TYPE_THROTTLE = 2
+} GstQOSType;
+
+/**
+ * GstGapFlags:
+ * @GST_GAP_FLAG_MISSING_DATA: The #GST_EVENT_GAP signals missing data,
+ * for example because of packet loss.
+ *
+ * The different flags that can be set on #GST_EVENT_GAP events. See
+ * gst_event_set_gap_flags() for details.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_GAP_FLAG_MISSING_DATA = (1<<0),
+} GstGapFlags;
+
+/**
+ * GstEvent:
+ * @mini_object: the parent structure
+ * @type: the #GstEventType of the event
+ * @timestamp: the timestamp of the event
+ * @seqnum: the sequence number of the event
+ *
+ * A #GstEvent.
+ */
+struct _GstEvent {
+ GstMiniObject mini_object;
+
+ /*< public >*/ /* with COW */
+ GstEventType type;
+ /* FIXME 2.0: Remove the GstEvent::timestamp field */
+ guint64 timestamp;
+ guint32 seqnum;
+};
+
+GST_API
+const gchar* gst_event_type_get_name (GstEventType type);
+
+GST_API
+GQuark gst_event_type_to_quark (GstEventType type);
+
+GST_API
+GstEventTypeFlags
+ gst_event_type_get_flags (GstEventType type);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstEvent *
+gst_event_ref (GstEvent * event)
+{
+ return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
+}
+
+static inline void
+gst_event_unref (GstEvent * event)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
+}
+
+static inline void
+gst_clear_event (GstEvent ** event_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) event_ptr);
+}
+
+/* copy event */
+static inline GstEvent *
+gst_event_copy (const GstEvent * event)
+{
+ return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstEvent * gst_event_ref (GstEvent * event);
+
+GST_API
+void gst_event_unref (GstEvent * event);
+
+GST_API
+void gst_clear_event (GstEvent ** event_ptr);
+
+GST_API
+GstEvent * gst_event_copy (const GstEvent * event);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+GST_API
+GType gst_event_get_type (void);
+
+/* custom event */
+
+GST_API
+GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure) G_GNUC_MALLOC;
+
+GST_API
+const GstStructure *
+ gst_event_get_structure (GstEvent *event);
+
+GST_API
+GstStructure * gst_event_writable_structure (GstEvent *event);
+
+GST_API
+gboolean gst_event_has_name (GstEvent *event, const gchar *name);
+
+GST_API
+gboolean gst_event_has_name_id (GstEvent *event, GQuark name);
+
+/* identifiers for events and messages */
+
+GST_API
+guint32 gst_event_get_seqnum (GstEvent *event);
+
+GST_API
+void gst_event_set_seqnum (GstEvent *event, guint32 seqnum);
+
+/* accumulated pad offsets for the event */
+
+GST_API
+gint64 gst_event_get_running_time_offset (GstEvent *event);
+
+GST_API
+void gst_event_set_running_time_offset (GstEvent *event, gint64 offset);
+
+/* Stream start event */
+
+GST_API
+GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
+
+GST_API
+void gst_event_set_stream (GstEvent *event, GstStream *stream);
+
+GST_API
+void gst_event_parse_stream (GstEvent *event, GstStream **stream);
+
+GST_API
+void gst_event_set_stream_flags (GstEvent *event, GstStreamFlags flags);
+
+GST_API
+void gst_event_parse_stream_flags (GstEvent *event, GstStreamFlags *flags);
+
+GST_API
+void gst_event_set_group_id (GstEvent *event, guint group_id);
+
+GST_API
+gboolean gst_event_parse_group_id (GstEvent *event, guint *group_id);
+
+/* flush events */
+
+GST_API
+GstEvent * gst_event_new_flush_start (void) G_GNUC_MALLOC;
+
+GST_API
+GstEvent * gst_event_new_flush_stop (gboolean reset_time) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_flush_stop (GstEvent *event, gboolean *reset_time);
+
+/* Stream collection event */
+
+GST_API
+GstEvent * gst_event_new_stream_collection (GstStreamCollection *collection) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_stream_collection (GstEvent *event, GstStreamCollection **collection);
+
+/* select streams event */
+
+GST_API
+GstEvent * gst_event_new_select_streams (GList *streams);
+
+GST_API
+void gst_event_parse_select_streams (GstEvent *event, GList **streams);
+
+/* stream-group-done event */
+
+GST_API
+GstEvent * gst_event_new_stream_group_done (guint group_id) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_stream_group_done (GstEvent *event, guint *group_id);
+
+/* EOS event */
+
+GST_API
+GstEvent * gst_event_new_eos (void) G_GNUC_MALLOC;
+
+/* GAP event */
+
+GST_API
+GstEvent * gst_event_new_gap (GstClockTime timestamp,
+ GstClockTime duration) G_GNUC_MALLOC;
+GST_API
+void gst_event_parse_gap (GstEvent * event,
+ GstClockTime * timestamp,
+ GstClockTime * duration);
+
+GST_API
+void gst_event_set_gap_flags (GstEvent * event,
+ GstGapFlags flags);
+
+GST_API
+void gst_event_parse_gap_flags (GstEvent * event,
+ GstGapFlags * flags);
+
+/* Caps events */
+
+GST_API
+GstEvent * gst_event_new_caps (GstCaps *caps) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_caps (GstEvent *event, GstCaps **caps);
+
+/* segment event */
+
+GST_API
+GstEvent* gst_event_new_segment (const GstSegment *segment) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_segment (GstEvent *event, const GstSegment **segment);
+
+GST_API
+void gst_event_copy_segment (GstEvent *event, GstSegment *segment);
+
+/* tag event */
+
+GST_API
+GstEvent* gst_event_new_tag (GstTagList *taglist) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
+
+/* TOC event */
+
+GST_API
+GstEvent* gst_event_new_toc (GstToc *toc, gboolean updated);
+
+GST_API
+void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated);
+
+/* Protection event */
+
+GST_API
+GstEvent * gst_event_new_protection (const gchar * system_id, GstBuffer * data, const gchar * origin);
+
+GST_API
+void gst_event_parse_protection (GstEvent * event, const gchar ** system_id,
+ GstBuffer ** data, const gchar ** origin);
+
+/* buffer */
+
+GST_API
+GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize,
+ gboolean async) G_GNUC_MALLOC;
+GST_API
+void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize,
+ gint64 *maxsize, gboolean *async);
+
+/* sink message */
+
+GST_API
+GstEvent* gst_event_new_sink_message (const gchar *name, GstMessage *msg) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg);
+
+/* QOS events */
+
+GST_API
+GstEvent* gst_event_new_qos (GstQOSType type, gdouble proportion,
+ GstClockTimeDiff diff, GstClockTime timestamp) G_GNUC_MALLOC;
+GST_API
+void gst_event_parse_qos (GstEvent *event, GstQOSType *type,
+ gdouble *proportion, GstClockTimeDiff *diff,
+ GstClockTime *timestamp);
+/* seek event */
+
+GST_API
+GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
+ GstSeekType start_type, gint64 start,
+ GstSeekType stop_type, gint64 stop) G_GNUC_MALLOC;
+GST_API
+void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format,
+ GstSeekFlags *flags,
+ GstSeekType *start_type, gint64 *start,
+ GstSeekType *stop_type, gint64 *stop);
+
+GST_API
+void gst_event_set_seek_trickmode_interval (GstEvent *event, GstClockTime interval);
+
+GST_API
+void gst_event_parse_seek_trickmode_interval (GstEvent *event, GstClockTime *interval);
+
+/* navigation event */
+
+GST_API
+GstEvent* gst_event_new_navigation (GstStructure *structure) G_GNUC_MALLOC;
+
+/* latency event */
+
+GST_API
+GstEvent* gst_event_new_latency (GstClockTime latency) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_latency (GstEvent *event, GstClockTime *latency);
+
+/* step event */
+
+GST_API
+GstEvent* gst_event_new_step (GstFormat format, guint64 amount, gdouble rate,
+ gboolean flush, gboolean intermediate) G_GNUC_MALLOC;
+GST_API
+void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount,
+ gdouble *rate, gboolean *flush, gboolean *intermediate);
+
+/* renegotiate event */
+
+GST_API
+GstEvent* gst_event_new_reconfigure (void) G_GNUC_MALLOC;
+
+/* TOC select event */
+
+GST_API
+GstEvent* gst_event_new_toc_select (const gchar *uid) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_toc_select (GstEvent *event, gchar **uid);
+
+/* segment-done event */
+
+GST_API
+GstEvent* gst_event_new_segment_done (GstFormat format, gint64 position) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position);
+
+/* instant-rate-change event */
+
+GST_API
+GstEvent * gst_event_new_instant_rate_change (gdouble rate_multiplier, GstSegmentFlags new_flags) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_instant_rate_change (GstEvent *event,
+ gdouble *rate_multiplier, GstSegmentFlags *new_flags);
+
+/* instant-rate-change-sync-time event */
+
+GST_API
+GstEvent * gst_event_new_instant_rate_sync_time (gdouble rate_multiplier,
+ GstClockTime running_time,
+ GstClockTime upstream_running_time) G_GNUC_MALLOC;
+
+GST_API
+void gst_event_parse_instant_rate_sync_time (GstEvent *event,
+ gdouble *rate_multiplier,
+ GstClockTime *running_time,
+ GstClockTime *upstream_running_time);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEvent, gst_event_unref)
+
+G_END_DECLS
+
+#endif /* __GST_EVENT_H__ */
diff --git a/include/gst/gstformat.h b/include/gst/gstformat.h
new file mode 100644
index 0000000000..111ca9b827
--- /dev/null
+++ b/include/gst/gstformat.h
@@ -0,0 +1,126 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstformat.h: Header for GstFormat types used in queries and
+ * seeking.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_FORMAT_H__
+#define __GST_FORMAT_H__
+
+#include <glib.h>
+
+#include <gst/gstiterator.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstFormat:
+ * @GST_FORMAT_UNDEFINED: undefined format
+ * @GST_FORMAT_DEFAULT: the default format of the pad/element. This can be
+ * samples for raw audio, frames/fields for raw video (some, but not all,
+ * elements support this; use @GST_FORMAT_TIME if you don't have a good
+ * reason to query for samples/frames)
+ * @GST_FORMAT_BYTES: bytes
+ * @GST_FORMAT_TIME: time in nanoseconds
+ * @GST_FORMAT_BUFFERS: buffers (few, if any, elements implement this as of
+ * May 2009)
+ * @GST_FORMAT_PERCENT: percentage of stream (few, if any, elements implement
+ * this as of May 2009)
+ *
+ * Standard predefined formats
+ */
+/* NOTE: don't forget to update the table in gstformat.c when changing
+ * this enum */
+typedef enum {
+ GST_FORMAT_UNDEFINED = 0, /* must be first in list */
+ GST_FORMAT_DEFAULT = 1,
+ GST_FORMAT_BYTES = 2,
+ GST_FORMAT_TIME = 3,
+ GST_FORMAT_BUFFERS = 4,
+ GST_FORMAT_PERCENT = 5
+} GstFormat;
+
+/* a percentage is always relative to 1000000 */
+/**
+ * GST_FORMAT_PERCENT_MAX:
+ *
+ * The PERCENT format is between 0 and this value
+ */
+#define GST_FORMAT_PERCENT_MAX G_GINT64_CONSTANT (1000000)
+/**
+ * GST_FORMAT_PERCENT_SCALE:
+ *
+ * The value used to scale down the reported PERCENT format value to
+ * its real value.
+ */
+#define GST_FORMAT_PERCENT_SCALE G_GINT64_CONSTANT (10000)
+
+typedef struct _GstFormatDefinition GstFormatDefinition;
+
+/**
+ * GstFormatDefinition:
+ * @value: The unique id of this format
+ * @nick: A short nick of the format
+ * @description: A longer description of the format
+ * @quark: A quark for the nick
+ *
+ * A format definition
+ */
+struct _GstFormatDefinition
+{
+ GstFormat value;
+ const gchar *nick;
+ const gchar *description;
+ GQuark quark;
+};
+
+GST_API
+const gchar* gst_format_get_name (GstFormat format);
+
+GST_API
+GQuark gst_format_to_quark (GstFormat format);
+
+/* register a new format */
+
+GST_API
+GstFormat gst_format_register (const gchar *nick,
+ const gchar *description);
+
+GST_API
+GstFormat gst_format_get_by_nick (const gchar *nick);
+
+/* check if a format is in an array of formats */
+
+GST_API
+gboolean gst_formats_contains (const GstFormat *formats, GstFormat format);
+
+/* query for format details */
+
+GST_API
+const GstFormatDefinition*
+ gst_format_get_details (GstFormat format);
+
+GST_API
+GstIterator* gst_format_iterate_definitions (void);
+
+G_END_DECLS
+
+#endif /* __GST_FORMAT_H__ */
diff --git a/include/gst/gstghostpad.h b/include/gst/gstghostpad.h
new file mode 100644
index 0000000000..7f4a253212
--- /dev/null
+++ b/include/gst/gstghostpad.h
@@ -0,0 +1,151 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ * 2005 Andy Wingo <wingo@pobox.com>
+ *
+ * gstghostpad.h: Proxy pads
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_GHOST_PAD_H__
+#define __GST_GHOST_PAD_H__
+
+
+#include <gst/gstpad.h>
+
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PROXY_PAD (gst_proxy_pad_get_type ())
+#define GST_IS_PROXY_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROXY_PAD))
+#define GST_IS_PROXY_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PROXY_PAD))
+#define GST_PROXY_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROXY_PAD, GstProxyPad))
+#define GST_PROXY_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PROXY_PAD, GstProxyPadClass))
+
+typedef struct _GstProxyPad GstProxyPad;
+typedef struct _GstProxyPadPrivate GstProxyPadPrivate;
+typedef struct _GstProxyPadClass GstProxyPadClass;
+
+struct _GstProxyPad
+{
+ GstPad pad;
+
+ /*< private >*/
+ GstProxyPadPrivate *priv;
+};
+
+struct _GstProxyPadClass
+{
+ GstPadClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[1];
+};
+
+GST_API
+GType gst_proxy_pad_get_type (void);
+
+GST_API
+GstProxyPad * gst_proxy_pad_get_internal (GstProxyPad *pad);
+
+
+GST_API
+GstIterator* gst_proxy_pad_iterate_internal_links_default (GstPad *pad, GstObject *parent) G_GNUC_MALLOC;
+
+GST_API
+GstFlowReturn gst_proxy_pad_chain_default (GstPad *pad, GstObject *parent,
+ GstBuffer *buffer);
+GST_API
+GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, GstObject *parent,
+ GstBufferList *list);
+GST_API
+GstFlowReturn gst_proxy_pad_getrange_default (GstPad *pad, GstObject *parent,
+ guint64 offset, guint size,
+ GstBuffer **buffer);
+
+#define GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ())
+#define GST_IS_GHOST_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD))
+#define GST_IS_GHOST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD))
+#define GST_GHOST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad))
+#define GST_GHOST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass))
+#define GST_GHOST_PAD_CAST(obj) ((GstGhostPad*)(obj))
+
+/**
+ * GstGhostPad:
+ *
+ * Opaque #GstGhostPad structure.
+ */
+typedef struct _GstGhostPad GstGhostPad;
+typedef struct _GstGhostPadPrivate GstGhostPadPrivate;
+typedef struct _GstGhostPadClass GstGhostPadClass;
+
+struct _GstGhostPad
+{
+ GstProxyPad pad;
+
+ /*< private >*/
+ GstGhostPadPrivate *priv;
+};
+
+struct _GstGhostPadClass
+{
+ GstProxyPadClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+
+GST_API
+GType gst_ghost_pad_get_type (void);
+
+GST_API
+GstPad* gst_ghost_pad_new (const gchar *name, GstPad *target) G_GNUC_MALLOC;
+
+GST_API
+GstPad* gst_ghost_pad_new_no_target (const gchar *name, GstPadDirection dir) G_GNUC_MALLOC;
+
+GST_API
+GstPad* gst_ghost_pad_new_from_template (const gchar *name, GstPad * target, GstPadTemplate * templ) G_GNUC_MALLOC;
+
+GST_API
+GstPad* gst_ghost_pad_new_no_target_from_template (const gchar *name, GstPadTemplate * templ) G_GNUC_MALLOC;
+
+GST_API
+GstPad* gst_ghost_pad_get_target (GstGhostPad *gpad);
+
+GST_API
+gboolean gst_ghost_pad_set_target (GstGhostPad *gpad, GstPad *newtarget);
+
+GST_DEPRECATED
+gboolean gst_ghost_pad_construct (GstGhostPad *gpad);
+
+GST_API
+gboolean gst_ghost_pad_activate_mode_default (GstPad * pad, GstObject * parent,
+ GstPadMode mode, gboolean active);
+GST_API
+gboolean gst_ghost_pad_internal_activate_mode_default (GstPad * pad, GstObject * parent,
+ GstPadMode mode, gboolean active);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGhostPad, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstProxyPad, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_GHOST_PAD_H__ */
diff --git a/include/gst/gstinfo.h b/include/gst/gstinfo.h
new file mode 100644
index 0000000000..955a83ddbd
--- /dev/null
+++ b/include/gst/gstinfo.h
@@ -0,0 +1,1812 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gstinfo.h: debugging functions
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSTINFO_H__
+#define __GSTINFO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstDebugLevel:
+ * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
+ * debugging output.
+ * @GST_LEVEL_ERROR: Error messages are to be used only when an error occurred
+ * that stops the application from keeping working correctly.
+ * An examples is gst_element_error, which outputs a message with this priority.
+ * It does not mean that the application is terminating as with g_error.
+ * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
+ * that could lead to problems or weird behaviour later on. An example of this
+ * would be clocking issues ("your computer is pretty slow") or broken input
+ * data ("Can't synchronize to stream.")
+ * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
+ * in the executed code path is not fully implemented or handled yet. Note
+ * that this does not replace proper error handling in any way, the purpose
+ * of this message is to make it easier to spot incomplete/unfinished pieces
+ * of code when reading the debug log.
+ * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
+ * updated about what is happening.
+ * Examples where this should be used are when a typefind function has
+ * successfully determined the type of the stream or when an mp3 plugin detects
+ * the format to be used. ("This file has mono sound.")
+ * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
+ * happens that is not the expected default behavior, or something that's
+ * useful to know but doesn't happen all the time (ie. per loop iteration or
+ * buffer processed or event handled).
+ * An example would be notifications about state changes or receiving/sending
+ * of events.
+ * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
+ * useful to know. As a rule of thumb a pipeline that is running as expected
+ * should never output anything else but LOG messages whilst processing data.
+ * Use this log level to log recurring information in chain functions and
+ * loop functions, for example.
+ * @GST_LEVEL_TRACE: Tracing-related messages.
+ * Examples for this are referencing/dereferencing of objects.
+ * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
+ * data as memory dumps in the log. They will be displayed as hexdump with
+ * ASCII characters.
+ * @GST_LEVEL_COUNT: The number of defined debugging levels.
+ *
+ * The level defines the importance of a debugging message. The more important a
+ * message is, the greater the probability that the debugging system outputs it.
+ */
+typedef enum {
+ GST_LEVEL_NONE = 0,
+ GST_LEVEL_ERROR = 1,
+ GST_LEVEL_WARNING = 2,
+ GST_LEVEL_FIXME = 3,
+ GST_LEVEL_INFO = 4,
+ GST_LEVEL_DEBUG = 5,
+ GST_LEVEL_LOG = 6,
+ GST_LEVEL_TRACE = 7,
+ /* add more */
+ GST_LEVEL_MEMDUMP = 9,
+ /* add more */
+ GST_LEVEL_COUNT
+} GstDebugLevel;
+
+/**
+ * GST_LEVEL_DEFAULT:
+ *
+ * Defines the default debugging level to be used with GStreamer. It is normally
+ * set to #GST_LEVEL_NONE so nothing get printed.
+ * As it can be configured at compile time, developer builds may chose to
+ * override that though.
+ * You can use this as an argument to gst_debug_set_default_threshold() to
+ * reset the debugging output to default behaviour.
+ */
+#ifndef GST_LEVEL_DEFAULT
+#define GST_LEVEL_DEFAULT GST_LEVEL_NONE
+#endif
+
+/**
+ * GST_LEVEL_MAX:
+ *
+ * Defines the maximum debugging level to be enabled at compilation time. By default
+ * it is set such that all debugging statements will be enabled.
+ *
+ * If you wish to compile GStreamer and plugins with only some debugging statements
+ * (Such as just warnings and errors), you can define it at compile time to the
+ * maximum debug level. Any debug statements above that level will be compiled out.
+ *
+ * Since: 1.6
+ */
+#ifndef GST_LEVEL_MAX
+#define GST_LEVEL_MAX GST_LEVEL_COUNT
+#endif
+
+/* defines for format (colors etc)
+ * don't change them around, it uses terminal layout
+ * Terminal color strings:
+ * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+ * Text color codes:
+ * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+ * Background color codes:
+ * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+ */
+/**
+ * GstDebugColorFlags:
+ * @GST_DEBUG_FG_BLACK: Use black as foreground color.
+ * @GST_DEBUG_FG_RED: Use red as foreground color.
+ * @GST_DEBUG_FG_GREEN: Use green as foreground color.
+ * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
+ * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
+ * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
+ * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
+ * @GST_DEBUG_FG_WHITE: Use white as foreground color.
+ * @GST_DEBUG_BG_BLACK: Use black as background color.
+ * @GST_DEBUG_BG_RED: Use red as background color.
+ * @GST_DEBUG_BG_GREEN: Use green as background color.
+ * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
+ * @GST_DEBUG_BG_BLUE: Use blue as background color.
+ * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
+ * @GST_DEBUG_BG_CYAN: Use cyan as background color.
+ * @GST_DEBUG_BG_WHITE: Use white as background color.
+ * @GST_DEBUG_BOLD: Make the output bold.
+ * @GST_DEBUG_UNDERLINE: Underline the output.
+ *
+ * These are some terminal style flags you can use when creating your
+ * debugging categories to make them stand out in debugging output.
+ */
+typedef enum { /*< flags >*/
+ /* colors */
+ GST_DEBUG_FG_BLACK = 0x0000,
+ GST_DEBUG_FG_RED = 0x0001,
+ GST_DEBUG_FG_GREEN = 0x0002,
+ GST_DEBUG_FG_YELLOW = 0x0003,
+ GST_DEBUG_FG_BLUE = 0x0004,
+ GST_DEBUG_FG_MAGENTA = 0x0005,
+ GST_DEBUG_FG_CYAN = 0x0006,
+ GST_DEBUG_FG_WHITE = 0x0007,
+ /* background colors */
+ GST_DEBUG_BG_BLACK = 0x0000,
+ GST_DEBUG_BG_RED = 0x0010,
+ GST_DEBUG_BG_GREEN = 0x0020,
+ GST_DEBUG_BG_YELLOW = 0x0030,
+ GST_DEBUG_BG_BLUE = 0x0040,
+ GST_DEBUG_BG_MAGENTA = 0x0050,
+ GST_DEBUG_BG_CYAN = 0x0060,
+ GST_DEBUG_BG_WHITE = 0x0070,
+ /* other formats */
+ GST_DEBUG_BOLD = 0x0100,
+ GST_DEBUG_UNDERLINE = 0x0200
+} GstDebugColorFlags;
+
+/**
+ * GstStackTraceFlags:
+ * @GST_STACK_TRACE_SHOW_NONE: Try to retrieve the minimum information
+ * available, which may be none on some platforms
+ * (Since: 1.18)
+ * @GST_STACK_TRACE_SHOW_FULL: Try to retrieve as much information as possible,
+ * including source information when getting the
+ * stack trace
+ *
+ * Since: 1.12
+ */
+typedef enum {
+ GST_STACK_TRACE_SHOW_NONE = 0,
+ GST_STACK_TRACE_SHOW_FULL = 1 << 0
+} GstStackTraceFlags;
+
+/**
+ * GstDebugColorMode:
+ * @GST_DEBUG_COLOR_MODE_OFF: Do not use colors in logs.
+ * @GST_DEBUG_COLOR_MODE_ON: Paint logs in a platform-specific way.
+ * @GST_DEBUG_COLOR_MODE_UNIX: Paint logs with UNIX terminal color codes
+ * no matter what platform GStreamer is running on.
+ */
+typedef enum {
+ GST_DEBUG_COLOR_MODE_OFF = 0,
+ GST_DEBUG_COLOR_MODE_ON = 1,
+ GST_DEBUG_COLOR_MODE_UNIX = 2
+} GstDebugColorMode;
+
+
+#define GST_DEBUG_FG_MASK (0x000F)
+#define GST_DEBUG_BG_MASK (0x00F0)
+#define GST_DEBUG_FORMAT_MASK (0xFF00)
+
+typedef struct _GstDebugCategory GstDebugCategory;
+/**
+ * GstDebugCategory:
+ *
+ * This is the struct that describes the categories. Once initialized with
+ * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
+ */
+struct _GstDebugCategory {
+ /*< private >*/
+ gint threshold;
+ guint color; /* see defines above */
+
+ const gchar * name;
+ const gchar * description;
+};
+
+/********** some convenience macros for debugging **********/
+
+/**
+ * GST_STR_NULL:
+ * @str: (allow-none): The string to check.
+ *
+ * Macro to use when a string must not be %NULL, but may be %NULL. If the string
+ * is %NULL, "(NULL)" is printed instead.
+ * In GStreamer printf string arguments may not be %NULL, because on some
+ * platforms (ie Solaris) the libc crashes in that case. This includes debugging
+ * strings.
+ */
+#define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
+
+/* FIXME, not MT safe */
+/**
+ * GST_DEBUG_PAD_NAME:
+ * @pad: The pad to debug.
+ *
+ * Evaluates to 2 strings, that describe the pad. Often used in debugging
+ * statements.
+ */
+#define GST_DEBUG_PAD_NAME(pad) \
+ (pad != NULL) ? \
+ ((GST_OBJECT_PARENT(pad) != NULL) ? \
+ GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
+ "''" ) : "''", \
+ (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
+
+/**
+ * GST_FUNCTION:
+ *
+ * This macro should evaluate to the name of the current function and be should
+ * be defined when configuring your project, as it is compiler dependent. If it
+ * is not defined, some default value is used. It is used to provide debugging
+ * output with the function name of the message.
+ *
+ * Note that this is different from G_STRFUNC as we do not want the full
+ * function signature in C++ code.
+ */
+#ifndef GST_FUNCTION
+#if defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# define GST_FUNCTION ((const char*) (__func__))
+#elif defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
+# define GST_FUNCTION ((const char*) (__FUNCTION__))
+#else
+# define GST_FUNCTION ((const char*) ("???"))
+#endif
+#endif /* ifndef GST_FUNCTION */
+
+/**
+ * GST_PTR_FORMAT: (skip):
+ *
+ * printf format type used to debug GStreamer types. You can use this in
+ * combination with GStreamer's debug logging system as well as the functions
+ * gst_info_vasprintf(), gst_info_strdup_vprintf() and gst_info_strdup_printf()
+ * to pretty-print the following types: #GstCaps, #GstStructure,
+ * #GstCapsFeatures, #GstTagList, #GstDateTime, #GstBuffer, #GstBufferList,
+ * #GstMessage, #GstEvent, #GstQuery, #GstContext, #GstPad, #GstObject. All
+ * #GObject types will be printed as typename plus pointer, and everything
+ * else will simply be printed as pointer address.
+ *
+ * This can only be used on types whose size is >= sizeof(gpointer).
+ */
+#define GST_PTR_FORMAT "p\aA"
+
+/**
+ * GST_SEGMENT_FORMAT: (skip):
+ *
+ * printf format type used to debug GStreamer segments. You can use this in
+ * combination with GStreamer's debug logging system as well as the functions
+ * gst_info_vasprintf(), gst_info_strdup_vprintf() and gst_info_strdup_printf()
+ * to pretty-print #GstSegment structures.
+ * This can only be used on pointers to GstSegment structures.
+ */
+#define GST_SEGMENT_FORMAT "p\aB"
+
+/**
+ * GST_TIMEP_FORMAT: (skip):
+ *
+ * printf format type used to debug GStreamer ClockTime pointers. You can use
+ * this in combination with GStreamer's debug logging system as well as the
+ * functions gst_info_vasprintf(), gst_info_strdup_vprintf() and
+ * gst_info_strdup_printf() to pretty-print #GstClockTime pointers. This can
+ * only be used on pointers to GstClockTime values.
+ *
+ * Since: 1.18
+ */
+#define GST_TIMEP_FORMAT "p\aT"
+
+/**
+ * GST_STIMEP_FORMAT: (skip):
+ *
+ * printf format type used to debug GStreamer signed time value pointers. You
+ * can use this in combination with GStreamer's debug logging system as well as
+ * the functions gst_info_vasprintf(), gst_info_strdup_vprintf() and
+ * gst_info_strdup_printf() to pretty-print signed time (pointers to
+ * #GstClockTimeDiff or #gint64).
+ *
+ * Since: 1.18
+ */
+#define GST_STIMEP_FORMAT "p\aS"
+
+typedef struct _GstDebugMessage GstDebugMessage;
+
+/**
+ * GstLogFunction:
+ * @category: a #GstDebugCategory
+ * @level: a #GstDebugLevel
+ * @file: file name
+ * @function: function name
+ * @line: line number
+ * @object: a #GObject
+ * @message: the message
+ * @user_data: user data for the log function
+ *
+ * Function prototype for a logging function that can be registered with
+ * gst_debug_add_log_function().
+ * Use G_GNUC_NO_INSTRUMENT on that function.
+ */
+typedef void (*GstLogFunction) (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ GstDebugMessage * message,
+ gpointer user_data);
+
+GST_API
+void gst_debug_log (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ const gchar * format,
+ ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
+GST_API
+void gst_debug_log_valist (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ const gchar * format,
+ va_list args) G_GNUC_NO_INSTRUMENT;
+
+GST_API
+void gst_debug_log_literal (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ const gchar * message_string) G_GNUC_NO_INSTRUMENT;
+
+/* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro */
+
+GST_API
+GstDebugCategory *_gst_debug_category_new (const gchar * name,
+ guint color,
+ const gchar * description);
+
+/* do not use this function, use the GST_DEBUG_CATEGORY_GET macro */
+
+GST_API
+GstDebugCategory *_gst_debug_get_category (const gchar *name);
+
+
+/* do not use this function, use the GST_CAT_MEMDUMP_* macros */
+
+GST_API
+void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
+ const gchar * func, gint line, GObject * obj, const gchar * msg,
+ const guint8 * data, guint length);
+
+/**
+ * GstDebugFuncPtr: (attributes doc.skip=true)
+ * we define this to avoid a compiler warning regarding a cast from a function
+ * pointer to a void pointer
+ * (see https://bugzilla.gnome.org/show_bug.cgi?id=309253)
+ */
+typedef void (* GstDebugFuncPtr) (void);
+
+/* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
+
+GST_API
+void _gst_debug_register_funcptr (GstDebugFuncPtr func,
+ const gchar * ptrname);
+GST_API
+const gchar *
+ _gst_debug_nameof_funcptr (GstDebugFuncPtr func) G_GNUC_NO_INSTRUMENT;
+
+
+GST_API
+const gchar * gst_debug_message_get (GstDebugMessage * message);
+
+GST_API
+gchar * gst_debug_log_get_line (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ GstDebugMessage * message) G_GNUC_NO_INSTRUMENT;
+
+GST_API
+void gst_debug_log_default (GstDebugCategory * category,
+ GstDebugLevel level,
+ const gchar * file,
+ const gchar * function,
+ gint line,
+ GObject * object,
+ GstDebugMessage * message,
+ gpointer user_data) G_GNUC_NO_INSTRUMENT;
+
+GST_API
+const gchar * gst_debug_level_get_name (GstDebugLevel level);
+
+GST_API
+void gst_debug_add_log_function (GstLogFunction func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+guint gst_debug_remove_log_function (GstLogFunction func);
+
+GST_API
+guint gst_debug_remove_log_function_by_data (gpointer data);
+
+GST_API
+void gst_debug_set_active (gboolean active);
+
+GST_API
+gboolean gst_debug_is_active (void);
+
+GST_API
+void gst_debug_set_colored (gboolean colored);
+
+GST_API
+void gst_debug_set_color_mode (GstDebugColorMode mode);
+
+GST_API
+void gst_debug_set_color_mode_from_string (const gchar * mode);
+
+GST_API
+gboolean gst_debug_is_colored (void);
+
+GST_API
+GstDebugColorMode gst_debug_get_color_mode (void);
+
+GST_API
+void gst_debug_set_default_threshold (GstDebugLevel level);
+
+GST_API
+GstDebugLevel gst_debug_get_default_threshold (void);
+
+GST_API
+void gst_debug_set_threshold_for_name (const gchar * name,
+ GstDebugLevel level);
+GST_API
+void gst_debug_set_threshold_from_string (const gchar * list, gboolean reset);
+
+GST_API
+void gst_debug_unset_threshold_for_name (const gchar * name);
+
+GST_DEPRECATED
+void gst_debug_category_free (GstDebugCategory * category);
+
+GST_API
+void gst_debug_category_set_threshold (GstDebugCategory * category,
+ GstDebugLevel level);
+
+GST_API
+void gst_debug_category_reset_threshold (GstDebugCategory * category);
+
+GST_API
+GstDebugLevel gst_debug_category_get_threshold (GstDebugCategory * category);
+
+GST_API
+const gchar * gst_debug_category_get_name (GstDebugCategory * category);
+
+GST_API
+guint gst_debug_category_get_color (GstDebugCategory * category);
+
+GST_API
+const gchar * gst_debug_category_get_description (GstDebugCategory * category);
+
+GST_API
+GSList * gst_debug_get_all_categories (void);
+
+
+GST_API
+gchar * gst_debug_construct_term_color (guint colorinfo);
+
+GST_API
+gint gst_debug_construct_win_color (guint colorinfo);
+
+GST_API
+gint gst_info_vasprintf (gchar ** result,
+ const gchar * format,
+ va_list args) G_GNUC_PRINTF (2, 0);
+GST_API
+gchar * gst_info_strdup_vprintf (const gchar *format, va_list args) G_GNUC_PRINTF (1, 0);
+
+GST_API
+gchar * gst_info_strdup_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
+
+GST_API
+void gst_print (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
+
+GST_API
+void gst_println (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
+
+GST_API
+void gst_printerr (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
+
+GST_API
+void gst_printerrln (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
+
+#ifndef GST_DISABLE_GST_DEBUG
+
+/* cast to void * avoids a warning with gcc 6
+ * see https://bugzilla.gnome.org/show_bug.cgi?id=764526 */
+#define gst_debug_add_log_function(func,data,notify) \
+G_STMT_START{ \
+ if ((func) == (void *) gst_debug_log_default) { \
+ gst_debug_add_log_function(NULL,data,notify); \
+ } else { \
+ gst_debug_add_log_function(func,data,notify); \
+ } \
+}G_STMT_END
+
+#define gst_debug_remove_log_function(func) \
+ ((func) == (void *) gst_debug_log_default) ? \
+ gst_debug_remove_log_function(NULL) : \
+ gst_debug_remove_log_function(func)
+
+/**
+ * GST_DEBUG_CATEGORY:
+ * @cat: the category
+ *
+ * Defines a GstDebugCategory variable.
+ * This macro expands to nothing if debugging is disabled.
+ */
+#define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
+/**
+ * GST_DEBUG_CATEGORY_EXTERN:
+ * @cat: the category
+ *
+ * Declares a GstDebugCategory variable as extern. Use in header files.
+ * This macro expands to nothing if debugging is disabled.
+ */
+#define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
+
+/**
+ * GST_DEBUG_CATEGORY_STATIC:
+ * @cat: the category
+ *
+ * Defines a static GstDebugCategory variable.
+ * This macro expands to nothing if debugging is disabled.
+ */
+#define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
+
+/**
+ * GST_DEBUG_CATEGORY_INIT:
+ * @cat: the category to initialize.
+ * @name: the name of the category.
+ * @color: the colors to use for a color representation or 0 for no color.
+ * @description: optional description of the category.
+ *
+ * Initializes a new #GstDebugCategory with the given properties and set to
+ * the default threshold.
+ *
+ * > This macro expands to nothing if debugging is disabled.
+ * >
+ * > When naming your category, please follow the following conventions to ensure
+ * > that the pattern matching for categories works as expected. It is not
+ * > earth-shattering if you don't follow these conventions, but it would be nice
+ * > for everyone.
+ * >
+ * > If you define a category for a plugin or a feature of it, name the category
+ * > like the feature. So if you wanted to write a "filesrc" element, you would
+ * > name the category "filesrc". Use lowercase letters only.
+ * > If you define more than one category for the same element, append an
+ * > underscore and an identifier to your categories, like this: "filesrc_cache"
+ * >
+ * > If you create a library or an application using debugging categories, use a
+ * > common prefix followed by an underscore for all your categories. GStreamer
+ * > uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
+ * > to include uppercase letters.
+ *
+ */
+#define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
+ if (cat == NULL) \
+ cat = _gst_debug_category_new (name,color,description); \
+}G_STMT_END
+
+/**
+ * GST_DEBUG_CATEGORY_GET:
+ * @cat: the category to initialize.
+ * @name: log category name
+ *
+ * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the
+ * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
+ * @cat. Otherwise @cat will be %NULL.
+ *
+ * |[<!-- language="C" -->
+ * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
+ * #define GST_CAT_DEFAULT gst_myplugin_debug
+ * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
+ * ...
+ * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
+ * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
+ * ]|
+ */
+#ifdef GST_CAT_DEFAULT
+#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
+ cat = _gst_debug_get_category (name); \
+ if (!cat) { \
+ cat = GST_CAT_DEFAULT; \
+ } \
+}G_STMT_END
+#else
+#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
+ cat = _gst_debug_get_category (name); \
+}G_STMT_END
+#endif
+
+/**
+ * GST_CAT_DEFAULT:
+ *
+ * Default gstreamer core debug log category. Please define your own.
+ */
+
+GST_API GstDebugCategory * GST_CAT_DEFAULT;
+/* this symbol may not be used */
+
+GST_API gboolean _gst_debug_enabled;
+
+/* the min debug level, used for quickly discarding debug
+ * messages that fall under the threshold. */
+
+GST_API GstDebugLevel _gst_debug_min;
+
+/**
+ * GST_CAT_LEVEL_LOG:
+ * @cat: category to use
+ * @level: the severity of the message
+ * @object: (allow-none): the #GObject the message belongs to or %NULL if none
+ * @...: A printf-style message to output
+ *
+ * Outputs a debugging message. This is the most general macro for outputting
+ * debugging messages. You will probably want to use one of the ones described
+ * below.
+ *
+ * There is no need to finish the end of the debug message with a newline
+ * character, a newline character will be added automatically.
+ */
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
+ if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
+ gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
+ (GObject *) (object), __VA_ARGS__); \
+ } \
+}G_STMT_END
+#else /* G_HAVE_GNUC_VARARGS */
+#ifdef G_HAVE_GNUC_VARARGS
+#define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
+ if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
+ gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
+ (GObject *) (object), ##args ); \
+ } \
+}G_STMT_END
+#else /* no variadic macros, use inline */
+static inline void
+GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
+ GstDebugLevel level, gpointer object, const char *format, va_list varargs)
+{
+ if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {
+ gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
+ varargs);
+ }
+}
+
+static inline void
+GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
+ gpointer object, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
+ va_end (varargs);
+}
+#endif
+#endif /* G_HAVE_ISO_VARARGS */
+
+/* This one doesn't have varargs in the macro, so it's different than all the
+ * other macros and hence in a separate block right here. Docs chunks are
+ * with the other doc chunks below though. */
+#define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{ \
+ if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= GST_LEVEL_MAX && \
+ GST_LEVEL_MEMDUMP <= _gst_debug_min)) { \
+ _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__, \
+ (GObject *) (object), (msg), (data), (length)); \
+ } \
+}G_STMT_END
+
+#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) \
+ __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
+#define GST_CAT_MEMDUMP(cat,msg,data,length) \
+ __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
+#define GST_MEMDUMP_OBJECT(obj,msg,data,length) \
+ __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
+#define GST_MEMDUMP(msg,data,length) \
+ __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
+
+/**
+ * GST_CAT_ERROR_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an error message belonging to the given object in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_WARNING_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a warning message belonging to the given object in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_INFO_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an informational message belonging to the given object in the given
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_DEBUG_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an debugging message belonging to the given object in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_LOG_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an logging message belonging to the given object in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_FIXME_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a fixme message belonging to the given object in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_TRACE_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a tracing message belonging to the given object in the given
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_MEMDUMP_OBJECT:
+ * @cat: category to use
+ * @obj: the #GObject the message belongs to
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a hexdump of @data relating to the given object in the given
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+
+
+/**
+ * GST_CAT_ERROR:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an error message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_WARNING:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an warning message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_INFO:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an informational message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_DEBUG:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an debugging message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_LOG:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an logging message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_FIXME:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output an fixme message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_TRACE:
+ * @cat: category to use
+ * @...: printf-style message to output
+ *
+ * Output a tracing message in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_CAT_MEMDUMP:
+ * @cat: category to use
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a hexdump of @data in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+
+
+/**
+ * GST_ERROR_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an error message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_WARNING_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a warning message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_INFO_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output an informational message belonging to the given object in the default
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_DEBUG_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a debugging message belonging to the given object in the default
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_LOG_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a logging message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_FIXME_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a fixme message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_TRACE_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @...: printf-style message to output
+ *
+ * Output a tracing message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_MEMDUMP_OBJECT:
+ * @obj: the #GObject the message belongs to
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a logging message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+
+
+/**
+ * GST_ERROR:
+ * @...: printf-style message to output
+ *
+ * Output an error message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_WARNING:
+ * @...: printf-style message to output
+ *
+ * Output a warning message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_INFO:
+ * @...: printf-style message to output
+ *
+ * Output an informational message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_DEBUG:
+ * @...: printf-style message to output
+ *
+ * Output a debugging message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_LOG:
+ * @...: printf-style message to output
+ *
+ * Output a logging message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_FIXME:
+ * @...: printf-style message to output
+ *
+ * Output a fixme message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_TRACE:
+ * @...: printf-style message to output
+ *
+ * Output a tracing message in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+/**
+ * GST_MEMDUMP:
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a hexdump of @data.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ */
+
+#ifdef G_HAVE_ISO_VARARGS
+
+#define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
+#define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
+#define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
+#define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
+#define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
+#define GST_CAT_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__)
+#define GST_CAT_TRACE_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, __VA_ARGS__)
+
+#define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
+#define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
+#define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
+#define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
+#define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
+#define GST_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
+#define GST_CAT_TRACE(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
+
+#define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
+#define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
+#define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
+#define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
+#define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
+#define GST_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__)
+#define GST_TRACE_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, __VA_ARGS__)
+
+#define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
+#define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
+#define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
+#define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
+#define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
+#define GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
+#define GST_TRACE(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
+
+#else
+#ifdef G_HAVE_GNUC_VARARGS
+
+#define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
+#define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
+#define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
+#define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
+#define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
+#define GST_CAT_FIXME_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, ##args )
+#define GST_CAT_TRACE_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, ##args )
+
+#define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
+#define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
+#define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
+#define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
+#define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
+#define GST_CAT_FIXME(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, ##args )
+#define GST_CAT_TRACE(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, ##args )
+
+#define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
+#define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
+#define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
+#define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
+#define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
+#define GST_FIXME_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, ##args )
+#define GST_TRACE_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, ##args )
+
+#define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
+#define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
+#define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
+#define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
+#define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
+#define GST_FIXME(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, ##args )
+#define GST_TRACE(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, ##args )
+
+#else
+/* no variadic macros, use inline */
+static inline void
+GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
+ const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_INFO_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_LOG_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_ERROR (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_WARNING (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_INFO (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_DEBUG (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_LOG (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
+ format, varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_FIXME (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+
+static inline void
+GST_TRACE (const char *format, ...)
+{
+ va_list varargs;
+
+ va_start (varargs, format);
+ GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
+ varargs);
+ va_end (varargs);
+}
+#endif
+#endif
+
+
+/********** function pointer stuff **********/
+
+/**
+ * GST_DEBUG_REGISTER_FUNCPTR:
+ * @ptr: pointer to the function to register
+ *
+ * Register a pointer to a function with its name, so it can later be used by
+ * GST_DEBUG_FUNCPTR_NAME().
+ *
+ * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr.
+ */
+#define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
+ _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
+/**
+ * GST_DEBUG_FUNCPTR:
+ * @ptr: pointer to the function to register
+ *
+ * Register a pointer to a function with its name, so it can later be used by
+ * GST_DEBUG_FUNCPTR_NAME().
+ *
+ * Returns: the value passed to @ptr.
+ */
+#define GST_DEBUG_FUNCPTR(ptr) \
+ (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
+
+/**
+ * GST_DEBUG_FUNCPTR_NAME:
+ * @ptr: address of the function of which to look up the name
+ *
+ * Retrieves the name of the function, if it was previously registered with
+ * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
+ *
+ * This macro returns a constant string which must not be modified or
+ * freed by the caller.
+ */
+#define GST_DEBUG_FUNCPTR_NAME(ptr) \
+ _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
+
+
+#else /* GST_DISABLE_GST_DEBUG */
+
+
+#ifndef GST_INFO_C
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+# pragma GCC poison gst_debug_log
+# pragma GCC poison gst_debug_log_valist
+# pragma GCC poison gst_debug_log_literal
+# pragma GCC poison _gst_debug_category_new
+#endif
+
+#define _gst_debug_min GST_LEVEL_NONE
+
+#define gst_debug_set_default_threshold(level) G_STMT_START{ }G_STMT_END
+#define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
+
+#define gst_debug_level_get_name(level) ("NONE")
+#define gst_debug_message_get(message) ("")
+#define gst_debug_add_log_function(func,data,notify) G_STMT_START{ }G_STMT_END
+#define gst_debug_set_active(active) G_STMT_START{ }G_STMT_END
+#define gst_debug_is_active() (FALSE)
+#define gst_debug_set_colored(colored) G_STMT_START{ }G_STMT_END
+#define gst_debug_set_color_mode(mode) G_STMT_START{ }G_STMT_END
+#define gst_debug_set_color_mode_from_string(mode) G_STMT_START{ }G_STMT_END
+#define gst_debug_is_colored() (FALSE)
+#define gst_debug_get_color_mode() (GST_DEBUG_COLOR_MODE_OFF)
+#define gst_debug_set_default_threshold(level) G_STMT_START{ }G_STMT_END
+#define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
+#define gst_debug_set_threshold_for_name(name,level) G_STMT_START{ }G_STMT_END
+#define gst_debug_unset_threshold_for_name(name) G_STMT_START{ }G_STMT_END
+
+/* we are using dummy function prototypes here to eat ';' as these macros are
+ * used outside of functions */
+#define GST_DEBUG_CATEGORY(var) void _gst_debug_dummy_##var (void)
+#define GST_DEBUG_CATEGORY_EXTERN(var) void _gst_debug_dummy_extern_##var (void)
+#define GST_DEBUG_CATEGORY_STATIC(var) void _gst_debug_dummy_static_##var (void)
+
+#define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_CATEGORY_GET(var,name) G_STMT_START{ }G_STMT_END
+#ifndef GST_DISABLE_DEPRECATED
+#define gst_debug_category_free(category) G_STMT_START{ }G_STMT_END
+#endif
+#define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END
+#define gst_debug_category_reset_threshold(category) G_STMT_START{ }G_STMT_END
+#define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
+#define gst_debug_category_get_name(cat) ("")
+#define gst_debug_category_get_color(cat) (0)
+#define gst_debug_category_get_description(cat) ("")
+#define gst_debug_get_all_categories() (NULL)
+#define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
+#define gst_debug_construct_win_color(colorinfo) (0)
+
+#endif /* !GST_INFO_C */
+
+#ifdef G_HAVE_ISO_VARARGS
+
+#define GST_CAT_LEVEL_LOG(cat,level,...) G_STMT_START{ }G_STMT_END
+
+#define GST_CAT_ERROR_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_WARNING_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_INFO_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_DEBUG_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_LOG_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_FIXME_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_TRACE_OBJECT(...) G_STMT_START{ }G_STMT_END
+
+#define GST_CAT_ERROR(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_WARNING(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_INFO(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_DEBUG(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_LOG(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_FIXME(...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_TRACE(...) G_STMT_START{ }G_STMT_END
+
+#define GST_ERROR_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_WARNING_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_INFO_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_LOG_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_FIXME_OBJECT(...) G_STMT_START{ }G_STMT_END
+#define GST_TRACE_OBJECT(...) G_STMT_START{ }G_STMT_END
+
+#define GST_ERROR(...) G_STMT_START{ }G_STMT_END
+#define GST_WARNING(...) G_STMT_START{ }G_STMT_END
+#define GST_INFO(...) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG(...) G_STMT_START{ }G_STMT_END
+#define GST_LOG(...) G_STMT_START{ }G_STMT_END
+#define GST_FIXME(...) G_STMT_START{ }G_STMT_END
+#define GST_TRACE(...) G_STMT_START{ }G_STMT_END
+
+#else /* !G_HAVE_ISO_VARARGS */
+#ifdef G_HAVE_GNUC_VARARGS
+
+#define GST_CAT_LEVEL_LOG(cat,level,args...) G_STMT_START{ }G_STMT_END
+
+#define GST_CAT_ERROR_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_WARNING_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_INFO_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_DEBUG_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_LOG_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_FIXME_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_TRACE_OBJECT(args...) G_STMT_START{ }G_STMT_END
+
+#define GST_CAT_ERROR(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_WARNING(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_INFO(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_DEBUG(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_LOG(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_FIXME(args...) G_STMT_START{ }G_STMT_END
+#define GST_CAT_TRACE(args...) G_STMT_START{ }G_STMT_END
+
+#define GST_ERROR_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_WARNING_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_INFO_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_LOG_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_FIXME_OBJECT(args...) G_STMT_START{ }G_STMT_END
+#define GST_TRACE_OBJECT(args...) G_STMT_START{ }G_STMT_END
+
+#define GST_ERROR(args...) G_STMT_START{ }G_STMT_END
+#define GST_WARNING(args...) G_STMT_START{ }G_STMT_END
+#define GST_INFO(args...) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG(args...) G_STMT_START{ }G_STMT_END
+#define GST_LOG(args...) G_STMT_START{ }G_STMT_END
+#define GST_FIXME(args...) G_STMT_START{ }G_STMT_END
+#define GST_TRACE(args...) G_STMT_START{ }G_STMT_END
+
+#else /* !G_HAVE_GNUC_VARARGS */
+static inline void
+GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
+ GstDebugLevel level, gpointer object, const char *format, va_list varargs)
+{
+}
+
+static inline void
+GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
+ const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
+ ...)
+{
+}
+
+static inline void
+GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
+{
+}
+
+static inline void
+GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_INFO_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_LOG_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
+{
+}
+
+static inline void
+GST_ERROR (const char *format, ...)
+{
+}
+
+static inline void
+GST_WARNING (const char *format, ...)
+{
+}
+
+static inline void
+GST_INFO (const char *format, ...)
+{
+}
+
+static inline void
+GST_DEBUG (const char *format, ...)
+{
+}
+
+static inline void
+GST_LOG (const char *format, ...)
+{
+}
+
+static inline void
+GST_FIXME (const char *format, ...)
+{
+}
+
+static inline void
+GST_TRACE (const char *format, ...)
+{
+}
+
+#endif /* G_HAVE_GNUC_VARARGS */
+#endif /* G_HAVE_ISO_VARARGS */
+
+#define GST_DEBUG_REGISTER_FUNCPTR(ptr) G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_FUNCPTR(ptr) (ptr)
+#define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
+
+#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
+#define GST_CAT_MEMDUMP(cat,msg,data,length) G_STMT_START{ }G_STMT_END
+#define GST_MEMDUMP_OBJECT(obj,msg,data,length) G_STMT_START{ }G_STMT_END
+#define GST_MEMDUMP(msg,data,length) G_STMT_START{ }G_STMT_END
+
+#endif /* GST_DISABLE_GST_DEBUG */
+
+
+GST_API
+void gst_debug_print_stack_trace (void);
+
+GST_API
+gchar * gst_debug_get_stack_trace (GstStackTraceFlags flags);
+
+GST_API
+void gst_debug_add_ring_buffer_logger (guint max_size_per_thread, guint thread_timeout);
+GST_API
+void gst_debug_remove_ring_buffer_logger (void);
+GST_API
+gchar ** gst_debug_ring_buffer_logger_get_logs (void);
+
+G_END_DECLS
+
+#endif /* __GSTINFO_H__ */
diff --git a/include/gst/gstiterator.h b/include/gst/gstiterator.h
new file mode 100644
index 0000000000..6305dd949c
--- /dev/null
+++ b/include/gst/gstiterator.h
@@ -0,0 +1,290 @@
+/* GStreamer
+ * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2011 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * gstiterator.h: Header for GstIterator
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_ITERATOR_H__
+#define __GST_ITERATOR_H__
+
+#include <glib-object.h> /* for GValue in the fold */
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ITERATOR (gst_iterator_get_type ())
+
+/**
+ * GstIteratorResult:
+ * @GST_ITERATOR_DONE: No more items in the iterator
+ * @GST_ITERATOR_OK: An item was retrieved
+ * @GST_ITERATOR_RESYNC: Datastructure changed while iterating
+ * @GST_ITERATOR_ERROR: An error happened
+ *
+ * The result of gst_iterator_next().
+ */
+typedef enum {
+ GST_ITERATOR_DONE = 0,
+ GST_ITERATOR_OK = 1,
+ GST_ITERATOR_RESYNC = 2,
+ GST_ITERATOR_ERROR = 3
+} GstIteratorResult;
+
+typedef struct _GstIterator GstIterator;
+
+/**
+ * GstIteratorItem:
+ * @GST_ITERATOR_ITEM_SKIP: Skip this item
+ * @GST_ITERATOR_ITEM_PASS: Return item
+ * @GST_ITERATOR_ITEM_END: Stop after this item.
+ *
+ * The result of a #GstIteratorItemFunction.
+ */
+typedef enum {
+ GST_ITERATOR_ITEM_SKIP = 0,
+ GST_ITERATOR_ITEM_PASS = 1,
+ GST_ITERATOR_ITEM_END = 2
+} GstIteratorItem;
+
+/**
+ * GstIteratorCopyFunction:
+ * @it: The original iterator
+ * @copy: The copied iterator
+ *
+ * This function will be called when creating a copy of @it and should
+ * create a copy of all custom iterator fields or increase their
+ * reference counts.
+ */
+typedef void (*GstIteratorCopyFunction) (const GstIterator *it, GstIterator *copy);
+
+/**
+ * GstIteratorItemFunction:
+ * @it: the iterator
+ * @item: the item being retrieved.
+ *
+ * The function that will be called after the next item of the iterator
+ * has been retrieved. This function can be used to skip items or stop
+ * the iterator.
+ *
+ * The function will be called with the iterator lock held.
+ *
+ * Returns: the result of the operation.
+ */
+typedef GstIteratorItem (*GstIteratorItemFunction) (GstIterator *it, const GValue * item);
+
+/**
+ * GstIteratorNextFunction:
+ * @it: the iterator
+ * @result: a pointer to hold the next item
+ *
+ * The function that will be called when the next element of the iterator
+ * should be retrieved.
+ *
+ * Implementors of a #GstIterator should implement this
+ * function and pass it to the constructor of the custom iterator.
+ * The function will be called with the iterator lock held.
+ *
+ * Returns: the result of the operation.
+ */
+typedef GstIteratorResult (*GstIteratorNextFunction) (GstIterator *it, GValue *result);
+/**
+ * GstIteratorResyncFunction:
+ * @it: the iterator
+ *
+ * This function will be called whenever a concurrent update happened
+ * to the iterated datastructure. The implementor of the iterator should
+ * restart the iterator from the beginning and clean up any state it might
+ * have.
+ *
+ * Implementors of a #GstIterator should implement this
+ * function and pass it to the constructor of the custom iterator.
+ * The function will be called with the iterator lock held.
+ */
+typedef void (*GstIteratorResyncFunction) (GstIterator *it);
+/**
+ * GstIteratorFreeFunction:
+ * @it: the iterator
+ *
+ * This function will be called when the iterator is freed.
+ *
+ * Implementors of a #GstIterator should implement this
+ * function and pass it to the constructor of the custom iterator.
+ * The function will be called with the iterator lock held.
+ */
+typedef void (*GstIteratorFreeFunction) (GstIterator *it);
+
+/**
+ * GstIteratorForeachFunction:
+ * @item: The item
+ * @user_data: User data
+ *
+ * A function that is called by gst_iterator_foreach() for every element.
+ */
+typedef void (*GstIteratorForeachFunction) (const GValue * item, gpointer user_data);
+
+/**
+ * GstIteratorFoldFunction:
+ * @item: the item to fold
+ * @ret: a #GValue collecting the result
+ * @user_data: data passed to gst_iterator_fold()
+ *
+ * A function to be passed to gst_iterator_fold().
+ *
+ * Returns: %TRUE if the fold should continue, %FALSE if it should stop.
+ */
+typedef gboolean (*GstIteratorFoldFunction) (const GValue * item, GValue * ret, gpointer user_data);
+
+/**
+ * GST_ITERATOR:
+ * @it: the #GstIterator value
+ *
+ * Macro to cast to a #GstIterator
+ */
+#define GST_ITERATOR(it) ((GstIterator*)(it))
+/**
+ * GST_ITERATOR_LOCK:
+ * @it: the #GstIterator to get the lock of
+ *
+ * Macro to get the lock protecting the datastructure being iterated.
+ */
+#define GST_ITERATOR_LOCK(it) (GST_ITERATOR(it)->lock)
+/**
+ * GST_ITERATOR_COOKIE:
+ * @it: the #GstIterator to get the cookie of
+ *
+ * Macro to get the cookie of a #GstIterator. The cookie of the
+ * iterator is the value of the master cookie when the iterator
+ * was created.
+ * Whenever the iterator is iterated, the value is compared to the
+ * value of the master cookie. If they are different, a concurrent
+ * modification happened to the iterator and a resync is needed.
+ */
+#define GST_ITERATOR_COOKIE(it) (GST_ITERATOR(it)->cookie)
+/**
+ * GST_ITERATOR_ORIG_COOKIE:
+ * @it: the #GstIterator to get the master cookie of
+ *
+ * Macro to get a pointer to where the master cookie is stored. The
+ * master cookie protects the structure being iterated and gets updated
+ * whenever the datastructure changes.
+ */
+#define GST_ITERATOR_ORIG_COOKIE(it) (GST_ITERATOR(it)->master_cookie)
+
+/**
+ * GstIterator:
+ * @copy: The function to copy the iterator
+ * @next: The function to get the next item in the iterator
+ * @item: The function to be called for each item retrieved
+ * @resync: The function to call when a resync is needed.
+ * @free: The function to call when the iterator is freed
+ * @pushed: The iterator that is currently pushed with gst_iterator_push()
+ * @type: The type of the object that this iterator will return
+ * @lock: The lock protecting the data structure and the cookie.
+ * @cookie: The cookie; the value of the master_cookie when this iterator was
+ * created.
+ * @master_cookie: A pointer to the master cookie.
+ * @size: the size of the iterator
+ *
+ * #GstIterator base structure. The values of this structure are
+ * protected for subclasses, use the methods to use the #GstIterator.
+ */
+struct _GstIterator {
+ /*< protected >*/
+ GstIteratorCopyFunction copy;
+ GstIteratorNextFunction next;
+ GstIteratorItemFunction item;
+ GstIteratorResyncFunction resync;
+ GstIteratorFreeFunction free;
+
+ GstIterator *pushed; /* pushed iterator */
+
+ GType type;
+ GMutex *lock;
+ guint32 cookie; /* cookie of the iterator */
+ guint32 *master_cookie; /* pointer to guint32 holding the cookie when this
+ iterator was created */
+ guint size;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_iterator_get_type (void);
+
+/* creating iterators */
+
+GST_API
+GstIterator* gst_iterator_new (guint size,
+ GType type,
+ GMutex *lock,
+ guint32 *master_cookie,
+ GstIteratorCopyFunction copy,
+ GstIteratorNextFunction next,
+ GstIteratorItemFunction item,
+ GstIteratorResyncFunction resync,
+ GstIteratorFreeFunction free) G_GNUC_MALLOC;
+GST_API
+GstIterator* gst_iterator_new_list (GType type,
+ GMutex *lock,
+ guint32 *master_cookie,
+ GList **list,
+ GObject * owner,
+ GstIteratorItemFunction item) G_GNUC_MALLOC;
+GST_API
+GstIterator* gst_iterator_new_single (GType type,
+ const GValue * object) G_GNUC_MALLOC;
+GST_API
+GstIterator* gst_iterator_copy (const GstIterator *it) G_GNUC_MALLOC;
+
+/* using iterators */
+
+GST_API
+GstIteratorResult gst_iterator_next (GstIterator *it, GValue * elem);
+
+GST_API
+void gst_iterator_resync (GstIterator *it);
+
+GST_API
+void gst_iterator_free (GstIterator *it);
+
+GST_API
+void gst_iterator_push (GstIterator *it, GstIterator *other);
+
+/* higher-order functions that operate on iterators */
+
+GST_API
+GstIterator* gst_iterator_filter (GstIterator *it, GCompareFunc func,
+ const GValue * user_data) G_GNUC_MALLOC;
+GST_API
+GstIteratorResult gst_iterator_fold (GstIterator *it,
+ GstIteratorFoldFunction func,
+ GValue *ret, gpointer user_data);
+GST_API
+GstIteratorResult gst_iterator_foreach (GstIterator *it,
+ GstIteratorForeachFunction func, gpointer user_data);
+GST_API
+gboolean gst_iterator_find_custom (GstIterator *it, GCompareFunc func,
+ GValue *elem, gpointer user_data);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstIterator, gst_iterator_free)
+
+G_END_DECLS
+
+#endif /* __GST_ITERATOR_H__ */
diff --git a/include/gst/gstmacros.h b/include/gst/gstmacros.h
new file mode 100644
index 0000000000..b3313e4e37
--- /dev/null
+++ b/include/gst/gstmacros.h
@@ -0,0 +1,59 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __GST_MACROS_H__
+#define __GST_MACROS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+# define GST_GNUC_CONSTRUCTOR \
+ __attribute__ ((constructor))
+#else /* !__GNUC__ */
+# define GST_GNUC_CONSTRUCTOR
+#endif /* !__GNUC__ */
+
+#if defined (__GNUC__) && !defined (GST_IMPLEMENT_INLINES)
+# define GST_INLINE_FUNC extern __inline__
+# define GST_CAN_INLINE 1
+#elif defined(_MSC_VER)
+# define GST_INLINE_FUNC extern __inline
+# define GST_CAN_INLINE 1
+#else
+# define GST_INLINE_FUNC extern
+# undef GST_CAN_INLINE
+#endif
+
+/* MSVC defines 'restrict' as a keyword and not a define */
+#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(restrict)
+# if defined(__GNUC__) && __GNUC__ >= 4
+# define restrict __restrict__
+# elif defined(_MSC_VER)
+# define restrict __restrict
+# else
+# define restrict
+# endif
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_MACROS_H__ */
+
+
diff --git a/include/gst/gstmemory.h b/include/gst/gstmemory.h
new file mode 100644
index 0000000000..cf84de28ad
--- /dev/null
+++ b/include/gst/gstmemory.h
@@ -0,0 +1,390 @@
+/* GStreamer
+ * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
+ *
+ * gstmemory.h: Header for memory blocks
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_MEMORY_H__
+#define __GST_MEMORY_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+#include <gst/gstminiobject.h>
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_memory_type;
+#define GST_TYPE_MEMORY (_gst_memory_type)
+
+GST_API
+GType gst_memory_get_type(void);
+
+typedef struct _GstMemory GstMemory;
+typedef struct _GstAllocator GstAllocator;
+
+#define GST_MEMORY_CAST(mem) ((GstMemory *)(mem))
+
+/**
+ * GstMemoryFlags:
+ * @GST_MEMORY_FLAG_READONLY: memory is readonly. It is not allowed to map the
+ * memory with #GST_MAP_WRITE.
+ * @GST_MEMORY_FLAG_NO_SHARE: memory must not be shared. Copies will have to be
+ * made when this memory needs to be shared between buffers. (DEPRECATED:
+ * do not use in new code, instead you should create a custom GstAllocator for
+ * memory pooling instead of relying on the GstBuffer they were originally
+ * attached to.)
+ * @GST_MEMORY_FLAG_ZERO_PREFIXED: the memory prefix is filled with 0 bytes
+ * @GST_MEMORY_FLAG_ZERO_PADDED: the memory padding is filled with 0 bytes
+ * @GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS: the memory is physically
+ * contiguous. (Since: 1.2)
+ * @GST_MEMORY_FLAG_NOT_MAPPABLE: the memory can't be mapped via
+ * gst_memory_map() without any preconditions. (Since: 1.2)
+ * @GST_MEMORY_FLAG_LAST: first flag that can be used for custom purposes
+ *
+ * Flags for wrapped memory.
+ */
+typedef enum {
+ GST_MEMORY_FLAG_READONLY = GST_MINI_OBJECT_FLAG_LOCK_READONLY,
+ GST_MEMORY_FLAG_NO_SHARE = (GST_MINI_OBJECT_FLAG_LAST << 0),
+ GST_MEMORY_FLAG_ZERO_PREFIXED = (GST_MINI_OBJECT_FLAG_LAST << 1),
+ GST_MEMORY_FLAG_ZERO_PADDED = (GST_MINI_OBJECT_FLAG_LAST << 2),
+ GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS = (GST_MINI_OBJECT_FLAG_LAST << 3),
+ GST_MEMORY_FLAG_NOT_MAPPABLE = (GST_MINI_OBJECT_FLAG_LAST << 4),
+
+ GST_MEMORY_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 16)
+} GstMemoryFlags;
+
+/**
+ * GST_MEMORY_FLAGS:
+ * @mem: a #GstMemory.
+ *
+ * A flags word containing #GstMemoryFlags flags set on @mem
+ */
+#define GST_MEMORY_FLAGS(mem) GST_MINI_OBJECT_FLAGS (mem)
+/**
+ * GST_MEMORY_FLAG_IS_SET:
+ * @mem: a #GstMemory.
+ * @flag: the #GstMemoryFlags to check.
+ *
+ * Gives the status of a specific flag on a @mem.
+ */
+#define GST_MEMORY_FLAG_IS_SET(mem,flag) GST_MINI_OBJECT_FLAG_IS_SET (mem,flag)
+/**
+ * GST_MEMORY_FLAG_UNSET:
+ * @mem: a #GstMemory.
+ * @flag: the #GstMemoryFlags to clear.
+ *
+ * Clear a specific flag on a @mem.
+ */
+#define GST_MEMORY_FLAG_UNSET(mem,flag) GST_MINI_OBJECT_FLAG_UNSET (mem, flag)
+
+/**
+ * GST_MEMORY_IS_READONLY:
+ * @mem: a #GstMemory.
+ *
+ * Check if @mem is readonly.
+ */
+#define GST_MEMORY_IS_READONLY(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_READONLY)
+/**
+ * GST_MEMORY_IS_NO_SHARE:
+ * @mem: a #GstMemory.
+ *
+ * Check if @mem cannot be shared between buffers
+ */
+#define GST_MEMORY_IS_NO_SHARE(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_NO_SHARE)
+/**
+ * GST_MEMORY_IS_ZERO_PREFIXED:
+ * @mem: a #GstMemory.
+ *
+ * Check if the prefix in @mem is 0 filled.
+ */
+#define GST_MEMORY_IS_ZERO_PREFIXED(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_ZERO_PREFIXED)
+/**
+ * GST_MEMORY_IS_ZERO_PADDED:
+ * @mem: a #GstMemory.
+ *
+ * Check if the padding in @mem is 0 filled.
+ */
+#define GST_MEMORY_IS_ZERO_PADDED(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_ZERO_PADDED)
+
+/**
+ * GST_MEMORY_IS_PHYSICALLY_CONTIGUOUS:
+ * @mem: a #GstMemory.
+ *
+ * Check if @mem is physically contiguous.
+ *
+ * Since: 1.2
+ */
+#define GST_MEMORY_IS_PHYSICALLY_CONTIGUOUS(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS)
+
+/**
+ * GST_MEMORY_IS_NOT_MAPPABLE:
+ * @mem: a #GstMemory.
+ *
+ * Check if @mem can't be mapped via gst_memory_map() without any preconditions
+ *
+ * Since: 1.2
+ */
+#define GST_MEMORY_IS_NOT_MAPPABLE(mem) GST_MEMORY_FLAG_IS_SET(mem,GST_MEMORY_FLAG_NOT_MAPPABLE)
+
+/**
+ * GstMemory:
+ * @mini_object: parent structure
+ * @allocator: pointer to the #GstAllocator
+ * @parent: parent memory block
+ * @maxsize: the maximum size allocated
+ * @align: the alignment of the memory
+ * @offset: the offset where valid data starts
+ * @size: the size of valid data
+ *
+ * Base structure for memory implementations. Custom memory will put this structure
+ * as the first member of their structure.
+ */
+struct _GstMemory {
+ GstMiniObject mini_object;
+
+ GstAllocator *allocator;
+
+ GstMemory *parent;
+ gsize maxsize;
+ gsize align;
+ gsize offset;
+ gsize size;
+};
+
+/**
+ * GstMapFlags:
+ * @GST_MAP_READ: map for read access
+ * @GST_MAP_WRITE: map for write access
+ * @GST_MAP_FLAG_LAST: first flag that can be used for custom purposes
+ *
+ * Flags used when mapping memory
+ */
+typedef enum {
+ GST_MAP_READ = GST_LOCK_FLAG_READ,
+ GST_MAP_WRITE = GST_LOCK_FLAG_WRITE,
+
+ GST_MAP_FLAG_LAST = (1 << 16)
+} GstMapFlags;
+
+/**
+ * GST_MAP_READWRITE: (value 3) (type GstMapFlags)
+ *
+ * GstMapFlags value alias for GST_MAP_READ | GST_MAP_WRITE
+ */
+#define GST_MAP_READWRITE ((GstMapFlags) (GST_MAP_READ | GST_MAP_WRITE))
+
+
+/**
+ * GstMapInfo:
+ * @memory: a pointer to the mapped memory
+ * @flags: flags used when mapping the memory
+ * @data: (array length=size): a pointer to the mapped data
+ * @size: the valid size in @data
+ * @maxsize: the maximum bytes in @data
+ * @user_data: extra private user_data that the implementation of the memory
+ * can use to store extra info.
+ *
+ * A structure containing the result of a map operation such as
+ * gst_memory_map(). It contains the data and size.
+ */
+typedef struct {
+ GstMemory *memory;
+ GstMapFlags flags;
+ guint8 *data;
+ gsize size;
+ gsize maxsize;
+ /*< protected >*/
+ gpointer user_data[4];
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+} GstMapInfo;
+
+/**
+ * GST_MAP_INFO_INIT:
+ *
+ * Initializer for #GstMapInfo
+ */
+#define GST_MAP_INFO_INIT { NULL, (GstMapFlags) 0, NULL, 0, 0, { NULL, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL}}
+
+/**
+ * GstMemoryMapFunction:
+ * @mem: a #GstMemory
+ * @maxsize: size to map
+ * @flags: access mode for the memory
+ *
+ * Get the memory of @mem that can be accessed according to the mode specified
+ * in @flags. The function should return a pointer that contains at least
+ * @maxsize bytes.
+ *
+ * Returns: a pointer to memory of which at least @maxsize bytes can be
+ * accessed according to the access pattern in @flags.
+ */
+typedef gpointer (*GstMemoryMapFunction) (GstMemory *mem, gsize maxsize, GstMapFlags flags);
+
+/**
+ * GstMemoryMapFullFunction:
+ * @mem: a #GstMemory
+ * @info: the #GstMapInfo to map with
+ * @maxsize: size to map
+ *
+ * Get the memory of @mem that can be accessed according to the mode specified
+ * in @info's flags. The function should return a pointer that contains at least
+ * @maxsize bytes.
+ *
+ * Returns: a pointer to memory of which at least @maxsize bytes can be
+ * accessed according to the access pattern in @info's flags.
+ */
+typedef gpointer (*GstMemoryMapFullFunction) (GstMemory *mem, GstMapInfo * info, gsize maxsize);
+
+/**
+ * GstMemoryUnmapFunction:
+ * @mem: a #GstMemory
+ *
+ * Release the pointer previously retrieved with gst_memory_map().
+ */
+typedef void (*GstMemoryUnmapFunction) (GstMemory *mem);
+
+/**
+ * GstMemoryUnmapFullFunction:
+ * @mem: a #GstMemory
+ * @info: a #GstMapInfo
+ *
+ * Release the pointer previously retrieved with gst_memory_map() with @info.
+ */
+typedef void (*GstMemoryUnmapFullFunction) (GstMemory *mem, GstMapInfo * info);
+
+/**
+ * GstMemoryCopyFunction:
+ * @mem: a #GstMemory
+ * @offset: an offset
+ * @size: a size or -1
+ *
+ * Copy @size bytes from @mem starting at @offset and return them wrapped in a
+ * new GstMemory object.
+ * If @size is set to -1, all bytes starting at @offset are copied.
+ *
+ * Returns: a new #GstMemory object wrapping a copy of the requested region in
+ * @mem.
+ */
+typedef GstMemory * (*GstMemoryCopyFunction) (GstMemory *mem, gssize offset, gssize size);
+
+/**
+ * GstMemoryShareFunction:
+ * @mem: a #GstMemory
+ * @offset: an offset
+ * @size: a size or -1
+ *
+ * Share @size bytes from @mem starting at @offset and return them wrapped in a
+ * new GstMemory object. If @size is set to -1, all bytes starting at @offset are
+ * shared. This function does not make a copy of the bytes in @mem.
+ *
+ * Returns: a new #GstMemory object sharing the requested region in @mem.
+ */
+typedef GstMemory * (*GstMemoryShareFunction) (GstMemory *mem, gssize offset, gssize size);
+
+/**
+ * GstMemoryIsSpanFunction:
+ * @mem1: a #GstMemory
+ * @mem2: a #GstMemory
+ * @offset: a result offset
+ *
+ * Check if @mem1 and @mem2 occupy contiguous memory and return the offset of
+ * @mem1 in the parent buffer in @offset.
+ *
+ * Returns: %TRUE if @mem1 and @mem2 are in contiguous memory.
+ */
+typedef gboolean (*GstMemoryIsSpanFunction) (GstMemory *mem1, GstMemory *mem2, gsize *offset);
+
+GST_API
+void gst_memory_init (GstMemory *mem, GstMemoryFlags flags,
+ GstAllocator *allocator, GstMemory *parent,
+ gsize maxsize, gsize align,
+ gsize offset, gsize size);
+GST_API
+gboolean gst_memory_is_type (GstMemory *mem, const gchar *mem_type);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstMemory *
+gst_memory_ref (GstMemory * memory)
+{
+ return (GstMemory *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (memory));
+}
+
+static inline void
+gst_memory_unref (GstMemory * memory)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstMemory * gst_memory_ref (GstMemory * memory);
+
+GST_API
+void gst_memory_unref (GstMemory * memory);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/* getting/setting memory properties */
+
+GST_API
+gsize gst_memory_get_sizes (GstMemory *mem, gsize *offset, gsize *maxsize);
+
+GST_API
+void gst_memory_resize (GstMemory *mem, gssize offset, gsize size);
+
+#define gst_memory_lock(m,f) gst_mini_object_lock (GST_MINI_OBJECT_CAST (m), (f))
+#define gst_memory_unlock(m,f) gst_mini_object_unlock (GST_MINI_OBJECT_CAST (m), (f))
+#define gst_memory_is_writable(m) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (m))
+#define gst_memory_make_writable(m) GST_MEMORY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (m)))
+
+/* retrieving data */
+
+GST_API
+GstMemory * gst_memory_make_mapped (GstMemory *mem, GstMapInfo *info, GstMapFlags flags) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+gboolean gst_memory_map (GstMemory *mem, GstMapInfo *info, GstMapFlags flags);
+
+GST_API
+void gst_memory_unmap (GstMemory *mem, GstMapInfo *info);
+
+/* copy and subregions */
+
+GST_API
+GstMemory * gst_memory_copy (GstMemory *mem, gssize offset, gssize size) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+GstMemory * gst_memory_share (GstMemory *mem, gssize offset, gssize size) G_GNUC_WARN_UNUSED_RESULT;
+
+/* span memory */
+
+GST_API
+gboolean gst_memory_is_span (GstMemory *mem1, GstMemory *mem2, gsize *offset);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMemory, gst_memory_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAllocator, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_MEMORY_H__ */
diff --git a/include/gst/gstmessage.h b/include/gst/gstmessage.h
new file mode 100644
index 0000000000..ea3f49fea6
--- /dev/null
+++ b/include/gst/gstmessage.h
@@ -0,0 +1,842 @@
+/* GStreamer
+ * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
+ *
+ * gstmessage.h: Header for GstMessage subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MESSAGE_H__
+#define __GST_MESSAGE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMessage GstMessage;
+
+/**
+ * GstMessageType:
+ * @GST_MESSAGE_UNKNOWN: an undefined message
+ * @GST_MESSAGE_EOS: end-of-stream reached in a pipeline. The application will
+ * only receive this message in the PLAYING state and every time it sets a
+ * pipeline to PLAYING that is in the EOS state. The application can perform a
+ * flushing seek in the pipeline, which will undo the EOS state again.
+ * @GST_MESSAGE_ERROR: an error occurred. When the application receives an error
+ * message it should stop playback of the pipeline and not assume that more
+ * data will be played. It is possible to specify a redirection url to the error
+ * messages by setting a `redirect-location` field into the error message, application
+ * or high level bins might use the information as required.
+ * @GST_MESSAGE_WARNING: a warning occurred.
+ * @GST_MESSAGE_INFO: an info message occurred
+ * @GST_MESSAGE_TAG: a tag was found.
+ * @GST_MESSAGE_BUFFERING: the pipeline is buffering. When the application
+ * receives a buffering message in the PLAYING state for a non-live pipeline it
+ * must PAUSE the pipeline until the buffering completes, when the percentage
+ * field in the message is 100%. For live pipelines, no action must be
+ * performed and the buffering percentage can be used to inform the user about
+ * the progress.
+ * @GST_MESSAGE_STATE_CHANGED: a state change happened
+ * @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread.
+ * This message is deprecated.
+ * @GST_MESSAGE_STEP_DONE: a stepping operation finished.
+ * @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
+ * a clock. This message is used internally and
+ * never forwarded to the application.
+ * @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
+ * unusable. The pipeline will select a new clock on
+ * the next PLAYING state change. The application
+ * should set the pipeline to PAUSED and back to
+ * PLAYING when this message is received.
+ * @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
+ * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
+ * message is used internally and never forwarded to the application.
+ * @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
+ * stops, errors, etc..
+ * @GST_MESSAGE_APPLICATION: message posted by the application, possibly
+ * via an application-specific element.
+ * @GST_MESSAGE_ELEMENT: element-specific message, see the specific element's
+ * documentation
+ * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment. This
+ * message is used internally and never forwarded to the application.
+ * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment. This
+ * message is forwarded to the application after all elements that posted
+ * @GST_MESSAGE_SEGMENT_START posted a GST_MESSAGE_SEGMENT_DONE message.
+ * @GST_MESSAGE_DURATION_CHANGED: The duration of a pipeline changed. The
+ * application can get the new duration with a duration query.
+ * @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC
+ * #GstStateChange. This message is not forwarded to the application but is used
+ * internally.
+ * @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC
+ * #GstStateChange. The application will only receive this message from the toplevel
+ * pipeline.
+ * @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The
+ * application should recalculate and distribute a new latency.
+ * @GST_MESSAGE_REQUEST_STATE: Posted by elements when they want the pipeline to
+ * change state. This message is a suggestion to the application which can
+ * decide to perform the state change on (part of) the pipeline.
+ * @GST_MESSAGE_STEP_START: A stepping operation was started.
+ * @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing
+ * strategy for Quality of Service reasons.
+ * @GST_MESSAGE_PROGRESS: A progress message.
+ * @GST_MESSAGE_TOC: A new table of contents (TOC) was found or previously found TOC
+ * was updated.
+ * @GST_MESSAGE_RESET_TIME: Message to request resetting the pipeline's
+ * running time from the pipeline. This is an internal message which
+ * applications will likely never receive.
+ * @GST_MESSAGE_STREAM_START: Message indicating start of a new stream. Useful
+ * e.g. when using playbin in gapless playback mode, to get notified when
+ * the next title actually starts playing (which will be some time after
+ * the URI for the next title has been set).
+ * @GST_MESSAGE_NEED_CONTEXT: Message indicating that an element wants a specific context (Since: 1.2)
+ * @GST_MESSAGE_HAVE_CONTEXT: Message indicating that an element created a context (Since: 1.2)
+ * @GST_MESSAGE_EXTENDED: Message is an extended message type (see below).
+ * These extended message IDs can't be used directly with mask-based API
+ * like gst_bus_poll() or gst_bus_timed_pop_filtered(), but you can still
+ * filter for GST_MESSAGE_EXTENDED and then check the result for the
+ * specific type. (Since: 1.4)
+ * @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
+ * a #GstDeviceProvider (Since: 1.4)
+ * @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
+ * from a #GstDeviceProvider (Since: 1.4)
+ * @GST_MESSAGE_PROPERTY_NOTIFY: Message indicating a #GObject property has
+ * changed (Since: 1.10)
+ * @GST_MESSAGE_STREAM_COLLECTION: Message indicating a new #GstStreamCollection
+ * is available (Since: 1.10)
+ * @GST_MESSAGE_STREAMS_SELECTED: Message indicating the active selection of
+ * #GstStreams has changed (Since: 1.10)
+ * @GST_MESSAGE_REDIRECT: Message indicating to request the application to
+ * try to play the given URL(s). Useful if for example a HTTP 302/303
+ * response is received with a non-HTTP URL inside. (Since: 1.10)
+ * @GST_MESSAGE_DEVICE_CHANGED: Message indicating a #GstDevice was changed
+ * a #GstDeviceProvider (Since: 1.16)
+ * @GST_MESSAGE_INSTANT_RATE_REQUEST: Message sent by elements to request the
+ * running time from the pipeline when an instant rate change should
+ * be applied (which may be in the past when the answer arrives). (Since: 1.18)
+ * @GST_MESSAGE_ANY: mask for all of the above messages.
+ *
+ * The different message types that are available.
+ */
+/* NOTE: keep in sync with quark registration in gstmessage.c
+ * NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
+ */
+/* FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration */
+/* FIXME: For GST_MESSAGE_ANY ~0 -> 0xffffffff see
+ * https://bugzilla.gnome.org/show_bug.cgi?id=732633
+ */
+typedef enum
+{
+ GST_MESSAGE_UNKNOWN = 0,
+ GST_MESSAGE_EOS = (1 << 0),
+ GST_MESSAGE_ERROR = (1 << 1),
+ GST_MESSAGE_WARNING = (1 << 2),
+ GST_MESSAGE_INFO = (1 << 3),
+ GST_MESSAGE_TAG = (1 << 4),
+ GST_MESSAGE_BUFFERING = (1 << 5),
+ GST_MESSAGE_STATE_CHANGED = (1 << 6),
+ GST_MESSAGE_STATE_DIRTY = (1 << 7),
+ GST_MESSAGE_STEP_DONE = (1 << 8),
+ GST_MESSAGE_CLOCK_PROVIDE = (1 << 9),
+ GST_MESSAGE_CLOCK_LOST = (1 << 10),
+ GST_MESSAGE_NEW_CLOCK = (1 << 11),
+ GST_MESSAGE_STRUCTURE_CHANGE = (1 << 12),
+ GST_MESSAGE_STREAM_STATUS = (1 << 13),
+ GST_MESSAGE_APPLICATION = (1 << 14),
+ GST_MESSAGE_ELEMENT = (1 << 15),
+ GST_MESSAGE_SEGMENT_START = (1 << 16),
+ GST_MESSAGE_SEGMENT_DONE = (1 << 17),
+ GST_MESSAGE_DURATION_CHANGED = (1 << 18),
+ GST_MESSAGE_LATENCY = (1 << 19),
+ GST_MESSAGE_ASYNC_START = (1 << 20),
+ GST_MESSAGE_ASYNC_DONE = (1 << 21),
+ GST_MESSAGE_REQUEST_STATE = (1 << 22),
+ GST_MESSAGE_STEP_START = (1 << 23),
+ GST_MESSAGE_QOS = (1 << 24),
+ GST_MESSAGE_PROGRESS = (1 << 25),
+ GST_MESSAGE_TOC = (1 << 26),
+ GST_MESSAGE_RESET_TIME = (1 << 27),
+ GST_MESSAGE_STREAM_START = (1 << 28),
+ GST_MESSAGE_NEED_CONTEXT = (1 << 29),
+ GST_MESSAGE_HAVE_CONTEXT = (1 << 30),
+ GST_MESSAGE_EXTENDED = (gint) (1u << 31),
+ GST_MESSAGE_DEVICE_ADDED = GST_MESSAGE_EXTENDED + 1,
+ GST_MESSAGE_DEVICE_REMOVED = GST_MESSAGE_EXTENDED + 2,
+ GST_MESSAGE_PROPERTY_NOTIFY = GST_MESSAGE_EXTENDED + 3,
+ GST_MESSAGE_STREAM_COLLECTION = GST_MESSAGE_EXTENDED + 4,
+ GST_MESSAGE_STREAMS_SELECTED = GST_MESSAGE_EXTENDED + 5,
+ GST_MESSAGE_REDIRECT = GST_MESSAGE_EXTENDED + 6,
+ GST_MESSAGE_DEVICE_CHANGED = GST_MESSAGE_EXTENDED + 7,
+ GST_MESSAGE_INSTANT_RATE_REQUEST = GST_MESSAGE_EXTENDED + 8,
+ GST_MESSAGE_ANY = (gint) (0xffffffff)
+} GstMessageType;
+
+#include <gst/gstminiobject.h>
+#include <gst/gstobject.h>
+#include <gst/gstelement.h>
+#include <gst/gsttaglist.h>
+#include <gst/gststructure.h>
+#include <gst/gstquery.h>
+#include <gst/gsttoc.h>
+#include <gst/gstdevice.h>
+#include <gst/gststreams.h>
+#include <gst/gststreamcollection.h>
+
+GST_API GType _gst_message_type;
+
+#define GST_TYPE_MESSAGE (_gst_message_type)
+#define GST_IS_MESSAGE(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
+#define GST_MESSAGE_CAST(obj) ((GstMessage*)(obj))
+#define GST_MESSAGE(obj) (GST_MESSAGE_CAST(obj))
+
+/* the lock is used to handle the synchronous handling of messages,
+ * the emitting thread is blocked until the handling thread processed
+ * the message using this mutex/cond pair */
+#define GST_MESSAGE_GET_LOCK(message) (&GST_MESSAGE_CAST(message)->lock)
+#define GST_MESSAGE_LOCK(message) g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
+#define GST_MESSAGE_UNLOCK(message) g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
+#define GST_MESSAGE_GET_COND(message) (&GST_MESSAGE_CAST(message)->cond)
+#define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
+#define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_GET_COND(message))
+
+/**
+ * GST_MESSAGE_TYPE:
+ * @message: a #GstMessage
+ *
+ * Get the #GstMessageType of @message.
+ */
+#define GST_MESSAGE_TYPE(message) (GST_MESSAGE_CAST(message)->type)
+/**
+ * GST_MESSAGE_TYPE_IS_EXTENDED:
+ * @message: a #GstMessage
+ *
+ * Check if the message is in the extended message group
+ * Since: 1.4
+ */
+#define GST_MESSAGE_TYPE_IS_EXTENDED(message) (!!(GST_MESSAGE_CAST(message)->type & GST_MESSAGE_EXTENDED))
+
+/**
+ * GST_MESSAGE_TYPE_NAME:
+ * @message: a #GstMessage
+ *
+ * Get a constant string representation of the #GstMessageType of @message.
+ */
+#define GST_MESSAGE_TYPE_NAME(message) gst_message_type_get_name(GST_MESSAGE_TYPE(message))
+/**
+ * GST_MESSAGE_TIMESTAMP:
+ * @message: a #GstMessage
+ *
+ * Get the timestamp of @message. This is the timestamp when the message
+ * was created.
+ */
+#define GST_MESSAGE_TIMESTAMP(message) (GST_MESSAGE_CAST(message)->timestamp)
+/**
+ * GST_MESSAGE_SRC:
+ * @message: a #GstMessage
+ *
+ * Get the object that posted @message.
+ */
+#define GST_MESSAGE_SRC(message) (GST_MESSAGE_CAST(message)->src)
+
+/**
+ * GST_MESSAGE_SEQNUM:
+ * @message: a #GstMessage
+ *
+ * Get the sequence number of @message.
+ */
+#define GST_MESSAGE_SEQNUM(message) (GST_MESSAGE_CAST(message)->seqnum)
+
+/**
+ * GST_MESSAGE_SRC_NAME:
+ * @message: a #GstMessage
+ *
+ * Get the name of the object that posted @message. Returns "(NULL)" if
+ * the message has no source object set.
+ */
+#define GST_MESSAGE_SRC_NAME(message) (GST_MESSAGE_SRC(message) ? \
+ GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)")
+
+/**
+ * GstStructureChangeType:
+ * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
+ * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
+ *
+ * The type of a %GST_MESSAGE_STRUCTURE_CHANGE.
+ */
+typedef enum {
+ GST_STRUCTURE_CHANGE_TYPE_PAD_LINK = 0,
+ GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
+} GstStructureChangeType;
+
+/**
+ * GstStreamStatusType:
+ * @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
+ * @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
+ * @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
+ * @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
+ * @GST_STREAM_STATUS_TYPE_START: a thread is started
+ * @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
+ * @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
+ *
+ * The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the
+ * application of new streaming threads and their status.
+ */
+typedef enum {
+ GST_STREAM_STATUS_TYPE_CREATE = 0,
+ GST_STREAM_STATUS_TYPE_ENTER = 1,
+ GST_STREAM_STATUS_TYPE_LEAVE = 2,
+ GST_STREAM_STATUS_TYPE_DESTROY = 3,
+
+ GST_STREAM_STATUS_TYPE_START = 8,
+ GST_STREAM_STATUS_TYPE_PAUSE = 9,
+ GST_STREAM_STATUS_TYPE_STOP = 10
+} GstStreamStatusType;
+
+/**
+ * GstProgressType:
+ * @GST_PROGRESS_TYPE_START: A new task started.
+ * @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues.
+ * @GST_PROGRESS_TYPE_COMPLETE: A task completed.
+ * @GST_PROGRESS_TYPE_CANCELED: A task was canceled.
+ * @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also
+ * posted on the bus.
+ *
+ * The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the
+ * application of the status of asynchronous tasks.
+ */
+typedef enum {
+ GST_PROGRESS_TYPE_START = 0,
+ GST_PROGRESS_TYPE_CONTINUE = 1,
+ GST_PROGRESS_TYPE_COMPLETE = 2,
+ GST_PROGRESS_TYPE_CANCELED = 3,
+ GST_PROGRESS_TYPE_ERROR = 4
+} GstProgressType;
+
+/**
+ * GstMessage:
+ * @mini_object: the parent structure
+ * @type: the #GstMessageType of the message
+ * @timestamp: the timestamp of the message
+ * @src: the src of the message
+ * @seqnum: the sequence number of the message
+ *
+ * A #GstMessage.
+ */
+struct _GstMessage
+{
+ GstMiniObject mini_object;
+
+ /*< public > *//* with COW */
+ GstMessageType type;
+ guint64 timestamp;
+ GstObject *src;
+ guint32 seqnum;
+
+ /*< private >*//* with MESSAGE_LOCK */
+ GMutex lock; /* lock and cond for async delivery */
+ GCond cond;
+};
+
+#include <gst/gstquery.h>
+
+GST_API
+GType gst_message_get_type (void);
+
+GST_API
+const gchar* gst_message_type_get_name (GstMessageType type);
+
+GST_API
+GQuark gst_message_type_to_quark (GstMessageType type);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstMessage *
+gst_message_ref (GstMessage * msg)
+{
+ return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
+}
+
+static inline void
+gst_message_unref (GstMessage * msg)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
+}
+
+static inline void
+gst_clear_message (GstMessage ** msg_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) msg_ptr);
+}
+
+/* copy message */
+static inline GstMessage * gst_message_copy (const GstMessage * msg);
+static inline GstMessage *
+gst_message_copy (const GstMessage * msg)
+{
+ return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstMessage * gst_message_ref (GstMessage * msg);
+
+GST_API
+void gst_message_unref (GstMessage * msg);
+
+GST_API
+void gst_clear_message (GstMessage ** msg_ptr);
+
+GST_API
+GstMessage * gst_message_copy (const GstMessage * msg);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_message_is_writable:
+ * @msg: a #GstMessage
+ *
+ * Tests if you can safely write into a message's structure or validly
+ * modify the seqnum and timestamp fields.
+ */
+#define gst_message_is_writable(msg) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
+/**
+ * gst_message_make_writable:
+ * @msg: (transfer full): the message to make writable
+ *
+ * Checks if a message is writable. If not, a writable copy is made and
+ * returned.
+ *
+ * Returns: (transfer full): a message (possibly a duplicate) that is writable.
+ *
+ * MT safe
+ */
+#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean gst_message_replace (GstMessage **old_message, GstMessage *new_message);
+static inline gboolean
+gst_message_replace (GstMessage **old_message, GstMessage *new_message)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
+}
+
+static inline gboolean
+gst_message_take (GstMessage **old_message, GstMessage *new_message)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_message,
+ (GstMiniObject *) new_message);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_message_replace (GstMessage ** old_message,
+ GstMessage * new_message);
+
+GST_API
+gboolean gst_message_take (GstMessage ** old_message,
+ GstMessage * new_message);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/* custom messages */
+
+GST_API
+GstMessage * gst_message_new_custom (GstMessageType type,
+ GstObject * src,
+ GstStructure * structure) G_GNUC_MALLOC;
+GST_API
+const GstStructure *
+ gst_message_get_structure (GstMessage *message);
+
+GST_API
+GstStructure * gst_message_writable_structure (GstMessage *message);
+
+GST_API
+gboolean gst_message_has_name (GstMessage *message, const gchar *name);
+
+/* identifiers for events and messages */
+
+GST_API
+guint32 gst_message_get_seqnum (GstMessage *message);
+
+GST_API
+void gst_message_set_seqnum (GstMessage *message, guint32 seqnum);
+
+/* EOS */
+
+GST_API
+GstMessage * gst_message_new_eos (GstObject * src) G_GNUC_MALLOC;
+
+/* ERROR */
+
+GST_API
+GstMessage * gst_message_new_error (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
+
+GST_API
+GstMessage * gst_message_new_error_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
+
+GST_API
+void gst_message_parse_error_details (GstMessage *message, const GstStructure **structure);
+
+/* WARNING */
+
+GST_API
+GstMessage * gst_message_new_warning (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
+
+GST_API
+GstMessage * gst_message_new_warning_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
+
+GST_API
+void gst_message_parse_warning_details (GstMessage *message, const GstStructure **structure);
+
+/* INFO */
+
+GST_API
+GstMessage * gst_message_new_info (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
+
+GST_API
+GstMessage * gst_message_new_info_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug);
+
+GST_API
+void gst_message_parse_info_details (GstMessage *message, const GstStructure **structure);
+
+/* TAG */
+
+GST_API
+GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
+
+/* BUFFERING */
+
+GST_API
+GstMessage * gst_message_new_buffering (GstObject * src, gint percent) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_buffering (GstMessage *message, gint *percent);
+
+GST_API
+void gst_message_set_buffering_stats (GstMessage *message, GstBufferingMode mode,
+ gint avg_in, gint avg_out,
+ gint64 buffering_left);
+GST_API
+void gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode,
+ gint *avg_in, gint *avg_out,
+ gint64 *buffering_left);
+
+/* STATE_CHANGED */
+
+GST_API
+GstMessage * gst_message_new_state_changed (GstObject * src, GstState oldstate,
+ GstState newstate, GstState pending) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
+ GstState *newstate, GstState *pending);
+
+/* STATE_DIRTY */
+
+GST_API
+GstMessage * gst_message_new_state_dirty (GstObject * src) G_GNUC_MALLOC;
+
+/* STEP_DONE */
+
+GST_API
+GstMessage * gst_message_new_step_done (GstObject * src, GstFormat format, guint64 amount,
+ gdouble rate, gboolean flush, gboolean intermediate,
+ guint64 duration, gboolean eos) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_step_done (GstMessage * message, GstFormat *format, guint64 *amount,
+ gdouble *rate, gboolean *flush, gboolean *intermediate,
+ guint64 *duration, gboolean *eos);
+/* CLOCK_PROVIDE */
+
+GST_API
+GstMessage * gst_message_new_clock_provide (GstObject * src, GstClock *clock, gboolean ready) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock,
+ gboolean *ready);
+
+/* CLOCK_LOST */
+
+GST_API
+GstMessage * gst_message_new_clock_lost (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
+
+/* NEW_CLOCK */
+
+GST_API
+GstMessage * gst_message_new_new_clock (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
+
+/* APPLICATION */
+
+GST_API
+GstMessage * gst_message_new_application (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
+
+/* ELEMENT */
+
+GST_API
+GstMessage * gst_message_new_element (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
+
+/* SEGMENT_START */
+
+GST_API
+GstMessage * gst_message_new_segment_start (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_segment_start (GstMessage *message, GstFormat *format,
+ gint64 *position);
+
+/* SEGMENT_DONE */
+
+GST_API
+GstMessage * gst_message_new_segment_done (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_segment_done (GstMessage *message, GstFormat *format,
+ gint64 *position);
+
+/* DURATION_CHANGED */
+
+GST_API
+GstMessage * gst_message_new_duration_changed (GstObject * src) G_GNUC_MALLOC;
+
+/* LATENCY */
+
+GST_API
+GstMessage * gst_message_new_latency (GstObject * src) G_GNUC_MALLOC;
+
+/* ASYNC_START */
+
+GST_API
+GstMessage * gst_message_new_async_start (GstObject * src) G_GNUC_MALLOC;
+
+/* ASYNC_DONE */
+
+GST_API
+GstMessage * gst_message_new_async_done (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_async_done (GstMessage *message, GstClockTime *running_time);
+
+/* STRUCTURE CHANGE */
+
+GST_API
+GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
+ GstElement *owner, gboolean busy) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
+ GstElement **owner, gboolean *busy);
+
+/* STREAM STATUS */
+
+GST_API
+GstMessage * gst_message_new_stream_status (GstObject * src, GstStreamStatusType type,
+ GstElement *owner) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_stream_status (GstMessage *message, GstStreamStatusType *type,
+ GstElement **owner);
+GST_API
+void gst_message_set_stream_status_object (GstMessage *message, const GValue *object);
+
+GST_API
+const GValue * gst_message_get_stream_status_object (GstMessage *message);
+
+/* REQUEST_STATE */
+
+GST_API
+GstMessage * gst_message_new_request_state (GstObject * src, GstState state) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_request_state (GstMessage * message, GstState *state);
+
+/* STEP_START */
+
+GST_API
+GstMessage * gst_message_new_step_start (GstObject * src, gboolean active, GstFormat format,
+ guint64 amount, gdouble rate, gboolean flush,
+ gboolean intermediate) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_step_start (GstMessage * message, gboolean *active, GstFormat *format,
+ guint64 *amount, gdouble *rate, gboolean *flush,
+ gboolean *intermediate);
+
+/* QOS */
+
+GST_API
+GstMessage * gst_message_new_qos (GstObject * src, gboolean live, guint64 running_time,
+ guint64 stream_time, guint64 timestamp, guint64 duration) G_GNUC_MALLOC;
+GST_API
+void gst_message_set_qos_values (GstMessage * message, gint64 jitter, gdouble proportion,
+ gint quality);
+GST_API
+void gst_message_set_qos_stats (GstMessage * message, GstFormat format, guint64 processed,
+ guint64 dropped);
+GST_API
+void gst_message_parse_qos (GstMessage * message, gboolean * live, guint64 * running_time,
+ guint64 * stream_time, guint64 * timestamp, guint64 * duration);
+GST_API
+void gst_message_parse_qos_values (GstMessage * message, gint64 * jitter, gdouble * proportion,
+ gint * quality);
+GST_API
+void gst_message_parse_qos_stats (GstMessage * message, GstFormat * format, guint64 * processed,
+ guint64 * dropped);
+/* PROGRESS */
+
+GST_API
+GstMessage * gst_message_new_progress (GstObject * src, GstProgressType type, const gchar *code,
+ const gchar *text) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_progress (GstMessage * message, GstProgressType * type, gchar ** code,
+ gchar ** text);
+
+/* TOC */
+
+GST_API
+GstMessage * gst_message_new_toc (GstObject *src, GstToc *toc, gboolean updated);
+
+GST_API
+void gst_message_parse_toc (GstMessage *message, GstToc **toc, gboolean *updated);
+
+/* RESET_TIME */
+
+GST_API
+GstMessage * gst_message_new_reset_time (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_reset_time (GstMessage *message, GstClockTime *running_time);
+
+/* STREAM_START */
+
+GST_API
+GstMessage * gst_message_new_stream_start (GstObject * src) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_set_group_id (GstMessage *message, guint group_id);
+
+GST_API
+gboolean gst_message_parse_group_id (GstMessage *message, guint *group_id);
+
+/* NEED_CONTEXT */
+
+GST_API
+GstMessage * gst_message_new_need_context (GstObject * src, const gchar * context_type) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_message_parse_context_type (GstMessage * message, const gchar ** context_type);
+
+/* HAVE_CONTEXT */
+
+GST_API
+GstMessage * gst_message_new_have_context (GstObject * src, GstContext *context) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_have_context (GstMessage *message, GstContext **context);
+
+/* DEVICE_ADDED */
+
+GST_API
+GstMessage * gst_message_new_device_added (GstObject * src, GstDevice * device) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_device_added (GstMessage * message, GstDevice ** device);
+
+/* DEVICE_REMOVED */
+
+GST_API
+GstMessage * gst_message_new_device_removed (GstObject * src, GstDevice * device) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_device_removed (GstMessage * message, GstDevice ** device);
+
+/* DEVICE_CHANGED */
+
+GST_API
+GstMessage * gst_message_new_device_changed (GstObject * src, GstDevice * device, GstDevice *changed_device);
+
+GST_API
+void gst_message_parse_device_changed (GstMessage * message, GstDevice ** device, GstDevice ** changed_device);
+
+
+/* PROPERTY_NOTIFY */
+
+GST_API
+GstMessage * gst_message_new_property_notify (GstObject * src, const gchar * property_name, GValue * val) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_property_notify (GstMessage * message, GstObject ** object, const gchar ** property_name, const GValue ** property_value);
+
+/* STREAM_COLLECTION */
+
+GST_API
+GstMessage * gst_message_new_stream_collection (GstObject * src, GstStreamCollection * collection) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_parse_stream_collection (GstMessage *message, GstStreamCollection **collection);
+
+/* STREAMS_SELECTED */
+
+GST_API
+GstMessage * gst_message_new_streams_selected (GstObject *src, GstStreamCollection *collection);
+
+GST_API
+void gst_message_streams_selected_add (GstMessage *message, GstStream *stream);
+
+GST_API
+void gst_message_parse_streams_selected (GstMessage * message, GstStreamCollection **collection);
+
+GST_API
+guint gst_message_streams_selected_get_size (GstMessage * message);
+
+GST_API
+GstStream *gst_message_streams_selected_get_stream (GstMessage *message, guint idx);
+
+/* REDIRECT */
+
+GST_API
+GstMessage * gst_message_new_redirect (GstObject * src, const gchar * location, GstTagList * tag_list, const GstStructure * entry_struct) G_GNUC_MALLOC;
+
+GST_API
+void gst_message_add_redirect_entry (GstMessage * message, const gchar * location, GstTagList * tag_list, const GstStructure * entry_struct);
+
+GST_API
+void gst_message_parse_redirect_entry (GstMessage * message, gsize entry_index, const gchar ** location, GstTagList ** tag_list, const GstStructure ** entry_struct);
+
+GST_API
+gsize gst_message_get_num_redirect_entries (GstMessage * message);
+
+/* INSTANT_RATE_REQUEST */
+
+GST_API
+GstMessage * gst_message_new_instant_rate_request (GstObject * src, gdouble rate_multiplier) G_GNUC_MALLOC;
+GST_API
+void gst_message_parse_instant_rate_request (GstMessage * message, gdouble * rate_multiplier);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMessage, gst_message_unref)
+
+G_END_DECLS
+
+#endif /* __GST_MESSAGE_H__ */
diff --git a/include/gst/gstmeta.h b/include/gst/gstmeta.h
new file mode 100644
index 0000000000..547e5fc870
--- /dev/null
+++ b/include/gst/gstmeta.h
@@ -0,0 +1,301 @@
+/* GStreamer
+ * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
+ *
+ * gstmeta.h: Header for Metadata structures
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_META_H__
+#define __GST_META_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMeta GstMeta;
+typedef struct _GstMetaInfo GstMetaInfo;
+
+#define GST_META_CAST(meta) ((GstMeta *)(meta))
+
+/**
+ * GstMetaFlags:
+ * @GST_META_FLAG_NONE: no flags
+ * @GST_META_FLAG_READONLY: metadata should not be modified
+ * @GST_META_FLAG_POOLED: metadata is managed by a bufferpool
+ * @GST_META_FLAG_LOCKED: metadata should not be removed
+ * @GST_META_FLAG_LAST: additional flags can be added starting from this flag.
+ *
+ * Extra metadata flags.
+ */
+typedef enum {
+ GST_META_FLAG_NONE = 0,
+ GST_META_FLAG_READONLY = (1 << 0),
+ GST_META_FLAG_POOLED = (1 << 1),
+ GST_META_FLAG_LOCKED = (1 << 2),
+
+ GST_META_FLAG_LAST = (1 << 16)
+} GstMetaFlags;
+
+/**
+ * GST_META_FLAGS:
+ * @meta: a #GstMeta.
+ *
+ * A flags word containing #GstMetaFlags flags set on @meta
+ */
+#define GST_META_FLAGS(meta) (GST_META_CAST (meta)->flags)
+/**
+ * GST_META_FLAG_IS_SET:
+ * @meta: a #GstMeta.
+ * @flag: the #GstMetaFlags to check.
+ *
+ * Gives the status of a specific flag on a metadata.
+ */
+#define GST_META_FLAG_IS_SET(meta,flag) !!(GST_META_FLAGS (meta) & (flag))
+/**
+ * GST_META_FLAG_SET:
+ * @meta: a #GstMeta.
+ * @flag: the #GstMetaFlags to set.
+ *
+ * Sets a metadata flag on a metadata.
+ */
+#define GST_META_FLAG_SET(meta,flag) (GST_META_FLAGS (meta) |= (flag))
+/**
+ * GST_META_FLAG_UNSET:
+ * @meta: a #GstMeta.
+ * @flag: the #GstMetaFlags to clear.
+ *
+ * Clears a metadata flag.
+ */
+#define GST_META_FLAG_UNSET(meta,flag) (GST_META_FLAGS (meta) &= ~(flag))
+
+/**
+ * GST_META_TAG_MEMORY_STR:
+ *
+ * This metadata stays relevant as long as memory layout is unchanged.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_MEMORY_STR "memory"
+
+/**
+ * GstMeta:
+ * @flags: extra flags for the metadata
+ * @info: pointer to the #GstMetaInfo
+ *
+ * Base structure for metadata. Custom metadata will put this structure
+ * as the first member of their structure.
+ */
+struct _GstMeta {
+ GstMetaFlags flags;
+ const GstMetaInfo *info;
+};
+
+/**
+ * GstCustomMeta:
+ *
+ * Simple typing wrapper around #GstMeta
+ *
+ * Since: 1.20
+ */
+typedef struct {
+ GstMeta meta;
+} GstCustomMeta;
+
+#include <gst/gstbuffer.h>
+
+/**
+ * GstMetaInitFunction:
+ * @meta: a #GstMeta
+ * @params: parameters passed to the init function
+ * @buffer: a #GstBuffer
+ *
+ * Function called when @meta is initialized in @buffer.
+ */
+typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuffer *buffer);
+
+/**
+ * GstMetaFreeFunction:
+ * @meta: a #GstMeta
+ * @buffer: a #GstBuffer
+ *
+ * Function called when @meta is freed in @buffer.
+ */
+typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
+
+/**
+ * gst_meta_transform_copy:
+ *
+ * GQuark for the "gst-copy" transform.
+ */
+
+GST_API GQuark _gst_meta_transform_copy;
+
+/**
+ * GST_META_TRANSFORM_IS_COPY:
+ * @type: a transform type
+ *
+ * Check if the transform type is a copy transform
+ */
+#define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy)
+
+/**
+ * GstMetaTransformCopy:
+ * @region: %TRUE if only region is copied
+ * @offset: the offset to copy, 0 if @region is %FALSE, otherwise > 0
+ * @size: the size to copy, -1 or the buffer size when @region is %FALSE
+ *
+ * Extra data passed to a "gst-copy" transform #GstMetaTransformFunction.
+ */
+typedef struct {
+ gboolean region;
+ gsize offset;
+ gsize size;
+} GstMetaTransformCopy;
+
+/**
+ * GstMetaTransformFunction:
+ * @transbuf: a #GstBuffer
+ * @meta: a #GstMeta
+ * @buffer: a #GstBuffer
+ * @type: the transform type
+ * @data: transform specific data.
+ *
+ * Function called for each @meta in @buffer as a result of performing a
+ * transformation on @transbuf. Additional @type specific transform data
+ * is passed to the function as @data.
+ *
+ * Implementations should check the @type of the transform and parse
+ * additional type specific fields in @data that should be used to update
+ * the metadata on @transbuf.
+ *
+ * Returns: %TRUE if the transform could be performed
+ */
+typedef gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf,
+ GstMeta *meta, GstBuffer *buffer,
+ GQuark type, gpointer data);
+
+/**
+ * GstCustomMetaTransformFunction:
+ * @transbuf: a #GstBuffer
+ * @meta: a #GstCustomMeta
+ * @buffer: a #GstBuffer
+ * @type: the transform type
+ * @data: transform specific data.
+ * @user_data: user data passed when registering the meta
+ *
+ * Function called for each @meta in @buffer as a result of performing a
+ * transformation on @transbuf. Additional @type specific transform data
+ * is passed to the function as @data.
+ *
+ * Implementations should check the @type of the transform and parse
+ * additional type specific fields in @data that should be used to update
+ * the metadata on @transbuf.
+ *
+ * Returns: %TRUE if the transform could be performed
+ * Since: 1.20
+ */
+typedef gboolean (*GstCustomMetaTransformFunction) (GstBuffer *transbuf,
+ GstCustomMeta *meta, GstBuffer *buffer,
+ GQuark type, gpointer data, gpointer user_data);
+
+/**
+ * GstMetaInfo:
+ * @api: tag identifying the metadata structure and api
+ * @type: type identifying the implementor of the api
+ * @size: size of the metadata
+ * @init_func: function for initializing the metadata
+ * @free_func: function for freeing the metadata
+ * @transform_func: function for transforming the metadata
+ *
+ * The #GstMetaInfo provides information about a specific metadata
+ * structure.
+ */
+struct _GstMetaInfo {
+ GType api;
+ GType type;
+ gsize size;
+
+ GstMetaInitFunction init_func;
+ GstMetaFreeFunction free_func;
+ GstMetaTransformFunction transform_func;
+
+ /* No padding needed, GstMetaInfo is always allocated by GStreamer and is
+ * not subclassable or stack-allocatable, so we can extend it as we please
+ * just like interfaces */
+};
+
+GST_API
+GType gst_meta_api_type_register (const gchar *api,
+ const gchar **tags);
+GST_API
+gboolean gst_meta_api_type_has_tag (GType api, GQuark tag);
+
+GST_API
+const GstMetaInfo * gst_meta_register (GType api, const gchar *impl,
+ gsize size,
+ GstMetaInitFunction init_func,
+ GstMetaFreeFunction free_func,
+ GstMetaTransformFunction transform_func);
+
+GST_API
+const GstMetaInfo * gst_meta_register_custom (const gchar *name, const gchar **tags,
+ GstCustomMetaTransformFunction transform_func,
+ gpointer user_data, GDestroyNotify destroy_data);
+
+GST_API
+gboolean gst_meta_info_is_custom (const GstMetaInfo *info);
+
+GST_API
+GstStructure * gst_custom_meta_get_structure (GstCustomMeta *meta);
+
+GST_API
+gboolean gst_custom_meta_has_name (GstCustomMeta *meta, const gchar * name);
+
+GST_API
+const GstMetaInfo * gst_meta_get_info (const gchar * impl);
+
+GST_API
+const gchar* const* gst_meta_api_type_get_tags (GType api);
+
+GST_API
+guint64 gst_meta_get_seqnum (const GstMeta * meta);
+
+GST_API
+gint gst_meta_compare_seqnum (const GstMeta * meta1,
+ const GstMeta * meta2);
+
+/* some default tags */
+
+GST_API GQuark _gst_meta_tag_memory;
+
+/**
+ * GST_META_TAG_MEMORY:
+ *
+ * Metadata tagged with this tag depends on the particular memory
+ * or buffer that it is on.
+ *
+ * Deprecated: The GQuarks are not exported by any public API, use
+ * GST_META_TAG_MEMORY_STR instead.
+ */
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_META_TAG_MEMORY (_gst_meta_tag_memory)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_META_H__ */
diff --git a/include/gst/gstminiobject.h b/include/gst/gstminiobject.h
new file mode 100644
index 0000000000..f4dfa8d913
--- /dev/null
+++ b/include/gst/gstminiobject.h
@@ -0,0 +1,315 @@
+/* GStreamer
+ * Copyright (C) 2005 David Schleef <ds@schleef.org>
+ *
+ * gstminiobject.h: Header for GstMiniObject
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_MINI_OBJECT_H__
+#define __GST_MINI_OBJECT_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_mini_object_type;
+
+#define GST_TYPE_MINI_OBJECT (_gst_mini_object_type)
+
+#define GST_IS_MINI_OBJECT_TYPE(obj,type) ((obj) && GST_MINI_OBJECT_TYPE(obj) == (type))
+#define GST_MINI_OBJECT_CAST(obj) ((GstMiniObject*)(obj))
+#define GST_MINI_OBJECT_CONST_CAST(obj) ((const GstMiniObject*)(obj))
+#define GST_MINI_OBJECT(obj) (GST_MINI_OBJECT_CAST(obj))
+
+typedef struct _GstMiniObject GstMiniObject;
+
+GST_API
+GType gst_mini_object_get_type (void);
+
+/**
+ * GstMiniObjectCopyFunction:
+ * @obj: MiniObject to copy
+ *
+ * Function prototype for methods to create copies of instances.
+ *
+ * Returns: reference to cloned instance.
+ */
+typedef GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *obj);
+/**
+ * GstMiniObjectDisposeFunction:
+ * @obj: MiniObject to dispose
+ *
+ * Function prototype for when a miniobject has lost its last refcount.
+ * Implementation of the mini object are allowed to revive the
+ * passed object by doing a gst_mini_object_ref(). If the object is not
+ * revived after the dispose function, the function should return %TRUE
+ * and the memory associated with the object is freed.
+ *
+ * Returns: %TRUE if the object should be cleaned up.
+ */
+typedef gboolean (*GstMiniObjectDisposeFunction) (GstMiniObject *obj);
+/**
+ * GstMiniObjectFreeFunction:
+ * @obj: MiniObject to free
+ *
+ * Virtual function prototype for methods to free resources used by
+ * mini-objects.
+ */
+typedef void (*GstMiniObjectFreeFunction) (GstMiniObject *obj);
+
+ /**
+ * GstMiniObjectNotify:
+ * @user_data: data that was provided when the notify was added
+ * @obj: the mini object
+ *
+ * A #GstMiniObjectNotify function can be added to a mini object as a
+ * callback that gets triggered when gst_mini_object_unref() drops the
+ * last ref and @obj is about to be freed.
+ */
+typedef void (*GstMiniObjectNotify) (gpointer user_data, GstMiniObject * obj);
+
+/**
+ * GST_MINI_OBJECT_TYPE:
+ * @obj: MiniObject to return type for.
+ *
+ * This macro returns the type of the mini-object.
+ */
+#define GST_MINI_OBJECT_TYPE(obj) (GST_MINI_OBJECT_CAST(obj)->type)
+
+/**
+ * GST_MINI_OBJECT_FLAGS:
+ * @obj: MiniObject to return flags for.
+ *
+ * This macro returns the entire set of flags for the mini-object.
+ */
+#define GST_MINI_OBJECT_FLAGS(obj) (GST_MINI_OBJECT_CAST(obj)->flags)
+/**
+ * GST_MINI_OBJECT_FLAG_IS_SET:
+ * @obj: MiniObject to check for flags.
+ * @flag: Flag to check for
+ *
+ * This macro checks to see if the given flag is set.
+ */
+#define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag) !!(GST_MINI_OBJECT_FLAGS (obj) & (flag))
+/**
+ * GST_MINI_OBJECT_FLAG_SET:
+ * @obj: MiniObject to set flag in.
+ * @flag: Flag to set, can by any number of bits in guint32.
+ *
+ * This macro sets the given bits.
+ */
+#define GST_MINI_OBJECT_FLAG_SET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) |= (flag))
+/**
+ * GST_MINI_OBJECT_FLAG_UNSET:
+ * @obj: MiniObject to unset flag in.
+ * @flag: Flag to set, must be a single bit in guint32.
+ *
+ * This macro unsets the given bits.
+ */
+#define GST_MINI_OBJECT_FLAG_UNSET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
+
+/**
+ * GstMiniObjectFlags:
+ * @GST_MINI_OBJECT_FLAG_LOCKABLE: the object can be locked and unlocked with
+ * gst_mini_object_lock() and gst_mini_object_unlock().
+ * @GST_MINI_OBJECT_FLAG_LOCK_READONLY: the object is permanently locked in
+ * READONLY mode. Only read locks can be performed on the object.
+ * @GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED: the object is expected to stay alive
+ * even after gst_deinit() has been called and so should be ignored by leak
+ * detection tools. (Since: 1.10)
+ * @GST_MINI_OBJECT_FLAG_LAST: first flag that can be used by subclasses.
+ *
+ * Flags for the mini object
+ */
+typedef enum
+{
+ GST_MINI_OBJECT_FLAG_LOCKABLE = (1 << 0),
+ GST_MINI_OBJECT_FLAG_LOCK_READONLY = (1 << 1),
+ GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED = (1 << 2),
+ /* padding */
+ GST_MINI_OBJECT_FLAG_LAST = (1 << 4)
+} GstMiniObjectFlags;
+
+/**
+ * GST_MINI_OBJECT_IS_LOCKABLE:
+ * @obj: a #GstMiniObject
+ *
+ * Check if @obj is lockable. A lockable object can be locked and unlocked with
+ * gst_mini_object_lock() and gst_mini_object_unlock().
+ */
+#define GST_MINI_OBJECT_IS_LOCKABLE(obj) GST_MINI_OBJECT_FLAG_IS_SET(obj, GST_MINI_OBJECT_FLAG_LOCKABLE)
+
+/**
+ * GstLockFlags:
+ * @GST_LOCK_FLAG_READ: lock for read access
+ * @GST_LOCK_FLAG_WRITE: lock for write access
+ * @GST_LOCK_FLAG_EXCLUSIVE: lock for exclusive access
+ * @GST_LOCK_FLAG_LAST: first flag that can be used for custom purposes
+ *
+ * Flags used when locking miniobjects
+ */
+typedef enum {
+ GST_LOCK_FLAG_READ = (1 << 0),
+ GST_LOCK_FLAG_WRITE = (1 << 1),
+ GST_LOCK_FLAG_EXCLUSIVE = (1 << 2),
+
+ GST_LOCK_FLAG_LAST = (1 << 8)
+} GstLockFlags;
+
+/**
+ * GST_LOCK_FLAG_READWRITE: (value 3) (type GstLockFlags)
+ *
+ * GstLockFlags value alias for GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE
+ */
+#define GST_LOCK_FLAG_READWRITE ((GstLockFlags) (GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE))
+
+/**
+ * GST_MINI_OBJECT_REFCOUNT:
+ * @obj: a #GstMiniObject
+ *
+ * Get access to the reference count field of the mini-object.
+ */
+#define GST_MINI_OBJECT_REFCOUNT(obj) ((GST_MINI_OBJECT_CAST(obj))->refcount)
+/**
+ * GST_MINI_OBJECT_REFCOUNT_VALUE:
+ * @obj: a #GstMiniObject
+ *
+ * Get the reference count value of the mini-object.
+ */
+#define GST_MINI_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
+
+/**
+ * GstMiniObject: (ref-func gst_mini_object_ref) (unref-func gst_mini_object_unref) (set-value-func g_value_set_boxed) (get-value-func g_value_get_boxed)
+ * @type: the GType of the object
+ * @refcount: atomic refcount
+ * @lockstate: atomic state of the locks
+ * @flags: extra flags.
+ * @copy: a copy function
+ * @dispose: a dispose function
+ * @free: the free function
+ *
+ * Base class for refcounted lightweight objects.
+ */
+struct _GstMiniObject {
+ GType type;
+
+ /*< public >*/ /* with COW */
+ gint refcount;
+ gint lockstate;
+ guint flags;
+
+ GstMiniObjectCopyFunction copy;
+ GstMiniObjectDisposeFunction dispose;
+ GstMiniObjectFreeFunction free;
+
+ /* < private > */
+ /* Used to keep track of parents, weak ref notifies and qdata */
+ guint priv_uint;
+ gpointer priv_pointer;
+};
+
+GST_API
+void gst_mini_object_init (GstMiniObject *mini_object,
+ guint flags, GType type,
+ GstMiniObjectCopyFunction copy_func,
+ GstMiniObjectDisposeFunction dispose_func,
+ GstMiniObjectFreeFunction free_func);
+
+
+/* refcounting */
+
+GST_API
+GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
+
+GST_API
+void gst_mini_object_unref (GstMiniObject *mini_object);
+
+GST_API
+void gst_clear_mini_object (GstMiniObject **object_ptr);
+#define gst_clear_mini_object(object_ptr) g_clear_pointer ((object_ptr), gst_mini_object_unref)
+
+GST_API
+void gst_mini_object_weak_ref (GstMiniObject *object,
+ GstMiniObjectNotify notify,
+ gpointer data);
+GST_API
+void gst_mini_object_weak_unref (GstMiniObject *object,
+ GstMiniObjectNotify notify,
+ gpointer data);
+
+/* locking */
+
+GST_API
+gboolean gst_mini_object_lock (GstMiniObject *object, GstLockFlags flags);
+
+GST_API
+void gst_mini_object_unlock (GstMiniObject *object, GstLockFlags flags);
+
+GST_API
+gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
+
+GST_API
+GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object) G_GNUC_WARN_UNUSED_RESULT;
+
+/* copy */
+
+GST_API
+GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+
+
+GST_API
+void gst_mini_object_set_qdata (GstMiniObject *object, GQuark quark,
+ gpointer data, GDestroyNotify destroy);
+GST_API
+gpointer gst_mini_object_get_qdata (GstMiniObject *object, GQuark quark);
+
+GST_API
+gpointer gst_mini_object_steal_qdata (GstMiniObject *object, GQuark quark);
+
+GST_API
+void gst_mini_object_add_parent (GstMiniObject *object, GstMiniObject *parent);
+GST_API
+void gst_mini_object_remove_parent (GstMiniObject *object, GstMiniObject *parent);
+
+GST_API
+gboolean gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
+
+GST_API
+gboolean gst_mini_object_take (GstMiniObject **olddata, GstMiniObject *newdata);
+
+GST_API
+GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata) G_GNUC_WARN_UNUSED_RESULT;
+
+/**
+ * GST_DEFINE_MINI_OBJECT_TYPE:
+ * @TypeName: name of the new type in CamelCase
+ * @type_name: name of the new type
+ *
+ * Define a new mini-object type with the given name
+ */
+#define GST_DEFINE_MINI_OBJECT_TYPE(TypeName,type_name) \
+ G_DEFINE_BOXED_TYPE(TypeName,type_name, \
+ (GBoxedCopyFunc) gst_mini_object_ref, \
+ (GBoxedFreeFunc) gst_mini_object_unref)
+
+G_END_DECLS
+
+#endif
+
diff --git a/include/gst/gstobject.h b/include/gst/gstobject.h
new file mode 100644
index 0000000000..85e827533b
--- /dev/null
+++ b/include/gst/gstobject.h
@@ -0,0 +1,332 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstobject.h: Header for base GstObject
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_OBJECT_H__
+#define __GST_OBJECT_H__
+
+#include <gst/gstconfig.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_OBJECT (gst_object_get_type ())
+#define GST_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OBJECT))
+#define GST_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_OBJECT))
+#define GST_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OBJECT, GstObjectClass))
+#define GST_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject))
+#define GST_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass))
+#define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
+#define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
+
+/**
+ * GstObjectFlags:
+ * @GST_OBJECT_FLAG_MAY_BE_LEAKED: the object is expected to stay alive even
+ * after gst_deinit() has been called and so should be ignored by leak
+ * detection tools. (Since: 1.10)
+ * @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
+ *
+ * The standard flags that an gstobject may have.
+ */
+typedef enum
+{
+ GST_OBJECT_FLAG_MAY_BE_LEAKED = (1 << 0),
+ /* padding */
+ GST_OBJECT_FLAG_LAST = (1<<4)
+} GstObjectFlags;
+
+/**
+ * GST_OBJECT_REFCOUNT:
+ * @obj: a #GstObject
+ *
+ * Get access to the reference count field of the object.
+ */
+#define GST_OBJECT_REFCOUNT(obj) (((GObject*)(obj))->ref_count)
+/**
+ * GST_OBJECT_REFCOUNT_VALUE:
+ * @obj: a #GstObject
+ *
+ * Get the reference count value of the object.
+ */
+#define GST_OBJECT_REFCOUNT_VALUE(obj) g_atomic_int_get ((gint *) &GST_OBJECT_REFCOUNT(obj))
+
+/* we do a GST_OBJECT_CAST to avoid type checking, better call these
+ * function with a valid object! */
+
+/**
+ * GST_OBJECT_GET_LOCK:
+ * @obj: a #GstObject
+ *
+ * Acquire a reference to the mutex of this object.
+ */
+#define GST_OBJECT_GET_LOCK(obj) (&GST_OBJECT_CAST(obj)->lock)
+/**
+ * GST_OBJECT_LOCK:
+ * @obj: a #GstObject to lock
+ *
+ * This macro will obtain a lock on the object, making serialization possible.
+ * It blocks until the lock can be obtained.
+ */
+#define GST_OBJECT_LOCK(obj) g_mutex_lock(GST_OBJECT_GET_LOCK(obj))
+/**
+ * GST_OBJECT_TRYLOCK:
+ * @obj: a #GstObject.
+ *
+ * This macro will try to obtain a lock on the object, but will return with
+ * %FALSE if it can't get it immediately.
+ */
+#define GST_OBJECT_TRYLOCK(obj) g_mutex_trylock(GST_OBJECT_GET_LOCK(obj))
+/**
+ * GST_OBJECT_UNLOCK:
+ * @obj: a #GstObject to unlock.
+ *
+ * This macro releases a lock on the object.
+ */
+#define GST_OBJECT_UNLOCK(obj) g_mutex_unlock(GST_OBJECT_GET_LOCK(obj))
+
+
+/**
+ * GST_OBJECT_NAME:
+ * @obj: a #GstObject
+ *
+ * Get the name of this object. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_object_get_name() instead.
+ */
+#define GST_OBJECT_NAME(obj) (GST_OBJECT_CAST(obj)->name)
+/**
+ * GST_OBJECT_PARENT:
+ * @obj: a #GstObject
+ *
+ * Get the parent of this object. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_object_get_parent() instead.
+ */
+#define GST_OBJECT_PARENT(obj) (GST_OBJECT_CAST(obj)->parent)
+
+
+/**
+ * GST_OBJECT_FLAGS:
+ * @obj: a #GstObject
+ *
+ * This macro returns the entire set of flags for the object.
+ */
+#define GST_OBJECT_FLAGS(obj) (GST_OBJECT_CAST (obj)->flags)
+/**
+ * GST_OBJECT_FLAG_IS_SET:
+ * @obj: a #GstObject
+ * @flag: Flag to check for
+ *
+ * This macro checks to see if the given flag is set.
+ */
+#define GST_OBJECT_FLAG_IS_SET(obj,flag) ((GST_OBJECT_FLAGS (obj) & (flag)) == (flag))
+/**
+ * GST_OBJECT_FLAG_SET:
+ * @obj: a #GstObject
+ * @flag: Flag to set
+ *
+ * This macro sets the given bits.
+ */
+#define GST_OBJECT_FLAG_SET(obj,flag) (GST_OBJECT_FLAGS (obj) |= (flag))
+/**
+ * GST_OBJECT_FLAG_UNSET:
+ * @obj: a #GstObject
+ * @flag: Flag to set
+ *
+ * This macro unsets the given bits.
+ */
+#define GST_OBJECT_FLAG_UNSET(obj,flag) (GST_OBJECT_FLAGS (obj) &= ~(flag))
+
+typedef struct _GstObject GstObject;
+typedef struct _GstObjectClass GstObjectClass;
+
+/**
+ * GstObject:
+ * @lock: object LOCK
+ * @name: The name of the object
+ * @parent: this object's parent, weak ref
+ * @flags: flags for this object
+ *
+ * GStreamer base object class.
+ */
+struct _GstObject {
+ GInitiallyUnowned object;
+
+ /*< public >*/ /* with LOCK */
+ GMutex lock; /* object LOCK */
+ gchar *name; /* object name */
+ GstObject *parent; /* this object's parent, weak ref */
+ guint32 flags;
+
+ /*< private >*/
+ GList *control_bindings; /* List of GstControlBinding */
+ guint64 control_rate;
+ guint64 last_sync;
+
+ gpointer _gst_reserved;
+};
+
+/**
+ * GstObjectClass:
+ * @parent_class: parent
+ * @path_string_separator: separator used by gst_object_get_path_string()
+ * @deep_notify: default signal handler
+ *
+ * GStreamer base object class.
+ */
+struct _GstObjectClass {
+ GInitiallyUnownedClass parent_class;
+
+ const gchar *path_string_separator;
+
+ /* signals */
+ void (*deep_notify) (GstObject * object, GstObject * orig, GParamSpec * pspec);
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/* normal GObject stuff */
+
+GST_API
+GType gst_object_get_type (void);
+
+/* name routines */
+
+GST_API
+gboolean gst_object_set_name (GstObject *object, const gchar *name);
+
+GST_API
+gchar* gst_object_get_name (GstObject *object);
+
+/* parentage routines */
+
+GST_API
+gboolean gst_object_set_parent (GstObject *object, GstObject *parent);
+
+GST_API
+GstObject* gst_object_get_parent (GstObject *object);
+
+GST_API
+void gst_object_unparent (GstObject *object);
+
+GST_API
+gboolean gst_object_has_as_parent (GstObject *object, GstObject *parent);
+
+GST_API
+gboolean gst_object_has_as_ancestor (GstObject *object, GstObject *ancestor);
+
+GST_DEPRECATED_FOR(gst_object_has_as_ancestor)
+gboolean gst_object_has_ancestor (GstObject *object, GstObject *ancestor);
+
+GST_API
+void gst_object_default_deep_notify (GObject *object, GstObject *orig,
+ GParamSpec *pspec, gchar **excluded_props);
+
+/* refcounting + life cycle */
+
+GST_API
+gpointer gst_object_ref (gpointer object);
+
+GST_API
+void gst_object_unref (gpointer object);
+
+GST_API
+void gst_clear_object (GstObject **object_ptr);
+#define gst_clear_object(object_ptr) g_clear_pointer ((object_ptr), gst_object_unref)
+
+GST_API
+gpointer gst_object_ref_sink (gpointer object);
+
+/* replace object pointer */
+
+GST_API
+gboolean gst_object_replace (GstObject **oldobj, GstObject *newobj);
+
+/* printing out the 'path' of the object */
+
+GST_API
+gchar * gst_object_get_path_string (GstObject *object);
+
+/* misc utils */
+
+GST_API
+gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
+
+/* controller functions */
+#include <gst/gstcontrolbinding.h>
+#include <gst/gstcontrolsource.h>
+
+GST_API
+GstClockTime gst_object_suggest_next_sync (GstObject * object);
+
+GST_API
+gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
+
+GST_API
+gboolean gst_object_has_active_control_bindings (GstObject *object);
+
+GST_API
+void gst_object_set_control_bindings_disabled (GstObject *object, gboolean disabled);
+
+GST_API
+void gst_object_set_control_binding_disabled (GstObject *object,
+ const gchar * property_name,
+ gboolean disabled);
+
+GST_API
+gboolean gst_object_add_control_binding (GstObject * object, GstControlBinding * binding);
+
+GST_API
+GstControlBinding *
+ gst_object_get_control_binding (GstObject *object, const gchar * property_name);
+
+GST_API
+gboolean gst_object_remove_control_binding (GstObject * object, GstControlBinding * binding);
+
+GST_API
+GValue * gst_object_get_value (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp);
+GST_API
+gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp, GstClockTime interval,
+ guint n_values, gpointer values);
+GST_API
+gboolean gst_object_get_g_value_array (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp, GstClockTime interval,
+ guint n_values, GValue *values);
+GST_API
+GstClockTime gst_object_get_control_rate (GstObject * object);
+
+GST_API
+void gst_object_set_control_rate (GstObject * object, GstClockTime control_rate);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstObject, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_OBJECT_H__ */
+
diff --git a/include/gst/gstpad.h b/include/gst/gstpad.h
new file mode 100644
index 0000000000..c89be30508
--- /dev/null
+++ b/include/gst/gstpad.h
@@ -0,0 +1,1576 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstpad.h: Header for GstPad object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_PAD_H__
+#define __GST_PAD_H__
+
+#include <gst/gstconfig.h>
+
+typedef struct _GstPad GstPad;
+typedef struct _GstPadPrivate GstPadPrivate;
+typedef struct _GstPadClass GstPadClass;
+typedef struct _GstPadProbeInfo GstPadProbeInfo;
+
+/**
+ * GstPadDirection:
+ * @GST_PAD_UNKNOWN: direction is unknown.
+ * @GST_PAD_SRC: the pad is a source pad.
+ * @GST_PAD_SINK: the pad is a sink pad.
+ *
+ * The direction of a pad.
+ */
+typedef enum {
+ GST_PAD_UNKNOWN,
+ GST_PAD_SRC,
+ GST_PAD_SINK
+} GstPadDirection;
+
+/**
+ * GstPadMode:
+ * @GST_PAD_MODE_NONE: Pad will not handle dataflow
+ * @GST_PAD_MODE_PUSH: Pad handles dataflow in downstream push mode
+ * @GST_PAD_MODE_PULL: Pad handles dataflow in upstream pull mode
+ *
+ * The status of a GstPad. After activating a pad, which usually happens when the
+ * parent element goes from READY to PAUSED, the GstPadMode defines if the
+ * pad operates in push or pull mode.
+ */
+typedef enum {
+ GST_PAD_MODE_NONE,
+ GST_PAD_MODE_PUSH,
+ GST_PAD_MODE_PULL
+} GstPadMode;
+
+#include <glib.h>
+
+GST_API
+const gchar * gst_pad_mode_get_name (GstPadMode mode);
+
+#include <gst/gstobject.h>
+#include <gst/gstbuffer.h>
+#include <gst/gstbufferlist.h>
+#include <gst/gstcaps.h>
+#include <gst/gstpadtemplate.h>
+#include <gst/gstevent.h>
+#include <gst/gstquery.h>
+#include <gst/gsttask.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Pad base class
+ */
+#define GST_TYPE_PAD (gst_pad_get_type ())
+#define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
+#define GST_IS_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
+#define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
+#define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
+#define GST_PAD_CAST(obj) ((GstPad*)(obj))
+
+
+
+/**
+ * GstPadLinkReturn:
+ * @GST_PAD_LINK_OK : link succeeded
+ * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
+ * @GST_PAD_LINK_WAS_LINKED : pad was already linked
+ * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
+ * @GST_PAD_LINK_NOFORMAT : pads do not have common format
+ * @GST_PAD_LINK_NOSCHED : pads cannot cooperate in scheduling
+ * @GST_PAD_LINK_REFUSED : refused for some reason
+ *
+ * Result values from gst_pad_link and friends.
+ */
+typedef enum {
+ GST_PAD_LINK_OK = 0,
+ GST_PAD_LINK_WRONG_HIERARCHY = -1,
+ GST_PAD_LINK_WAS_LINKED = -2,
+ GST_PAD_LINK_WRONG_DIRECTION = -3,
+ GST_PAD_LINK_NOFORMAT = -4,
+ GST_PAD_LINK_NOSCHED = -5,
+ GST_PAD_LINK_REFUSED = -6
+} GstPadLinkReturn;
+
+/**
+ * GST_PAD_LINK_FAILED:
+ * @ret: the #GstPadLinkReturn value
+ *
+ * Macro to test if the given #GstPadLinkReturn value indicates a failed
+ * link step.
+ */
+#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
+
+/**
+ * GST_PAD_LINK_SUCCESSFUL:
+ * @ret: the #GstPadLinkReturn value
+ *
+ * Macro to test if the given #GstPadLinkReturn value indicates a successful
+ * link step.
+ */
+#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
+
+/**
+ * GstFlowReturn:
+ * @GST_FLOW_OK: Data passing was ok.
+ * @GST_FLOW_NOT_LINKED: Pad is not linked.
+ * @GST_FLOW_FLUSHING: Pad is flushing.
+ * @GST_FLOW_EOS: Pad is EOS.
+ * @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated.
+ * @GST_FLOW_ERROR: Some (fatal) error occurred. Element generating
+ * this error should post an error message using
+ * GST_ELEMENT_ERROR() with more details.
+ * @GST_FLOW_NOT_SUPPORTED: This operation is not supported.
+ * @GST_FLOW_CUSTOM_SUCCESS: Elements can use values starting from
+ * this (and higher) to define custom success
+ * codes.
+ * @GST_FLOW_CUSTOM_SUCCESS_1: Pre-defined custom success code (define your
+ * custom success code to this to avoid compiler
+ * warnings).
+ * @GST_FLOW_CUSTOM_SUCCESS_2: Pre-defined custom success code.
+ * @GST_FLOW_CUSTOM_ERROR: Elements can use values starting from
+ * this (and lower) to define custom error codes.
+ * @GST_FLOW_CUSTOM_ERROR_1: Pre-defined custom error code (define your
+ * custom error code to this to avoid compiler
+ * warnings).
+ * @GST_FLOW_CUSTOM_ERROR_2: Pre-defined custom error code.
+ *
+ * The result of passing data to a pad.
+ *
+ * Note that the custom return values should not be exposed outside of the
+ * element scope.
+ */
+typedef enum {
+ /* custom success starts here */
+ GST_FLOW_CUSTOM_SUCCESS_2 = 102,
+ GST_FLOW_CUSTOM_SUCCESS_1 = 101,
+ GST_FLOW_CUSTOM_SUCCESS = 100,
+
+ /* core predefined */
+ GST_FLOW_OK = 0,
+ /* expected failures */
+ GST_FLOW_NOT_LINKED = -1,
+ GST_FLOW_FLUSHING = -2,
+ /* error cases */
+ GST_FLOW_EOS = -3,
+ GST_FLOW_NOT_NEGOTIATED = -4,
+ GST_FLOW_ERROR = -5,
+ GST_FLOW_NOT_SUPPORTED = -6,
+
+ /* custom error starts here */
+ GST_FLOW_CUSTOM_ERROR = -100,
+ GST_FLOW_CUSTOM_ERROR_1 = -101,
+ GST_FLOW_CUSTOM_ERROR_2 = -102
+} GstFlowReturn;
+
+GST_API
+const gchar * gst_flow_get_name (GstFlowReturn ret);
+
+GST_API
+GQuark gst_flow_to_quark (GstFlowReturn ret);
+
+GST_API
+const gchar * gst_pad_link_get_name (GstPadLinkReturn ret);
+
+/**
+ * GstPadLinkCheck:
+ * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
+ * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
+ * Could be omitted if it is already known that the two elements that own the
+ * pads are in the same bin.
+ * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
+ * their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
+ * would be unsafe e.g. if one pad has %GST_CAPS_ANY.
+ * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
+ * caps returned by gst_pad_query_caps().
+ * @GST_PAD_LINK_CHECK_NO_RECONFIGURE: Disables pushing a reconfigure event when pads are
+ * linked.
+ * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
+ * pads (i.e. the ones used by gst_pad_link()).
+ *
+ * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
+ * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
+ * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
+ *
+ * > Only disable some of the checks if you are 100% certain you know the link
+ * > will not fail because of hierarchy/caps compatibility failures. If uncertain,
+ * > use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
+ * > for linking the pads.
+ */
+
+typedef enum {
+ GST_PAD_LINK_CHECK_NOTHING = 0,
+ GST_PAD_LINK_CHECK_HIERARCHY = 1 << 0,
+ GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
+ GST_PAD_LINK_CHECK_CAPS = 1 << 2,
+
+
+ /* Not really checks, more like flags
+ * Added here to avoid creating a new gst_pad_link_variant */
+ GST_PAD_LINK_CHECK_NO_RECONFIGURE = 1 << 3,
+
+ GST_PAD_LINK_CHECK_DEFAULT = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
+} GstPadLinkCheck;
+
+/* pad states */
+/**
+ * GstPadActivateFunction:
+ * @pad: a #GstPad
+ * @parent: the parent of @pad
+ *
+ * This function is called when the pad is activated during the element
+ * READY to PAUSED state change. By default this function will call the
+ * activate function that puts the pad in push mode but elements can
+ * override this function to activate the pad in pull mode if they wish.
+ *
+ * Returns: %TRUE if the pad could be activated.
+ */
+typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
+/**
+ * GstPadActivateModeFunction:
+ * @pad: a #GstPad
+ * @parent: the parent of @pad
+ * @mode: the requested activation mode of @pad
+ * @active: activate or deactivate the pad.
+ *
+ * The prototype of the push and pull activate functions.
+ *
+ * Returns: %TRUE if the pad could be activated or deactivated.
+ */
+typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
+ GstPadMode mode, gboolean active);
+
+
+/* data passing */
+/**
+ * GstPadChainFunction:
+ * @pad: the sink #GstPad that performed the chain.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL.
+ *
+ * A function that will be called on sinkpads when chaining buffers.
+ * The function typically processes the data contained in the buffer and
+ * either consumes the data or passes it on to the internally linked pad(s).
+ *
+ * The implementer of this function receives a refcount to @buffer and should
+ * gst_buffer_unref() when the buffer is no longer needed.
+ *
+ * When a chain function detects an error in the data stream, it must post an
+ * error on the bus and return an appropriate #GstFlowReturn value.
+ *
+ * Returns: #GST_FLOW_OK for success
+ */
+typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstObject *parent,
+ GstBuffer *buffer);
+
+/**
+ * GstPadChainListFunction:
+ * @pad: the sink #GstPad that performed the chain.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @list: (transfer full): the #GstBufferList that is chained, not %NULL.
+ *
+ * A function that will be called on sinkpads when chaining buffer lists.
+ * The function typically processes the data contained in the buffer list and
+ * either consumes the data or passes it on to the internally linked pad(s).
+ *
+ * The implementer of this function receives a refcount to @list and
+ * should gst_buffer_list_unref() when the list is no longer needed.
+ *
+ * When a chainlist function detects an error in the data stream, it must
+ * post an error on the bus and return an appropriate #GstFlowReturn value.
+ *
+ * Returns: #GST_FLOW_OK for success
+ */
+typedef GstFlowReturn (*GstPadChainListFunction) (GstPad *pad, GstObject *parent,
+ GstBufferList *list);
+
+/**
+ * GstPadGetRangeFunction:
+ * @pad: the src #GstPad to perform the getrange on.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @offset: the offset of the range
+ * @length: the length of the range
+ * @buffer: a memory location to hold the result buffer, cannot be %NULL.
+ *
+ * This function will be called on source pads when a peer element
+ * request a buffer at the specified @offset and @length. If this function
+ * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
+ * contents of @buffer is invalid for any other return value.
+ *
+ * This function is installed on a source pad with
+ * gst_pad_set_getrange_function() and can only be called on source pads after
+ * they are successfully activated with gst_pad_activate_mode() with the
+ * #GST_PAD_MODE_PULL.
+ *
+ * @offset and @length are always given in byte units. @offset must normally be a value
+ * between 0 and the length in bytes of the data available on @pad. The
+ * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
+ * #GST_QUERY_SEEKING.
+ *
+ * Any @offset larger or equal than the length will make the function return
+ * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
+ * contain a valid buffer.
+ *
+ * The buffer size of @buffer will only be smaller than @length when @offset is
+ * near the end of the stream. In all other cases, the size of @buffer must be
+ * exactly the requested size.
+ *
+ * It is allowed to call this function with a 0 @length and valid @offset, in
+ * which case @buffer will contain a 0-sized buffer and the function returns
+ * #GST_FLOW_OK.
+ *
+ * When this function is called with a -1 @offset, the sequentially next buffer
+ * of length @length in the stream is returned.
+ *
+ * When this function is called with a -1 @length, a buffer with a default
+ * optimal length is returned in @buffer. The length might depend on the value
+ * of @offset.
+ *
+ * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
+ * return value leaves @buffer undefined.
+ */
+typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, GstObject *parent,
+ guint64 offset, guint length,
+ GstBuffer **buffer);
+
+/**
+ * GstPadEventFunction:
+ * @pad: the #GstPad to handle the event.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @event: (transfer full): the #GstEvent to handle.
+ *
+ * Function signature to handle an event for the pad.
+ *
+ * Returns: %TRUE if the pad could handle the event.
+ */
+typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstObject *parent,
+ GstEvent *event);
+
+/**
+ * GstPadEventFullFunction:
+ * @pad: the #GstPad to handle the event.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @event: (transfer full): the #GstEvent to handle.
+ *
+ * Function signature to handle an event for the pad.
+ *
+ * This variant is for specific elements that will take into account the
+ * last downstream flow return (from a pad push), in which case they can
+ * return it.
+ *
+ * Returns: %GST_FLOW_OK if the event was handled properly, or any other
+ * #GstFlowReturn dependent on downstream state.
+ *
+ * Since: 1.8
+ */
+typedef GstFlowReturn (*GstPadEventFullFunction) (GstPad *pad, GstObject *parent,
+ GstEvent *event);
+
+
+/* internal links */
+/**
+ * GstPadIterIntLinkFunction:
+ * @pad: The #GstPad to query.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ *
+ * The signature of the internal pad link iterator function.
+ *
+ * Returns: a new #GstIterator that will iterate over all pads that are
+ * linked to the given pad on the inside of the parent element.
+ *
+ * the caller must call gst_iterator_free() after usage.
+ */
+typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, GstObject *parent);
+
+/* generic query function */
+/**
+ * GstPadQueryFunction:
+ * @pad: the #GstPad to query.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @query: the #GstQuery object to execute
+ *
+ * The signature of the query function.
+ *
+ * Returns: %TRUE if the query could be performed.
+ */
+typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
+ GstQuery *query);
+
+
+/* linking */
+/**
+ * GstPadLinkFunction:
+ * @pad: the #GstPad that is linked.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ * @peer: the peer #GstPad of the link
+ *
+ * Function signature to handle a new link on the pad.
+ *
+ * Returns: the result of the link with the specified peer.
+ */
+typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent, GstPad *peer);
+/**
+ * GstPadUnlinkFunction:
+ * @pad: the #GstPad that is linked.
+ * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
+ * flag is set, @parent is guaranteed to be not-%NULL and remain valid
+ * during the execution of this function.
+ *
+ * Function signature to handle a unlinking the pad prom its peer.
+ *
+ * The pad's lock is already held when the unlink function is called, so most
+ * pad functions cannot be called from within the callback.
+ */
+typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
+
+
+/* misc */
+/**
+ * GstPadForwardFunction:
+ * @pad: the #GstPad that is forwarded.
+ * @user_data: the gpointer to optional user data.
+ *
+ * A forward function is called for all internally linked pads, see
+ * gst_pad_forward().
+ *
+ * Returns: %TRUE if the dispatching procedure has to be stopped.
+ */
+typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
+
+/**
+ * GstPadProbeType:
+ * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
+ * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block while the callback is called
+ * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
+ * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
+ * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
+ * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
+ * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
+ * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
+ * explicitly enabled and is not included in the
+ * @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
+ * @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
+ * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
+ * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
+ * @GST_PAD_PROBE_TYPE_PUSH: probe push
+ * @GST_PAD_PROBE_TYPE_PULL: probe pull
+ * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
+ * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
+ * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
+ * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
+ * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
+ * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
+ * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
+ * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
+ * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
+ * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
+ *
+ * The different probing types that can occur. When either one of
+ * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
+ * blocking probe.
+ */
+typedef enum
+{
+ GST_PAD_PROBE_TYPE_INVALID = 0,
+ /* flags to control blocking */
+ GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
+ GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
+ /* flags to select datatypes */
+ GST_PAD_PROBE_TYPE_BUFFER = (1 << 4),
+ GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 5),
+ GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
+ GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 7),
+ GST_PAD_PROBE_TYPE_EVENT_FLUSH = (1 << 8),
+ GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
+ GST_PAD_PROBE_TYPE_QUERY_UPSTREAM = (1 << 10),
+ /* flags to select scheduling mode */
+ GST_PAD_PROBE_TYPE_PUSH = (1 << 12),
+ GST_PAD_PROBE_TYPE_PULL = (1 << 13),
+
+ /* flag combinations */
+ GST_PAD_PROBE_TYPE_BLOCKING = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
+ GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+ GST_PAD_PROBE_TYPE_DATA_UPSTREAM = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
+ GST_PAD_PROBE_TYPE_DATA_BOTH = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
+ GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
+ GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
+ GST_PAD_PROBE_TYPE_EVENT_BOTH = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
+ GST_PAD_PROBE_TYPE_QUERY_BOTH = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
+ GST_PAD_PROBE_TYPE_ALL_BOTH = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
+ GST_PAD_PROBE_TYPE_SCHEDULING = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
+} GstPadProbeType;
+
+
+/**
+ * GstPadProbeReturn:
+ * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
+ * place, and defers decisions about dropping or passing data to other
+ * probes, if any. If there are no other probes, the default behaviour
+ * for the probe type applies ('block' for blocking probes,
+ * and 'pass' for non-blocking probes).
+ * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
+ * the data item is not sent downstream. For pull mode, it means that
+ * the data item is not passed upstream. In both cases, no other probes
+ * are called for this item and %GST_FLOW_OK or %TRUE is returned to the
+ * caller.
+ * @GST_PAD_PROBE_REMOVE: remove this probe, passing the data. For blocking probes
+ * this will cause data flow to unblock, unless there are also other
+ * blocking probes installed.
+ * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
+ * next item. Note, that if there are multiple pad probes installed and
+ * any probe returns PASS, the data will be passed.
+ * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
+ * forwarded further. For events and buffers this is the same behaviour as
+ * %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
+ * or event yourself). For queries it will also return %TRUE to the caller.
+ * The probe can also modify the #GstFlowReturn value by using the
+ * #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
+ * Note that the resulting query must contain valid entries.
+ * Since: 1.6
+ *
+ * Different return values for the #GstPadProbeCallback.
+ */
+typedef enum
+{
+ GST_PAD_PROBE_DROP,
+ GST_PAD_PROBE_OK,
+ GST_PAD_PROBE_REMOVE,
+ GST_PAD_PROBE_PASS,
+ GST_PAD_PROBE_HANDLED
+} GstPadProbeReturn;
+
+
+/**
+ * GstPadProbeInfo:
+ * @type: the current probe type
+ * @id: the id of the probe
+ * @data: (allow-none): type specific data, check the @type field to know the
+ * datatype. This field can be %NULL.
+ * @offset: offset of pull probe, this field is valid when @type contains
+ * #GST_PAD_PROBE_TYPE_PULL
+ * @size: size of pull probe, this field is valid when @type contains
+ * #GST_PAD_PROBE_TYPE_PULL
+ *
+ * Info passed in the #GstPadProbeCallback.
+ */
+struct _GstPadProbeInfo
+{
+ GstPadProbeType type;
+ gulong id;
+ gpointer data;
+ guint64 offset;
+ guint size;
+
+ /*< private >*/
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GstFlowReturn flow_ret;
+ } abi;
+ } ABI;
+};
+
+#define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type)
+#define GST_PAD_PROBE_INFO_ID(d) ((d)->id)
+#define GST_PAD_PROBE_INFO_DATA(d) ((d)->data)
+#define GST_PAD_PROBE_INFO_FLOW_RETURN(d) ((d)->ABI.abi.flow_ret)
+
+#define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
+#define GST_PAD_PROBE_INFO_BUFFER_LIST(d) GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
+#define GST_PAD_PROBE_INFO_EVENT(d) GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
+#define GST_PAD_PROBE_INFO_QUERY(d) GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
+
+#define GST_PAD_PROBE_INFO_OFFSET(d) ((d)->offset)
+#define GST_PAD_PROBE_INFO_SIZE(d) ((d)->size)
+
+GST_API
+GstEvent* gst_pad_probe_info_get_event (GstPadProbeInfo * info);
+
+GST_API
+GstQuery* gst_pad_probe_info_get_query (GstPadProbeInfo * info);
+
+GST_API
+GstBuffer* gst_pad_probe_info_get_buffer (GstPadProbeInfo * info);
+
+GST_API
+GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
+
+/**
+ * GstPadProbeCallback:
+ * @pad: the #GstPad that is blocked
+ * @info: #GstPadProbeInfo
+ * @user_data: the gpointer to optional user data.
+ *
+ * Callback used by gst_pad_add_probe(). Gets called to notify about the current
+ * blocking type.
+ *
+ * The callback is allowed to modify the data pointer in @info.
+ *
+ * Returns: a #GstPadProbeReturn
+ */
+typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,
+ gpointer user_data);
+
+/**
+ * GstPadStickyEventsForeachFunction:
+ * @pad: the #GstPad.
+ * @event: (allow-none): a sticky #GstEvent.
+ * @user_data: the #gpointer to optional user data.
+ *
+ * Callback used by gst_pad_sticky_events_foreach().
+ *
+ * When this function returns %TRUE, the next event will be
+ * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
+ *
+ * When @event is set to %NULL, the item will be removed from the list of sticky events.
+ * @event can be replaced by assigning a new reference to it.
+ * This function is responsible for unreffing the old event when
+ * removing or modifying.
+ *
+ * Returns: %TRUE if the iteration should continue
+ */
+typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
+ gpointer user_data);
+
+/**
+ * GstPadFlags:
+ * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
+ * @GST_PAD_FLAG_FLUSHING: is pad flushing
+ * @GST_PAD_FLAG_EOS: is pad in EOS state
+ * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
+ * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
+ * into the pad callbacks.
+ * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
+ * The flag has to be unset manually after
+ * reconfiguration happened.
+ * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
+ * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that
+ * once the caps are set on the pad, the default caps query function
+ * will only return those caps.
+ * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
+ * all events and queries to the internally linked pads
+ * instead of discarding them.
+ * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
+ * allocation queries to the internally linked pads
+ * instead of discarding them.
+ * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
+ * scheduling queries to the internally linked pads
+ * instead of discarding them.
+ * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
+ * it the caps intersect the query-caps result instead
+ * of checking for a subset. This is interesting for
+ * parsers that can accept incompletely specified caps.
+ * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
+ * the template pad caps instead of query caps to
+ * compare with the accept caps. Use this in combination
+ * with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since: 1.6)
+ * @GST_PAD_FLAG_LAST: offset to define more flags
+ *
+ * Pad state flags
+ */
+typedef enum {
+ GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
+ GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
+ GST_PAD_FLAG_EOS = (GST_OBJECT_FLAG_LAST << 2),
+ GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 3),
+ GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 4),
+ GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
+ GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 6),
+ GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7),
+ GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8),
+ GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
+ GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
+ GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
+ GST_PAD_FLAG_ACCEPT_TEMPLATE = (GST_OBJECT_FLAG_LAST << 12),
+ /* padding */
+ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
+} GstPadFlags;
+
+/**
+ * GstPad:
+ * @element_private: private data owned by the parent element
+ * @padtemplate: padtemplate for this pad
+ * @direction: the direction of the pad, cannot change after creating
+ * the pad.
+ *
+ * The #GstPad structure. Use the functions to update the variables.
+ */
+struct _GstPad {
+ GstObject object;
+
+ /*< public >*/
+ gpointer element_private;
+
+ GstPadTemplate *padtemplate;
+
+ GstPadDirection direction;
+
+ /*< private >*/
+ /* streaming rec_lock */
+ GRecMutex stream_rec_lock;
+ GstTask *task;
+
+ /* block cond, mutex is from the object */
+ GCond block_cond;
+ GHookList probes;
+
+ GstPadMode mode;
+ GstPadActivateFunction activatefunc;
+ gpointer activatedata;
+ GDestroyNotify activatenotify;
+ GstPadActivateModeFunction activatemodefunc;
+ gpointer activatemodedata;
+ GDestroyNotify activatemodenotify;
+
+ /* pad link */
+ GstPad *peer;
+ GstPadLinkFunction linkfunc;
+ gpointer linkdata;
+ GDestroyNotify linknotify;
+ GstPadUnlinkFunction unlinkfunc;
+ gpointer unlinkdata;
+ GDestroyNotify unlinknotify;
+
+ /* data transport functions */
+ GstPadChainFunction chainfunc;
+ gpointer chaindata;
+ GDestroyNotify chainnotify;
+ GstPadChainListFunction chainlistfunc;
+ gpointer chainlistdata;
+ GDestroyNotify chainlistnotify;
+ GstPadGetRangeFunction getrangefunc;
+ gpointer getrangedata;
+ GDestroyNotify getrangenotify;
+ GstPadEventFunction eventfunc;
+ gpointer eventdata;
+ GDestroyNotify eventnotify;
+
+ /* pad offset */
+ gint64 offset;
+
+ /* generic query method */
+ GstPadQueryFunction queryfunc;
+ gpointer querydata;
+ GDestroyNotify querynotify;
+
+ /* internal links */
+ GstPadIterIntLinkFunction iterintlinkfunc;
+ gpointer iterintlinkdata;
+ GDestroyNotify iterintlinknotify;
+
+ /* counts number of probes attached. */
+ gint num_probes;
+ gint num_blocked;
+
+ GstPadPrivate *priv;
+
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GstFlowReturn last_flowret;
+ GstPadEventFullFunction eventfullfunc;
+ } abi;
+ } ABI;
+};
+
+struct _GstPadClass {
+ GstObjectClass parent_class;
+
+ /* signal callbacks */
+ void (*linked) (GstPad *pad, GstPad *peer);
+ void (*unlinked) (GstPad *pad, GstPad *peer);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+
+/***** helper macros *****/
+/* GstPad */
+
+/**
+ * GST_PAD_NAME:
+ * @pad: a #GstPad
+ *
+ * Get name of the given pad.
+ * No locking is performed in this function, use gst_pad_get_name() instead.
+ */
+#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
+/**
+ * GST_PAD_PARENT:
+ * @pad: a #GstPad
+ *
+ * Get the @pad parent.
+ * No locking is performed in this function, use gst_pad_get_parent() instead.
+ */
+#define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
+/**
+ * GST_PAD_ELEMENT_PRIVATE:
+ * @pad: a #GstPad
+ *
+ * Get the private data of @pad, which is usually some pad- or stream-specific
+ * structure created by the element and set on the pad when creating it.
+ * No locking is performed in this function.
+ */
+#define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
+/**
+ * GST_PAD_PAD_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Get the @pad #GstPadTemplate. It describes the possible media types
+ * a @pad or an element factory can handle.
+ */
+#define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
+/**
+ * GST_PAD_DIRECTION:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadDirection of the given @pad. Accessor macro, use
+ * gst_pad_get_direction() instead.
+ */
+#define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
+/**
+ * GST_PAD_TASK:
+ * @pad: a #GstPad
+ *
+ * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the
+ * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task()
+ * functions instead.
+ */
+#define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
+/**
+ * GST_PAD_MODE:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad
+ * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or
+ * GST_PAD_MODE_PULL depending on which mode the pad was activated in.
+ */
+#define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
+/**
+ * GST_PAD_ACTIVATEFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadActivateFunction from @pad.
+ */
+#define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
+/**
+ * GST_PAD_ACTIVATEMODEFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadActivateModeFunction from the given @pad.
+ */
+#define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
+/**
+ * GST_PAD_CHAINFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadChainFunction from the given @pad.
+ */
+#define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
+/**
+ * GST_PAD_CHAINLISTFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadChainListFunction from the given @pad.
+ */
+#define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
+/**
+ * GST_PAD_GETRANGEFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadGetRangeFunction from the given @pad.
+ */
+#define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
+/**
+ * GST_PAD_EVENTFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadEventFunction from the given @pad, which
+ * is the function that handles events on the pad. You can
+ * use this to set your own event handling function on a pad
+ * after you create it. If your element derives from a base
+ * class, use the base class's virtual functions instead.
+ */
+#define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
+/**
+ * GST_PAD_EVENTFULLFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadEventFullFunction from the given @pad, which
+ * is the function that handles events on the pad. You can
+ * use this to set your own event handling function on a pad
+ * after you create it. If your element derives from a base
+ * class, use the base class's virtual functions instead.
+ *
+ * Since: 1.8
+ */
+#define GST_PAD_EVENTFULLFUNC(pad) (GST_PAD_CAST(pad)->ABI.abi.eventfullfunc)
+/**
+ * GST_PAD_QUERYFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadQueryFunction from @pad, which is the function
+ * that handles queries on the pad. You can use this to set your
+ * own query handling function on a pad after you create it. If your
+ * element derives from a base class, use the base class's virtual
+ * functions instead.
+ */
+#define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
+/**
+ * GST_PAD_ITERINTLINKFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadIterIntLinkFunction from the given @pad.
+ */
+#define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
+/**
+ * GST_PAD_PEER:
+ * @pad: a #GstPad
+ *
+ * Return the pad's peer member. This member is a pointer to the linked @pad.
+ * No locking is performed in this function, use gst_pad_get_peer() instead.
+ */
+#define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
+/**
+ * GST_PAD_LINKFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadLinkFunction for the given @pad.
+ */
+#define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
+/**
+ * GST_PAD_UNLINKFUNC:
+ * @pad: a #GstPad
+ *
+ * Get the #GstPadUnlinkFunction from the given @pad.
+ */
+#define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
+/**
+ * GST_PAD_IS_SRC:
+ * @pad: a #GstPad
+ *
+ * Returns: %TRUE if the pad is a source pad (i.e. produces data).
+ */
+#define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
+/**
+ * GST_PAD_IS_SINK:
+ * @pad: a #GstPad
+ *
+ * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
+ */
+#define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
+/**
+ * GST_PAD_IS_LINKED:
+ * @pad: a #GstPad
+ *
+ * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
+ * instead.
+ */
+#define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
+/**
+ * GST_PAD_IS_ACTIVE:
+ * @pad: a #GstPad
+ *
+ * Returns: %TRUE if the pad has been activated.
+ */
+#define GST_PAD_IS_ACTIVE(pad) (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
+/**
+ * GST_PAD_IS_BLOCKED:
+ * @pad: a #GstPad
+ *
+ * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
+ */
+#define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
+/**
+ * GST_PAD_IS_BLOCKING:
+ * @pad: a #GstPad
+ *
+ * Check if the @pad is currently blocking on a buffer or event. Use
+ * gst_pad_is_blocking() instead.
+ */
+#define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
+/**
+ * GST_PAD_IS_FLUSHING:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad is flushing.
+ */
+#define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
+/**
+ * GST_PAD_SET_FLUSHING:
+ * @pad: a #GstPad
+ *
+ * Set the given @pad to flushing state, which means it will not accept any
+ * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers
+ * are pushed on it. This usually happens when the pad is shut down or when
+ * a flushing seek happens. This is used inside GStreamer when flush start/stop
+ * events pass through pads, or when an element state is changed and pads are
+ * activated or deactivated.
+ */
+#define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
+/**
+ * GST_PAD_UNSET_FLUSHING:
+ * @pad: a #GstPad
+ *
+ * Unset the flushing flag.
+ */
+#define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
+/**
+ * GST_PAD_IS_EOS:
+ * @pad: a #GstPad
+ *
+ * Check if the @pad is in EOS state.
+ */
+#define GST_PAD_IS_EOS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
+/**
+ * GST_PAD_NEEDS_RECONFIGURE:
+ * @pad: a #GstPad
+ *
+ * Check if the @pad should be reconfigured/renegotiated.
+ * The flag has to be unset manually after reconfiguration happened.
+ * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead.
+ */
+#define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
+/**
+ * GST_PAD_HAS_PENDING_EVENTS:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad has pending events. This is used internally by
+ * GStreamer.
+ */
+#define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
+/**
+ * GST_PAD_IS_FIXED_CAPS:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad is using fixed caps, which means that
+ * once the caps are set on the @pad, the caps query function will
+ * only return those caps. See gst_pad_use_fixed_caps().
+ */
+#define GST_PAD_IS_FIXED_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
+/**
+ * GST_PAD_NEEDS_PARENT:
+ * @pad: a #GstPad
+ *
+ * Check if there is a parent object before calling into the @pad callbacks.
+ * This is used internally by GStreamer.
+ */
+#define GST_PAD_NEEDS_PARENT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
+/**
+ * GST_PAD_IS_PROXY_CAPS:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad is set to proxy caps. This means that the default
+ * event and query handler will forward all events and queries to the
+ * internally linked @pads instead of discarding them.
+ */
+#define GST_PAD_IS_PROXY_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
+/**
+ * GST_PAD_SET_PROXY_CAPS:
+ * @pad: a #GstPad
+ *
+ * Set @pad to proxy caps, so that all caps-related events and queries are
+ * proxied down- or upstream to the other side of the element automatically.
+ * Set this if the element always outputs data in the exact same format as it
+ * receives as input. This is just for convenience to avoid implementing some
+ * standard event and query handling code in an element.
+ */
+#define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
+/**
+ * GST_PAD_UNSET_PROXY_CAPS:
+ * @pad: a #GstPad
+ *
+ * Unset proxy caps flag.
+ */
+#define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
+/**
+ * GST_PAD_IS_PROXY_ALLOCATION:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad is set as proxy allocation which means
+ * that the default query handler will forward allocation queries to the
+ * internally linked @pads instead of discarding them.
+ */
+#define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+/**
+ * GST_PAD_SET_PROXY_ALLOCATION:
+ * @pad: a #GstPad
+ *
+ * Set @pad to proxy allocation queries, which means that the default query
+ * handler will forward allocation queries to the internally linked @pads
+ * instead of discarding them.
+ * Set this if the element always outputs data in the exact same format as it
+ * receives as input. This is just for convenience to avoid implementing some
+ * standard query handling code in an element.
+ */
+#define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+/**
+ * GST_PAD_UNSET_PROXY_ALLOCATION:
+ * @pad: a #GstPad
+ *
+ * Unset proxy allocation flag.
+ */
+#define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
+/**
+ * GST_PAD_IS_PROXY_SCHEDULING:
+ * @pad: a #GstPad
+ *
+ * Check if the given @pad is set to proxy scheduling queries, which means that
+ * the default query handler will forward scheduling queries to the internally
+ * linked @pads instead of discarding them.
+ */
+#define GST_PAD_IS_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
+/**
+ * GST_PAD_SET_PROXY_SCHEDULING:
+ * @pad: a #GstPad
+ *
+ * Set @pad to proxy scheduling queries, which means that the default query
+ * handler will forward scheduling queries to the internally linked @pads
+ * instead of discarding them. You will usually want to handle scheduling
+ * queries explicitly if your element supports multiple scheduling modes.
+ */
+#define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
+/**
+ * GST_PAD_UNSET_PROXY_SCHEDULING:
+ * @pad: a #GstPad
+ *
+ * Unset proxy scheduling flag.
+ */
+#define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
+/**
+ * GST_PAD_IS_ACCEPT_INTERSECT:
+ * @pad: a #GstPad
+ *
+ * Check if the pad's accept intersect flag is set. The default accept-caps
+ * handler will check if the caps intersect the query-caps result instead of
+ * checking for a subset. This is interesting for parser elements that can
+ * accept incompletely specified caps.
+ */
+#define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
+/**
+ * GST_PAD_SET_ACCEPT_INTERSECT:
+ * @pad: a #GstPad
+ *
+ * Set @pad to by default accept caps by intersecting the result instead of
+ * checking for a subset. This is interesting for parser elements that can
+ * accept incompletely specified caps.
+ */
+#define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
+/**
+ * GST_PAD_UNSET_ACCEPT_INTERSECT:
+ * @pad: a #GstPad
+ *
+ * Unset accept intersect flag.
+ */
+#define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
+/**
+ * GST_PAD_IS_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Check if the pad's accept caps operation will use the pad template caps.
+ * The default accept-caps will do a query caps to get the caps, which might
+ * be querying downstream causing unnecessary overhead. It is recommended to
+ * implement a proper accept-caps query handler or to use this flag to prevent
+ * recursive accept-caps handling.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_IS_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
+ * GST_PAD_SET_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Set @pad to by default use the pad template caps to compare with
+ * the accept caps instead of using a caps query result.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_SET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
+ * GST_PAD_UNSET_ACCEPT_TEMPLATE:
+ * @pad: a #GstPad
+ *
+ * Unset accept template flag.
+ *
+ * Since: 1.6
+ */
+#define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
+/**
+ * GST_PAD_GET_STREAM_LOCK:
+ * @pad: a #GstPad
+ *
+ * Get the stream lock of @pad. The stream lock is protecting the
+ * resources used in the data processing functions of @pad. Accessor
+ * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead
+ * to take/release the pad's stream lock.
+ */
+#define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
+/**
+ * GST_PAD_STREAM_LOCK:
+ * @pad: a #GstPad
+ *
+ * Take the pad's stream lock. The stream lock is recursive and will be taken
+ * when buffers or serialized downstream events are pushed on a pad.
+ */
+#define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
+/**
+ * GST_PAD_STREAM_TRYLOCK:
+ * @pad: a #GstPad
+ *
+ * Try to take the pad's stream lock, and return %TRUE if the lock could be
+ * taken, and otherwise %FALSE.
+ */
+#define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
+/**
+ * GST_PAD_STREAM_UNLOCK:
+ * @pad: a #GstPad
+ *
+ * Release the pad's stream lock.
+ */
+#define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
+/**
+ * GST_PAD_LAST_FLOW_RETURN:
+ * @pad: a #GstPad
+ *
+ * Gets the last flow return on this pad
+ *
+ * Since: 1.4
+ */
+#define GST_PAD_LAST_FLOW_RETURN(pad) (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
+
+#define GST_PAD_BLOCK_GET_COND(pad) (&GST_PAD_CAST(pad)->block_cond)
+#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
+#define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
+#define GST_PAD_BLOCK_BROADCAST(pad) (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
+
+GST_API
+GType gst_pad_get_type (void);
+
+/* creating pads */
+
+GST_API
+GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
+
+GST_API
+GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
+
+GST_API
+GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
+
+
+/**
+ * gst_pad_get_name:
+ * @pad: the pad to get the name from
+ *
+ * Get a copy of the name of the pad. g_free() after usage.
+ *
+ * MT safe.
+ */
+#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
+/**
+ * gst_pad_get_parent:
+ * @pad: the pad to get the parent of
+ *
+ * Get the parent of @pad. This function increases the refcount
+ * of the parent object so you should gst_object_unref() it after usage.
+ * Can return %NULL if the pad did not have a parent.
+ *
+ * MT safe.
+ *
+ * Returns: (nullable): the parent
+ */
+#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
+
+GST_API
+GstPadDirection gst_pad_get_direction (GstPad *pad);
+
+GST_API
+gboolean gst_pad_set_active (GstPad *pad, gboolean active);
+
+GST_API
+gboolean gst_pad_is_active (GstPad *pad);
+
+GST_API
+gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode,
+ gboolean active);
+GST_API
+gulong gst_pad_add_probe (GstPad *pad,
+ GstPadProbeType mask,
+ GstPadProbeCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy_data);
+GST_API
+void gst_pad_remove_probe (GstPad *pad, gulong id);
+
+GST_API
+gboolean gst_pad_is_blocked (GstPad *pad);
+
+GST_API
+gboolean gst_pad_is_blocking (GstPad *pad);
+
+GST_API
+void gst_pad_mark_reconfigure (GstPad *pad);
+
+GST_API
+gboolean gst_pad_needs_reconfigure (GstPad *pad);
+
+GST_API
+gboolean gst_pad_check_reconfigure (GstPad *pad);
+
+GST_API
+void gst_pad_set_element_private (GstPad *pad, gpointer priv);
+
+GST_API
+gpointer gst_pad_get_element_private (GstPad *pad);
+
+GST_API
+GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
+
+GST_API
+GstFlowReturn gst_pad_store_sticky_event (GstPad *pad, GstEvent *event);
+
+GST_API
+GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type,
+ guint idx);
+
+GST_API
+void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
+
+/* data passing setup functions */
+
+GST_API
+void gst_pad_set_activate_function_full (GstPad *pad,
+ GstPadActivateFunction activate,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_activatemode_function_full (GstPad *pad,
+ GstPadActivateModeFunction activatemode,
+ gpointer user_data,
+ GDestroyNotify notify);
+/* data passing functions */
+
+GST_API
+void gst_pad_set_chain_function_full (GstPad *pad,
+ GstPadChainFunction chain,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_chain_list_function_full (GstPad *pad,
+ GstPadChainListFunction chainlist,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_getrange_function_full (GstPad *pad,
+ GstPadGetRangeFunction get,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_event_function_full (GstPad *pad,
+ GstPadEventFunction event,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_event_full_function_full (GstPad *pad,
+ GstPadEventFullFunction event,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+#define gst_pad_set_activate_function(p,f) gst_pad_set_activate_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_activatemode_function(p,f) gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_chain_function(p,f) gst_pad_set_chain_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_chain_list_function(p,f) gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_getrange_function(p,f) gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_event_function(p,f) gst_pad_set_event_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_event_full_function(p,f) gst_pad_set_event_full_function_full((p),(f),NULL,NULL)
+
+/* pad links */
+
+GST_API
+void gst_pad_set_link_function_full (GstPad *pad,
+ GstPadLinkFunction link,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_pad_set_unlink_function_full (GstPad *pad,
+ GstPadUnlinkFunction unlink,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+#define gst_pad_set_link_function(p,f) gst_pad_set_link_function_full((p),(f),NULL,NULL)
+#define gst_pad_set_unlink_function(p,f) gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
+
+GST_API
+gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
+GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
+GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
+
+GST_API
+gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
+
+GST_API
+gboolean gst_pad_is_linked (GstPad *pad);
+
+GST_API
+GstPad* gst_pad_get_peer (GstPad *pad);
+
+GST_API
+GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
+
+/* capsnego function for linked/unlinked pads */
+
+GST_API
+GstCaps * gst_pad_get_current_caps (GstPad * pad);
+
+GST_API
+gboolean gst_pad_has_current_caps (GstPad * pad);
+
+/* capsnego for linked pads */
+
+GST_API
+GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
+
+/* pad offsets */
+
+GST_API
+gint64 gst_pad_get_offset (GstPad *pad);
+
+GST_API
+void gst_pad_set_offset (GstPad *pad, gint64 offset);
+
+/* data passing functions to peer */
+
+GST_API
+GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
+
+GST_API
+GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
+
+GST_API
+GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
+ GstBuffer **buffer);
+GST_API
+gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
+
+GST_API
+gboolean gst_pad_event_default (GstPad *pad, GstObject *parent,
+ GstEvent *event);
+GST_API
+GstFlowReturn gst_pad_get_last_flow_return (GstPad *pad);
+
+/* data passing functions on pad */
+
+GST_API
+GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
+
+GST_API
+GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
+
+GST_API
+GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
+ GstBuffer **buffer);
+GST_API
+gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
+
+/* pad tasks */
+
+GST_API
+gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
+ gpointer user_data, GDestroyNotify notify);
+GST_API
+gboolean gst_pad_pause_task (GstPad *pad);
+
+GST_API
+gboolean gst_pad_stop_task (GstPad *pad);
+
+GST_API
+GstTaskState gst_pad_get_task_state (GstPad *pad);
+
+/* internal links */
+
+GST_API
+void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
+ GstPadIterIntLinkFunction iterintlink,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_API
+GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
+
+GST_API
+GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
+
+#define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
+
+GST_API
+GstPad * gst_pad_get_single_internal_link (GstPad * pad);
+
+/* generic query function */
+
+GST_API
+gboolean gst_pad_query (GstPad *pad, GstQuery *query);
+
+GST_API
+gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
+
+GST_API
+void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
+ GstQuery *query);
+
+#define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
+
+/* misc helper functions */
+
+GST_API
+gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,
+ gpointer user_data);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PAD_H__ */
diff --git a/include/gst/gstpadtemplate.h b/include/gst/gstpadtemplate.h
new file mode 100644
index 0000000000..0736818e18
--- /dev/null
+++ b/include/gst/gstpadtemplate.h
@@ -0,0 +1,246 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstpadtemplate.h: Header for GstPadTemplate object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_PAD_TEMPLATE_H__
+#define __GST_PAD_TEMPLATE_H__
+
+#include <gst/gstconfig.h>
+
+typedef struct _GstPadTemplate GstPadTemplate;
+typedef struct _GstPadTemplateClass GstPadTemplateClass;
+typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
+
+#include <gst/gstobject.h>
+#include <gst/gstbuffer.h>
+#include <gst/gstcaps.h>
+#include <gst/gstevent.h>
+#include <gst/gstquery.h>
+#include <gst/gsttask.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ())
+
+#define GST_TYPE_PAD_TEMPLATE (gst_pad_template_get_type ())
+#define GST_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
+#define GST_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
+#define GST_IS_PAD_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
+#define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
+
+/**
+ * GstPadPresence:
+ * @GST_PAD_ALWAYS: the pad is always available
+ * @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
+ * @GST_PAD_REQUEST: the pad is only available on request with
+ * gst_element_request_pad().
+ *
+ * Indicates when this pad will become available.
+ */
+typedef enum {
+ GST_PAD_ALWAYS,
+ GST_PAD_SOMETIMES,
+ GST_PAD_REQUEST
+} GstPadPresence;
+
+/**
+ * GST_PAD_TEMPLATE_NAME_TEMPLATE:
+ * @templ: the template to query
+ *
+ * Get the nametemplate of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template)
+
+/**
+ * GST_PAD_TEMPLATE_DIRECTION:
+ * @templ: the template to query
+ *
+ * Get the #GstPadDirection of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
+
+/**
+ * GST_PAD_TEMPLATE_PRESENCE:
+ * @templ: the template to query
+ *
+ * Get the #GstPadPresence of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
+
+/**
+ * GST_PAD_TEMPLATE_CAPS:
+ * @templ: the template to query
+ *
+ * Get a handle to the padtemplate #GstCaps
+ */
+#define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
+
+/**
+ * GST_PAD_TEMPLATE_GTYPE:
+ * @templ: the template to query
+ *
+ * Get the #GType of the padtemplate
+ *
+ * Since: 1.14
+ */
+#define GST_PAD_TEMPLATE_GTYPE(templ) (((GstPadTemplate *)(templ))->ABI.abi.gtype)
+
+/**
+ * GstPadTemplateFlags:
+ * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
+ *
+ * Flags for the padtemplate
+ */
+typedef enum {
+ /* padding */
+ GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
+} GstPadTemplateFlags;
+
+/**
+ * GST_PAD_TEMPLATE_IS_FIXED:
+ * @templ: the template to query
+ *
+ * Check if the properties of the padtemplate are fixed
+ */
+#define GST_PAD_TEMPLATE_IS_FIXED(templ) (GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
+
+/**
+ * GstPadTemplate:
+ *
+ * The padtemplate object.
+ */
+struct _GstPadTemplate {
+ GstObject object;
+
+ gchar *name_template;
+ GstPadDirection direction;
+ GstPadPresence presence;
+ GstCaps *caps;
+
+ /*< private >*/
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GType gtype;
+ GstCaps *documentation_caps;
+ } abi;
+ } ABI;
+};
+
+struct _GstPadTemplateClass {
+ GstObjectClass parent_class;
+
+ /* signal callbacks */
+ void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstStaticPadTemplate:
+ * @name_template: the name of the template
+ * @direction: the direction of the template
+ * @presence: the presence of the template
+ * @static_caps: the caps of the template.
+ *
+ * Structure describing the #GstStaticPadTemplate.
+ */
+struct _GstStaticPadTemplate {
+ const gchar *name_template;
+ GstPadDirection direction;
+ GstPadPresence presence;
+ GstStaticCaps static_caps;
+};
+
+/**
+ * GST_STATIC_PAD_TEMPLATE:
+ * @padname: the name template of the pad
+ * @dir: the GstPadDirection of the pad
+ * @pres: the GstPadPresence of the pad
+ * @caps: the GstStaticCaps of the pad
+ *
+ * Convenience macro to fill the values of a #GstStaticPadTemplate
+ * structure.
+ * Example:
+ * |[<!-- language="C" -->
+ * static GstStaticPadTemplate my_src_template = \
+ * GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ * GST_STATIC_CAPS_ANY);
+ * ]|
+ */
+#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
+{ \
+ /* name_template */ padname, \
+ /* direction */ dir, \
+ /* presence */ pres, \
+ /* caps */ caps \
+}
+
+/* templates and factories */
+
+GST_API
+GType gst_pad_template_get_type (void);
+
+/**
+ * gst_static_pad_template_get_type: (attributes doc.skip=true)
+ */
+GST_API
+GType gst_static_pad_template_get_type (void);
+
+GST_API
+GstPadTemplate* gst_pad_template_new (const gchar *name_template,
+ GstPadDirection direction, GstPadPresence presence,
+ GstCaps *caps) G_GNUC_MALLOC;
+GST_API
+GstPadTemplate* gst_pad_template_new_with_gtype (const gchar *name_template,
+ GstPadDirection direction, GstPadPresence presence,
+ GstCaps *caps, GType pad_type) G_GNUC_MALLOC;
+GST_API
+GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
+
+GST_API
+GstPadTemplate * gst_pad_template_new_from_static_pad_template_with_gtype (
+ GstStaticPadTemplate * pad_template,
+ GType pad_type);
+
+GST_API
+GstCaps* gst_static_pad_template_get_caps (GstStaticPadTemplate *templ);
+
+GST_API
+GstCaps* gst_pad_template_get_caps (GstPadTemplate *templ);
+
+GST_API
+void gst_pad_template_set_documentation_caps (GstPadTemplate *templ, GstCaps *caps);
+
+GST_API
+GstCaps* gst_pad_template_get_documentation_caps (GstPadTemplate *templ);
+
+GST_API
+void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPadTemplate, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PAD_TEMPLATE_H__ */
+
diff --git a/include/gst/gstparamspecs.h b/include/gst/gstparamspecs.h
new file mode 100644
index 0000000000..ff35507c73
--- /dev/null
+++ b/include/gst/gstparamspecs.h
@@ -0,0 +1,190 @@
+/* GStreamer - GParamSpecs for some of our types
+ * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PARAMSPECS_H__
+#define __GST_PARAMSPECS_H__
+
+#include <gst/gstvalue.h>
+
+G_BEGIN_DECLS
+
+/* --- paramspec flags */
+
+/**
+ * GST_PARAM_CONTROLLABLE: (value 512)
+ *
+ * Use this flag on GObject properties to signal they can make sense to be.
+ * controlled over time. This hint is used by the GstController.
+ */
+#define GST_PARAM_CONTROLLABLE (1 << (G_PARAM_USER_SHIFT + 1))
+
+/**
+ * GST_PARAM_MUTABLE_READY: (value 1024)
+ *
+ * Use this flag on GObject properties of GstElements to indicate that
+ * they can be changed when the element is in the READY or lower state.
+ */
+#define GST_PARAM_MUTABLE_READY (1 << (G_PARAM_USER_SHIFT + 2))
+
+/**
+ * GST_PARAM_MUTABLE_PAUSED: (value 2048)
+ *
+ * Use this flag on GObject properties of GstElements to indicate that
+ * they can be changed when the element is in the PAUSED or lower state.
+ * This flag implies GST_PARAM_MUTABLE_READY.
+ */
+#define GST_PARAM_MUTABLE_PAUSED (1 << (G_PARAM_USER_SHIFT + 3))
+
+/**
+ * GST_PARAM_MUTABLE_PLAYING: (value 4096)
+ *
+ * Use this flag on GObject properties of GstElements to indicate that
+ * they can be changed when the element is in the PLAYING or lower state.
+ * This flag implies GST_PARAM_MUTABLE_PAUSED.
+ */
+#define GST_PARAM_MUTABLE_PLAYING (1 << (G_PARAM_USER_SHIFT + 4))
+
+/**
+ * GST_PARAM_DOC_SHOW_DEFAULT: (value 8192)
+ *
+ * Use this flag on GObject properties of GstObject to indicate that
+ * during `gst-inspect` and friends, the default value should be used
+ * as default instead of the current value.
+ *
+ * Since: 1.18
+ */
+#define GST_PARAM_DOC_SHOW_DEFAULT (1 << (G_PARAM_USER_SHIFT + 5))
+
+/**
+ * GST_PARAM_CONDITIONALLY_AVAILABLE: (value 16384)
+ *
+ * Use this flag on GObject properties of GstObject to indicate that
+ * they might not be available depending on environment such as OS, device, etc,
+ * so such properties will be installed conditionally only if the GstObject is
+ * able to support it.
+ *
+ * Since: 1.18
+ */
+#define GST_PARAM_CONDITIONALLY_AVAILABLE (1 << (G_PARAM_USER_SHIFT + 6))
+
+/**
+ * GST_PARAM_USER_SHIFT: (value 65536)
+ *
+ * Bits based on GST_PARAM_USER_SHIFT can be used by 3rd party applications.
+ */
+#define GST_PARAM_USER_SHIFT (1 << (G_PARAM_USER_SHIFT + 8))
+
+
+/* --- type macros --- */
+
+/**
+ * GstParamFraction:
+ *
+ * A fundamental type that describes a #GParamSpec for fractional
+ * properties
+ */
+
+#define GST_TYPE_PARAM_FRACTION (gst_param_spec_fraction_get_type ())
+#define GST_IS_PARAM_SPEC_FRACTION(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GST_TYPE_PARAM_FRACTION))
+#define GST_PARAM_SPEC_FRACTION(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GST_TYPE_PARAM_FRACTION, GstParamSpecFraction))
+
+/**
+ * GstParamArray:
+ *
+ * A fundamental type that describes a #GParamSpec for arrays of
+ * values
+ *
+ * Since: 1.12
+ */
+
+#define GST_TYPE_PARAM_ARRAY_LIST (gst_param_spec_array_get_type ())
+#define GST_IS_PARAM_SPEC_ARRAY_LIST(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GST_TYPE_PARAM_ARRAY_LIST))
+#define GST_PARAM_SPEC_ARRAY_LIST(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GST_TYPE_PARAM_ARRAY_LIST, GstParamSpecArray))
+
+
+/* --- get_type functions --- */
+
+GST_API
+GType gst_param_spec_fraction_get_type (void);
+
+GST_API
+GType gst_param_spec_array_get_type (void);
+
+
+/* --- typedefs & structures --- */
+
+typedef struct _GstParamSpecFraction GstParamSpecFraction;
+typedef struct _GstParamSpecArray GstParamSpecArray;
+
+/**
+ * GstParamSpecFraction:
+ * @parent_instance: super class
+ * @min_num: minimal numerator
+ * @min_den: minimal denominator
+ * @max_num: maximal numerator
+ * @max_den: maximal denominator
+ * @def_num: default numerator
+ * @def_den: default denominator
+ *
+ * A GParamSpec derived structure that contains the meta data for fractional
+ * properties.
+ */
+struct _GstParamSpecFraction {
+ GParamSpec parent_instance;
+
+ gint min_num, min_den;
+ gint max_num, max_den;
+ gint def_num, def_den;
+};
+
+/**
+ * GstParamSpecArray:
+ * @parent_instance: super class
+ * @element_spec: the #GParamSpec of the type of values in the array
+ *
+ * A GParamSpec derived structure for arrays of values.
+ */
+struct _GstParamSpecArray {
+ GParamSpec parent_instance;
+
+ GParamSpec * element_spec;
+};
+
+
+/* --- GParamSpec prototypes --- */
+
+GST_API
+GParamSpec * gst_param_spec_fraction (const gchar * name,
+ const gchar * nick,
+ const gchar * blurb,
+ gint min_num, gint min_denom,
+ gint max_num, gint max_denom,
+ gint default_num, gint default_denom,
+ GParamFlags flags) G_GNUC_MALLOC;
+GST_API
+GParamSpec * gst_param_spec_array (const gchar * name,
+ const gchar * nick,
+ const gchar * blurb,
+ GParamSpec * element_spec,
+ GParamFlags flags) G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* __GST_PARAMSPECS_H__ */
+
diff --git a/include/gst/gstparse.h b/include/gst/gstparse.h
new file mode 100644
index 0000000000..8dfe8e5d3a
--- /dev/null
+++ b/include/gst/gstparse.h
@@ -0,0 +1,138 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstparse.h: get a pipeline from a text pipeline description
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PARSE_H__
+#define __GST_PARSE_H__
+
+#include <gst/gstelement.h>
+
+G_BEGIN_DECLS
+
+GST_API
+GQuark gst_parse_error_quark (void);
+/**
+ * GST_PARSE_ERROR:
+ *
+ * Get access to the error quark of the parse subsystem.
+ */
+#define GST_PARSE_ERROR gst_parse_error_quark ()
+
+/* FIXME 2.0: rename to GstParseLaunchError, this is not only related to
+ *parsing */
+/**
+ * GstParseError:
+ * @GST_PARSE_ERROR_SYNTAX: A syntax error occurred.
+ * @GST_PARSE_ERROR_NO_SUCH_ELEMENT: The description contained an unknown element
+ * @GST_PARSE_ERROR_NO_SUCH_PROPERTY: An element did not have a specified property
+ * @GST_PARSE_ERROR_LINK: There was an error linking two pads.
+ * @GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY: There was an error setting a property
+ * @GST_PARSE_ERROR_EMPTY_BIN: An empty bin was specified.
+ * @GST_PARSE_ERROR_EMPTY: An empty description was specified
+ * @GST_PARSE_ERROR_DELAYED_LINK: A delayed link did not get resolved.
+ *
+ * The different parsing errors that can occur.
+ */
+typedef enum
+{
+ GST_PARSE_ERROR_SYNTAX,
+ GST_PARSE_ERROR_NO_SUCH_ELEMENT,
+ GST_PARSE_ERROR_NO_SUCH_PROPERTY,
+ GST_PARSE_ERROR_LINK,
+ GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
+ GST_PARSE_ERROR_EMPTY_BIN,
+ GST_PARSE_ERROR_EMPTY,
+ GST_PARSE_ERROR_DELAYED_LINK
+} GstParseError;
+
+/**
+ * GstParseFlags:
+ * @GST_PARSE_FLAG_NONE: Do not use any special parsing options.
+ * @GST_PARSE_FLAG_FATAL_ERRORS: Always return %NULL when an error occurs
+ * (default behaviour is to return partially constructed bins or elements
+ * in some cases)
+ * @GST_PARSE_FLAG_NO_SINGLE_ELEMENT_BINS: If a bin only has a single element,
+ * just return the element.
+ * @GST_PARSE_FLAG_PLACE_IN_BIN: If more than one toplevel element is described
+ * by the pipeline description string, put them in a #GstBin instead of a
+ * #GstPipeline. (Since: 1.10)
+ *
+ * Parsing options.
+ */
+typedef enum
+{
+ GST_PARSE_FLAG_NONE = 0,
+ GST_PARSE_FLAG_FATAL_ERRORS = (1 << 0),
+ GST_PARSE_FLAG_NO_SINGLE_ELEMENT_BINS = (1 << 1),
+ GST_PARSE_FLAG_PLACE_IN_BIN = (1 << 2)
+} GstParseFlags;
+
+#define GST_TYPE_PARSE_CONTEXT (gst_parse_context_get_type())
+
+/**
+ * GstParseContext:
+ *
+ * Opaque structure.
+ */
+typedef struct _GstParseContext GstParseContext;
+
+/* create, process and free a parse context */
+
+GST_API
+GType gst_parse_context_get_type (void);
+
+GST_API
+GstParseContext * gst_parse_context_new (void) G_GNUC_MALLOC;
+
+GST_API
+gchar ** gst_parse_context_get_missing_elements (GstParseContext * context) G_GNUC_MALLOC;
+
+GST_API
+void gst_parse_context_free (GstParseContext * context);
+
+GST_API
+GstParseContext * gst_parse_context_copy (const GstParseContext * context);
+
+
+/* parse functions */
+
+GST_API
+GstElement * gst_parse_launch (const gchar * pipeline_description,
+ GError ** error) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_parse_launchv (const gchar ** argv,
+ GError ** error) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_parse_launch_full (const gchar * pipeline_description,
+ GstParseContext * context,
+ GstParseFlags flags,
+ GError ** error) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_parse_launchv_full (const gchar ** argv,
+ GstParseContext * context,
+ GstParseFlags flags,
+ GError ** error) G_GNUC_MALLOC;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstParseContext, gst_parse_context_free)
+
+G_END_DECLS
+
+#endif /* __GST_PARSE_H__ */
diff --git a/include/gst/gstpipeline.h b/include/gst/gstpipeline.h
new file mode 100644
index 0000000000..6406fb86d3
--- /dev/null
+++ b/include/gst/gstpipeline.h
@@ -0,0 +1,138 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstpipeline.h: Header for GstPipeline element
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_PIPELINE_H__
+#define __GST_PIPELINE_H__
+
+#include <gst/gstbin.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PIPELINE (gst_pipeline_get_type ())
+#define GST_PIPELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PIPELINE, GstPipeline))
+#define GST_IS_PIPELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PIPELINE))
+#define GST_PIPELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PIPELINE, GstPipelineClass))
+#define GST_IS_PIPELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PIPELINE))
+#define GST_PIPELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PIPELINE, GstPipelineClass))
+#define GST_PIPELINE_CAST(obj) ((GstPipeline*)(obj))
+
+typedef struct _GstPipeline GstPipeline;
+typedef struct _GstPipelineClass GstPipelineClass;
+typedef struct _GstPipelinePrivate GstPipelinePrivate;
+
+/**
+ * GstPipelineFlags:
+ * @GST_PIPELINE_FLAG_FIXED_CLOCK: this pipeline works with a fixed clock
+ * @GST_PIPELINE_FLAG_LAST: offset to define more flags
+ *
+ * Pipeline flags
+ */
+typedef enum {
+ GST_PIPELINE_FLAG_FIXED_CLOCK = (GST_BIN_FLAG_LAST << 0),
+ /* padding */
+ GST_PIPELINE_FLAG_LAST = (GST_BIN_FLAG_LAST << 4)
+} GstPipelineFlags;
+
+/**
+ * GstPipeline:
+ * @fixed_clock: The fixed clock of the pipeline, used when
+ * GST_PIPELINE_FLAG_FIXED_CLOCK is set.
+ * @stream_time: The stream time of the pipeline. A better name for this
+ * property would be the running_time, the total time spent in the
+ * PLAYING state without being flushed. (deprecated, use the start_time
+ * on GstElement).
+ * @delay: Extra delay added to base_time to compensate for computing delays
+ * when setting elements to PLAYING.
+ *
+ * The #GstPipeline structure.
+ */
+struct _GstPipeline {
+ GstBin bin;
+
+ /*< public >*/ /* with LOCK */
+ GstClock *fixed_clock;
+
+ GstClockTime stream_time;
+ GstClockTime delay;
+
+ /*< private >*/
+ GstPipelinePrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstPipelineClass {
+ GstBinClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_pipeline_get_type (void);
+
+GST_API
+GstElement* gst_pipeline_new (const gchar *name) G_GNUC_MALLOC;
+
+GST_API
+GstBus* gst_pipeline_get_bus (GstPipeline *pipeline);
+
+GST_API
+void gst_pipeline_use_clock (GstPipeline *pipeline, GstClock *clock);
+
+GST_API
+gboolean gst_pipeline_set_clock (GstPipeline *pipeline, GstClock *clock);
+
+GST_API
+GstClock* gst_pipeline_get_clock (GstPipeline *pipeline);
+
+GST_API
+GstClock* gst_pipeline_get_pipeline_clock (GstPipeline *pipeline);
+
+GST_API
+void gst_pipeline_auto_clock (GstPipeline *pipeline);
+
+GST_API
+void gst_pipeline_set_delay (GstPipeline *pipeline, GstClockTime delay);
+
+GST_API
+GstClockTime gst_pipeline_get_delay (GstPipeline *pipeline);
+
+GST_API
+void gst_pipeline_set_latency (GstPipeline *pipeline, GstClockTime latency);
+
+GST_API
+GstClockTime gst_pipeline_get_latency (GstPipeline *pipeline);
+
+GST_API
+void gst_pipeline_set_auto_flush_bus (GstPipeline *pipeline, gboolean auto_flush);
+
+GST_API
+gboolean gst_pipeline_get_auto_flush_bus (GstPipeline *pipeline);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPipeline, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PIPELINE_H__ */
+
diff --git a/include/gst/gstplugin.h b/include/gst/gstplugin.h
new file mode 100644
index 0000000000..7bb33568de
--- /dev/null
+++ b/include/gst/gstplugin.h
@@ -0,0 +1,402 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstplugin.h: Header for plugin subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_PLUGIN_H__
+#define __GST_PLUGIN_H__
+
+#include <gst/gstconfig.h>
+
+#include <gst/gstobject.h>
+#include <gst/gstmacros.h>
+#include <gst/gststructure.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPlugin:
+ *
+ * The opaque plugin object
+ */
+typedef struct _GstPlugin GstPlugin;
+typedef struct _GstPluginClass GstPluginClass;
+typedef struct _GstPluginDesc GstPluginDesc;
+
+/**
+ * gst_plugin_error_quark:
+ *
+ * Get the error quark.
+ *
+ * Returns: The error quark used in GError messages
+ */
+
+GST_API
+GQuark gst_plugin_error_quark (void);
+/**
+ * GST_PLUGIN_ERROR:
+ *
+ * The error message category quark
+ */
+#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
+
+/**
+ * GstPluginError:
+ * @GST_PLUGIN_ERROR_MODULE: The plugin could not be loaded
+ * @GST_PLUGIN_ERROR_DEPENDENCIES: The plugin has unresolved dependencies
+ * @GST_PLUGIN_ERROR_NAME_MISMATCH: The plugin has already be loaded from a different file
+ *
+ * The plugin loading errors
+ */
+typedef enum
+{
+ GST_PLUGIN_ERROR_MODULE,
+ GST_PLUGIN_ERROR_DEPENDENCIES,
+ GST_PLUGIN_ERROR_NAME_MISMATCH
+} GstPluginError;
+
+/**
+ * GstPluginFlags:
+ * @GST_PLUGIN_FLAG_CACHED: Temporarily loaded plugins
+ * @GST_PLUGIN_FLAG_BLACKLISTED: The plugin won't be scanned (again)
+ *
+ * The plugin loading state
+ */
+typedef enum
+{
+ GST_PLUGIN_FLAG_CACHED = (GST_OBJECT_FLAG_LAST << 0),
+ GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1)
+} GstPluginFlags;
+
+/**
+ * GstPluginDependencyFlags:
+ * @GST_PLUGIN_DEPENDENCY_FLAG_NONE : no special flags
+ * @GST_PLUGIN_DEPENDENCY_FLAG_RECURSE : recurse into subdirectories
+ * @GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY : use paths
+ * argument only if none of the environment variables is set
+ * @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX : interpret
+ * filename argument as filter suffix and check all matching files in
+ * the directory
+ * @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX : interpret
+ * filename argument as filter prefix and check all matching files in
+ * the directory. Since: 1.8.
+ * @GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE : interpret
+ * non-absolute paths as relative to the main executable directory. Since
+ * 1.14.
+ *
+ * Flags used in connection with gst_plugin_add_dependency().
+ */
+typedef enum {
+ GST_PLUGIN_DEPENDENCY_FLAG_NONE = 0,
+ GST_PLUGIN_DEPENDENCY_FLAG_RECURSE = (1 << 0),
+ GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY = (1 << 1),
+ GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2),
+ GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX = (1 << 3),
+ GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE = (1 << 4)
+} GstPluginDependencyFlags;
+
+/**
+ * GstPluginInitFunc:
+ * @plugin: The plugin object
+ *
+ * A plugin should provide a pointer to a function of this type in the
+ * plugin_desc struct.
+ * This function will be called by the loader at startup. One would then
+ * register each #GstPluginFeature.
+ *
+ * Returns: %TRUE if plugin initialised successfully
+ */
+/* FIXME 0.11: Make return void */
+typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
+
+/**
+ * GstPluginInitFullFunc:
+ * @plugin: The plugin object
+ * @user_data: extra data
+ *
+ * A plugin should provide a pointer to a function of either #GstPluginInitFunc
+ * or this type in the plugin_desc struct.
+ * The function will be called by the loader at startup. One would then
+ * register each #GstPluginFeature. This version allows
+ * user data to be passed to init function (useful for bindings).
+ *
+ * Returns: %TRUE if plugin initialised successfully
+ */
+/* FIXME 0.11: Merge with GstPluginInitFunc */
+typedef gboolean (*GstPluginInitFullFunc) (GstPlugin *plugin, gpointer user_data);
+
+/**
+ * GstPluginDesc:
+ * @major_version: the major version number of core that plugin was compiled for
+ * @minor_version: the minor version number of core that plugin was compiled for
+ * @name: a unique name of the plugin
+ * @description: description of plugin
+ * @plugin_init: pointer to the init function of this plugin.
+ * @version: version of the plugin
+ * @license: effective license of plugin
+ * @source: source module plugin belongs to
+ * @package: shipped package plugin belongs to
+ * @origin: URL to provider of plugin
+ * @release_datetime: (allow-none): date time string in ISO 8601
+ * format (or rather, a subset thereof), or %NULL. Allowed are the
+ * following formats: "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with
+ * 'T' a separator and 'Z' indicating UTC/Zulu time). This field
+ * should be set via the GST_PACKAGE_RELEASE_DATETIME
+ * preprocessor macro.
+ *
+ * A plugin should export a variable of this type called plugin_desc. The plugin
+ * loader will use the data provided there to initialize the plugin.
+ *
+ * The @licence parameter must be one of: LGPL, GPL, QPL, GPL/QPL, MPL,
+ * BSD, MIT/X11, Proprietary, unknown.
+ */
+struct _GstPluginDesc {
+ gint major_version;
+ gint minor_version;
+ const gchar *name;
+ const gchar *description;
+ GstPluginInitFunc plugin_init;
+ const gchar *version;
+ const gchar *license;
+ const gchar *source;
+ const gchar *package;
+ const gchar *origin;
+ const gchar *release_datetime;
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+
+#define GST_TYPE_PLUGIN (gst_plugin_get_type())
+#define GST_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN))
+#define GST_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN))
+#define GST_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN, GstPluginClass))
+#define GST_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN, GstPlugin))
+#define GST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN, GstPluginClass))
+#define GST_PLUGIN_CAST(obj) ((GstPlugin*)(obj))
+
+#ifdef GST_PACKAGE_RELEASE_DATETIME
+#define __GST_PACKAGE_RELEASE_DATETIME GST_PACKAGE_RELEASE_DATETIME
+#else
+#define __GST_PACKAGE_RELEASE_DATETIME NULL
+#endif
+
+/**
+ * GST_PLUGIN_STATIC_DECLARE:
+ * @name: short, but unique name of the plugin
+ *
+ * This macro can be used to initialize statically linked plugins. It is
+ * necessary to call this macro before the plugin can be used.
+ * It has to be used in combination with GST_PLUGIN_STATIC_REGISTER
+ * and must be placed outside any block to declare the plugin initialization
+ * function.
+ *
+ * Since: 1.2
+ */
+#define GST_PLUGIN_STATIC_DECLARE(name) \
+ extern void G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void)
+
+/**
+ * GST_PLUGIN_STATIC_REGISTER:
+ * @name: short, but unique name of the plugin
+ *
+ * This macro can be used to initialize statically linked plugins. It is
+ * necessary to call this macro before the plugin can be used.
+ * It has to be used in combination with GST_PLUGIN_STATIC_DECLARE and
+ * calls the plugin initialization function.
+ *
+ * Since: 1.2
+ */
+#define GST_PLUGIN_STATIC_REGISTER(name) G_PASTE(gst_plugin_, G_PASTE(name, _register)) ()
+
+/**
+ * GST_PLUGIN_DEFINE:
+ * @major: major version number of the gstreamer-core that plugin was compiled for
+ * @minor: minor version number of the gstreamer-core that plugin was compiled for
+ * @name: short, but unique name of the plugin
+ * @description: information about the purpose of the plugin
+ * @init: function pointer to the plugin_init method with the signature of <code>static gboolean plugin_init (GstPlugin * plugin)</code>.
+ * @version: full version string (e.g. VERSION from config.h)
+ * @license: under which licence the package has been released, e.g. GPL, LGPL.
+ * @package: the package-name (e.g. PACKAGE_NAME from config.h)
+ * @origin: a description from where the package comes from (e.g. the homepage URL)
+ *
+ * This macro needs to be used to define the entry point and meta data of a
+ * plugin. One would use this macro to export a plugin, so that it can be used
+ * by other applications.
+ *
+ * The macro uses a define named PACKAGE for the #GstPluginDesc,source field.
+ * When using autoconf, this is usually set automatically via the AC_INIT
+ * macro, and set in config.h. If you are not using autoconf, you will need to
+ * define PACKAGE yourself and set it to a short mnemonic string identifying
+ * your application/package, e.g. 'someapp' or 'my-plugins-foo.
+ *
+ * If defined, the GST_PACKAGE_RELEASE_DATETIME will also be used for the
+ * #GstPluginDesc,release_datetime field.
+ */
+#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
+G_BEGIN_DECLS \
+GST_PLUGIN_EXPORT const GstPluginDesc * G_PASTE(gst_plugin_, G_PASTE(name, _get_desc)) (void); \
+GST_PLUGIN_EXPORT void G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void); \
+\
+static const GstPluginDesc gst_plugin_desc = { \
+ major, \
+ minor, \
+ G_STRINGIFY(name), \
+ (gchar *) description, \
+ init, \
+ version, \
+ license, \
+ PACKAGE, \
+ package, \
+ origin, \
+ __GST_PACKAGE_RELEASE_DATETIME, \
+ GST_PADDING_INIT \
+}; \
+\
+const GstPluginDesc * \
+G_PASTE(gst_plugin_, G_PASTE(name, _get_desc)) (void) \
+{ \
+ return &gst_plugin_desc; \
+} \
+\
+void \
+G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void) \
+{ \
+ gst_plugin_register_static (major, minor, G_STRINGIFY(name), \
+ description, init, version, license, \
+ PACKAGE, package, origin); \
+} \
+G_END_DECLS
+
+/**
+ * GST_LICENSE_UNKNOWN:
+ *
+ * To be used in GST_PLUGIN_DEFINE if unsure about the licence.
+ */
+#define GST_LICENSE_UNKNOWN "unknown"
+
+
+/* function for filters */
+/**
+ * GstPluginFilter:
+ * @plugin: the plugin to check
+ * @user_data: the user_data that has been passed on e.g. gst_registry_plugin_filter()
+ *
+ * A function that can be used with e.g. gst_registry_plugin_filter()
+ * to get a list of plugins that match certain criteria.
+ *
+ * Returns: %TRUE for a positive match, %FALSE otherwise
+ */
+typedef gboolean (*GstPluginFilter) (GstPlugin *plugin,
+ gpointer user_data);
+
+GST_API
+GType gst_plugin_get_type (void);
+
+GST_API
+gboolean gst_plugin_register_static (gint major_version,
+ gint minor_version,
+ const gchar *name,
+ const gchar *description,
+ GstPluginInitFunc init_func,
+ const gchar *version,
+ const gchar *license,
+ const gchar *source,
+ const gchar *package,
+ const gchar *origin);
+GST_API
+gboolean gst_plugin_register_static_full (gint major_version,
+ gint minor_version,
+ const gchar *name,
+ const gchar *description,
+ GstPluginInitFullFunc init_full_func,
+ const gchar *version,
+ const gchar *license,
+ const gchar *source,
+ const gchar *package,
+ const gchar *origin,
+ gpointer user_data);
+GST_API
+const gchar* gst_plugin_get_name (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_description (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_filename (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_version (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_license (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_source (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_package (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_origin (GstPlugin *plugin);
+
+GST_API
+const gchar* gst_plugin_get_release_date_string (GstPlugin *plugin);
+
+GST_API
+const GstStructure* gst_plugin_get_cache_data (GstPlugin * plugin);
+
+GST_API
+void gst_plugin_set_cache_data (GstPlugin * plugin, GstStructure *cache_data);
+
+GST_API
+gboolean gst_plugin_is_loaded (GstPlugin *plugin);
+
+GST_API
+GstPlugin * gst_plugin_load_file (const gchar *filename, GError** error);
+
+GST_API
+GstPlugin * gst_plugin_load (GstPlugin *plugin);
+
+GST_API
+GstPlugin * gst_plugin_load_by_name (const gchar *name);
+
+GST_API
+void gst_plugin_add_dependency (GstPlugin * plugin,
+ const gchar ** env_vars,
+ const gchar ** paths,
+ const gchar ** names,
+ GstPluginDependencyFlags flags);
+GST_API
+void gst_plugin_add_dependency_simple (GstPlugin * plugin,
+ const gchar * env_vars,
+ const gchar * paths,
+ const gchar * names,
+ GstPluginDependencyFlags flags);
+GST_API
+void gst_plugin_list_free (GList *list);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlugin, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PLUGIN_H__ */
diff --git a/include/gst/gstpluginfeature.h b/include/gst/gstpluginfeature.h
new file mode 100644
index 0000000000..87f3707ea0
--- /dev/null
+++ b/include/gst/gstpluginfeature.h
@@ -0,0 +1,164 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstpluginfeature.h: Header for base GstPluginFeature
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_PLUGIN_FEATURE_H__
+#define __GST_PLUGIN_FEATURE_H__
+
+#include <glib-object.h>
+#include <gst/gstobject.h>
+#include <gst/gstplugin.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PLUGIN_FEATURE (gst_plugin_feature_get_type())
+#define GST_PLUGIN_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeature))
+#define GST_IS_PLUGIN_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN_FEATURE))
+#define GST_PLUGIN_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
+#define GST_IS_PLUGIN_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN_FEATURE))
+#define GST_PLUGIN_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
+#define GST_PLUGIN_FEATURE_CAST(obj) ((GstPluginFeature*)(obj))
+
+/**
+ * GstPluginFeature:
+ *
+ * Opaque #GstPluginFeature structure.
+ */
+typedef struct _GstPluginFeature GstPluginFeature;
+typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
+
+/**
+ * GstRank:
+ * @GST_RANK_NONE: will be chosen last or not at all
+ * @GST_RANK_MARGINAL: unlikely to be chosen
+ * @GST_RANK_SECONDARY: likely to be chosen
+ * @GST_RANK_PRIMARY: will be chosen first
+ *
+ * Element priority ranks. Defines the order in which the autoplugger (or
+ * similar rank-picking mechanisms, such as e.g. gst_element_make_from_uri())
+ * will choose this element over an alternative one with the same function.
+ *
+ * These constants serve as a rough guidance for defining the rank of a
+ * #GstPluginFeature. Any value is valid, including values bigger than
+ * @GST_RANK_PRIMARY.
+ */
+typedef enum {
+ GST_RANK_NONE = 0,
+ GST_RANK_MARGINAL = 64,
+ GST_RANK_SECONDARY = 128,
+ GST_RANK_PRIMARY = 256
+} GstRank;
+
+/**
+ * gst_plugin_feature_get_name:
+ * @feature: a #GstPluginFeature to get the name of @feature.
+ *
+ * Returns the name of @feature.
+ * For a nameless plugin feature, this returns %NULL.
+ *
+ * Returns: (transfer none) (nullable): the name of @feature. MT safe.
+ *
+ */
+#define gst_plugin_feature_get_name(feature) GST_OBJECT_NAME(feature)
+
+/**
+ * gst_plugin_feature_set_name:
+ * @feature: a #GstPluginFeature to set the name of.
+ * @name: the new name
+ *
+ * Sets the name of the plugin feature, getting rid of the old name if there was one.
+ */
+#define gst_plugin_feature_set_name(feature,name) gst_object_set_name(GST_OBJECT_CAST(feature),name)
+
+/**
+ * GstPluginFeatureFilter:
+ * @feature: the pluginfeature to check
+ * @user_data: the user_data that has been passed on e.g.
+ * gst_registry_feature_filter()
+ *
+ * A function that can be used with e.g. gst_registry_feature_filter()
+ * to get a list of pluginfeature that match certain criteria.
+ *
+ * Returns: %TRUE for a positive match, %FALSE otherwise
+ */
+typedef gboolean (*GstPluginFeatureFilter) (GstPluginFeature *feature,
+ gpointer user_data);
+
+/* normal GObject stuff */
+
+GST_API
+GType gst_plugin_feature_get_type (void);
+
+GST_API
+GstPluginFeature *
+ gst_plugin_feature_load (GstPluginFeature *feature);
+
+GST_API
+void gst_plugin_feature_set_rank (GstPluginFeature *feature, guint rank);
+
+GST_API
+guint gst_plugin_feature_get_rank (GstPluginFeature *feature);
+
+GST_API
+GstPlugin * gst_plugin_feature_get_plugin (GstPluginFeature *feature);
+
+GST_API
+const gchar * gst_plugin_feature_get_plugin_name (GstPluginFeature *feature);
+
+GST_API
+void gst_plugin_feature_list_free (GList *list);
+
+GST_API
+GList *gst_plugin_feature_list_copy (GList *list) G_GNUC_MALLOC;
+
+GST_API
+void gst_plugin_feature_list_debug (GList *list);
+
+/**
+ * GST_PLUGIN_FEATURE_LIST_DEBUG:
+ * @list: (transfer none) (element-type Gst.PluginFeature): a #GList of
+ * plugin features
+ *
+ * Debug the plugin feature names in @list.
+ */
+#ifndef GST_DISABLE_GST_DEBUG
+#define GST_PLUGIN_FEATURE_LIST_DEBUG(list) gst_plugin_feature_list_debug(list)
+#else
+#define GST_PLUGIN_FEATURE_LIST_DEBUG(list)
+#endif
+
+GST_API
+gboolean gst_plugin_feature_check_version (GstPluginFeature *feature,
+ guint min_major,
+ guint min_minor,
+ guint min_micro);
+GST_API
+gint gst_plugin_feature_rank_compare_func (gconstpointer p1,
+ gconstpointer p2);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPluginFeature, gst_object_unref)
+
+G_END_DECLS
+
+
+#endif /* __GST_PLUGIN_FEATURE_H__ */
+
diff --git a/include/gst/gstpoll.h b/include/gst/gstpoll.h
new file mode 100644
index 0000000000..660f9340e5
--- /dev/null
+++ b/include/gst/gstpoll.h
@@ -0,0 +1,132 @@
+/* GStreamer
+ * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2004 Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) 2007 Peter Kjellerstedt <pkj@axis.com>
+ *
+ * gstpoll.h: File descriptor set
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_POLL_H__
+#define __GST_POLL_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gst/gstclock.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPoll:
+ *
+ * A set of file/network descriptors.
+ */
+typedef struct _GstPoll GstPoll;
+
+/**
+ * GstPollFD:
+ * @fd: a file descriptor
+ *
+ * A file descriptor object.
+ */
+typedef struct {
+ int fd;
+
+ /*< private >*/
+ gint idx;
+} GstPollFD;
+
+/**
+ * GST_POLL_FD_INIT:
+ *
+ * A #GstPollFD must be initialized with this macro, before it can be
+ * used. This macro can used be to initialize a variable, but it cannot
+ * be assigned to a variable. In that case you have to use
+ * gst_poll_fd_init().
+ */
+#define GST_POLL_FD_INIT { -1, -1 }
+
+GST_API
+GstPoll* gst_poll_new (gboolean controllable) G_GNUC_MALLOC;
+
+GST_API
+GstPoll* gst_poll_new_timer (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_poll_free (GstPoll *set);
+
+GST_API
+void gst_poll_get_read_gpollfd (GstPoll *set, GPollFD *fd);
+
+GST_API
+void gst_poll_fd_init (GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_add_fd (GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_remove_fd (GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_ctl_write (GstPoll *set, GstPollFD *fd, gboolean active);
+
+GST_API
+gboolean gst_poll_fd_ctl_read (GstPoll *set, GstPollFD *fd, gboolean active);
+
+GST_API
+gboolean gst_poll_fd_ctl_pri (GstPoll *set, GstPollFD *fd, gboolean active);
+
+GST_API
+void gst_poll_fd_ignored (GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_has_closed (const GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_has_error (const GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_can_read (const GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_can_write (const GstPoll *set, GstPollFD *fd);
+
+GST_API
+gboolean gst_poll_fd_has_pri (const GstPoll *set, GstPollFD *fd);
+
+GST_API
+gint gst_poll_wait (GstPoll *set, GstClockTime timeout);
+
+GST_API
+gboolean gst_poll_set_controllable (GstPoll *set, gboolean controllable);
+
+GST_API
+void gst_poll_restart (GstPoll *set);
+
+GST_API
+void gst_poll_set_flushing (GstPoll *set, gboolean flushing);
+
+GST_API
+gboolean gst_poll_write_control (GstPoll *set);
+
+GST_API
+gboolean gst_poll_read_control (GstPoll *set) G_GNUC_WARN_UNUSED_RESULT;
+
+G_END_DECLS
+
+#endif /* __GST_POLL_H__ */
diff --git a/include/gst/gstpreset.h b/include/gst/gstpreset.h
new file mode 100644
index 0000000000..65c19a2092
--- /dev/null
+++ b/include/gst/gstpreset.h
@@ -0,0 +1,118 @@
+/* GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ *
+ * gstpreset.h: helper interface header for element presets
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PRESET_H__
+#define __GST_PRESET_H__
+
+#include <glib-object.h>
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PRESET (gst_preset_get_type())
+#define GST_PRESET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET, GstPreset))
+#define GST_IS_PRESET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET))
+#define GST_PRESET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PRESET, GstPresetInterface))
+
+/**
+ * GstPreset:
+ *
+ * Opaque #GstPreset data structure.
+ */
+typedef struct _GstPreset GstPreset; /* dummy object */
+typedef struct _GstPresetInterface GstPresetInterface;
+
+/**
+ * GstPresetInterface:
+ * @parent: parent interface type.
+ * @get_preset_names: virtual method to get list of presets
+ * @get_property_names: virtual methods to get properties that are persistent
+ * @load_preset: virtual methods to load a preset into properties
+ * @save_preset: virtual methods to save properties into a preset
+ * @rename_preset: virtual methods to rename a preset
+ * @delete_preset: virtual methods to remove a preset
+ * @set_meta: virtual methods to set textual meta data to a preset
+ * @get_meta: virtual methods to get textual meta data from a preset
+ *
+ * #GstPreset interface.
+ */
+struct _GstPresetInterface
+{
+ GTypeInterface parent;
+
+ /* methods */
+ gchar** (*get_preset_names) (GstPreset *preset);
+
+ gchar** (*get_property_names) (GstPreset *preset);
+
+ gboolean (*load_preset) (GstPreset *preset, const gchar *name);
+ gboolean (*save_preset) (GstPreset *preset, const gchar *name);
+ gboolean (*rename_preset) (GstPreset *preset, const gchar *old_name,
+ const gchar *new_name);
+ gboolean (*delete_preset) (GstPreset *preset, const gchar *name);
+
+ gboolean (*set_meta) (GstPreset *preset, const gchar *name,
+ const gchar *tag, const gchar *value);
+ gboolean (*get_meta) (GstPreset *preset, const gchar *name,
+ const gchar *tag, gchar **value);
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_preset_get_type (void);
+
+GST_API
+gchar** gst_preset_get_preset_names (GstPreset *preset) G_GNUC_MALLOC;
+
+GST_API
+gchar** gst_preset_get_property_names (GstPreset *preset) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_preset_load_preset (GstPreset *preset, const gchar *name);
+
+GST_API
+gboolean gst_preset_save_preset (GstPreset *preset, const gchar *name);
+
+GST_API
+gboolean gst_preset_rename_preset (GstPreset *preset, const gchar *old_name,
+ const gchar *new_name);
+GST_API
+gboolean gst_preset_delete_preset (GstPreset *preset, const gchar *name);
+
+GST_API
+gboolean gst_preset_set_meta (GstPreset *preset, const gchar *name,
+ const gchar *tag, const gchar *value);
+GST_API
+gboolean gst_preset_get_meta (GstPreset *preset, const gchar *name,
+ const gchar *tag, gchar **value);
+GST_API
+gboolean gst_preset_set_app_dir (const gchar *app_dir);
+
+GST_API
+const gchar *gst_preset_get_app_dir (void);
+
+GST_API
+gboolean gst_preset_is_editable (GstPreset *preset);
+
+G_END_DECLS
+
+#endif /* __GST_PRESET_H__ */
diff --git a/include/gst/gstpromise.h b/include/gst/gstpromise.h
new file mode 100644
index 0000000000..b9ea6bae91
--- /dev/null
+++ b/include/gst/gstpromise.h
@@ -0,0 +1,120 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PROMISE_H__
+#define __GST_PROMISE_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+GST_API
+GType gst_promise_get_type(void);
+#define GST_TYPE_PROMISE (gst_promise_get_type())
+#define GST_PROMISE(obj) ((GstPromise *) obj)
+
+typedef struct _GstPromise GstPromise;
+
+/**
+ * GstPromiseResult:
+ * @GST_PROMISE_RESULT_PENDING: Initial state. Waiting for transition to any
+ * other state.
+ * @GST_PROMISE_RESULT_INTERRUPTED: Interrupted by the consumer as it doesn't
+ * want the value anymore.
+ * @GST_PROMISE_RESULT_REPLIED: A producer marked a reply
+ * @GST_PROMISE_RESULT_EXPIRED: The promise expired (the carrying object
+ * lost all refs) and the promise will never be fulfilled.
+ *
+ * The result of a #GstPromise
+ *
+ * Since: 1.14
+ */
+typedef enum
+{
+ GST_PROMISE_RESULT_PENDING,
+ GST_PROMISE_RESULT_INTERRUPTED,
+ GST_PROMISE_RESULT_REPLIED,
+ GST_PROMISE_RESULT_EXPIRED,
+} GstPromiseResult;
+
+/**
+ * GstPromiseChangeFunc:
+ * @promise: a #GstPromise
+ * @user_data: (closure): user data
+ *
+ * Since: 1.14
+ */
+typedef void (*GstPromiseChangeFunc) (GstPromise * promise, gpointer user_data);
+
+/**
+ * GstPromise:
+ * @parent: parent #GstMiniObject
+ *
+ * Since: 1.14
+ */
+struct _GstPromise
+{
+ GstMiniObject parent;
+};
+
+GST_API
+GstPromise * gst_promise_new (void);
+GST_API
+GstPromise * gst_promise_new_with_change_func (GstPromiseChangeFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_API
+GstPromiseResult gst_promise_wait (GstPromise * promise);
+GST_API
+void gst_promise_reply (GstPromise * promise,
+ GstStructure * s);
+GST_API
+void gst_promise_interrupt (GstPromise * promise);
+GST_API
+void gst_promise_expire (GstPromise * promise);
+
+GST_API
+const GstStructure * gst_promise_get_reply (GstPromise * promise);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline GstPromise *
+gst_promise_ref (GstPromise * promise)
+{
+ return (GstPromise *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (promise));
+}
+
+static inline void
+gst_promise_unref (GstPromise * promise)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstPromise * gst_promise_ref (GstPromise * promise);
+
+GST_API
+void gst_promise_unref (GstPromise * promise);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPromise, gst_promise_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PROMISE_H__ */
diff --git a/include/gst/gstprotection.h b/include/gst/gstprotection.h
new file mode 100644
index 0000000000..d0d4ba9d71
--- /dev/null
+++ b/include/gst/gstprotection.h
@@ -0,0 +1,100 @@
+/* GStreamer
+ * Copyright (C) <2015> YouView TV Ltd.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PROTECTION_H__
+#define __GST_PROTECTION_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_PROTECTION_SYSTEM_ID_CAPS_FIELD:
+ *
+ * The field name in a GstCaps that is used to signal the UUID of the protection
+ * system.
+ *
+ * Since: 1.6
+ */
+#define GST_PROTECTION_SYSTEM_ID_CAPS_FIELD "protection-system"
+
+/**
+ * GST_PROTECTION_UNSPECIFIED_SYSTEM_ID:
+ *
+ * The protection system value of the unspecified UUID.
+ * In some cases the system protection ID is not present in the contents or in their
+ * metadata, as encrypted WebM.
+ * This define is used to set the value of the "system_id" field in GstProtectionEvent,
+ * with this value, the application will use an external information to choose which
+ * protection system to use.
+ *
+ * Example: The matroskademux uses this value in the case of encrypted WebM,
+ * the application will choose the appropriate protection system based on the information
+ * received through EME API.
+ *
+ * Since: 1.16
+ */
+#define GST_PROTECTION_UNSPECIFIED_SYSTEM_ID "unspecified-system-id"
+
+typedef struct _GstProtectionMeta GstProtectionMeta;
+/**
+ * GstProtectionMeta:
+ * @meta: the parent #GstMeta.
+ * @info: the cryptographic information needed to decrypt the sample.
+ *
+ * Metadata type that holds information about a sample from a protection-protected
+ * track, including the information needed to decrypt it (if it is encrypted).
+ *
+ * Since: 1.6
+ */
+struct _GstProtectionMeta
+{
+ GstMeta meta;
+
+ GstStructure *info;
+};
+
+/**
+ * gst_protection_meta_api_get_type: (attributes doc.skip=true)
+ */
+GST_API
+GType gst_protection_meta_api_get_type (void);
+
+#define GST_PROTECTION_META_API_TYPE (gst_protection_meta_api_get_type())
+
+#define gst_buffer_get_protection_meta(b) \
+ ((GstProtectionMeta*)gst_buffer_get_meta ((b), GST_PROTECTION_META_API_TYPE))
+
+#define GST_PROTECTION_META_INFO (gst_protection_meta_get_info())
+
+GST_API
+const GstMetaInfo * gst_protection_meta_get_info (void);
+
+GST_API
+GstProtectionMeta * gst_buffer_add_protection_meta (GstBuffer * buffer,
+ GstStructure * info);
+GST_API
+const gchar * gst_protection_select_system (const gchar ** system_identifiers);
+
+GST_API
+gchar ** gst_protection_filter_systems_by_available_decryptors (
+ const gchar ** system_identifiers);
+
+G_END_DECLS
+#endif /* __GST_PROTECTION_META_H__ */
diff --git a/include/gst/gstquery.h b/include/gst/gstquery.h
new file mode 100644
index 0000000000..949e30aeed
--- /dev/null
+++ b/include/gst/gstquery.h
@@ -0,0 +1,661 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ * 2011 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstquery.h: GstQuery API declaration
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_QUERY_H__
+#define __GST_QUERY_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstQuery GstQuery;
+
+#include <gst/gstminiobject.h>
+
+/**
+ * GstQueryTypeFlags:
+ * @GST_QUERY_TYPE_UPSTREAM: Set if the query can travel upstream.
+ * @GST_QUERY_TYPE_DOWNSTREAM: Set if the query can travel downstream.
+ * @GST_QUERY_TYPE_SERIALIZED: Set if the query should be serialized with data
+ * flow.
+ *
+ * #GstQueryTypeFlags indicate the aspects of the different #GstQueryType
+ * values. You can get the type flags of a #GstQueryType with the
+ * gst_query_type_get_flags() function.
+ */
+typedef enum {
+ GST_QUERY_TYPE_UPSTREAM = 1 << 0,
+ GST_QUERY_TYPE_DOWNSTREAM = 1 << 1,
+ GST_QUERY_TYPE_SERIALIZED = 1 << 2
+} GstQueryTypeFlags;
+
+/**
+ * GST_QUERY_TYPE_BOTH: (value 3) (type GstQueryTypeFlags)
+ *
+ * The same thing as #GST_QUERY_TYPE_UPSTREAM | #GST_QUERY_TYPE_DOWNSTREAM.
+ */
+#define GST_QUERY_TYPE_BOTH \
+ ((GstQueryTypeFlags)(GST_QUERY_TYPE_UPSTREAM | GST_QUERY_TYPE_DOWNSTREAM))
+
+#define GST_QUERY_NUM_SHIFT (8)
+
+/**
+ * GST_QUERY_MAKE_TYPE:
+ * @num: the query number to create
+ * @flags: the query flags
+ *
+ * when making custom query types, use this macro with the num and
+ * the given flags
+ */
+#define GST_QUERY_MAKE_TYPE(num,flags) \
+ (((num) << GST_QUERY_NUM_SHIFT) | (flags))
+
+#define _FLAG(name) GST_QUERY_TYPE_##name
+
+
+/**
+ * GstQueryType:
+ * @GST_QUERY_UNKNOWN: unknown query type
+ * @GST_QUERY_POSITION: current position in stream
+ * @GST_QUERY_DURATION: total duration of the stream
+ * @GST_QUERY_LATENCY: latency of stream
+ * @GST_QUERY_JITTER: current jitter of stream
+ * @GST_QUERY_RATE: current rate of the stream
+ * @GST_QUERY_SEEKING: seeking capabilities
+ * @GST_QUERY_SEGMENT: segment start/stop positions
+ * @GST_QUERY_CONVERT: convert values between formats
+ * @GST_QUERY_FORMATS: query supported formats for convert
+ * @GST_QUERY_BUFFERING: query available media for efficient seeking.
+ * @GST_QUERY_CUSTOM: a custom application or element defined query.
+ * @GST_QUERY_URI: query the URI of the source or sink.
+ * @GST_QUERY_ALLOCATION: the buffer allocation properties
+ * @GST_QUERY_SCHEDULING: the scheduling properties
+ * @GST_QUERY_ACCEPT_CAPS: the accept caps query
+ * @GST_QUERY_CAPS: the caps query
+ * @GST_QUERY_DRAIN: wait till all serialized data is consumed downstream
+ * @GST_QUERY_CONTEXT: query the pipeline-local context from
+ * downstream or upstream (since 1.2)
+ * @GST_QUERY_BITRATE: the bitrate query (since 1.16)
+ *
+ * Standard predefined Query types
+ */
+/* NOTE: don't forget to update the table in gstquery.c when changing
+ * this enum */
+typedef enum {
+ GST_QUERY_UNKNOWN = GST_QUERY_MAKE_TYPE (0, 0),
+ GST_QUERY_POSITION = GST_QUERY_MAKE_TYPE (10, _FLAG(BOTH)),
+ GST_QUERY_DURATION = GST_QUERY_MAKE_TYPE (20, _FLAG(BOTH)),
+ GST_QUERY_LATENCY = GST_QUERY_MAKE_TYPE (30, _FLAG(BOTH)),
+ GST_QUERY_JITTER = GST_QUERY_MAKE_TYPE (40, _FLAG(BOTH)),
+ GST_QUERY_RATE = GST_QUERY_MAKE_TYPE (50, _FLAG(BOTH)),
+ GST_QUERY_SEEKING = GST_QUERY_MAKE_TYPE (60, _FLAG(BOTH)),
+ GST_QUERY_SEGMENT = GST_QUERY_MAKE_TYPE (70, _FLAG(BOTH)),
+ GST_QUERY_CONVERT = GST_QUERY_MAKE_TYPE (80, _FLAG(BOTH)),
+ GST_QUERY_FORMATS = GST_QUERY_MAKE_TYPE (90, _FLAG(BOTH)),
+ GST_QUERY_BUFFERING = GST_QUERY_MAKE_TYPE (110, _FLAG(BOTH)),
+ GST_QUERY_CUSTOM = GST_QUERY_MAKE_TYPE (120, _FLAG(BOTH)),
+ GST_QUERY_URI = GST_QUERY_MAKE_TYPE (130, _FLAG(BOTH)),
+ GST_QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED)),
+ GST_QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, _FLAG(UPSTREAM)),
+ GST_QUERY_ACCEPT_CAPS = GST_QUERY_MAKE_TYPE (160, _FLAG(BOTH)),
+ GST_QUERY_CAPS = GST_QUERY_MAKE_TYPE (170, _FLAG(BOTH)),
+ GST_QUERY_DRAIN = GST_QUERY_MAKE_TYPE (180, _FLAG(DOWNSTREAM) | _FLAG(SERIALIZED)),
+ GST_QUERY_CONTEXT = GST_QUERY_MAKE_TYPE (190, _FLAG(BOTH)),
+ GST_QUERY_BITRATE = GST_QUERY_MAKE_TYPE (200, _FLAG(DOWNSTREAM)),
+} GstQueryType;
+#undef _FLAG
+
+GST_API GType _gst_query_type;
+
+#define GST_TYPE_QUERY (_gst_query_type)
+#define GST_IS_QUERY(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_QUERY))
+#define GST_QUERY_CAST(obj) ((GstQuery*)(obj))
+#define GST_QUERY(obj) (GST_QUERY_CAST(obj))
+
+/**
+ * GST_QUERY_TYPE:
+ * @query: the query to query
+ *
+ * Get the #GstQueryType of the query.
+ */
+#define GST_QUERY_TYPE(query) (((GstQuery*)(query))->type)
+
+/**
+ * GST_QUERY_TYPE_NAME:
+ * @query: the query to query
+ *
+ * Get a constant string representation of the #GstQueryType of the query.
+ */
+#define GST_QUERY_TYPE_NAME(query) (gst_query_type_get_name(GST_QUERY_TYPE(query)))
+
+/**
+ * GST_QUERY_IS_UPSTREAM:
+ * @ev: the query to query
+ *
+ * Check if an query can travel upstream.
+ */
+#define GST_QUERY_IS_UPSTREAM(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_UPSTREAM)
+/**
+ * GST_QUERY_IS_DOWNSTREAM:
+ * @ev: the query to query
+ *
+ * Check if an query can travel downstream.
+ */
+#define GST_QUERY_IS_DOWNSTREAM(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_DOWNSTREAM)
+/**
+ * GST_QUERY_IS_SERIALIZED:
+ * @ev: the query to query
+ *
+ * Check if an query is serialized with the data stream.
+ */
+#define GST_QUERY_IS_SERIALIZED(ev) !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_SERIALIZED)
+
+
+/**
+ * GstQuery:
+ * @mini_object: The parent #GstMiniObject type
+ * @type: the #GstQueryType
+ *
+ * The #GstQuery structure.
+ */
+struct _GstQuery
+{
+ GstMiniObject mini_object;
+
+ /*< public > *//* with COW */
+ GstQueryType type;
+};
+
+/**
+ * GstBufferingMode:
+ * @GST_BUFFERING_STREAM: a small amount of data is buffered
+ * @GST_BUFFERING_DOWNLOAD: the stream is being downloaded
+ * @GST_BUFFERING_TIMESHIFT: the stream is being downloaded in a ringbuffer
+ * @GST_BUFFERING_LIVE: the stream is a live stream
+ *
+ * The different types of buffering methods.
+ */
+typedef enum {
+ GST_BUFFERING_STREAM,
+ GST_BUFFERING_DOWNLOAD,
+ GST_BUFFERING_TIMESHIFT,
+ GST_BUFFERING_LIVE
+} GstBufferingMode;
+
+#include <gst/gstiterator.h>
+#include <gst/gststructure.h>
+#include <gst/gstformat.h>
+#include <gst/gstpad.h>
+#include <gst/gstallocator.h>
+#include <gst/gsttoc.h>
+#include <gst/gstcontext.h>
+
+GST_API
+const gchar* gst_query_type_get_name (GstQueryType type);
+
+GST_API
+GQuark gst_query_type_to_quark (GstQueryType type);
+
+GST_API
+GstQueryTypeFlags
+ gst_query_type_get_flags (GstQueryType type);
+
+
+GST_API
+GType gst_query_get_type (void);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstQuery *
+gst_query_ref (GstQuery * q)
+{
+ return GST_QUERY_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (q)));
+}
+
+static inline void
+gst_query_unref (GstQuery * q)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (q));
+}
+
+static inline void
+gst_clear_query (GstQuery ** query_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) query_ptr);
+}
+
+/* copy query */
+static inline GstQuery *
+gst_query_copy (const GstQuery * q)
+{
+ return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstQuery * gst_query_ref (GstQuery * q);
+
+GST_API
+void gst_query_unref (GstQuery * q);
+
+GST_API
+void gst_clear_query (GstQuery ** query_ptr);
+
+GST_API
+GstQuery * gst_query_copy (const GstQuery * q);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_query_is_writable:
+ * @q: a #GstQuery
+ *
+ * Tests if you can safely write data into a query's structure.
+ */
+#define gst_query_is_writable(q) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))
+/**
+ * gst_query_make_writable:
+ * @q: (transfer full): a #GstQuery to make writable
+ *
+ * Makes a writable query from the given query.
+ *
+ * Returns: (transfer full): a new writable query (possibly same as @q)
+ */
+#define gst_query_make_writable(q) GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_query_replace (GstQuery **old_query, GstQuery *new_query)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_query, (GstMiniObject *) new_query);
+}
+
+static inline gboolean
+gst_query_take (GstQuery **old_query, GstQuery *new_query)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_query,
+ (GstMiniObject *) new_query);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_query_replace (GstQuery ** old_query,
+ GstQuery * new_query);
+
+GST_API
+gboolean gst_query_take (GstQuery ** old_query,
+ GstQuery * new_query);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/* application specific query */
+
+GST_API
+GstQuery * gst_query_new_custom (GstQueryType type, GstStructure *structure) G_GNUC_MALLOC;
+
+GST_API
+const GstStructure *
+ gst_query_get_structure (GstQuery *query);
+
+GST_API
+GstStructure * gst_query_writable_structure (GstQuery *query);
+
+/* position query */
+
+GST_API
+GstQuery* gst_query_new_position (GstFormat format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur);
+
+GST_API
+void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur);
+
+/* duration query */
+
+GST_API
+GstQuery* gst_query_new_duration (GstFormat format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration);
+
+GST_API
+void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration);
+
+/* latency query */
+
+GST_API
+GstQuery* gst_query_new_latency (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_latency (GstQuery *query, gboolean live, GstClockTime min_latency,
+ GstClockTime max_latency);
+
+GST_API
+void gst_query_parse_latency (GstQuery *query, gboolean *live, GstClockTime *min_latency,
+ GstClockTime *max_latency);
+
+/* convert query */
+
+GST_API
+GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value,
+ GstFormat dest_format, gint64 dest_value);
+
+GST_API
+void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value,
+ GstFormat *dest_format, gint64 *dest_value);
+/* segment query */
+
+GST_API
+GstQuery* gst_query_new_segment (GstFormat format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_segment (GstQuery *query, gdouble rate, GstFormat format,
+ gint64 start_value, gint64 stop_value);
+
+GST_API
+void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format,
+ gint64 *start_value, gint64 *stop_value);
+
+/* seeking query */
+
+GST_API
+GstQuery* gst_query_new_seeking (GstFormat format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_seeking (GstQuery *query, GstFormat format,
+ gboolean seekable,
+ gint64 segment_start,
+ gint64 segment_end);
+
+GST_API
+void gst_query_parse_seeking (GstQuery *query, GstFormat *format,
+ gboolean *seekable,
+ gint64 *segment_start,
+ gint64 *segment_end);
+/* formats query */
+
+GST_API
+GstQuery* gst_query_new_formats (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
+
+GST_API
+void gst_query_set_formatsv (GstQuery *query, gint n_formats, const GstFormat *formats);
+
+GST_API
+void gst_query_parse_n_formats (GstQuery *query, guint *n_formats);
+
+GST_API
+void gst_query_parse_nth_format (GstQuery *query, guint nth, GstFormat *format);
+
+/* buffering query */
+
+GST_API
+GstQuery* gst_query_new_buffering (GstFormat format) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_buffering_percent (GstQuery *query, gboolean busy, gint percent);
+
+GST_API
+void gst_query_parse_buffering_percent (GstQuery *query, gboolean *busy, gint *percent);
+
+GST_API
+void gst_query_set_buffering_stats (GstQuery *query, GstBufferingMode mode,
+ gint avg_in, gint avg_out,
+ gint64 buffering_left);
+
+GST_API
+void gst_query_parse_buffering_stats (GstQuery *query, GstBufferingMode *mode,
+ gint *avg_in, gint *avg_out,
+ gint64 *buffering_left);
+
+GST_API
+void gst_query_set_buffering_range (GstQuery *query, GstFormat format,
+ gint64 start, gint64 stop,
+ gint64 estimated_total);
+
+GST_API
+void gst_query_parse_buffering_range (GstQuery *query, GstFormat *format,
+ gint64 *start, gint64 *stop,
+ gint64 *estimated_total);
+
+GST_API
+gboolean gst_query_add_buffering_range (GstQuery *query,
+ gint64 start, gint64 stop);
+
+GST_API
+guint gst_query_get_n_buffering_ranges (GstQuery *query);
+
+GST_API
+gboolean gst_query_parse_nth_buffering_range (GstQuery *query,
+ guint index, gint64 *start,
+ gint64 *stop);
+
+/* URI query */
+
+GST_API
+GstQuery * gst_query_new_uri (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_parse_uri (GstQuery *query, gchar **uri);
+
+GST_API
+void gst_query_set_uri (GstQuery *query, const gchar *uri);
+
+GST_API
+void gst_query_parse_uri_redirection (GstQuery *query, gchar **uri);
+
+GST_API
+void gst_query_set_uri_redirection (GstQuery *query, const gchar *uri);
+
+GST_API
+void gst_query_parse_uri_redirection_permanent (GstQuery *query, gboolean * permanent);
+
+GST_API
+void gst_query_set_uri_redirection_permanent (GstQuery *query, gboolean permanent);
+
+/* allocation query */
+
+GST_API
+GstQuery * gst_query_new_allocation (GstCaps *caps, gboolean need_pool) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_parse_allocation (GstQuery *query, GstCaps **caps, gboolean *need_pool);
+
+/* pools */
+
+GST_API
+void gst_query_add_allocation_pool (GstQuery *query, GstBufferPool *pool,
+ guint size, guint min_buffers,
+ guint max_buffers);
+
+GST_API
+guint gst_query_get_n_allocation_pools (GstQuery *query);
+
+GST_API
+void gst_query_parse_nth_allocation_pool (GstQuery *query, guint index,
+ GstBufferPool **pool,
+ guint *size, guint *min_buffers,
+ guint *max_buffers);
+
+GST_API
+void gst_query_set_nth_allocation_pool (GstQuery *query, guint index,
+ GstBufferPool *pool,
+ guint size, guint min_buffers,
+ guint max_buffers);
+
+GST_API
+void gst_query_remove_nth_allocation_pool (GstQuery *query, guint index);
+
+/* allocators */
+
+GST_API
+void gst_query_add_allocation_param (GstQuery *query, GstAllocator *allocator,
+ const GstAllocationParams *params);
+
+GST_API
+guint gst_query_get_n_allocation_params (GstQuery *query);
+
+GST_API
+void gst_query_parse_nth_allocation_param (GstQuery *query, guint index,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+
+GST_API
+void gst_query_set_nth_allocation_param (GstQuery *query, guint index,
+ GstAllocator *allocator,
+ const GstAllocationParams *params);
+
+GST_API
+void gst_query_remove_nth_allocation_param (GstQuery *query, guint index);
+
+/* metadata */
+
+GST_API
+void gst_query_add_allocation_meta (GstQuery *query, GType api, const GstStructure *params);
+
+GST_API
+guint gst_query_get_n_allocation_metas (GstQuery *query);
+
+GST_API
+GType gst_query_parse_nth_allocation_meta (GstQuery *query, guint index,
+ const GstStructure **params);
+
+GST_API
+void gst_query_remove_nth_allocation_meta (GstQuery *query, guint index);
+
+GST_API
+gboolean gst_query_find_allocation_meta (GstQuery *query, GType api, guint *index);
+
+
+/* scheduling query */
+/**
+ * GstSchedulingFlags:
+ * @GST_SCHEDULING_FLAG_SEEKABLE: if seeking is possible
+ * @GST_SCHEDULING_FLAG_SEQUENTIAL: if sequential access is recommended
+ * @GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED: if bandwidth is limited and buffering possible (since 1.2)
+ *
+ * The different scheduling flags.
+ */
+typedef enum {
+ GST_SCHEDULING_FLAG_SEEKABLE = (1 << 0),
+ GST_SCHEDULING_FLAG_SEQUENTIAL = (1 << 1),
+ GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED = (1 << 2)
+} GstSchedulingFlags;
+
+GST_API
+GstQuery * gst_query_new_scheduling (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_scheduling (GstQuery *query, GstSchedulingFlags flags,
+ gint minsize, gint maxsize, gint align);
+
+GST_API
+void gst_query_parse_scheduling (GstQuery *query, GstSchedulingFlags *flags,
+ gint *minsize, gint *maxsize, gint *align);
+
+GST_API
+void gst_query_add_scheduling_mode (GstQuery *query, GstPadMode mode);
+
+GST_API
+guint gst_query_get_n_scheduling_modes (GstQuery *query);
+
+GST_API
+GstPadMode gst_query_parse_nth_scheduling_mode (GstQuery *query, guint index);
+
+GST_API
+gboolean gst_query_has_scheduling_mode (GstQuery *query, GstPadMode mode);
+
+GST_API
+gboolean gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
+ GstSchedulingFlags flags);
+
+/* accept-caps query */
+
+GST_API
+GstQuery * gst_query_new_accept_caps (GstCaps *caps) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_parse_accept_caps (GstQuery *query, GstCaps **caps);
+
+GST_API
+void gst_query_set_accept_caps_result (GstQuery *query, gboolean result);
+
+GST_API
+void gst_query_parse_accept_caps_result (GstQuery *query, gboolean *result);
+
+/* caps query */
+
+GST_API
+GstQuery * gst_query_new_caps (GstCaps *filter) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_parse_caps (GstQuery *query, GstCaps **filter);
+
+GST_API
+void gst_query_set_caps_result (GstQuery *query, GstCaps *caps);
+
+GST_API
+void gst_query_parse_caps_result (GstQuery *query, GstCaps **caps);
+
+/* drain query */
+
+GST_API
+GstQuery * gst_query_new_drain (void) G_GNUC_MALLOC;
+
+/* context query */
+
+GST_API
+GstQuery * gst_query_new_context (const gchar * context_type) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_query_parse_context_type (GstQuery * query, const gchar ** context_type);
+
+GST_API
+void gst_query_set_context (GstQuery *query, GstContext *context);
+
+GST_API
+void gst_query_parse_context (GstQuery *query, GstContext **context);
+
+/* bitrate query */
+
+GST_API
+GstQuery * gst_query_new_bitrate (void) G_GNUC_MALLOC;
+
+GST_API
+void gst_query_set_bitrate (GstQuery * query, guint nominal_bitrate);
+
+GST_API
+void gst_query_parse_bitrate (GstQuery * query, guint * nominal_bitrate);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstQuery, gst_query_unref)
+
+G_END_DECLS
+
+#endif /* __GST_QUERY_H__ */
+
diff --git a/include/gst/gstregistry.h b/include/gst/gstregistry.h
new file mode 100644
index 0000000000..4b8f36884a
--- /dev/null
+++ b/include/gst/gstregistry.h
@@ -0,0 +1,132 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstregistry.h: Header for registry handling
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_REGISTRY_H__
+#define __GST_REGISTRY_H__
+
+#include <gst/gstconfig.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_REGISTRY (gst_registry_get_type ())
+#define GST_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry))
+#define GST_IS_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY))
+#define GST_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REGISTRY, GstRegistryClass))
+#define GST_IS_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REGISTRY))
+#define GST_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_REGISTRY, GstRegistryClass))
+
+typedef struct _GstRegistry GstRegistry;
+typedef struct _GstRegistryClass GstRegistryClass;
+typedef struct _GstRegistryPrivate GstRegistryPrivate;
+
+/**
+ * GstRegistry:
+ *
+ * Opaque #GstRegistry structure.
+ */
+struct _GstRegistry {
+ GstObject object;
+
+ /*< private >*/
+ GstRegistryPrivate *priv;
+};
+
+struct _GstRegistryClass {
+ GstObjectClass parent_class;
+};
+
+GST_API
+GType gst_registry_get_type (void);
+
+GST_API
+GstRegistry * gst_registry_get (void);
+
+GST_API
+gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path);
+
+#if 0
+void gst_registry_add_path (GstRegistry * registry, const gchar * path);
+GList* gst_registry_get_path_list (GstRegistry *registry);
+#endif
+
+GST_API
+gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
+
+GST_API
+void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin);
+
+GST_API
+gboolean gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * feature);
+
+GST_API
+void gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature);
+
+GST_API
+GList* gst_registry_get_plugin_list (GstRegistry *registry);
+
+GST_API
+GList* gst_registry_plugin_filter (GstRegistry *registry,
+ GstPluginFilter filter,
+ gboolean first,
+ gpointer user_data);
+GST_API
+GList* gst_registry_feature_filter (GstRegistry *registry,
+ GstPluginFeatureFilter filter,
+ gboolean first,
+ gpointer user_data);
+GST_API
+GList * gst_registry_get_feature_list (GstRegistry *registry,
+ GType type);
+GST_API
+GList * gst_registry_get_feature_list_by_plugin (GstRegistry *registry, const gchar *name);
+
+GST_API
+guint32 gst_registry_get_feature_list_cookie (GstRegistry *registry);
+
+GST_API
+GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name);
+
+GST_API
+GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type);
+
+GST_API
+GstPlugin * gst_registry_lookup (GstRegistry *registry, const char *filename);
+
+GST_API
+GstPluginFeature * gst_registry_lookup_feature (GstRegistry *registry, const char *name);
+
+GST_API
+gboolean gst_registry_check_feature_version (GstRegistry *registry,
+ const gchar *feature_name,
+ guint min_major,
+ guint min_minor,
+ guint min_micro);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRegistry, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_REGISTRY_H__ */
+
diff --git a/include/gst/gstsample.h b/include/gst/gstsample.h
new file mode 100644
index 0000000000..e3023b097c
--- /dev/null
+++ b/include/gst/gstsample.h
@@ -0,0 +1,194 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstsample.h: Header for GstSample object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_SAMPLE_H__
+#define __GST_SAMPLE_H__
+
+#include <gst/gstbuffer.h>
+#include <gst/gstbufferlist.h>
+#include <gst/gstcaps.h>
+#include <gst/gstsegment.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_sample_type;
+
+#define GST_TYPE_SAMPLE (_gst_sample_type)
+#define GST_IS_SAMPLE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_SAMPLE))
+#define GST_SAMPLE_CAST(obj) ((GstSample *)obj)
+#define GST_SAMPLE(obj) (GST_SAMPLE_CAST(obj))
+
+/**
+ * GstSample:
+ *
+ * The opaque structure of a #GstSample. A sample contains a typed memory
+ * block and the associated timing information. It is mainly used to
+ * exchange buffers with an application.
+ */
+typedef struct _GstSample GstSample;
+
+GST_API
+GType gst_sample_get_type (void);
+
+/* allocation */
+
+GST_API
+GstSample * gst_sample_new (GstBuffer *buffer,
+ GstCaps *caps,
+ const GstSegment *segment,
+ GstStructure *info);
+GST_API
+GstBuffer * gst_sample_get_buffer (GstSample *sample);
+
+GST_API
+GstCaps * gst_sample_get_caps (GstSample *sample);
+
+GST_API
+GstSegment * gst_sample_get_segment (GstSample *sample);
+
+GST_API
+const GstStructure * gst_sample_get_info (GstSample *sample);
+
+GST_API
+GstBufferList * gst_sample_get_buffer_list (GstSample *sample);
+
+GST_API
+void gst_sample_set_buffer_list (GstSample *sample, GstBufferList *buffer_list);
+
+GST_API
+void gst_sample_set_buffer (GstSample *sample, GstBuffer *buffer);
+
+GST_API
+void gst_sample_set_caps (GstSample *sample, GstCaps *caps);
+
+GST_API
+void gst_sample_set_segment (GstSample * sample, const GstSegment *segment);
+
+GST_API
+gboolean gst_sample_set_info (GstSample *sample, GstStructure *info);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstSample *
+gst_sample_ref (GstSample * sample)
+{
+ return GST_SAMPLE_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (
+ sample)));
+}
+
+static inline void
+gst_sample_unref (GstSample * sample)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (sample));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstSample * gst_sample_ref (GstSample * sample);
+
+GST_API
+void gst_sample_unref (GstSample * sample);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_sample_is_writable:
+ * @sample: A #GstSample
+ *
+ * Tests if you can safely set the buffer and / or buffer list of @sample.
+ *
+ * Since: 1.16
+ */
+#define gst_sample_is_writable(sample) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (sample))
+
+/**
+ * gst_sample_make_writable:
+ * @sample: (transfer full): A #GstSample
+ *
+ * Returns a writable copy of @sample. If the source sample is
+ * already writable, this will simply return the same sample.
+ *
+ * Use this function to ensure that a sample can be safely modified before
+ * making changes to it, for example before calling gst_sample_set_buffer()
+ *
+ * If the reference count of the source sample @sample is exactly one, the caller
+ * is the sole owner and this function will return the sample object unchanged.
+ *
+ * If there is more than one reference on the object, a copy will be made using
+ * gst_sample_copy(). The passed-in @sample will be unreffed in that case, and the
+ * caller will now own a reference to the new returned sample object.
+ *
+ * In short, this function unrefs the sample in the argument and refs the sample
+ * that it returns. Don't access the argument after calling this function unless
+ * you have an additional reference to it.
+ *
+ * Returns: (transfer full): a writable sample which may or may not be the
+ * same as @sample
+ *
+ * Since: 1.16
+ */
+#define gst_sample_make_writable(sample) GST_SAMPLE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (sample)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* copy sample */
+static inline GstSample *
+gst_sample_copy (const GstSample * buf)
+{
+ return GST_SAMPLE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstSample * gst_sample_copy(const GstSample * buf);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+/**
+ * gst_value_set_sample:
+ * @v: a #GValue to receive the data
+ * @b: (transfer none): a #GstSample to assign to the GstValue
+ *
+ * Sets @b as the value of @v. Caller retains reference to sample.
+ */
+#define gst_value_set_sample(v,b) g_value_set_boxed((v),(b))
+/**
+ * gst_value_take_sample:
+ * @v: a #GValue to receive the data
+ * @b: (transfer full): a #GstSample to assign to the GstValue
+ *
+ * Sets @b as the value of @v. Caller gives away reference to sample.
+ */
+#define gst_value_take_sample(v,b) g_value_take_boxed(v,(b))
+/**
+ * gst_value_get_sample:
+ * @v: a #GValue to query
+ *
+ * Receives a #GstSample as the value of @v. Does not return a reference to
+ * the sample, so the pointer is only valid for as long as the caller owns
+ * a reference to @v.
+ *
+ * Returns: (transfer none): sample
+ */
+#define gst_value_get_sample(v) GST_SAMPLE_CAST (g_value_get_boxed(v))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstSample, gst_sample_unref)
+
+G_END_DECLS
+
+#endif /* __GST_SAMPLE_H__ */
diff --git a/include/gst/gstsegment.h b/include/gst/gstsegment.h
new file mode 100644
index 0000000000..7207cc5bf5
--- /dev/null
+++ b/include/gst/gstsegment.h
@@ -0,0 +1,351 @@
+/* GStreamer
+ * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstsegment.h: Header for GstSegment subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_SEGMENT_H__
+#define __GST_SEGMENT_H__
+
+#include <gst/gstformat.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_SEGMENT (gst_segment_get_type())
+
+typedef struct _GstSegment GstSegment;
+
+/**
+ * GstSeekType:
+ * @GST_SEEK_TYPE_NONE: no change in position is required
+ * @GST_SEEK_TYPE_SET: absolute position is requested
+ * @GST_SEEK_TYPE_END: relative position to duration is requested
+ *
+ * The different types of seek events. When constructing a seek event with
+ * gst_event_new_seek() or when doing gst_segment_do_seek ().
+ */
+typedef enum {
+ /* one of these */
+ GST_SEEK_TYPE_NONE = 0,
+ GST_SEEK_TYPE_SET = 1,
+ GST_SEEK_TYPE_END = 2
+} GstSeekType;
+
+/**
+ * GstSeekFlags:
+ * @GST_SEEK_FLAG_NONE: no flag
+ * @GST_SEEK_FLAG_FLUSH: flush pipeline
+ * @GST_SEEK_FLAG_ACCURATE: accurate position is requested, this might
+ * be considerably slower for some formats.
+ * @GST_SEEK_FLAG_KEY_UNIT: seek to the nearest keyframe. This might be
+ * faster but less accurate.
+ * @GST_SEEK_FLAG_SEGMENT: perform a segment seek.
+ * @GST_SEEK_FLAG_TRICKMODE: when doing fast forward or fast reverse playback, allow
+ * elements to skip frames instead of generating all
+ * frames. (Since: 1.6)
+ * @GST_SEEK_FLAG_SNAP_BEFORE: go to a location before the requested position,
+ * if %GST_SEEK_FLAG_KEY_UNIT this means the keyframe at or before
+ * the requested position the one at or before the seek target.
+ * @GST_SEEK_FLAG_SNAP_AFTER: go to a location after the requested position,
+ * if %GST_SEEK_FLAG_KEY_UNIT this means the keyframe at of after the
+ * requested position.
+ * @GST_SEEK_FLAG_SNAP_NEAREST: go to a position near the requested position,
+ * if %GST_SEEK_FLAG_KEY_UNIT this means the keyframe closest
+ * to the requested position, if both keyframes are at an equal
+ * distance, behaves like %GST_SEEK_FLAG_SNAP_BEFORE.
+ * @GST_SEEK_FLAG_TRICKMODE_KEY_UNITS: when doing fast forward or fast reverse
+ * playback, request that elements only decode keyframes
+ * and skip all other content, for formats that have
+ * keyframes. (Since: 1.6)
+ * @GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED: When doing fast forward or fast reverse
+ * playback, request that elements only decode keyframes and
+ * forward predicted frames and skip all other content (for example
+ * B-Frames), for formats that have keyframes and forward predicted
+ * frames. (Since: 1.18)
+ * @GST_SEEK_FLAG_TRICKMODE_NO_AUDIO: when doing fast forward or fast reverse
+ * playback, request that audio decoder elements skip
+ * decoding and output only gap events or silence. (Since: 1.6)
+ * @GST_SEEK_FLAG_INSTANT_RATE_CHANGE: Signals that a rate change should be
+ * applied immediately. Only valid if start/stop position
+ * are GST_CLOCK_TIME_NONE, the playback direction does not change
+ * and the seek is not flushing. (Since: 1.18)
+ * @GST_SEEK_FLAG_SKIP: Deprecated backward compatibility flag, replaced
+ * by %GST_SEEK_FLAG_TRICKMODE
+ *
+ * Flags to be used with gst_element_seek() or gst_event_new_seek(). All flags
+ * can be used together.
+ *
+ * A non flushing seek might take some time to perform as the currently
+ * playing data in the pipeline will not be cleared.
+ *
+ * An accurate seek might be slower for formats that don't have any indexes
+ * or timestamp markers in the stream. Specifying this flag might require a
+ * complete scan of the file in those cases.
+ *
+ * When performing a segment seek: after the playback of the segment completes,
+ * no EOS will be emitted by the element that performed the seek, but a
+ * %GST_MESSAGE_SEGMENT_DONE message will be posted on the bus by the element.
+ * When this message is posted, it is possible to send a new seek event to
+ * continue playback. With this seek method it is possible to perform seamless
+ * looping or simple linear editing.
+ *
+ * When only changing the playback rate and not the direction, the
+ * %GST_SEEK_FLAG_INSTANT_RATE_CHANGE flag can be used for a non-flushing seek
+ * to signal that the rate change should be applied immediately. This requires
+ * special support in the seek handlers (e.g. demuxers) and any elements
+ * synchronizing to the clock, and in general can't work in all cases (for example
+ * UDP streaming where the delivery rate is controlled by a remote server). The
+ * instant-rate-change mode supports changing the trickmode-related GST_SEEK_ flags,
+ * but can't be used in conjunction with other seek flags that affect the new
+ * playback position - as the playback position will not be changing.
+ *
+ * When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode
+ * playback, the %GST_SEEK_FLAG_TRICKMODE flag can be used to instruct decoders
+ * and demuxers to adjust the playback rate by skipping frames. This can improve
+ * performance and decrease CPU usage because not all frames need to be decoded.
+ *
+ * Beyond that, the %GST_SEEK_FLAG_TRICKMODE_KEY_UNITS flag can be used to
+ * request that decoders skip all frames except key units, and
+ * %GST_SEEK_FLAG_TRICKMODE_NO_AUDIO flags can be used to request that audio
+ * decoders do no decoding at all, and simple output silence.
+ *
+ * The %GST_SEEK_FLAG_SNAP_BEFORE flag can be used to snap to the previous
+ * relevant location, and the %GST_SEEK_FLAG_SNAP_AFTER flag can be used to
+ * select the next relevant location. If %GST_SEEK_FLAG_KEY_UNIT is specified,
+ * the relevant location is a keyframe. If both flags are specified, the nearest
+ * of these locations will be selected. If none are specified, the implementation is
+ * free to select whichever it wants.
+ *
+ * The before and after here are in running time, so when playing backwards,
+ * the next location refers to the one that will played in next, and not the
+ * one that is located after in the actual source stream.
+ *
+ * Also see part-seeking.txt in the GStreamer design documentation for more
+ * details on the meaning of these flags and the behaviour expected of
+ * elements that handle them.
+ */
+typedef enum {
+ GST_SEEK_FLAG_NONE = 0,
+ GST_SEEK_FLAG_FLUSH = (1 << 0),
+ GST_SEEK_FLAG_ACCURATE = (1 << 1),
+ GST_SEEK_FLAG_KEY_UNIT = (1 << 2),
+ GST_SEEK_FLAG_SEGMENT = (1 << 3),
+ GST_SEEK_FLAG_TRICKMODE = (1 << 4),
+ /* FIXME 2.0: Remove _SKIP flag,
+ * which was kept for backward compat when _TRICKMODE was added */
+ GST_SEEK_FLAG_SKIP = (1 << 4),
+ GST_SEEK_FLAG_SNAP_BEFORE = (1 << 5),
+ GST_SEEK_FLAG_SNAP_AFTER = (1 << 6),
+ GST_SEEK_FLAG_SNAP_NEAREST = GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_SNAP_AFTER,
+ /* Careful to restart next flag with 1<<7 here */
+ GST_SEEK_FLAG_TRICKMODE_KEY_UNITS = (1 << 7),
+ GST_SEEK_FLAG_TRICKMODE_NO_AUDIO = (1 << 8),
+ GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED = (1 << 9),
+ GST_SEEK_FLAG_INSTANT_RATE_CHANGE = (1 << 10),
+} GstSeekFlags;
+
+/**
+ * GstSegmentFlags:
+ * @GST_SEGMENT_FLAG_NONE: no flags
+ * @GST_SEGMENT_FLAG_RESET: reset the pipeline running_time to the segment
+ * running_time
+ * @GST_SEGMENT_FLAG_TRICKMODE: perform skip playback (Since: 1.6)
+ * @GST_SEGMENT_FLAG_SEGMENT: send SEGMENT_DONE instead of EOS
+ * @GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS: Decode only keyframes, where
+ * possible (Since: 1.6)
+ * @GST_SEGMENT_FLAG_TRICKMODE_FORWARD_PREDICTED: Decode only keyframes or forward
+ * predicted frames, where possible (Since: 1.18)
+ * @GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO: Do not decode any audio, where
+ * possible (Since: 1.6)
+ * @GST_SEGMENT_FLAG_SKIP: Deprecated backward compatibility flag, replaced
+ * by @GST_SEGMENT_FLAG_TRICKMODE
+ *
+ * Flags for the GstSegment structure. Currently mapped to the corresponding
+ * values of the seek flags.
+ */
+/* Note: update gst_segment_do_seek() when adding new flags here */
+typedef enum { /*< flags >*/
+ GST_SEGMENT_FLAG_NONE = GST_SEEK_FLAG_NONE,
+ GST_SEGMENT_FLAG_RESET = GST_SEEK_FLAG_FLUSH,
+ GST_SEGMENT_FLAG_TRICKMODE = GST_SEEK_FLAG_TRICKMODE,
+ /* FIXME 2.0: Remove _SKIP flag,
+ * which was kept for backward compat when _TRICKMODE was added */
+ GST_SEGMENT_FLAG_SKIP = GST_SEEK_FLAG_TRICKMODE,
+ GST_SEGMENT_FLAG_SEGMENT = GST_SEEK_FLAG_SEGMENT,
+ GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS = GST_SEEK_FLAG_TRICKMODE_KEY_UNITS,
+ GST_SEGMENT_FLAG_TRICKMODE_FORWARD_PREDICTED = GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED,
+ GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO = GST_SEEK_FLAG_TRICKMODE_NO_AUDIO
+} GstSegmentFlags;
+
+/* Flags that are reflected for instant-rate-change seeks */
+#define GST_SEGMENT_INSTANT_FLAGS \
+ (GST_SEGMENT_FLAG_TRICKMODE|GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS|GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED|GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO)
+
+/**
+ * GstSegment:
+ * @flags: flags for this segment
+ * @rate: the playback rate of the segment is set in response to a seek
+ * event and, without any seek, the value should be `1.0`. This
+ * value is used by elements that synchronize buffer [running
+ * times](additional/design/synchronisation.md#running-time) on
+ * the clock (usually the sink elements), leading to consuming
+ * buffers faster (for a value `> 1.0`) or slower (for `0.0 <
+ * value < 1.0`) than normal playback speed. The rate also
+ * defines the playback direction, meaning that when the value is
+ * lower than `0.0`, the playback happens in reverse, and the
+ * [stream-time](additional/design/synchronisation.md#stream-time)
+ * is going backward. The `rate` value should never be `0.0`.
+ * @applied_rate: The applied rate is the rate that has been applied to the stream.
+ * The effective/resulting playback rate of a stream is
+ * `rate * applied_rate`.
+ * The applied rate can be set by source elements when a server is
+ * sending the stream with an already modified playback speed
+ * rate. Filter elements that modify the stream in a way that
+ * modifies the playback speed should also modify the applied
+ * rate. For example the #videorate element when its
+ * #videorate:rate property is set will set the applied rate of
+ * the segment it pushed downstream. Also #scaletempo applies the
+ * input segment rate to the stream and outputs a segment with
+ * rate=1.0 and applied_rate=<inputsegment.rate>.
+ * @format: the unit used for all of the segment's values.
+ * @base: the running time (plus elapsed time, see offset) of the
+ * segment [start](GstSegment.start) ([stop](GstSegment.stop) if
+ * rate < 0.0).
+ * @offset: the offset expresses the elapsed time (in buffer timestamps)
+ * before a seek with its start (stop if rate < 0.0) seek type
+ * set to #GST_SEEK_TYPE_NONE, the value is set to the position
+ * of the segment at the time of the seek.
+ * @start: the start time of the segment (in buffer timestamps)
+ * [(PTS)](GstBuffer.pts), that is the timestamp of the first
+ * buffer to output inside the segment (last one during
+ * reverse playback). For example decoders will
+ * [clip](gst_segment_clip) out the buffers before the start
+ * time.
+ * @stop: the stop time of the segment (in buffer timestamps)
+ * [(PTS)](GstBuffer.pts), that is the timestamp of the last
+ * buffer to output inside the segment (first one during
+ * reverse playback). For example decoders will
+ * [clip](gst_segment_clip) out buffers after the stop time.
+ * @time: the stream time of the segment [start](GstSegment.start)
+ * ([stop](GstSegment.stop) if rate < 0.0).
+ * @position: the buffer timestamp position in the segment is supposed to be
+ * updated by elements such as sources, demuxers or parsers to
+ * track progress by setting it to the last pushed buffer' end time
+ * ([timestamp](GstBuffer.pts) + #GstBuffer.duration) for that
+ * specific segment. The position is used when reconfiguring the
+ * segment with #gst_segment_do_seek when the seek is only
+ * updating the segment (see [offset](GstSegment.offset)).
+ * @duration: the duration of the segment is the maximum absolute difference
+ * between #GstSegment.start and #GstSegment.stop if stop is not
+ * set, otherwise it should be the difference between those
+ * two values. This should be set by elements that know the
+ * overall stream duration (like demuxers) and will be used when
+ * seeking with #GST_SEEK_TYPE_END.
+ *
+ * The structure that holds the configured region of interest in a media file.
+ */
+struct _GstSegment {
+ /*< public >*/
+ GstSegmentFlags flags;
+
+ gdouble rate;
+ gdouble applied_rate;
+
+ GstFormat format;
+ guint64 base;
+ guint64 offset;
+ guint64 start;
+ guint64 stop;
+ guint64 time;
+
+ guint64 position;
+ guint64 duration;
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_segment_get_type (void);
+
+GST_API
+GstSegment * gst_segment_new (void) G_GNUC_MALLOC;
+
+GST_API
+GstSegment * gst_segment_copy (const GstSegment *segment) G_GNUC_MALLOC;
+
+GST_API
+void gst_segment_copy_into (const GstSegment *src, GstSegment *dest);
+
+GST_API
+void gst_segment_free (GstSegment *segment);
+
+GST_API
+void gst_segment_init (GstSegment *segment, GstFormat format);
+
+GST_API
+gint gst_segment_to_stream_time_full (const GstSegment *segment, GstFormat format, guint64 position, guint64 * stream_time);
+
+GST_API
+guint64 gst_segment_to_stream_time (const GstSegment *segment, GstFormat format, guint64 position);
+
+GST_API
+gint gst_segment_position_from_stream_time_full (const GstSegment * segment, GstFormat format, guint64 stream_time, guint64 * position);
+
+GST_API
+guint64 gst_segment_position_from_stream_time (const GstSegment * segment, GstFormat format, guint64 stream_time);
+
+GST_API
+guint64 gst_segment_to_running_time (const GstSegment *segment, GstFormat format, guint64 position);
+
+GST_API
+gint gst_segment_to_running_time_full (const GstSegment *segment, GstFormat format, guint64 position,
+ guint64 * running_time);
+
+GST_DEPRECATED_FOR(gst_segment_position_from_running_time)
+guint64 gst_segment_to_position (const GstSegment *segment, GstFormat format, guint64 running_time);
+
+GST_API
+gint gst_segment_position_from_running_time_full (const GstSegment *segment, GstFormat format, guint64 running_time, guint64 * position);
+
+GST_API
+guint64 gst_segment_position_from_running_time (const GstSegment *segment, GstFormat format, guint64 running_time);
+
+GST_API
+gboolean gst_segment_set_running_time (GstSegment *segment, GstFormat format, guint64 running_time);
+
+GST_API
+gboolean gst_segment_offset_running_time (GstSegment *segment, GstFormat format, gint64 offset);
+
+GST_API
+gboolean gst_segment_clip (const GstSegment *segment, GstFormat format, guint64 start,
+ guint64 stop, guint64 *clip_start, guint64 *clip_stop);
+GST_API
+gboolean gst_segment_do_seek (GstSegment * segment, gdouble rate,
+ GstFormat format, GstSeekFlags flags,
+ GstSeekType start_type, guint64 start,
+ GstSeekType stop_type, guint64 stop, gboolean * update);
+GST_API
+gboolean gst_segment_is_equal (const GstSegment * s0, const GstSegment * s1);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstSegment, gst_segment_free)
+
+G_END_DECLS
+
+#endif /* __GST_SEGMENT_H__ */
diff --git a/include/gst/gststreamcollection.h b/include/gst/gststreamcollection.h
new file mode 100644
index 0000000000..c6030c8789
--- /dev/null
+++ b/include/gst/gststreamcollection.h
@@ -0,0 +1,119 @@
+/* GStreamer
+ * Copyright (C) 2015 Centricular Ltd
+ * @author: Edward Hervey <edward@centricular.com>
+ * @author: Jan Schmidt <jan@centricular.com>
+ *
+ * gststreams.h : Header for GstStreamCollection subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_STREAM_COLLECTION_H__
+#define __GST_STREAM_COLLECTION_H__
+
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_STREAM_COLLECTION (gst_stream_collection_get_type ())
+#define GST_IS_STREAM_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_COLLECTION))
+#define GST_IS_STREAM_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_STREAM_COLLECTION))
+#define GST_STREAM_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_STREAM_COLLECTION, GstStreamCollectionClass))
+#define GST_STREAM_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_COLLECTION, GstStreamCollection))
+#define GST_STREAM_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_STREAM_COLLECTION, GstStreamCollectionClass))
+#define GST_STREAM_COLLECTION_CAST(obj) ((GstStreamCollection*)(obj))
+
+typedef struct _GstStreamCollection GstStreamCollection;
+typedef struct _GstStreamCollectionClass GstStreamCollectionClass;
+typedef struct _GstStreamCollectionPrivate GstStreamCollectionPrivate;
+
+#include <gst/gststreamcollection.h>
+#include <gst/gststreams.h>
+
+/**
+ * GstStreamCollection:
+ *
+ * A collection of #GstStream that are available.
+ *
+ * A #GstStreamCollection will be provided by elements that can make those
+ * streams available. Applications can use the collection to show the user
+ * what streams are available by using %gst_stream_collection_get_stream()
+ *
+ * Once posted, a #GstStreamCollection is immutable. Updates are made by sending
+ * a new #GstStreamCollection message, which may or may not share some of
+ * the #GstStream objects from the collection it replaces. The receiver can check
+ * the sender of a stream collection message to know which collection is
+ * obsoleted.
+ *
+ * Several elements in a pipeline can provide #GstStreamCollection.
+ *
+ * Applications can activate streams from a collection by using the
+ * #GST_EVENT_SELECT_STREAMS event on a pipeline, bin or element.
+ *
+ * Since: 1.10
+ */
+struct _GstStreamCollection {
+ /*< private >*/
+ GstObject object;
+
+ gchar *upstream_id;
+ GstStreamCollectionPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstStreamCollectionClass:
+ * @parent_class: the parent class structure
+ * @stream_notify: default signal handler for the stream-notify signal
+ *
+ * GstStreamCollection class structure
+ */
+struct _GstStreamCollectionClass {
+ GstObjectClass parent_class;
+
+ /* signals */
+ void (*stream_notify) (GstStreamCollection *collection, GstStream *stream, GParamSpec * pspec);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_stream_collection_get_type (void);
+
+GST_API
+GstStreamCollection *gst_stream_collection_new (const gchar *upstream_id);
+
+GST_API
+const gchar *gst_stream_collection_get_upstream_id (GstStreamCollection *collection);
+
+GST_API
+guint gst_stream_collection_get_size (GstStreamCollection *collection);
+
+GST_API
+GstStream *gst_stream_collection_get_stream (GstStreamCollection *collection, guint index);
+
+GST_API
+gboolean gst_stream_collection_add_stream (GstStreamCollection *collection,
+ GstStream *stream);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstStreamCollection, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_STREAM_COLLECTION_H__ */
diff --git a/include/gst/gststreams.h b/include/gst/gststreams.h
new file mode 100644
index 0000000000..b4d40d3bf8
--- /dev/null
+++ b/include/gst/gststreams.h
@@ -0,0 +1,159 @@
+/* GStreamer
+ * Copyright (C) 2015 Centricular Ltd
+ * @author: Edward Hervey <edward@centricular.com>
+ * @author: Jan Schmidt <jan@centricular.com>
+ *
+ * gststreams.h : Header for GstStream subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_STREAMS_H__
+#define __GST_STREAMS_H__
+
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_STREAM (gst_stream_get_type ())
+#define GST_IS_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM))
+#define GST_IS_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_STREAM))
+#define GST_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_STREAM, GstStreamClass))
+#define GST_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM, GstStream))
+#define GST_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_STREAM, GstStreamClass))
+#define GST_STREAM_CAST(obj) ((GstStream*)(obj))
+
+/**
+ * GstStreamType:
+ * @GST_STREAM_TYPE_UNKNOWN: The stream is of unknown (unclassified) type.
+ * @GST_STREAM_TYPE_AUDIO: The stream is of audio data
+ * @GST_STREAM_TYPE_VIDEO: The stream carries video data
+ * @GST_STREAM_TYPE_CONTAINER: The stream is a muxed container type
+ * @GST_STREAM_TYPE_TEXT: The stream contains subtitle / subpicture data.
+ *
+ * #GstStreamType describes a high level classification set for
+ * flows of data in #GstStream objects.
+ *
+ * Note that this is a flag, and therefore users should not assume it
+ * will be a single value. Do not use the equality operator for checking
+ * whether a stream is of a certain type.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_STREAM_TYPE_UNKNOWN = 1 << 0,
+ GST_STREAM_TYPE_AUDIO = 1 << 1,
+ GST_STREAM_TYPE_VIDEO = 1 << 2,
+ GST_STREAM_TYPE_CONTAINER = 1 << 3,
+ GST_STREAM_TYPE_TEXT = 1 << 4
+} GstStreamType;
+
+
+typedef struct _GstStream GstStream;
+typedef struct _GstStreamClass GstStreamClass;
+typedef struct _GstStreamPrivate GstStreamPrivate;
+
+/**
+ * GstStream:
+ * @stream_id: The Stream Identifier for this #GstStream
+ *
+ * A high-level object representing a single stream. It might be backed, or
+ * not, by an actual flow of data in a pipeline (#GstPad).
+ *
+ * A #GstStream does not care about data changes (such as decoding, encoding,
+ * parsing,...) as long as the underlying data flow corresponds to the same
+ * high-level flow (ex: a certain audio track).
+ *
+ * A #GstStream contains all the information pertinent to a stream, such as
+ * stream-id, tags, caps, type, ...
+ *
+ * Elements can subclass a #GstStream for internal usage (to contain information
+ * pertinent to streams of data).
+ *
+ * Since: 1.10
+ */
+struct _GstStream {
+ /*< private >*/
+ GstObject object;
+
+ /*< public >*/
+ const gchar *stream_id;
+
+ /*< private >*/
+ GstStreamPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstStreamClass:
+ * @parent_class: the parent class structure
+ *
+ * GstStream class structure
+ */
+struct _GstStreamClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_stream_get_type (void);
+
+#include <gst/gstevent.h>
+
+GST_API
+GstStream *gst_stream_new (const gchar *stream_id,
+ GstCaps *caps,
+ GstStreamType type,
+ GstStreamFlags flags);
+GST_API
+const gchar * gst_stream_get_stream_id (GstStream *stream);
+
+GST_API
+void gst_stream_set_stream_flags (GstStream *stream, GstStreamFlags flags);
+
+GST_API
+GstStreamFlags gst_stream_get_stream_flags (GstStream *stream);
+
+GST_API
+void gst_stream_set_stream_type (GstStream *stream, GstStreamType stream_type);
+
+GST_API
+GstStreamType gst_stream_get_stream_type (GstStream *stream);
+
+GST_API
+void gst_stream_set_tags (GstStream *stream, GstTagList *tags);
+
+GST_API
+GstTagList * gst_stream_get_tags (GstStream *stream);
+
+GST_API
+void gst_stream_set_caps (GstStream *stream, GstCaps *caps);
+
+GST_API
+GstCaps * gst_stream_get_caps (GstStream *stream);
+
+GST_API
+const gchar * gst_stream_type_get_name (GstStreamType stype);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstStream, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_STREAMS_H__ */
diff --git a/include/gst/gststructure.h b/include/gst/gststructure.h
new file mode 100644
index 0000000000..38ea2095c0
--- /dev/null
+++ b/include/gst/gststructure.h
@@ -0,0 +1,399 @@
+/* GStreamer
+ * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_STRUCTURE_H__
+#define __GST_STRUCTURE_H__
+
+#include <gst/gstconfig.h>
+#include <glib-object.h>
+#include <gst/gstclock.h>
+#include <gst/gstdatetime.h>
+#include <gst/glib-compat.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_structure_type;
+
+typedef struct _GstStructure GstStructure;
+
+/**
+ * GstSerializeFlags:
+ * @GST_SERIALIZE_FLAG_NONE: No special flags specified.
+ * @GST_SERIALIZE_FLAG_BACKWARD_COMPAT: Serialize using the old format for
+ * nested structures.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_SERIALIZE_FLAG_NONE = 0,
+ GST_SERIALIZE_FLAG_BACKWARD_COMPAT = (1 << 0),
+} GstSerializeFlags;
+
+#define GST_TYPE_STRUCTURE (_gst_structure_type)
+#define GST_IS_STRUCTURE(object) ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
+#define GST_STRUCTURE_CAST(object) ((GstStructure *)(object))
+#define GST_STRUCTURE(object) (GST_STRUCTURE_CAST(object))
+
+
+/**
+ * GstStructureForeachFunc:
+ * @field_id: the #GQuark of the field name
+ * @value: the #GValue of the field
+ * @user_data: user data
+ *
+ * A function that will be called in gst_structure_foreach(). The function may
+ * not modify @value.
+ *
+ * Returns: %TRUE if the foreach operation should continue, %FALSE if
+ * the foreach operation should stop with %FALSE.
+ */
+typedef gboolean (*GstStructureForeachFunc) (GQuark field_id,
+ const GValue * value,
+ gpointer user_data);
+
+/**
+ * GstStructureMapFunc:
+ * @field_id: the #GQuark of the field name
+ * @value: the #GValue of the field
+ * @user_data: user data
+ *
+ * A function that will be called in gst_structure_map_in_place(). The function
+ * may modify @value.
+ *
+ * Returns: %TRUE if the map operation should continue, %FALSE if
+ * the map operation should stop with %FALSE.
+ */
+typedef gboolean (*GstStructureMapFunc) (GQuark field_id,
+ GValue * value,
+ gpointer user_data);
+
+/**
+ * GstStructureFilterMapFunc:
+ * @field_id: the #GQuark of the field name
+ * @value: the #GValue of the field
+ * @user_data: user data
+ *
+ * A function that will be called in gst_structure_filter_and_map_in_place().
+ * The function may modify @value, and the value will be removed from
+ * the structure if %FALSE is returned.
+ *
+ * Returns: %TRUE if the field should be preserved, %FALSE if it
+ * should be removed.
+ */
+typedef gboolean (*GstStructureFilterMapFunc) (GQuark field_id,
+ GValue * value,
+ gpointer user_data);
+
+/**
+ * GstStructure:
+ * @type: the GType of a structure
+ *
+ * The GstStructure object. Most fields are private.
+ */
+struct _GstStructure {
+ GType type;
+
+ /*< private >*/
+ GQuark name;
+};
+
+GST_API
+GType gst_structure_get_type (void);
+
+GST_API
+GstStructure * gst_structure_new_empty (const gchar * name) G_GNUC_MALLOC;
+
+GST_API
+GstStructure * gst_structure_new_id_empty (GQuark quark) G_GNUC_MALLOC;
+
+GST_API
+GstStructure * gst_structure_new (const gchar * name,
+ const gchar * firstfield,
+ ...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
+GST_API
+GstStructure * gst_structure_new_valist (const gchar * name,
+ const gchar * firstfield,
+ va_list varargs) G_GNUC_MALLOC;
+GST_API
+GstStructure * gst_structure_new_id (GQuark name_quark,
+ GQuark field_quark,
+ ...) G_GNUC_MALLOC;
+GST_API
+GstStructure * gst_structure_new_from_string (const gchar * string);
+
+GST_API
+GstStructure * gst_structure_copy (const GstStructure * structure) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_structure_set_parent_refcount (GstStructure * structure,
+ gint * refcount);
+GST_API
+void gst_structure_free (GstStructure * structure);
+
+GST_API
+void gst_clear_structure (GstStructure **structure_ptr);
+#define gst_clear_structure(structure_ptr) g_clear_pointer ((structure_ptr), gst_structure_free)
+
+GST_API
+gboolean gst_structure_take (GstStructure ** oldstr_ptr,
+ GstStructure * newstr);
+GST_API
+const gchar * gst_structure_get_name (const GstStructure * structure);
+
+GST_API
+GQuark gst_structure_get_name_id (const GstStructure * structure);
+
+GST_API
+gboolean gst_structure_has_name (const GstStructure * structure,
+ const gchar * name);
+GST_API
+void gst_structure_set_name (GstStructure * structure,
+ const gchar * name);
+GST_API
+void gst_structure_id_set_value (GstStructure * structure,
+ GQuark field,
+ const GValue * value);
+GST_API
+void gst_structure_set_value (GstStructure * structure,
+ const gchar * fieldname,
+ const GValue * value);
+GST_API
+void gst_structure_set_array (GstStructure * structure,
+ const gchar * fieldname,
+ const GValueArray * array);
+GST_API
+void gst_structure_set_list (GstStructure * structure,
+ const gchar * fieldname,
+ const GValueArray * array);
+GST_API
+void gst_structure_id_take_value (GstStructure * structure,
+ GQuark field,
+ GValue * value);
+GST_API
+void gst_structure_take_value (GstStructure * structure,
+ const gchar * fieldname,
+ GValue * value);
+GST_API
+void gst_structure_set (GstStructure * structure,
+ const gchar * fieldname,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_structure_set_valist (GstStructure * structure,
+ const gchar * fieldname,
+ va_list varargs);
+GST_API
+void gst_structure_id_set (GstStructure * structure,
+ GQuark fieldname,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_structure_id_set_valist (GstStructure * structure,
+ GQuark fieldname,
+ va_list varargs);
+GST_API
+gboolean gst_structure_get_valist (const GstStructure * structure,
+ const char * first_fieldname,
+ va_list args);
+GST_API
+gboolean gst_structure_get (const GstStructure * structure,
+ const char * first_fieldname,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+gboolean gst_structure_id_get_valist (const GstStructure * structure,
+ GQuark first_field_id,
+ va_list args);
+GST_API
+gboolean gst_structure_id_get (const GstStructure * structure,
+ GQuark first_field_id,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+const GValue * gst_structure_id_get_value (const GstStructure * structure,
+ GQuark field);
+GST_API
+const GValue * gst_structure_get_value (const GstStructure * structure,
+ const gchar * fieldname);
+GST_API
+void gst_structure_remove_field (GstStructure * structure,
+ const gchar * fieldname);
+GST_API
+void gst_structure_remove_fields (GstStructure * structure,
+ const gchar * fieldname,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_structure_remove_fields_valist (GstStructure * structure,
+ const gchar * fieldname,
+ va_list varargs);
+GST_API
+void gst_structure_remove_all_fields (GstStructure * structure);
+
+GST_API
+GType gst_structure_get_field_type (const GstStructure * structure,
+ const gchar * fieldname);
+GST_API
+gboolean gst_structure_foreach (const GstStructure * structure,
+ GstStructureForeachFunc func,
+ gpointer user_data);
+GST_API
+gboolean gst_structure_map_in_place (GstStructure * structure,
+ GstStructureMapFunc func,
+ gpointer user_data);
+GST_API
+void gst_structure_filter_and_map_in_place (GstStructure * structure,
+ GstStructureFilterMapFunc func,
+ gpointer user_data);
+GST_API
+gint gst_structure_n_fields (const GstStructure * structure);
+
+GST_API
+const gchar * gst_structure_nth_field_name (const GstStructure * structure,
+ guint index);
+GST_API
+gboolean gst_structure_id_has_field (const GstStructure * structure,
+ GQuark field);
+GST_API
+gboolean gst_structure_id_has_field_typed (const GstStructure * structure,
+ GQuark field,
+ GType type);
+GST_API
+gboolean gst_structure_has_field (const GstStructure * structure,
+ const gchar * fieldname);
+GST_API
+gboolean gst_structure_has_field_typed (const GstStructure * structure,
+ const gchar * fieldname,
+ GType type);
+
+/* utility functions */
+
+GST_API
+gboolean gst_structure_get_boolean (const GstStructure * structure,
+ const gchar * fieldname,
+ gboolean * value);
+GST_API
+gboolean gst_structure_get_int (const GstStructure * structure,
+ const gchar * fieldname,
+ gint * value);
+GST_API
+gboolean gst_structure_get_uint (const GstStructure * structure,
+ const gchar * fieldname,
+ guint * value);
+GST_API
+gboolean gst_structure_get_int64 (const GstStructure * structure,
+ const gchar * fieldname,
+ gint64 * value);
+GST_API
+gboolean gst_structure_get_uint64 (const GstStructure * structure,
+ const gchar * fieldname,
+ guint64 * value);
+GST_API
+gboolean gst_structure_get_double (const GstStructure * structure,
+ const gchar * fieldname,
+ gdouble * value);
+GST_API
+gboolean gst_structure_get_date (const GstStructure * structure,
+ const gchar * fieldname,
+ GDate ** value);
+GST_API
+gboolean gst_structure_get_date_time (const GstStructure * structure,
+ const gchar * fieldname,
+ GstDateTime ** value);
+GST_API
+gboolean gst_structure_get_clock_time (const GstStructure * structure,
+ const gchar * fieldname,
+ GstClockTime * value);
+GST_API
+const gchar * gst_structure_get_string (const GstStructure * structure,
+ const gchar * fieldname);
+GST_API
+gboolean gst_structure_get_enum (const GstStructure * structure,
+ const gchar * fieldname,
+ GType enumtype,
+ gint * value);
+GST_API
+gboolean gst_structure_get_fraction (const GstStructure * structure,
+ const gchar * fieldname,
+ gint * value_numerator,
+ gint * value_denominator);
+GST_API
+gboolean gst_structure_get_flagset (const GstStructure * structure,
+ const gchar * fieldname,
+ guint * value_flags,
+ guint * value_mask);
+GST_API
+gboolean gst_structure_get_array (GstStructure * structure,
+ const gchar * fieldname,
+ GValueArray ** array);
+GST_API
+gboolean gst_structure_get_list (GstStructure * structure,
+ const gchar * fieldname,
+ GValueArray ** array);
+GST_API
+gchar * gst_structure_to_string (const GstStructure * structure) G_GNUC_MALLOC;
+GST_API
+gchar * gst_structure_serialize (const GstStructure * structure,
+ GstSerializeFlags flags) G_GNUC_MALLOC;
+
+GST_API
+GstStructure * gst_structure_from_string (const gchar * string,
+ gchar ** end) G_GNUC_MALLOC;
+GST_API
+gboolean gst_structure_fixate_field_nearest_int (GstStructure * structure,
+ const char * field_name,
+ int target);
+GST_API
+gboolean gst_structure_fixate_field_nearest_double (GstStructure * structure,
+ const char * field_name,
+ double target);
+GST_API
+gboolean gst_structure_fixate_field_boolean (GstStructure * structure,
+ const char * field_name,
+ gboolean target);
+GST_API
+gboolean gst_structure_fixate_field_string (GstStructure * structure,
+ const char * field_name,
+ const gchar * target);
+GST_API
+gboolean gst_structure_fixate_field_nearest_fraction (GstStructure * structure,
+ const char * field_name,
+ const gint target_numerator,
+ const gint target_denominator);
+GST_API
+gboolean gst_structure_fixate_field (GstStructure * structure,
+ const char * field_name);
+GST_API
+void gst_structure_fixate (GstStructure * structure);
+
+GST_API
+gboolean gst_structure_is_equal (const GstStructure * structure1,
+ const GstStructure * structure2);
+GST_API
+gboolean gst_structure_is_subset (const GstStructure * subset,
+ const GstStructure * superset);
+GST_API
+gboolean gst_structure_can_intersect (const GstStructure * struct1,
+ const GstStructure * struct2);
+GST_API
+GstStructure * gst_structure_intersect (const GstStructure * struct1,
+ const GstStructure * struct2) G_GNUC_MALLOC;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstStructure, gst_structure_free)
+
+G_END_DECLS
+
+#endif
+
diff --git a/include/gst/gstsystemclock.h b/include/gst/gstsystemclock.h
new file mode 100644
index 0000000000..01b1f22a47
--- /dev/null
+++ b/include/gst/gstsystemclock.h
@@ -0,0 +1,97 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ *
+ * gstsystemclock.h: A clock implementation based on system time
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_SYSTEM_CLOCK_H__
+#define __GST_SYSTEM_CLOCK_H__
+
+#include <gst/gstclock.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_SYSTEM_CLOCK (gst_system_clock_get_type ())
+#define GST_SYSTEM_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClock))
+#define GST_SYSTEM_CLOCK_CAST(obj) ((GstSystemClock *)(obj))
+#define GST_IS_SYSTEM_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SYSTEM_CLOCK))
+#define GST_SYSTEM_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass))
+#define GST_IS_SYSTEM_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SYSTEM_CLOCK))
+#define GST_SYSTEM_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass))
+
+
+typedef struct _GstSystemClock GstSystemClock;
+typedef struct _GstSystemClockClass GstSystemClockClass;
+typedef struct _GstSystemClockPrivate GstSystemClockPrivate;
+
+/**
+ * GstClockType:
+ * @GST_CLOCK_TYPE_REALTIME: time since Epoch
+ * @GST_CLOCK_TYPE_MONOTONIC: monotonic time since some unspecified starting
+ * point
+ * @GST_CLOCK_TYPE_OTHER: some other time source is used (Since: 1.0.5)
+ * @GST_CLOCK_TYPE_TAI: time since Epoch, but using International Atomic Time
+ * as reference (Since: 1.18)
+ *
+ * The different kind of clocks.
+ */
+typedef enum {
+ GST_CLOCK_TYPE_REALTIME = 0,
+ GST_CLOCK_TYPE_MONOTONIC = 1,
+ GST_CLOCK_TYPE_OTHER = 2,
+ GST_CLOCK_TYPE_TAI = 3
+} GstClockType;
+
+/**
+ * GstSystemClock:
+ *
+ * The default implementation of a #GstClock that uses the system time.
+ */
+struct _GstSystemClock {
+ GstClock clock;
+
+ /*< private >*/
+ GstSystemClockPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstSystemClockClass {
+ GstClockClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_system_clock_get_type (void);
+
+GST_API
+GstClock* gst_system_clock_obtain (void);
+
+GST_API
+void gst_system_clock_set_default (GstClock *new_clock);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstSystemClock, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_SYSTEM_CLOCK_H__ */
diff --git a/include/gst/gsttaglist.h b/include/gst/gsttaglist.h
new file mode 100644
index 0000000000..c15ea2d34f
--- /dev/null
+++ b/include/gst/gsttaglist.h
@@ -0,0 +1,1122 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gsttaglist.h: Header for tag support
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_TAGLIST_H__
+#define __GST_TAGLIST_H__
+
+#include <gst/gstdatetime.h>
+#include <gst/gstsample.h>
+#include <gst/gstbuffer.h>
+#include <gst/glib-compat.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstTagMergeMode:
+ * @GST_TAG_MERGE_UNDEFINED: undefined merge mode
+ * @GST_TAG_MERGE_REPLACE_ALL: replace all tags (clear list and append)
+ * @GST_TAG_MERGE_REPLACE: replace tags
+ * @GST_TAG_MERGE_APPEND: append tags
+ * @GST_TAG_MERGE_PREPEND: prepend tags
+ * @GST_TAG_MERGE_KEEP: keep existing tags
+ * @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
+ * @GST_TAG_MERGE_COUNT: the number of merge modes
+ *
+ * The different tag merging modes are basically replace, overwrite and append,
+ * but they can be seen from two directions. Given two taglists: (A) the tags
+ * already in the element and (B) the ones that are supplied to the element (
+ * e.g. via gst_tag_setter_merge_tags() / gst_tag_setter_add_tags() or a
+ * %GST_EVENT_TAG), how are these tags merged?
+ * In the table below this is shown for the cases that a tag exists in the list
+ * (A) or does not exists (!A) and combinations thereof.
+ *
+ * | merge mode | A + B | A + !B | !A + B | !A + !B |
+ * | ----------- | ----- | ------ | ------ | ------- |
+ * | REPLACE_ALL | B | ø | B | ø |
+ * | REPLACE | B | A | B | ø |
+ * | APPEND | A, B | A | B | ø |
+ * | PREPEND | B, A | A | B | ø |
+ * | KEEP | A | A | B | ø |
+ * | KEEP_ALL | A | A | ø | ø |
+ */
+
+typedef enum {
+ GST_TAG_MERGE_UNDEFINED,
+ GST_TAG_MERGE_REPLACE_ALL,
+ GST_TAG_MERGE_REPLACE,
+ GST_TAG_MERGE_APPEND,
+ GST_TAG_MERGE_PREPEND,
+ GST_TAG_MERGE_KEEP,
+ GST_TAG_MERGE_KEEP_ALL,
+ /* add more */
+ GST_TAG_MERGE_COUNT
+} GstTagMergeMode;
+
+#define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
+
+/**
+ * GstTagFlag:
+ * @GST_TAG_FLAG_UNDEFINED: undefined flag
+ * @GST_TAG_FLAG_META: tag is meta data
+ * @GST_TAG_FLAG_ENCODED: tag is encoded
+ * @GST_TAG_FLAG_DECODED: tag is decoded
+ * @GST_TAG_FLAG_COUNT: number of tag flags
+ *
+ * Extra tag flags used when registering tags.
+ */
+/* FIXME: these are not really flags .. */
+typedef enum {
+ GST_TAG_FLAG_UNDEFINED,
+ GST_TAG_FLAG_META,
+ GST_TAG_FLAG_ENCODED,
+ GST_TAG_FLAG_DECODED,
+ GST_TAG_FLAG_COUNT
+} GstTagFlag;
+
+#define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
+
+/**
+ * GstTagList:
+ * @mini_object: the parent type
+ *
+ * Object describing tags / metadata.
+ */
+typedef struct _GstTagList GstTagList;
+struct _GstTagList {
+ GstMiniObject mini_object;
+};
+
+GST_API GType _gst_tag_list_type;
+
+#define GST_TAG_LIST(x) ((GstTagList *) (x))
+#define GST_TYPE_TAG_LIST (_gst_tag_list_type)
+#define GST_IS_TAG_LIST(obj) (GST_IS_MINI_OBJECT_TYPE((obj), GST_TYPE_TAG_LIST))
+
+/**
+ * GstTagForeachFunc:
+ * @list: the #GstTagList
+ * @tag: a name of a tag in @list
+ * @user_data: user data
+ *
+ * A function that will be called in gst_tag_list_foreach(). The function may
+ * not modify the tag list.
+ */
+typedef void (*GstTagForeachFunc) (const GstTagList * list,
+ const gchar * tag,
+ gpointer user_data);
+
+/**
+ * GstTagMergeFunc:
+ * @dest: the destination #GValue
+ * @src: the source #GValue
+ *
+ * A function for merging multiple values of a tag used when registering
+ * tags.
+ */
+typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
+
+GST_API
+GType gst_tag_list_get_type (void);
+
+/* tag registration */
+
+GST_API
+void gst_tag_register (const gchar * name,
+ GstTagFlag flag,
+ GType type,
+ const gchar * nick,
+ const gchar * blurb,
+ GstTagMergeFunc func);
+GST_API
+void gst_tag_register_static (const gchar * name,
+ GstTagFlag flag,
+ GType type,
+ const gchar * nick,
+ const gchar * blurb,
+ GstTagMergeFunc func);
+
+/* some default merging functions */
+
+GST_API
+void gst_tag_merge_use_first (GValue * dest, const GValue * src);
+
+GST_API
+void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
+
+/* basic tag support */
+
+GST_API
+gboolean gst_tag_exists (const gchar * tag);
+
+GST_API
+GType gst_tag_get_type (const gchar * tag);
+
+GST_API
+const gchar * gst_tag_get_nick (const gchar * tag);
+
+GST_API
+const gchar * gst_tag_get_description (const gchar * tag);
+
+GST_API
+GstTagFlag gst_tag_get_flag (const gchar * tag);
+
+GST_API
+gboolean gst_tag_is_fixed (const gchar * tag);
+
+/* tag lists */
+
+/**
+ * GstTagScope:
+ * @GST_TAG_SCOPE_STREAM: tags specific to this single stream
+ * @GST_TAG_SCOPE_GLOBAL: global tags for the complete medium
+ *
+ * GstTagScope specifies if a taglist applies to the complete
+ * medium or only to one single stream.
+ */
+typedef enum {
+ GST_TAG_SCOPE_STREAM,
+ GST_TAG_SCOPE_GLOBAL
+} GstTagScope;
+
+GST_API
+GstTagList * gst_tag_list_new_empty (void) G_GNUC_MALLOC;
+
+GST_API
+GstTagList * gst_tag_list_new (const gchar * tag, ...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
+
+GST_API
+GstTagList * gst_tag_list_new_valist (va_list var_args) G_GNUC_MALLOC;
+
+GST_API
+void gst_tag_list_set_scope (GstTagList * list, GstTagScope scope);
+
+GST_API
+GstTagScope gst_tag_list_get_scope (const GstTagList * list);
+
+GST_API
+gchar * gst_tag_list_to_string (const GstTagList * list) G_GNUC_MALLOC;
+
+GST_API
+GstTagList * gst_tag_list_new_from_string (const gchar * str) G_GNUC_MALLOC;
+
+GST_API
+gint gst_tag_list_n_tags (const GstTagList * list);
+
+GST_API
+const gchar* gst_tag_list_nth_tag_name (const GstTagList * list, guint index);
+
+GST_API
+gboolean gst_tag_list_is_empty (const GstTagList * list);
+
+GST_API
+gboolean gst_tag_list_is_equal (const GstTagList * list1,
+ const GstTagList * list2);
+GST_API
+void gst_tag_list_insert (GstTagList * into,
+ const GstTagList * from,
+ GstTagMergeMode mode);
+GST_API
+GstTagList * gst_tag_list_merge (const GstTagList * list1,
+ const GstTagList * list2,
+ GstTagMergeMode mode) G_GNUC_MALLOC;
+GST_API
+guint gst_tag_list_get_tag_size (const GstTagList * list,
+ const gchar * tag);
+GST_API
+void gst_tag_list_add (GstTagList * list,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_tag_list_add_values (GstTagList * list,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_tag_list_add_valist (GstTagList * list,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ va_list var_args);
+GST_API
+void gst_tag_list_add_valist_values (GstTagList * list,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ va_list var_args);
+GST_API
+void gst_tag_list_add_value (GstTagList * list,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ const GValue * value);
+GST_API
+void gst_tag_list_remove_tag (GstTagList * list,
+ const gchar * tag);
+GST_API
+void gst_tag_list_foreach (const GstTagList * list,
+ GstTagForeachFunc func,
+ gpointer user_data);
+GST_API
+const GValue *
+ gst_tag_list_get_value_index (const GstTagList * list,
+ const gchar * tag,
+ guint index);
+GST_API
+gboolean gst_tag_list_copy_value (GValue * dest,
+ const GstTagList * list,
+ const gchar * tag);
+
+/* simplifications (FIXME: do we want them?) */
+
+GST_API
+gboolean gst_tag_list_get_boolean (const GstTagList * list,
+ const gchar * tag,
+ gboolean * value);
+GST_API
+gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gboolean * value);
+GST_API
+gboolean gst_tag_list_get_int (const GstTagList * list,
+ const gchar * tag,
+ gint * value);
+GST_API
+gboolean gst_tag_list_get_int_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gint * value);
+GST_API
+gboolean gst_tag_list_get_uint (const GstTagList * list,
+ const gchar * tag,
+ guint * value);
+GST_API
+gboolean gst_tag_list_get_uint_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ guint * value);
+GST_API
+gboolean gst_tag_list_get_int64 (const GstTagList * list,
+ const gchar * tag,
+ gint64 * value);
+GST_API
+gboolean gst_tag_list_get_int64_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gint64 * value);
+GST_API
+gboolean gst_tag_list_get_uint64 (const GstTagList * list,
+ const gchar * tag,
+ guint64 * value);
+GST_API
+gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ guint64 * value);
+GST_API
+gboolean gst_tag_list_get_float (const GstTagList * list,
+ const gchar * tag,
+ gfloat * value);
+GST_API
+gboolean gst_tag_list_get_float_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gfloat * value);
+GST_API
+gboolean gst_tag_list_get_double (const GstTagList * list,
+ const gchar * tag,
+ gdouble * value);
+GST_API
+gboolean gst_tag_list_get_double_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gdouble * value);
+GST_API
+gboolean gst_tag_list_get_string (const GstTagList * list,
+ const gchar * tag,
+ gchar ** value);
+GST_API
+gboolean gst_tag_list_get_string_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gchar ** value);
+GST_API
+gboolean gst_tag_list_peek_string_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ const gchar ** value);
+GST_API
+gboolean gst_tag_list_get_pointer (const GstTagList * list,
+ const gchar * tag,
+ gpointer * value);
+GST_API
+gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ gpointer * value);
+GST_API
+gboolean gst_tag_list_get_date (const GstTagList * list,
+ const gchar * tag,
+ GDate ** value);
+GST_API
+gboolean gst_tag_list_get_date_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ GDate ** value);
+GST_API
+gboolean gst_tag_list_get_date_time (const GstTagList * list,
+ const gchar * tag,
+ GstDateTime ** value);
+GST_API
+gboolean gst_tag_list_get_date_time_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ GstDateTime ** value);
+GST_API
+gboolean gst_tag_list_get_sample (const GstTagList * list,
+ const gchar * tag,
+ GstSample ** sample);
+GST_API
+gboolean gst_tag_list_get_sample_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ GstSample ** sample);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+/* refcounting */
+static inline GstTagList *
+gst_tag_list_ref (GstTagList * taglist)
+{
+ return (GstTagList *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (taglist));
+}
+
+static inline void
+gst_tag_list_unref (GstTagList * taglist)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (taglist));
+}
+
+static inline void
+gst_clear_tag_list (GstTagList ** taglist_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) taglist_ptr);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstTagList * gst_tag_list_ref (GstTagList * taglist);
+
+GST_API
+void gst_tag_list_unref (GstTagList * taglist);
+
+GST_API
+void gst_clear_tag_list (GstTagList ** taglist_ptr);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+GST_API
+GstTagList* gst_tag_list_copy(const GstTagList* taglist);
+
+#define gst_tag_list_copy(taglist) GST_TAG_LIST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (taglist)))
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline gboolean
+gst_tag_list_replace (GstTagList **old_taglist, GstTagList *new_taglist)
+{
+ return gst_mini_object_replace ((GstMiniObject **) old_taglist,
+ (GstMiniObject *) new_taglist);
+}
+
+static inline gboolean
+gst_tag_list_take (GstTagList **old_taglist, GstTagList *new_taglist)
+{
+ return gst_mini_object_take ((GstMiniObject **) old_taglist,
+ (GstMiniObject *) new_taglist);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+gboolean gst_tag_list_replace (GstTagList ** old_taglist,
+ GstTagList * new_taglist);
+
+GST_API
+gboolean gst_tag_list_take (GstTagList ** old_taglist,
+ GstTagList * new_taglist);
+#endif
+
+/**
+ * gst_tag_list_is_writable:
+ * @taglist: a #GstTagList
+ *
+ * Tests if you can safely modify @taglist. It is only safe to modify taglist
+ * when there is only one owner of the taglist - ie, the refcount is 1.
+ */
+#define gst_tag_list_is_writable(taglist) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (taglist))
+
+/**
+ * gst_tag_list_make_writable:
+ * @taglist: (transfer full): a #GstTagList
+ *
+ * Returns a writable copy of @taglist.
+ *
+ * If there is only one reference count on @taglist, the caller must be the
+ * owner, and so this function will return the taglist object unchanged. If on
+ * the other hand there is more than one reference on the object, a new taglist
+ * object will be returned (which will be a copy of @taglist). The caller's
+ * reference on @taglist will be removed, and instead the caller will own a
+ * reference to the returned object.
+ *
+ * In short, this function unrefs the taglist in the argument and refs the
+ * taglist that it returns. Don't access the argument after calling this
+ * function. See also: gst_tag_list_ref().
+ *
+ * Returns: (transfer full): a writable taglist which may or may not be the
+ * same as @taglist
+ */
+#define gst_tag_list_make_writable(taglist) GST_TAG_LIST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (taglist)))
+
+/* GStreamer core tags */
+/**
+ * GST_TAG_TITLE:
+ *
+ * commonly used title (string)
+ *
+ * The title as it should be displayed, e.g. 'The Doll House'
+ */
+#define GST_TAG_TITLE "title"
+/**
+ * GST_TAG_TITLE_SORTNAME:
+ *
+ * commonly used title, as used for sorting (string)
+ *
+ * The title as it should be sorted, e.g. 'Doll House, The'
+ */
+#define GST_TAG_TITLE_SORTNAME "title-sortname"
+/**
+ * GST_TAG_ARTIST:
+ *
+ * person(s) responsible for the recording (string)
+ *
+ * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
+ * 'The Guitar Heroes'
+ */
+#define GST_TAG_ARTIST "artist"
+/**
+ * GST_TAG_ARTIST_SORTNAME:
+ *
+ * person(s) responsible for the recording, as used for sorting (string)
+ *
+ * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
+ * 'Guitar Heroes, The'
+ */
+#define GST_TAG_ARTIST_SORTNAME "artist-sortname"
+/**
+ * GST_TAG_ALBUM:
+ *
+ * album containing this data (string)
+ *
+ * The album name as it should be displayed, e.g. 'The Jazz Guitar'
+ */
+#define GST_TAG_ALBUM "album"
+/**
+ * GST_TAG_ALBUM_SORTNAME:
+ *
+ * album containing this data, as used for sorting (string)
+ *
+ * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
+ */
+#define GST_TAG_ALBUM_SORTNAME "album-sortname"
+/**
+ * GST_TAG_ALBUM_ARTIST:
+ *
+ * The artist of the entire album, as it should be displayed.
+ */
+#define GST_TAG_ALBUM_ARTIST "album-artist"
+/**
+ * GST_TAG_ALBUM_ARTIST_SORTNAME:
+ *
+ * The artist of the entire album, as it should be sorted.
+ */
+#define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
+/**
+ * GST_TAG_COMPOSER:
+ *
+ * person(s) who composed the recording (string)
+ */
+#define GST_TAG_COMPOSER "composer"
+/**
+ * GST_TAG_CONDUCTOR:
+ *
+ * conductor/performer refinement (string)
+ *
+ * Since: 1.8
+ */
+#define GST_TAG_CONDUCTOR "conductor"
+/**
+ * GST_TAG_DATE:
+ *
+ * date the data was created (#GDate structure)
+ */
+#define GST_TAG_DATE "date"
+/**
+ * GST_TAG_DATE_TIME:
+ *
+ * date and time the data was created (#GstDateTime structure)
+ */
+#define GST_TAG_DATE_TIME "datetime"
+/**
+ * GST_TAG_GENRE:
+ *
+ * genre this data belongs to (string)
+ */
+#define GST_TAG_GENRE "genre"
+/**
+ * GST_TAG_COMMENT:
+ *
+ * free text commenting the data (string)
+ */
+#define GST_TAG_COMMENT "comment"
+/**
+ * GST_TAG_EXTENDED_COMMENT:
+ *
+ * key/value text commenting the data (string)
+ *
+ * Must be in the form of 'key=comment' or
+ * 'key[lc]=comment' where 'lc' is an ISO-639
+ * language code.
+ *
+ * This tag is used for unknown Vorbis comment tags,
+ * unknown APE tags and certain ID3v2 comment fields.
+ */
+#define GST_TAG_EXTENDED_COMMENT "extended-comment"
+/**
+ * GST_TAG_TRACK_NUMBER:
+ *
+ * track number inside a collection (unsigned integer)
+ */
+#define GST_TAG_TRACK_NUMBER "track-number"
+/**
+ * GST_TAG_TRACK_COUNT:
+ *
+ * count of tracks inside collection this track belongs to (unsigned integer)
+ */
+#define GST_TAG_TRACK_COUNT "track-count"
+/**
+ * GST_TAG_ALBUM_VOLUME_NUMBER:
+ *
+ * disc number inside a collection (unsigned integer)
+ */
+#define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
+/**
+ * GST_TAG_ALBUM_VOLUME_COUNT:
+ *
+ * count of discs inside collection this disc belongs to (unsigned integer)
+ */
+#define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
+/**
+ * GST_TAG_LOCATION:
+ *
+ * Origin of media as a URI (location, where the original of the file or stream
+ * is hosted) (string)
+ */
+#define GST_TAG_LOCATION "location"
+/**
+ * GST_TAG_HOMEPAGE:
+ *
+ * Homepage for this media (i.e. artist or movie homepage) (string)
+ */
+#define GST_TAG_HOMEPAGE "homepage"
+/**
+ * GST_TAG_DESCRIPTION:
+ *
+ * short text describing the content of the data (string)
+ */
+#define GST_TAG_DESCRIPTION "description"
+/**
+ * GST_TAG_VERSION:
+ *
+ * version of this data (string)
+ */
+#define GST_TAG_VERSION "version"
+/**
+ * GST_TAG_ISRC:
+ *
+ * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
+ */
+#define GST_TAG_ISRC "isrc"
+/**
+ * GST_TAG_ORGANIZATION:
+ *
+ * organization (string)
+ */
+#define GST_TAG_ORGANIZATION "organization"
+/**
+ * GST_TAG_COPYRIGHT:
+ *
+ * copyright notice of the data (string)
+ */
+#define GST_TAG_COPYRIGHT "copyright"
+/**
+ * GST_TAG_COPYRIGHT_URI:
+ *
+ * URI to location where copyright details can be found (string)
+ */
+#define GST_TAG_COPYRIGHT_URI "copyright-uri"
+/**
+ * GST_TAG_ENCODED_BY:
+ *
+ * name of the person or organisation that encoded the file. May contain a
+ * copyright message if the person or organisation also holds the copyright
+ * (string)
+ *
+ * Note: do not use this field to describe the encoding application. Use
+ * #GST_TAG_APPLICATION_NAME or #GST_TAG_COMMENT for that.
+ */
+#define GST_TAG_ENCODED_BY "encoded-by"
+/**
+ * GST_TAG_CONTACT:
+ *
+ * contact information (string)
+ */
+#define GST_TAG_CONTACT "contact"
+/**
+ * GST_TAG_LICENSE:
+ *
+ * license of data (string)
+ */
+#define GST_TAG_LICENSE "license"
+/**
+ * GST_TAG_LICENSE_URI:
+ *
+ * URI to location where license details can be found (string)
+ */
+#define GST_TAG_LICENSE_URI "license-uri"
+/**
+ * GST_TAG_PERFORMER:
+ *
+ * person(s) performing (string)
+ */
+#define GST_TAG_PERFORMER "performer"
+/**
+ * GST_TAG_DURATION:
+ *
+ * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
+ */
+#define GST_TAG_DURATION "duration"
+/**
+ * GST_TAG_CODEC:
+ *
+ * codec the data is stored in (string)
+ */
+#define GST_TAG_CODEC "codec"
+/**
+ * GST_TAG_VIDEO_CODEC:
+ *
+ * codec the video data is stored in (string)
+ */
+#define GST_TAG_VIDEO_CODEC "video-codec"
+/**
+ * GST_TAG_AUDIO_CODEC:
+ *
+ * codec the audio data is stored in (string)
+ */
+#define GST_TAG_AUDIO_CODEC "audio-codec"
+/**
+ * GST_TAG_SUBTITLE_CODEC:
+ *
+ * codec/format the subtitle data is stored in (string)
+ */
+#define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
+/**
+ * GST_TAG_CONTAINER_FORMAT:
+ *
+ * container format the data is stored in (string)
+ */
+#define GST_TAG_CONTAINER_FORMAT "container-format"
+/**
+ * GST_TAG_BITRATE:
+ *
+ * exact or average bitrate in bits/s (unsigned integer)
+ */
+#define GST_TAG_BITRATE "bitrate"
+/**
+ * GST_TAG_NOMINAL_BITRATE:
+ *
+ * nominal bitrate in bits/s (unsigned integer). The actual bitrate might be
+ * different from this target bitrate.
+ */
+#define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
+/**
+ * GST_TAG_MINIMUM_BITRATE:
+ *
+ * minimum bitrate in bits/s (unsigned integer)
+ */
+#define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
+/**
+ * GST_TAG_MAXIMUM_BITRATE:
+ *
+ * maximum bitrate in bits/s (unsigned integer)
+ */
+#define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
+/**
+ * GST_TAG_SERIAL:
+ *
+ * serial number of track (unsigned integer)
+ */
+#define GST_TAG_SERIAL "serial"
+/**
+ * GST_TAG_ENCODER:
+ *
+ * encoder used to encode this stream (string)
+ */
+#define GST_TAG_ENCODER "encoder"
+/**
+ * GST_TAG_ENCODER_VERSION:
+ *
+ * version of the encoder used to encode this stream (unsigned integer)
+ */
+#define GST_TAG_ENCODER_VERSION "encoder-version"
+/**
+ * GST_TAG_TRACK_GAIN:
+ *
+ * track gain in db (double)
+ */
+#define GST_TAG_TRACK_GAIN "replaygain-track-gain"
+/**
+ * GST_TAG_TRACK_PEAK:
+ *
+ * peak of the track (double)
+ */
+#define GST_TAG_TRACK_PEAK "replaygain-track-peak"
+/**
+ * GST_TAG_ALBUM_GAIN:
+ *
+ * album gain in db (double)
+ */
+#define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
+/**
+ * GST_TAG_ALBUM_PEAK:
+ *
+ * peak of the album (double)
+ */
+#define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
+/**
+ * GST_TAG_REFERENCE_LEVEL:
+ *
+ * reference level of track and album gain values (double)
+ */
+#define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
+/**
+ * GST_TAG_LANGUAGE_CODE:
+ *
+ * ISO-639-2 or ISO-639-1 code for the language the content is in (string)
+ *
+ * There is utility API in libgsttag in gst-plugins-base to obtain a translated
+ * language name from the language code: `gst_tag_get_language_name()`
+ */
+#define GST_TAG_LANGUAGE_CODE "language-code"
+/**
+ * GST_TAG_LANGUAGE_NAME:
+ *
+ * Name of the language the content is in (string)
+ *
+ * Free-form name of the language the content is in, if a language code
+ * is not available. This tag should not be set in addition to a language
+ * code. It is undefined what language or locale the language name is in.
+ */
+#define GST_TAG_LANGUAGE_NAME "language-name"
+/**
+ * GST_TAG_IMAGE:
+ *
+ * image (sample) (sample taglist should specify the content type and preferably
+ * also set "image-type" field as `GstTagImageType`)
+ */
+#define GST_TAG_IMAGE "image"
+/**
+ * GST_TAG_PREVIEW_IMAGE:
+ *
+ * image that is meant for preview purposes, e.g. small icon-sized version
+ * (sample) (sample taglist should specify the content type)
+ */
+#define GST_TAG_PREVIEW_IMAGE "preview-image"
+
+/**
+ * GST_TAG_ATTACHMENT:
+ *
+ * generic file attachment (sample) (sample taglist should specify the content
+ * type and if possible set "filename" to the file name of the
+ * attachment)
+ */
+#define GST_TAG_ATTACHMENT "attachment"
+
+/**
+ * GST_TAG_BEATS_PER_MINUTE:
+ *
+ * number of beats per minute in audio (double)
+ */
+#define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
+
+/**
+ * GST_TAG_KEYWORDS:
+ *
+ * comma separated keywords describing the content (string).
+ */
+#define GST_TAG_KEYWORDS "keywords"
+
+/**
+ * GST_TAG_GEO_LOCATION_NAME:
+ *
+ * human readable descriptive location of where the media has been recorded or
+ * produced. (string).
+ */
+#define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
+
+/**
+ * GST_TAG_GEO_LOCATION_LATITUDE:
+ *
+ * geo latitude location of where the media has been recorded or produced in
+ * degrees according to WGS84 (zero at the equator, negative values for southern
+ * latitudes) (double).
+ */
+#define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
+
+/**
+ * GST_TAG_GEO_LOCATION_LONGITUDE:
+ *
+ * geo longitude location of where the media has been recorded or produced in
+ * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
+ * negative values for western longitudes). (double).
+ */
+#define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
+
+/**
+ * GST_TAG_GEO_LOCATION_ELEVATION:
+ *
+ * geo elevation of where the media has been recorded or produced in meters
+ * according to WGS84 (zero is average sea level) (double).
+ */
+#define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
+/**
+ * GST_TAG_GEO_LOCATION_COUNTRY:
+ *
+ * The country (english name) where the media has been produced (string).
+ */
+#define GST_TAG_GEO_LOCATION_COUNTRY "geo-location-country"
+/**
+ * GST_TAG_GEO_LOCATION_CITY:
+ *
+ * The city (english name) where the media has been produced (string).
+ */
+#define GST_TAG_GEO_LOCATION_CITY "geo-location-city"
+/**
+ * GST_TAG_GEO_LOCATION_SUBLOCATION:
+ *
+ * A location 'smaller' than GST_TAG_GEO_LOCATION_CITY that specifies better
+ * where the media has been produced. (e.g. the neighborhood) (string).
+ *
+ * This tag has been added as this is how it is handled/named in XMP's
+ * Iptc4xmpcore schema.
+ */
+#define GST_TAG_GEO_LOCATION_SUBLOCATION "geo-location-sublocation"
+/**
+ * GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR:
+ *
+ * Represents the expected error on the horizontal positioning in
+ * meters (double).
+ */
+#define GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR "geo-location-horizontal-error"
+/**
+ * GST_TAG_GEO_LOCATION_MOVEMENT_SPEED:
+ *
+ * Speed of the capturing device when performing the capture.
+ * Represented in m/s. (double)
+ *
+ * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
+ */
+#define GST_TAG_GEO_LOCATION_MOVEMENT_SPEED "geo-location-movement-speed"
+/**
+ * GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION:
+ *
+ * Indicates the movement direction of the device performing the capture
+ * of a media. It is represented as degrees in floating point representation,
+ * 0 means the geographic north, and increases clockwise (double from 0 to 360)
+ *
+ * See also #GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
+ */
+#define GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION "geo-location-movement-direction"
+/**
+ * GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION:
+ *
+ * Indicates the direction the device is pointing to when capturing
+ * a media. It is represented as degrees in floating point representation,
+ * 0 means the geographic north, and increases clockwise (double from 0 to 360)
+ *
+ * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
+ */
+#define GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION "geo-location-capture-direction"
+/**
+ * GST_TAG_SHOW_NAME:
+ *
+ * Name of the show, used for displaying (string)
+ */
+#define GST_TAG_SHOW_NAME "show-name"
+/**
+ * GST_TAG_SHOW_SORTNAME:
+ *
+ * Name of the show, used for sorting (string)
+ */
+#define GST_TAG_SHOW_SORTNAME "show-sortname"
+/**
+ * GST_TAG_SHOW_EPISODE_NUMBER:
+ *
+ * Number of the episode within a season/show (unsigned integer)
+ */
+#define GST_TAG_SHOW_EPISODE_NUMBER "show-episode-number"
+/**
+ * GST_TAG_SHOW_SEASON_NUMBER:
+ *
+ * Number of the season of a show/series (unsigned integer)
+ */
+#define GST_TAG_SHOW_SEASON_NUMBER "show-season-number"
+/**
+ * GST_TAG_LYRICS:
+ *
+ * The lyrics of the media (string)
+ */
+#define GST_TAG_LYRICS "lyrics"
+/**
+ * GST_TAG_COMPOSER_SORTNAME:
+ *
+ * The composer's name, used for sorting (string)
+ */
+#define GST_TAG_COMPOSER_SORTNAME "composer-sortname"
+/**
+ * GST_TAG_GROUPING:
+ *
+ * Groups together media that are related and spans multiple tracks. An
+ * example are multiple pieces of a concerto. (string)
+ */
+#define GST_TAG_GROUPING "grouping"
+/**
+ * GST_TAG_USER_RATING:
+ *
+ * Rating attributed by a person (likely the application user).
+ * The higher the value, the more the user likes this media
+ * (unsigned int from 0 to 100)
+ */
+#define GST_TAG_USER_RATING "user-rating"
+/**
+ * GST_TAG_DEVICE_MANUFACTURER:
+ *
+ * Manufacturer of the device used to create the media (string)
+ */
+#define GST_TAG_DEVICE_MANUFACTURER "device-manufacturer"
+/**
+ * GST_TAG_DEVICE_MODEL:
+ *
+ * Model of the device used to create the media (string)
+ */
+#define GST_TAG_DEVICE_MODEL "device-model"
+/**
+ * GST_TAG_APPLICATION_NAME:
+ *
+ * Name of the application used to create the media (string)
+ */
+#define GST_TAG_APPLICATION_NAME "application-name"
+/**
+ * GST_TAG_APPLICATION_DATA:
+ *
+ * Arbitrary application data (sample)
+ *
+ * Some formats allow applications to add their own arbitrary data
+ * into files. This data is application dependent.
+ */
+#define GST_TAG_APPLICATION_DATA "application-data"
+/**
+ * GST_TAG_IMAGE_ORIENTATION:
+ *
+ * Represents the 'Orientation' tag from EXIF. Defines how the image
+ * should be rotated and mirrored for display. (string)
+ *
+ * This tag has a predefined set of allowed values:
+ * "rotate-0"
+ * "rotate-90"
+ * "rotate-180"
+ * "rotate-270"
+ * "flip-rotate-0"
+ * "flip-rotate-90"
+ * "flip-rotate-180"
+ * "flip-rotate-270"
+ *
+ * The naming is adopted according to a possible transformation to perform
+ * on the image to fix its orientation, obviously equivalent operations will
+ * yield the same result.
+ *
+ * Rotations indicated by the values are in clockwise direction and
+ * 'flip' means an horizontal mirroring.
+ */
+#define GST_TAG_IMAGE_ORIENTATION "image-orientation"
+/**
+ * GST_TAG_PUBLISHER:
+ *
+ * Name of the label or publisher (string)
+ *
+ * Since: 1.2
+ */
+#define GST_TAG_PUBLISHER "publisher"
+/**
+ * GST_TAG_INTERPRETED_BY:
+ *
+ * Information about the people behind a remix and similar
+ * interpretations of another existing piece (string)
+ *
+ * Since: 1.2
+ */
+#define GST_TAG_INTERPRETED_BY "interpreted-by"
+/**
+ * GST_TAG_MIDI_BASE_NOTE:
+ *
+ * [Midi note number](http://en.wikipedia.org/wiki/Note#Note_designation_in_accordance_with_octave_name)
+ * of the audio track. This is useful for sample instruments and in particular
+ * for multi-samples.
+ *
+ * Since: 1.4
+ */
+#define GST_TAG_MIDI_BASE_NOTE "midi-base-note"
+/**
+ * GST_TAG_PRIVATE_DATA:
+ *
+ * Any private data that may be contained in tags (sample).
+ *
+ * It is represented by #GstSample in which #GstBuffer contains the
+ * binary data and the sample's info #GstStructure may contain any
+ * extra information that identifies the origin or meaning of the data.
+ *
+ * Private frames in ID3v2 tags ('PRIV' frames) will be represented
+ * using this tag, in which case the GstStructure will be named
+ * "ID3PrivateFrame" and contain a field named "owner" of type string
+ * which contains the owner-identification string from the tag.
+ *
+ * Since: 1.8
+ */
+#define GST_TAG_PRIVATE_DATA "private-data"
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTagList, gst_tag_list_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TAGLIST_H__ */
diff --git a/include/gst/gsttagsetter.h b/include/gst/gsttagsetter.h
new file mode 100644
index 0000000000..8d5d237ad3
--- /dev/null
+++ b/include/gst/gsttagsetter.h
@@ -0,0 +1,106 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gsttagsetter.h: Interfaces for tagging
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TAG_SETTER_H__
+#define __GST_TAG_SETTER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TAG_SETTER (gst_tag_setter_get_type ())
+#define GST_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TAG_SETTER, GstTagSetter))
+#define GST_IS_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TAG_SETTER))
+#define GST_TAG_SETTER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_TAG_SETTER, GstTagSetterInterface))
+
+/**
+ * GstTagSetter:
+ *
+ * Opaque #GstTagSetter data structure.
+ */
+typedef struct _GstTagSetter GstTagSetter; /* Dummy typedef */
+typedef struct _GstTagSetterInterface GstTagSetterInterface;
+
+/**
+ * GstTagSetterInterface:
+ * @g_iface: parent interface type.
+ *
+ * #GstTagSetterInterface interface.
+ */
+/* use an empty interface here to allow detection of elements using user-set
+ tags */
+struct _GstTagSetterInterface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+
+ /* virtual table */
+};
+
+GST_API
+GType gst_tag_setter_get_type (void);
+
+GST_API
+void gst_tag_setter_reset_tags (GstTagSetter * setter);
+
+GST_API
+void gst_tag_setter_merge_tags (GstTagSetter * setter,
+ const GstTagList * list,
+ GstTagMergeMode mode);
+GST_API
+void gst_tag_setter_add_tags (GstTagSetter * setter,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_tag_setter_add_tag_values (GstTagSetter * setter,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ ...) G_GNUC_NULL_TERMINATED;
+GST_API
+void gst_tag_setter_add_tag_valist (GstTagSetter * setter,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ va_list var_args);
+GST_API
+void gst_tag_setter_add_tag_valist_values(GstTagSetter * setter,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ va_list var_args);
+GST_API
+void gst_tag_setter_add_tag_value (GstTagSetter * setter,
+ GstTagMergeMode mode,
+ const gchar * tag,
+ const GValue * value);
+GST_API
+const GstTagList *
+ gst_tag_setter_get_tag_list (GstTagSetter * setter);
+
+GST_API
+void gst_tag_setter_set_tag_merge_mode (GstTagSetter * setter,
+ GstTagMergeMode mode);
+GST_API
+GstTagMergeMode gst_tag_setter_get_tag_merge_mode (GstTagSetter * setter);
+
+G_END_DECLS
+
+#endif /* __GST_TAG_SETTER_H__ */
diff --git a/include/gst/gsttask.h b/include/gst/gsttask.h
new file mode 100644
index 0000000000..7ae1d43abb
--- /dev/null
+++ b/include/gst/gsttask.h
@@ -0,0 +1,220 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * <2005> Wim Taymans <wim@fluendo.com>
+ *
+ * gsttask.h: Streaming tasks
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TASK_H__
+#define __GST_TASK_H__
+
+#include <gst/gstobject.h>
+#include <gst/gsttaskpool.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstTaskFunction:
+ * @user_data: user data passed to the function
+ *
+ * A function that will repeatedly be called in the thread created by
+ * a #GstTask.
+ */
+typedef void (*GstTaskFunction) (gpointer user_data);
+
+/* --- standard type macros --- */
+#define GST_TYPE_TASK (gst_task_get_type ())
+#define GST_TASK(task) (G_TYPE_CHECK_INSTANCE_CAST ((task), GST_TYPE_TASK, GstTask))
+#define GST_IS_TASK(task) (G_TYPE_CHECK_INSTANCE_TYPE ((task), GST_TYPE_TASK))
+#define GST_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TASK, GstTaskClass))
+#define GST_IS_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TASK))
+#define GST_TASK_GET_CLASS(task) (G_TYPE_INSTANCE_GET_CLASS ((task), GST_TYPE_TASK, GstTaskClass))
+#define GST_TASK_CAST(task) ((GstTask*)(task))
+
+typedef struct _GstTask GstTask;
+typedef struct _GstTaskClass GstTaskClass;
+typedef struct _GstTaskPrivate GstTaskPrivate;
+
+/**
+ * GstTaskState:
+ * @GST_TASK_STARTED: the task is started and running
+ * @GST_TASK_STOPPED: the task is stopped
+ * @GST_TASK_PAUSED: the task is paused
+ *
+ * The different states a task can be in
+ */
+typedef enum {
+ GST_TASK_STARTED,
+ GST_TASK_STOPPED,
+ GST_TASK_PAUSED
+} GstTaskState;
+
+/**
+ * GST_TASK_STATE:
+ * @task: Task to get the state of
+ *
+ * Get access to the state of the task.
+ */
+#define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state)
+
+/**
+ * GST_TASK_GET_COND:
+ * @task: Task to get the cond of
+ *
+ * Get access to the cond of the task.
+ */
+#define GST_TASK_GET_COND(task) (&GST_TASK_CAST(task)->cond)
+/**
+ * GST_TASK_WAIT:
+ * @task: Task to wait for
+ *
+ * Wait for the task cond to be signalled
+ */
+#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task))
+/**
+ * GST_TASK_SIGNAL:
+ * @task: Task to signal
+ *
+ * Signal the task cond
+ */
+#define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (task))
+/**
+ * GST_TASK_BROADCAST:
+ * @task: Task to broadcast
+ *
+ * Send a broadcast signal to all waiting task conds
+ */
+#define GST_TASK_BROADCAST(task) g_cond_broadcast(GST_TASK_GET_COND (task))
+
+/**
+ * GST_TASK_GET_LOCK:
+ * @task: Task to get the lock of
+ *
+ * Get access to the task lock.
+ */
+#define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock)
+
+/**
+ * GstTaskThreadFunc:
+ * @task: The #GstTask
+ * @thread: The #GThread
+ * @user_data: user data
+ *
+ * Custom GstTask thread callback functions that can be installed.
+ */
+typedef void (*GstTaskThreadFunc) (GstTask *task, GThread *thread, gpointer user_data);
+
+/**
+ * GstTask:
+ * @state: the state of the task
+ * @cond: used to pause/resume the task
+ * @lock: The lock taken when iterating the task function
+ * @func: the function executed by this task
+ * @user_data: user_data passed to the task function
+ * @notify: GDestroyNotify for @user_data
+ * @running: a flag indicating that the task is running
+ *
+ * The #GstTask object.
+ */
+struct _GstTask {
+ GstObject object;
+
+ /*< public >*/ /* with LOCK */
+ GstTaskState state;
+ GCond cond;
+
+ GRecMutex *lock;
+
+ GstTaskFunction func;
+ gpointer user_data;
+ GDestroyNotify notify;
+
+ gboolean running;
+
+ /*< private >*/
+ GThread *thread;
+
+ GstTaskPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstTaskClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ GstTaskPool *pool;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+void gst_task_cleanup_all (void);
+
+GST_API
+GType gst_task_get_type (void);
+
+GST_API
+GstTask* gst_task_new (GstTaskFunction func,
+ gpointer user_data, GDestroyNotify notify);
+GST_API
+void gst_task_set_lock (GstTask *task, GRecMutex *mutex);
+
+GST_API
+GstTaskPool * gst_task_get_pool (GstTask *task);
+
+GST_API
+void gst_task_set_pool (GstTask *task, GstTaskPool *pool);
+
+GST_API
+void gst_task_set_enter_callback (GstTask *task,
+ GstTaskThreadFunc enter_func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+void gst_task_set_leave_callback (GstTask *task,
+ GstTaskThreadFunc leave_func,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_API
+GstTaskState gst_task_get_state (GstTask *task);
+
+GST_API
+gboolean gst_task_set_state (GstTask *task, GstTaskState state);
+
+GST_API
+gboolean gst_task_start (GstTask *task);
+
+GST_API
+gboolean gst_task_stop (GstTask *task);
+
+GST_API
+gboolean gst_task_pause (GstTask *task);
+
+GST_API
+gboolean gst_task_resume (GstTask *task);
+
+GST_API
+gboolean gst_task_join (GstTask *task);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTask, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TASK_H__ */
diff --git a/include/gst/gsttaskpool.h b/include/gst/gsttaskpool.h
new file mode 100644
index 0000000000..94c5ebe247
--- /dev/null
+++ b/include/gst/gsttaskpool.h
@@ -0,0 +1,177 @@
+/* GStreamer
+ * Copyright (C) <2009> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gsttaskpool.h: Pool for creating streaming threads
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TASK_POOL_H__
+#define __GST_TASK_POOL_H__
+
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+/* --- standard type macros --- */
+#define GST_TYPE_TASK_POOL (gst_task_pool_get_type ())
+#define GST_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_CAST ((pool), GST_TYPE_TASK_POOL, GstTaskPool))
+#define GST_IS_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_TYPE ((pool), GST_TYPE_TASK_POOL))
+#define GST_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), GST_TYPE_TASK_POOL, GstTaskPoolClass))
+#define GST_IS_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), GST_TYPE_TASK_POOL))
+#define GST_TASK_POOL_GET_CLASS(pool) (G_TYPE_INSTANCE_GET_CLASS ((pool), GST_TYPE_TASK_POOL, GstTaskPoolClass))
+#define GST_TASK_POOL_CAST(pool) ((GstTaskPool*)(pool))
+
+typedef struct _GstTaskPool GstTaskPool;
+typedef struct _GstTaskPoolClass GstTaskPoolClass;
+
+/**
+ * GstTaskPoolFunction:
+ * @user_data: user data for the task function
+ *
+ * Task function, see gst_task_pool_push().
+ */
+typedef void (*GstTaskPoolFunction) (void *user_data);
+
+/**
+ * GstTaskPool:
+ *
+ * The #GstTaskPool object.
+ */
+struct _GstTaskPool {
+ GstObject object;
+
+ /*< private >*/
+ GThreadPool *pool;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstTaskPoolClass:
+ * @parent_class: the parent class structure
+ * @prepare: prepare the threadpool
+ * @cleanup: make sure all threads are stopped
+ * @push: start a new thread
+ * @join: join a thread
+ *
+ * The #GstTaskPoolClass object.
+ */
+struct _GstTaskPoolClass {
+ GstObjectClass parent_class;
+
+ /*< public >*/
+ void (*prepare) (GstTaskPool *pool, GError **error);
+ void (*cleanup) (GstTaskPool *pool);
+
+ gpointer (*push) (GstTaskPool *pool, GstTaskPoolFunction func,
+ gpointer user_data, GError **error);
+ void (*join) (GstTaskPool *pool, gpointer id);
+
+ /**
+ * GstTaskPoolClass::dispose_handle:
+ * @pool: a #GstTaskPool
+ * @id: (transfer full): the handle to dispose of
+ *
+ * free / unref the handle returned in GstTaskPoolClass::push.
+ *
+ * Since: 1.20
+ */
+ void (*dispose_handle) (GstTaskPool *pool, gpointer id);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+};
+
+GST_API
+GType gst_task_pool_get_type (void);
+
+GST_API
+GstTaskPool * gst_task_pool_new (void);
+
+GST_API
+void gst_task_pool_prepare (GstTaskPool *pool, GError **error);
+
+GST_API
+gpointer gst_task_pool_push (GstTaskPool *pool, GstTaskPoolFunction func,
+ gpointer user_data, GError **error);
+GST_API
+void gst_task_pool_join (GstTaskPool *pool, gpointer id);
+
+GST_API
+void gst_task_pool_dispose_handle (GstTaskPool *pool, gpointer id);
+
+GST_API
+void gst_task_pool_cleanup (GstTaskPool *pool);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTaskPool, gst_object_unref)
+
+typedef struct _GstSharedTaskPool GstSharedTaskPool;
+typedef struct _GstSharedTaskPoolClass GstSharedTaskPoolClass;
+typedef struct _GstSharedTaskPoolPrivate GstSharedTaskPoolPrivate;
+
+#define GST_TYPE_SHARED_TASK_POOL (gst_shared_task_pool_get_type ())
+#define GST_SHARED_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_CAST ((pool), GST_TYPE_TASK_POOL, GstSharedTaskPool))
+#define GST_IS_SHARED_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_TYPE ((pool), GST_TYPE_SHARED_TASK_POOL))
+#define GST_SHARED_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), GST_TYPE_SHARED_TASK_POOL, GstSharedTaskPoolClass))
+#define GST_IS_SHARED_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), GST_TYPE_SHARED_TASK_POOL))
+#define GST_SHARED_TASK_POOL_GET_CLASS(pool) (G_TYPE_INSTANCE_GET_CLASS ((pool), GST_TYPE_SHARED_TASK_POOL, GstSharedTaskPoolClass))
+
+/**
+ * GstSharedTaskPool:
+ *
+ * The #GstSharedTaskPool object.
+ *
+ * since: 1.20
+ */
+struct _GstSharedTaskPool {
+ GstTaskPool parent;
+
+ /*< private >*/
+ GstSharedTaskPoolPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstSharedTaskPoolClass:
+ *
+ * The #GstSharedTaskPoolClass object.
+ *
+ * Since: 1.20
+ */
+struct _GstSharedTaskPoolClass {
+ GstTaskPoolClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_shared_task_pool_get_type (void);
+
+GST_API
+void gst_shared_task_pool_set_max_threads (GstSharedTaskPool *pool, guint max_threads);
+
+GST_API
+guint gst_shared_task_pool_get_max_threads (GstSharedTaskPool *pool);
+
+GST_API
+GstTaskPool * gst_shared_task_pool_new (void);
+
+G_END_DECLS
+
+#endif /* __GST_TASK_POOL_H__ */
diff --git a/include/gst/gsttoc.h b/include/gst/gsttoc.h
new file mode 100644
index 0000000000..a82c9f17f2
--- /dev/null
+++ b/include/gst/gsttoc.h
@@ -0,0 +1,249 @@
+/* GStreamer
+ * (c) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
+ *
+ * gsttoc.h: generic TOC API declaration
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TOC_H__
+#define __GST_TOC_H__
+
+#include <gst/gstconfig.h>
+#include <gst/gstminiobject.h>
+#include <gst/gststructure.h>
+#include <gst/gsttaglist.h>
+#include <gst/gstformat.h>
+
+G_BEGIN_DECLS
+
+GST_API GType _gst_toc_type;
+
+GST_API GType _gst_toc_entry_type;
+
+#define GST_TYPE_TOC (_gst_toc_type)
+#define GST_TYPE_TOC_ENTRY (_gst_toc_entry_type)
+
+typedef struct _GstTocEntry GstTocEntry;
+typedef struct _GstToc GstToc;
+
+/**
+ * GstTocScope:
+ * @GST_TOC_SCOPE_GLOBAL: global TOC representing all selectable options
+ * (this is what applications are usually interested in)
+ * @GST_TOC_SCOPE_CURRENT: TOC for the currently active/selected stream
+ * (this is a TOC representing the current stream from start to EOS,
+ * and is what a TOC writer / muxer is usually interested in; it will
+ * usually be a subset of the global TOC, e.g. just the chapters of
+ * the current title, or the chapters selected for playback from the
+ * current title)
+ *
+ * The scope of a TOC.
+ */
+typedef enum {
+ GST_TOC_SCOPE_GLOBAL = 1,
+ GST_TOC_SCOPE_CURRENT = 2
+} GstTocScope;
+
+/**
+ * GstTocEntryType:
+ * @GST_TOC_ENTRY_TYPE_ANGLE: entry is an angle (i.e. an alternative)
+ * @GST_TOC_ENTRY_TYPE_VERSION: entry is a version (i.e. alternative)
+ * @GST_TOC_ENTRY_TYPE_EDITION: entry is an edition (i.e. alternative)
+ * @GST_TOC_ENTRY_TYPE_INVALID: invalid entry type value
+ * @GST_TOC_ENTRY_TYPE_TITLE: entry is a title (i.e. a part of a sequence)
+ * @GST_TOC_ENTRY_TYPE_TRACK: entry is a track (i.e. a part of a sequence)
+ * @GST_TOC_ENTRY_TYPE_CHAPTER: entry is a chapter (i.e. a part of a sequence)
+ *
+ * The different types of TOC entries (see #GstTocEntry).
+ *
+ * There are two types of TOC entries: alternatives or parts in a sequence.
+ */
+typedef enum {
+ GST_TOC_ENTRY_TYPE_ANGLE = -3,
+ GST_TOC_ENTRY_TYPE_VERSION = -2,
+ GST_TOC_ENTRY_TYPE_EDITION = -1,
+ GST_TOC_ENTRY_TYPE_INVALID = 0,
+ GST_TOC_ENTRY_TYPE_TITLE = 1,
+ GST_TOC_ENTRY_TYPE_TRACK = 2,
+ GST_TOC_ENTRY_TYPE_CHAPTER = 3,
+} GstTocEntryType;
+
+/**
+ * GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE:
+ * @entry_type: The #GstTocEntryType from a #GstTocEntry
+ *
+ * Checks if @entry_type indicates that its #GstTocEntry is an alternative.
+ */
+#define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type) (entry_type < 0)
+
+/**
+ * GST_TOC_ENTRY_TYPE_IS_SEQUENCE:
+ * @entry_type: The #GstTocEntryType from a #GstTocEntry
+ *
+ * Checks if @entry_type indicates that its #GstTocEntry is a sequence.
+ */
+#define GST_TOC_ENTRY_TYPE_IS_SEQUENCE(entry_type) (entry_type > 0)
+
+/**
+ * GstTocLoopType:
+ * @GST_TOC_LOOP_NONE: single forward playback
+ * @GST_TOC_LOOP_FORWARD: repeat forward
+ * @GST_TOC_LOOP_REVERSE: repeat backward
+ * @GST_TOC_LOOP_PING_PONG: repeat forward and backward
+ *
+ * How a #GstTocEntry should be repeated. By default, entries are played a
+ * single time.
+ *
+ * Since: 1.4
+ */
+typedef enum {
+ GST_TOC_LOOP_NONE = 0,
+ GST_TOC_LOOP_FORWARD,
+ GST_TOC_LOOP_REVERSE,
+ GST_TOC_LOOP_PING_PONG
+} GstTocLoopType;
+
+/**
+ * GST_TOC_REPEAT_COUNT_INFINITE:
+ *
+ * Special value for the repeat_count set in gst_toc_entry_set_loop() or
+ * returned by gst_toc_entry_set_loop() to indicate infinite looping.
+ *
+ * Since: 1.4
+ */
+#define GST_TOC_REPEAT_COUNT_INFINITE (-1)
+
+/* functions to return type structures */
+
+GST_API
+GType gst_toc_get_type (void);
+
+GST_API
+GType gst_toc_entry_get_type (void);
+
+/* functions to create, ref and unref/free TOCs */
+
+GST_API
+GstToc * gst_toc_new (GstTocScope scope);
+
+GST_API
+GstTocScope gst_toc_get_scope (const GstToc *toc);
+
+GST_API
+void gst_toc_set_tags (GstToc *toc, GstTagList * tags);
+
+GST_API
+void gst_toc_merge_tags (GstToc *toc, GstTagList *tags, GstTagMergeMode mode);
+
+GST_API
+GstTagList * gst_toc_get_tags (const GstToc *toc);
+
+GST_API
+void gst_toc_append_entry (GstToc *toc, GstTocEntry *entry);
+
+GST_API
+GList * gst_toc_get_entries (const GstToc *toc);
+
+GST_API
+void gst_toc_dump (GstToc *toc);
+
+#define gst_toc_ref(toc) (GstToc*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(toc))
+#define gst_toc_unref(toc) gst_mini_object_unref(GST_MINI_OBJECT_CAST(toc))
+#define gst_toc_copy(toc) (GstToc*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(toc))
+#define gst_toc_make_writable(toc) (GstToc*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(toc))
+
+/* functions to create, ref and unref/free TOC entries */
+
+GST_API
+GstTocEntry * gst_toc_entry_new (GstTocEntryType type, const gchar *uid);
+
+#define gst_toc_entry_ref(entry) (GstTocEntry*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(entry))
+#define gst_toc_entry_unref(entry) gst_mini_object_unref(GST_MINI_OBJECT_CAST(entry))
+#define gst_toc_entry_copy(entry) (GstTocEntry*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(entry))
+#define gst_toc_entry_make_writable(entry) (GstTocEntry*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(entry))
+
+GST_API
+GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid);
+
+GST_API
+GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry);
+
+GST_API
+const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry);
+
+GST_API
+void gst_toc_entry_append_sub_entry (GstTocEntry *entry, GstTocEntry *subentry);
+
+GST_API
+GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry);
+
+GST_API
+void gst_toc_entry_set_tags (GstTocEntry *entry, GstTagList *tags);
+
+GST_API
+void gst_toc_entry_merge_tags (GstTocEntry *entry, GstTagList *tags, GstTagMergeMode mode);
+
+GST_API
+GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry);
+
+GST_API
+gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry);
+
+GST_API
+gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry);
+
+GST_API
+void gst_toc_entry_set_start_stop_times (GstTocEntry *entry, gint64 start, gint64 stop);
+
+GST_API
+gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry, gint64 *start, gint64 *stop);
+
+GST_API
+void gst_toc_entry_set_loop (GstTocEntry *entry, GstTocLoopType loop_type, gint repeat_count);
+
+GST_API
+gboolean gst_toc_entry_get_loop (const GstTocEntry *entry, GstTocLoopType *loop_type, gint *repeat_count);
+
+GST_API
+GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
+
+GST_API
+GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);
+
+
+GST_API
+const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type);
+
+static inline void
+_gst_autoptr_toc_unref (GstToc *toc)
+{
+ gst_toc_unref (toc);
+}
+
+static inline void
+_gst_autoptr_toc_entry_unref (GstTocEntry *entry)
+{
+ gst_toc_entry_unref (entry);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstToc, _gst_autoptr_toc_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTocEntry, _gst_autoptr_toc_entry_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TOC_H__ */
+
diff --git a/include/gst/gsttocsetter.h b/include/gst/gsttocsetter.h
new file mode 100644
index 0000000000..4d58187688
--- /dev/null
+++ b/include/gst/gsttocsetter.h
@@ -0,0 +1,72 @@
+/* GStreamer
+ * Copyright (C) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
+ *
+ * gsttocsetter.h: Interfaces for TOC
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TOC_SETTER_H__
+#define __GST_TOC_SETTER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TOC_SETTER (gst_toc_setter_get_type ())
+#define GST_TOC_SETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TOC_SETTER, GstTocSetter))
+#define GST_IS_TOC_SETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TOC_SETTER))
+#define GST_TOC_SETTER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_TOC_SETTER, GstTocSetterInterface))
+/**
+ * GstTocSetter:
+ *
+ * Opaque #GstTocSetter data structure.
+ */
+typedef struct _GstTocSetter GstTocSetter;
+typedef struct _GstTocSetterInterface GstTocSetterInterface;
+
+/**
+ * GstTocSetterInterface:
+ * @g_iface: parent interface type.
+ *
+ * #GstTocSetterInterface interface.
+ */
+
+struct _GstTocSetterInterface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+
+ /* virtual table */
+};
+
+GST_API
+GType gst_toc_setter_get_type (void);
+
+GST_API
+void gst_toc_setter_reset (GstTocSetter *setter);
+
+GST_API
+GstToc * gst_toc_setter_get_toc (GstTocSetter *setter);
+
+GST_API
+void gst_toc_setter_set_toc (GstTocSetter *setter, GstToc *toc);
+
+G_END_DECLS
+
+#endif /* __GST_TOC_SETTER_H__ */
+
diff --git a/include/gst/gsttracer.h b/include/gst/gsttracer.h
new file mode 100644
index 0000000000..6560296af1
--- /dev/null
+++ b/include/gst/gsttracer.h
@@ -0,0 +1,83 @@
+/* GStreamer
+ * Copyright (C) 2013 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gsttracer.h: tracer base class
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TRACER_H__
+#define __GST_TRACER_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gstobject.h>
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstTracer GstTracer;
+typedef struct _GstTracerPrivate GstTracerPrivate;
+typedef struct _GstTracerClass GstTracerClass;
+
+#define GST_TYPE_TRACER (gst_tracer_get_type())
+#define GST_TRACER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TRACER,GstTracer))
+#define GST_TRACER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TRACER,GstTracerClass))
+#define GST_IS_TRACER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TRACER))
+#define GST_IS_TRACER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TRACER))
+#define GST_TRACER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_TRACER,GstTracerClass))
+#define GST_TRACER_CAST(obj) ((GstTracer *)(obj))
+
+/**
+ * GstTracer:
+ *
+ * The opaque GstTracer instance structure
+ */
+struct _GstTracer {
+ GstObject parent;
+ /*< private >*/
+ GstTracerPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstTracerClass {
+ GstObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_API
+GType gst_tracer_get_type (void);
+
+GST_API
+void gst_tracing_register_hook (GstTracer *tracer, const gchar *detail,
+ GCallback func);
+
+/* tracing modules */
+
+GST_API
+gboolean gst_tracer_register (GstPlugin * plugin, const gchar * name, GType type);
+
+GST_API
+GList* gst_tracing_get_active_tracers (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracer, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TRACER_H__ */
+
diff --git a/include/gst/gsttracerfactory.h b/include/gst/gsttracerfactory.h
new file mode 100644
index 0000000000..ff88a4a605
--- /dev/null
+++ b/include/gst/gsttracerfactory.h
@@ -0,0 +1,64 @@
+/* GStreamer
+ * Copyright (C) 2013 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gsttracerfactory.h: tracing subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TRACER_FACTORY_H__
+#define __GST_TRACER_FACTORY_H__
+
+#include <gst/gstcaps.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TRACER_FACTORY (gst_tracer_factory_get_type())
+#define GST_TRACER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TRACER_FACTORY, GstTracerFactory))
+#define GST_IS_TRACER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TRACER_FACTORY))
+#define GST_TRACER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TRACER_FACTORY, GstTracerFactoryClass))
+#define GST_IS_TRACER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TRACER_FACTORY))
+#define GST_TRACER_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TRACER_FACTORY, GstTracerFactoryClass))
+#define GST_TRACER_FACTORY_CAST(obj) ((GstTracerFactory *)(obj))
+
+/**
+ * GstTracerFactory:
+ *
+ * Opaque object that stores information about a tracer function.
+ *
+ * Since: 1.8
+ */
+typedef struct _GstTracerFactory GstTracerFactory;
+typedef struct _GstTracerFactoryClass GstTracerFactoryClass;
+
+/* tracering interface */
+
+GST_API
+GType gst_tracer_factory_get_type (void);
+
+GST_API
+GList * gst_tracer_factory_get_list (void);
+
+GST_API
+GType gst_tracer_factory_get_tracer_type (GstTracerFactory * factory);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracerFactory, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TRACER_FACTORY_H__ */
diff --git a/include/gst/gsttracerrecord.h b/include/gst/gsttracerrecord.h
new file mode 100644
index 0000000000..3d8c4da9c0
--- /dev/null
+++ b/include/gst/gsttracerrecord.h
@@ -0,0 +1,106 @@
+/* GStreamer
+ * Copyright (C) 2016 Stefan Sauer <ensonic@users.sf.net>
+ *
+ * gsttracerrecord.h: tracer log record class
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TRACER_RECORD_H__
+#define __GST_TRACER_RECORD_H__
+
+#include <gst/gstobject.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstTracerRecord:
+ *
+ * The opaque GstTracerRecord instance structure
+ *
+ * Since: 1.8
+ */
+typedef struct _GstTracerRecord GstTracerRecord;
+typedef struct _GstTracerRecordClass GstTracerRecordClass;
+
+#define GST_TYPE_TRACER_RECORD (gst_tracer_record_get_type())
+#define GST_TRACER_RECORD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TRACER_RECORD,GstTracerRecord))
+#define GST_TRACER_RECORD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TRACER_RECORD,GstTracerRecordClass))
+#define GST_IS_TRACER_RECORD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TRACER_RECORD))
+#define GST_IS_TRACER_RECORD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TRACER_RECORD))
+#define GST_TRACER_RECORD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_TRACER_RECORD,GstTracerRecordClass))
+#define GST_TRACER_RECORD_CAST(obj) ((GstTracerRecord *)(obj))
+
+GST_API
+GType gst_tracer_record_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracerRecord, gst_object_unref)
+
+/**
+ * GstTracerValueScope:
+ * @GST_TRACER_VALUE_SCOPE_PROCESS: the value is related to the process
+ * @GST_TRACER_VALUE_SCOPE_THREAD: the value is related to a thread
+ * @GST_TRACER_VALUE_SCOPE_ELEMENT: the value is related to an #GstElement
+ * @GST_TRACER_VALUE_SCOPE_PAD: the value is related to a #GstPad
+ *
+ * Tracing record will contain fields that contain a measured value or extra
+ * meta-data. One such meta data are values that tell where a measurement was
+ * taken. This enumerating declares to which scope such a meta data field
+ * relates to. If it is e.g. %GST_TRACER_VALUE_SCOPE_PAD, then each of the log
+ * events may contain values for different #GstPads.
+ *
+ * Since: 1.8
+ */
+typedef enum
+{
+ GST_TRACER_VALUE_SCOPE_PROCESS,
+ GST_TRACER_VALUE_SCOPE_THREAD,
+ GST_TRACER_VALUE_SCOPE_ELEMENT,
+ GST_TRACER_VALUE_SCOPE_PAD
+} GstTracerValueScope;
+
+/**
+ * GstTracerValueFlags:
+ * @GST_TRACER_VALUE_FLAGS_NONE: no flags
+ * @GST_TRACER_VALUE_FLAGS_OPTIONAL: the value is optional. When using this flag
+ * one need to have an additional boolean arg before this value in the
+ * var-args list passed to gst_tracer_record_log().
+ * @GST_TRACER_VALUE_FLAGS_AGGREGATED: the value is a combined figure, since the
+ * start of tracing. Examples are averages or timestamps.
+ *
+ * Flag that describe the value. These flags help applications processing the
+ * logs to understand the values.
+ */
+typedef enum
+{
+ GST_TRACER_VALUE_FLAGS_NONE = 0,
+ GST_TRACER_VALUE_FLAGS_OPTIONAL = (1 << 0),
+ GST_TRACER_VALUE_FLAGS_AGGREGATED = (1 << 1),
+} GstTracerValueFlags;
+
+GST_API
+GstTracerRecord * gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) G_GNUC_NULL_TERMINATED;
+
+#ifndef GST_DISABLE_GST_DEBUG
+GST_API
+void gst_tracer_record_log (GstTracerRecord *self, ...);
+#else
+#define gst_tracer_record_log(...) G_STMT_START {} G_STMT_END
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_TRACER_RECORD_H__ */
diff --git a/include/gst/gsttypefind.h b/include/gst/gsttypefind.h
new file mode 100644
index 0000000000..6c2e595b6e
--- /dev/null
+++ b/include/gst/gsttypefind.h
@@ -0,0 +1,221 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gsttypefind.h: typefinding subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_TYPE_FIND_H__
+#define __GST_TYPE_FIND_H__
+
+#include <gst/gstcaps.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+
+G_BEGIN_DECLS
+/**
+ * GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM:
+ * @type_find: The type find name in lower case, with words separated by '_'.
+ * Used to generate `gst_type_find_register_*(GstPlugin* plugin)`.
+ * @register_func: pointer to a method with the format: `gboolean register_func (GstPlugin* plugin);`
+ *
+ * A convenience macro to define the entry point of a
+ * type find `gst_type_find_register_*(GstPlugin* plugin)` which uses
+ * register_func as the main registration method for the type find.
+ * As an example, you may define the type find named "custom-typefind"
+ * as following using `type_find_register_custom`:
+ *
+ * ```
+ * GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM (plugin, type_find_register_custom)
+ * ```
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM(type_find, register_func) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_type_find_register_, type_find) (GstPlugin * plugin) \
+{ \
+ return register_func (plugin); \
+} \
+G_END_DECLS
+
+/**
+ * GST_TYPE_FIND_REGISTER_DEFINE:
+ * @t_f: The type find name in lower case, with words separated by '_'.
+ * Used to generate `gst_type_find_register_*(GstPlugin* plugin)`.
+ * @t_f_n: The public name of the type find
+ * @r: The #GstRank of the type find (higher rank means more importance when autoplugging, see #GstRank)
+ * @func: The #GstTypeFindFunction to use
+ * @extensions: (nullable): Optional comma-separated list of extensions
+ * that could belong to this type
+ * @possible_caps: (nullable): Optionally the caps that could be returned when typefinding
+ * succeeds
+ * @data: Optional user data. This user data must be available until the plugin
+ * is unloaded.
+ * @data_notify: a #GDestroyNotify that will be called on @data when the plugin
+ * is unloaded.
+ *
+ * A convenience macro to define the entry point of a
+ * type find `gst_type_find_register_*(GstPlugin* plugin)`.
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_FIND_REGISTER_DEFINE(t_f, t_f_n, r, func, extensions, possible_caps, data, data_notify) \
+G_BEGIN_DECLS \
+gboolean G_PASTE (gst_type_find_register_, t_f) (GstPlugin * plugin) \
+{ \
+ return gst_type_find_register (plugin, t_f_n, r, func, extensions, possible_caps, data, data_notify); \
+} \
+G_END_DECLS
+
+/**
+ * GST_TYPE_FIND_REGISTER_DECLARE:
+ * @t_f: The type find name in lower case, with words separated by '_'.
+ *
+ * This macro can be used to declare a new type find.
+ * It has to be used in combination with #GST_TYPE_FIND_REGISTER_DEFINE macro
+ * and must be placed outside any block to declare the type find registration
+ * function.
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_FIND_REGISTER_DECLARE(t_f) \
+G_BEGIN_DECLS \
+gboolean G_PASTE(gst_type_find_register_, t_f) (GstPlugin * plugin); \
+G_END_DECLS
+
+/**
+ * GST_TYPE_FIND_REGISTER:
+ * @t_f: The type find name in lower case, with words separated by '_'.
+ * @plugin: The #GstPlugin where to register the type find.
+
+ *
+ * This macro can be used to register a type find into a #GstPlugin.
+ * This method will be usually called in the plugin init function
+ * but can also be called with a NULL plugin.
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_FIND_REGISTER(t_f, plugin) G_PASTE(gst_type_find_register_, t_f) (plugin)
+
+
+#define GST_TYPE_TYPE_FIND (gst_type_find_get_type())
+
+typedef struct _GstTypeFind GstTypeFind;
+
+/**
+ * GstTypeFindFunction:
+ * @find: A #GstTypeFind structure
+ * @user_data: optional data to pass to the function
+ *
+ * A function that will be called by typefinding.
+ */
+typedef void (* GstTypeFindFunction) (GstTypeFind *find, gpointer user_data);
+
+/**
+ * GstTypeFindProbability:
+ * @GST_TYPE_FIND_NONE: type undetected.
+ * @GST_TYPE_FIND_MINIMUM: unlikely typefind.
+ * @GST_TYPE_FIND_POSSIBLE: possible type detected.
+ * @GST_TYPE_FIND_LIKELY: likely a type was detected.
+ * @GST_TYPE_FIND_NEARLY_CERTAIN: nearly certain that a type was detected.
+ * @GST_TYPE_FIND_MAXIMUM: very certain a type was detected.
+ *
+ * The probability of the typefind function. Higher values have more certainty
+ * in doing a reliable typefind.
+ */
+typedef enum {
+ GST_TYPE_FIND_NONE = 0,
+ GST_TYPE_FIND_MINIMUM = 1,
+ GST_TYPE_FIND_POSSIBLE = 50,
+ GST_TYPE_FIND_LIKELY = 80,
+ GST_TYPE_FIND_NEARLY_CERTAIN = 99,
+ GST_TYPE_FIND_MAXIMUM = 100
+} GstTypeFindProbability;
+
+/**
+ * GstTypeFind:
+ * @peek: Method to peek data.
+ * @suggest: Method to suggest #GstCaps with a given probability.
+ * @data: The data used by the caller of the typefinding function.
+ * @get_length: Returns the length of current data.
+ *
+ * Object that stores typefind callbacks. To use with #GstTypeFindFactory.
+ */
+struct _GstTypeFind {
+ /* private to the caller of the typefind function */
+ const guint8 * (* peek) (gpointer data,
+ gint64 offset,
+ guint size);
+
+ void (* suggest) (gpointer data,
+ guint probability,
+ GstCaps *caps);
+
+ gpointer data;
+
+ /* optional */
+ guint64 (* get_length) (gpointer data);
+
+ /* <private> */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * gst_type_find_get_type: (attributes doc.skip=true)
+ */
+GST_API
+GType gst_type_find_get_type (void);
+
+/* typefind function interface */
+
+GST_API
+const guint8 * gst_type_find_peek (GstTypeFind * find,
+ gint64 offset,
+ guint size);
+GST_API
+void gst_type_find_suggest (GstTypeFind * find,
+ guint probability,
+ GstCaps * caps);
+GST_API
+void gst_type_find_suggest_empty_simple (GstTypeFind * find,
+ guint probability,
+ const char * media_type);
+GST_API
+void gst_type_find_suggest_simple (GstTypeFind * find,
+ guint probability,
+ const char * media_type,
+ const char * fieldname, ...) G_GNUC_NULL_TERMINATED;
+GST_API
+guint64 gst_type_find_get_length (GstTypeFind * find);
+
+/* registration interface */
+
+GST_API
+gboolean gst_type_find_register (GstPlugin * plugin,
+ const gchar * name,
+ guint rank,
+ GstTypeFindFunction func,
+ const gchar * extensions,
+ GstCaps * possible_caps,
+ gpointer data,
+ GDestroyNotify data_notify);
+
+G_END_DECLS
+
+#endif /* __GST_TYPE_FIND_H__ */
diff --git a/include/gst/gsttypefindfactory.h b/include/gst/gsttypefindfactory.h
new file mode 100644
index 0000000000..08227b11f2
--- /dev/null
+++ b/include/gst/gsttypefindfactory.h
@@ -0,0 +1,72 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ *
+ * gsttypefindfactory.h: typefinding subsystem
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TYPE_FIND_FACTORY_H__
+#define __GST_TYPE_FIND_FACTORY_H__
+
+#include <gst/gstcaps.h>
+#include <gst/gstplugin.h>
+#include <gst/gstpluginfeature.h>
+#include <gst/gsttypefind.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TYPE_FIND_FACTORY (gst_type_find_factory_get_type())
+#define GST_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactory))
+#define GST_IS_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_FACTORY))
+#define GST_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
+#define GST_IS_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY))
+#define GST_TYPE_FIND_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
+
+/**
+ * GstTypeFindFactory:
+ *
+ * Opaque object that stores information about a typefind function.
+ */
+typedef struct _GstTypeFindFactory GstTypeFindFactory;
+typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass;
+
+/* typefinding interface */
+
+GST_API
+GType gst_type_find_factory_get_type (void);
+
+GST_API
+GList * gst_type_find_factory_get_list (void);
+
+GST_API
+const gchar * const * gst_type_find_factory_get_extensions (GstTypeFindFactory *factory);
+
+GST_API
+GstCaps * gst_type_find_factory_get_caps (GstTypeFindFactory *factory);
+
+GST_API
+gboolean gst_type_find_factory_has_function (GstTypeFindFactory *factory);
+
+GST_API
+void gst_type_find_factory_call_function (GstTypeFindFactory *factory,
+ GstTypeFind *find);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTypeFindFactory, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TYPE_FIND_FACTORY_H__ */
diff --git a/include/gst/gsturi.h b/include/gst/gsturi.h
new file mode 100644
index 0000000000..8c5881bec8
--- /dev/null
+++ b/include/gst/gsturi.h
@@ -0,0 +1,396 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2014 David Waring, British Broadcasting Corporation
+ * <david.waring@rd.bbc.co.uk>
+ *
+ * gsturi.h: Header for uri to element mappings and URI manipulation.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_URI_H__
+#define __GST_URI_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#include <gst/gstconfig.h>
+
+/**
+ * gst_uri_error_quark: (attributes doc.skip=true)
+ */
+GST_API
+GQuark gst_uri_error_quark (void);
+
+/**
+ * GST_URI_ERROR:
+ *
+ * Get access to the error quark of the uri subsystem.
+ */
+#define GST_URI_ERROR gst_uri_error_quark ()
+
+/**
+ * GstURIError:
+ * @GST_URI_ERROR_UNSUPPORTED_PROTOCOL: The protocol is not supported
+ * @GST_URI_ERROR_BAD_URI: There was a problem with the URI
+ * @GST_URI_ERROR_BAD_STATE: Could not set or change the URI because the
+ * URI handler was in a state where that is not possible or not permitted
+ * @GST_URI_ERROR_BAD_REFERENCE: There was a problem with the entity that
+ * the URI references
+ *
+ * Different URI-related errors that can occur.
+ */
+typedef enum
+{
+ GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
+ GST_URI_ERROR_BAD_URI,
+ GST_URI_ERROR_BAD_STATE,
+ GST_URI_ERROR_BAD_REFERENCE
+} GstURIError;
+
+/**
+ * GstURIType:
+ * @GST_URI_UNKNOWN: The URI direction is unknown
+ * @GST_URI_SINK: The URI is a consumer.
+ * @GST_URI_SRC: The URI is a producer.
+ *
+ * The different types of URI direction.
+ */
+
+typedef enum {
+ GST_URI_UNKNOWN,
+ GST_URI_SINK,
+ GST_URI_SRC
+} GstURIType;
+
+/**
+ * GST_URI_TYPE_IS_VALID:
+ * @type: A #GstURIType
+ *
+ * Tests if the type direction is valid.
+ */
+#define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK)
+
+/* uri handler functions */
+#define GST_TYPE_URI_HANDLER (gst_uri_handler_get_type ())
+#define GST_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))
+#define GST_IS_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_URI_HANDLER))
+#define GST_URI_HANDLER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_URI_HANDLER, GstURIHandlerInterface))
+
+/**
+ * GstURIHandler:
+ *
+ * Opaque #GstURIHandler structure.
+ */
+typedef struct _GstURIHandler GstURIHandler;
+typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
+
+#include <gst/gstelement.h>
+#include "gstminiobject.h"
+
+/**
+ * GstURIHandlerInterface:
+ * @parent: The parent interface type
+ * @get_type: Method to tell whether the element handles source or sink URI.
+ * @get_protocols: Method to return the list of protocols handled by the element.
+ * @get_uri: Method to return the URI currently handled by the element.
+ * @set_uri: Method to set a new URI.
+ *
+ * Any #GstElement using this interface should implement these methods.
+ */
+struct _GstURIHandlerInterface {
+ GTypeInterface parent;
+
+ /* vtable */
+ /*< public >*/
+ /* querying capabilities */
+ GstURIType (* get_type) (GType type);
+ const gchar * const * (* get_protocols) (GType type);
+
+ /* using the interface */
+ gchar * (* get_uri) (GstURIHandler * handler);
+ gboolean (* set_uri) (GstURIHandler * handler,
+ const gchar * uri,
+ GError ** error);
+};
+
+/* general URI functions */
+
+GST_API
+gboolean gst_uri_protocol_is_valid (const gchar * protocol);
+
+GST_API
+gboolean gst_uri_protocol_is_supported (const GstURIType type,
+ const gchar *protocol);
+GST_API
+gboolean gst_uri_is_valid (const gchar * uri);
+
+GST_API
+gchar * gst_uri_get_protocol (const gchar * uri) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_uri_has_protocol (const gchar * uri,
+ const gchar * protocol);
+GST_API
+gchar * gst_uri_get_location (const gchar * uri) G_GNUC_MALLOC;
+
+GST_DEPRECATED_FOR(gst_uri_new)
+gchar * gst_uri_construct (const gchar * protocol,
+ const gchar * location) G_GNUC_MALLOC;
+GST_API
+gchar * gst_filename_to_uri (const gchar * filename,
+ GError ** error) G_GNUC_MALLOC;
+GST_API
+GstElement * gst_element_make_from_uri (const GstURIType type,
+ const gchar * uri,
+ const gchar * elementname,
+ GError ** error) G_GNUC_MALLOC;
+
+/* accessing the interface */
+
+GST_API
+GType gst_uri_handler_get_type (void);
+
+GST_API
+GstURIType gst_uri_handler_get_uri_type (GstURIHandler * handler);
+
+GST_API
+const gchar * const * gst_uri_handler_get_protocols (GstURIHandler * handler);
+
+GST_API
+gchar * gst_uri_handler_get_uri (GstURIHandler * handler) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_uri_handler_set_uri (GstURIHandler * handler,
+ const gchar * uri,
+ GError ** error);
+
+/*
+ * GstUri Type macros.
+ */
+#define GST_TYPE_URI (gst_uri_get_type ())
+#define GST_IS_URI(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_URI))
+#define GST_URI_CAST(obj) ((GstUri *)(obj))
+#define GST_URI_CONST_CAST(obj) ((const GstUri *)(obj))
+#define GST_URI(obj) (GST_URI_CAST(obj))
+
+/**
+ * GstUri:
+ *
+ * This is a private structure that holds the various parts of a parsed URI.
+ */
+struct _GstUri;
+typedef struct _GstUri GstUri;
+
+/**
+ * GST_URI_NO_PORT:
+ *
+ * Value for #GstUri<!-- -->.port to indicate no port number.
+ */
+#define GST_URI_NO_PORT 0
+
+/* used by GST_TYPE_URI */
+
+GST_API
+GType gst_uri_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+GST_API
+GstUri * gst_uri_new (const gchar * scheme,
+ const gchar * userinfo,
+ const gchar * host,
+ guint port,
+ const gchar * path,
+ const gchar * query,
+ const gchar * fragment) G_GNUC_MALLOC;
+GST_API
+GstUri * gst_uri_new_with_base (GstUri * base,
+ const gchar * scheme,
+ const gchar * userinfo,
+ const gchar * host,
+ guint port,
+ const gchar * path,
+ const gchar * query,
+ const gchar * fragment) G_GNUC_MALLOC;
+GST_API
+GstUri * gst_uri_from_string (const gchar * uri) G_GNUC_MALLOC;
+
+GST_API
+GstUri * gst_uri_from_string_escaped (const gchar * uri) G_GNUC_MALLOC;
+
+GST_API
+GstUri * gst_uri_from_string_with_base (GstUri * base,
+ const gchar * uri) G_GNUC_MALLOC;
+GST_API
+gboolean gst_uri_equal (const GstUri * first,
+ const GstUri * second);
+GST_API
+GstUri * gst_uri_join (GstUri * base_uri,
+ GstUri * ref_uri) G_GNUC_WARN_UNUSED_RESULT;
+GST_API
+gchar * gst_uri_join_strings (const gchar * base_uri,
+ const gchar * ref_uri) G_GNUC_MALLOC;
+GST_API
+gboolean gst_uri_is_writable (const GstUri * uri);
+
+GST_API
+GstUri * gst_uri_make_writable (GstUri * uri) G_GNUC_WARN_UNUSED_RESULT;
+
+GST_API
+gchar * gst_uri_to_string (const GstUri * uri) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_uri_is_normalized (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_normalize (GstUri * uri);
+
+GST_API
+const gchar * gst_uri_get_scheme (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_scheme (GstUri * uri, const gchar * scheme);
+
+GST_API
+const gchar * gst_uri_get_userinfo (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_userinfo (GstUri * uri, const gchar * userinfo);
+
+GST_API
+const gchar * gst_uri_get_host (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_host (GstUri * uri, const gchar * host);
+
+GST_API
+guint gst_uri_get_port (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_port (GstUri * uri, guint port);
+
+GST_API
+gchar * gst_uri_get_path (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_path (GstUri * uri, const gchar * path);
+
+GST_API
+gchar * gst_uri_get_path_string (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_path_string (GstUri * uri, const gchar * path);
+
+GST_API
+GList * gst_uri_get_path_segments (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_path_segments (GstUri * uri, GList * path_segments);
+
+GST_API
+gboolean gst_uri_append_path (GstUri * uri,
+ const gchar * relative_path);
+GST_API
+gboolean gst_uri_append_path_segment (GstUri * uri,
+ const gchar * path_segment);
+GST_API
+gchar * gst_uri_get_query_string (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_query_string (GstUri * uri, const gchar * query);
+
+GST_API
+GHashTable * gst_uri_get_query_table (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_query_table (GstUri * uri,
+ GHashTable * query_table);
+GST_API
+gboolean gst_uri_set_query_value (GstUri * uri, const gchar * query_key,
+ const gchar * query_value);
+GST_API
+gboolean gst_uri_remove_query_key (GstUri * uri, const gchar * query_key);
+
+GST_API
+gboolean gst_uri_query_has_key (const GstUri * uri,
+ const gchar * query_key);
+
+GST_API
+const gchar * gst_uri_get_query_value (const GstUri * uri,
+ const gchar * query_key);
+
+GST_API
+GList * gst_uri_get_query_keys (const GstUri * uri);
+
+GST_API
+const gchar * gst_uri_get_fragment (const GstUri * uri);
+
+GST_API
+gboolean gst_uri_set_fragment (GstUri * uri, const gchar * fragment);
+
+GST_API
+GHashTable * gst_uri_get_media_fragment_table (const GstUri * uri);
+
+#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
+static inline GstUri *
+gst_uri_copy (const GstUri * uri)
+{
+ return GST_URI_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (uri)));
+}
+
+static inline GstUri *
+gst_uri_ref (GstUri * uri)
+{
+ return GST_URI_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (uri)));
+}
+
+static inline void
+gst_uri_unref (GstUri * uri)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (uri));
+}
+
+static inline void
+gst_clear_uri (GstUri ** uri_ptr)
+{
+ gst_clear_mini_object ((GstMiniObject **) uri_ptr);
+}
+#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+GST_API
+GstUri * gst_uri_copy (const GstUri * uri);
+
+GST_API
+GstUri * gst_uri_ref (GstUri * uri);
+
+GST_API
+void gst_uri_unref (GstUri * uri);
+
+GST_API
+void gst_clear_uri (GstUri ** uri_ptr);
+#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstUri, gst_uri_unref)
+
+G_END_DECLS
+
+#endif /* __GST_URI_H__ */
diff --git a/include/gst/gstutils.h b/include/gst/gstutils.h
new file mode 100644
index 0000000000..295756996e
--- /dev/null
+++ b/include/gst/gstutils.h
@@ -0,0 +1,1230 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * 2002 Thomas Vander Stichele <thomas@apestaart.org>
+ *
+ * gstutils.h: Header for various utility functions
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_UTILS_H__
+#define __GST_UTILS_H__
+
+#include <glib.h>
+#include <gst/gstconfig.h>
+#include <gst/gstbin.h>
+#include <gst/gstparse.h>
+
+G_BEGIN_DECLS
+
+GST_API
+void gst_util_set_value_from_string (GValue *value, const gchar *value_str);
+
+GST_API
+void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
+
+GST_API
+gboolean gst_util_set_object_array (GObject * object, const gchar * name,
+ const GValueArray * array);
+GST_API
+gboolean gst_util_get_object_array (GObject * object, const gchar * name,
+ GValueArray ** array);
+GST_API
+void gst_util_dump_mem (const guchar *mem, guint size);
+
+GST_API
+void gst_util_dump_buffer (GstBuffer * buf);
+
+GST_API
+guint64 gst_util_gdouble_to_guint64 (gdouble value) G_GNUC_CONST;
+
+GST_API
+gdouble gst_util_guint64_to_gdouble (guint64 value) G_GNUC_CONST;
+
+/**
+ * gst_guint64_to_gdouble:
+ * @value: the #guint64 value to convert
+ *
+ * Convert @value to a gdouble.
+ *
+ * Returns: @value converted to a #gdouble.
+ */
+
+/**
+ * gst_gdouble_to_guint64:
+ * @value: the #gdouble value to convert
+ *
+ * Convert @value to a guint64.
+ *
+ * Returns: @value converted to a #guint64.
+ */
+#ifdef WIN32
+#define gst_gdouble_to_guint64(value) gst_util_gdouble_to_guint64(value)
+#define gst_guint64_to_gdouble(value) gst_util_guint64_to_gdouble(value)
+#else
+#define gst_gdouble_to_guint64(value) ((guint64) (value))
+#define gst_guint64_to_gdouble(value) ((gdouble) (value))
+#endif
+
+GST_API
+guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
+
+GST_API
+guint64 gst_util_uint64_scale_round (guint64 val, guint64 num, guint64 denom);
+
+GST_API
+guint64 gst_util_uint64_scale_ceil (guint64 val, guint64 num, guint64 denom);
+
+GST_API
+guint64 gst_util_uint64_scale_int (guint64 val, gint num, gint denom);
+
+GST_API
+guint64 gst_util_uint64_scale_int_round (guint64 val, gint num, gint denom);
+
+GST_API
+guint64 gst_util_uint64_scale_int_ceil (guint64 val, gint num, gint denom);
+
+/**
+ * GST_SEQNUM_INVALID:
+ *
+ * A value which is guaranteed to never be returned by
+ * gst_util_seqnum_next().
+ *
+ * Can be used as a default value in variables used to store seqnum.
+ *
+ * Since: 1.14
+ */
+#define GST_SEQNUM_INVALID (0)
+
+GST_API
+guint32 gst_util_seqnum_next (void);
+
+GST_API
+gint32 gst_util_seqnum_compare (guint32 s1, guint32 s2);
+
+/**
+ * GST_GROUP_ID_INVALID:
+ *
+ * A value which is guaranteed to never be returned by
+ * gst_util_group_id_next().
+ *
+ * Can be used as a default value in variables used to store group_id.
+ *
+ * Since: 1.14
+ */
+#define GST_GROUP_ID_INVALID (0)
+
+GST_API
+guint gst_util_group_id_next (void);
+
+/**
+ * GST_CALL_PARENT:
+ * @parent_class_cast: the name of the class cast macro for the parent type
+ * @name: name of the function to call
+ * @args: arguments enclosed in '( )'
+ *
+ * Just call the parent handler. This assumes that there is a variable
+ * named parent_class that points to the (duh!) parent class. Note that
+ * this macro is not to be used with things that return something, use
+ * the _WITH_DEFAULT version for that
+ */
+#define GST_CALL_PARENT(parent_class_cast, name, args) \
+ ((parent_class_cast(parent_class)->name != NULL) ? \
+ parent_class_cast(parent_class)->name args : (void) 0)
+
+/**
+ * GST_CALL_PARENT_WITH_DEFAULT:
+ * @parent_class_cast: the name of the class cast macro for the parent type
+ * @name: name of the function to call
+ * @args: arguments enclosed in '( )'
+ * @def_return: default result
+ *
+ * Same as GST_CALL_PARENT(), but in case there is no implementation, it
+ * evaluates to @def_return.
+ */
+#define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)\
+ ((parent_class_cast(parent_class)->name != NULL) ? \
+ parent_class_cast(parent_class)->name args : def_return)
+
+/* Define PUT and GET functions for unaligned memory */
+#define _GST_GET(__data, __idx, __size, __shift) \
+ (((guint##__size) (((const guint8 *) (__data))[__idx])) << (__shift))
+
+#define _GST_PUT(__data, __idx, __size, __shift, __num) \
+ (((guint8 *) (__data))[__idx] = (((guint##__size) (__num)) >> (__shift)) & 0xff)
+
+#ifndef __GTK_DOC_IGNORE__
+#if GST_HAVE_UNALIGNED_ACCESS
+static inline guint16 __gst_fast_read16(const guint8 *v) {
+ return *(const guint16*)(const void*)(v);
+}
+static inline guint32 __gst_fast_read32(const guint8 *v) {
+ return *(const guint32*)(const void*)(v);
+}
+static inline guint64 __gst_fast_read64(const guint8 *v) {
+ return *(const guint64*)(const void*)(v);
+}
+static inline guint16 __gst_fast_read_swap16(const guint8 *v) {
+ return GUINT16_SWAP_LE_BE(*(const guint16*)(const void*)(v));
+}
+static inline guint32 __gst_fast_read_swap32(const guint8 *v) {
+ return GUINT32_SWAP_LE_BE(*(const guint32*)(const void*)(v));
+}
+static inline guint64 __gst_fast_read_swap64(const guint8 *v) {
+ return GUINT64_SWAP_LE_BE(*(const guint64*)(const void*)(v));
+}
+# define _GST_FAST_READ(s, d) __gst_fast_read##s((const guint8 *)(d))
+# define _GST_FAST_READ_SWAP(s, d) __gst_fast_read_swap##s((const guint8 *)(d))
+
+static inline void __gst_fast_write16 (guint8 *p, guint16 v) {
+ *(guint16*)(void*)(p) = v;
+}
+static inline void __gst_fast_write32 (guint8 *p, guint32 v) {
+ *(guint32*)(void*)(p) = v;
+}
+static inline void __gst_fast_write64 (guint8 *p, guint64 v) {
+ *(guint64*)(void*)(p) = v;
+}
+static inline void __gst_fast_write_swap16 (guint8 *p, guint16 v) {
+ *(guint16*)(void*)(p) = GUINT16_SWAP_LE_BE (v);
+}
+static inline void __gst_fast_write_swap32 (guint8 *p, guint32 v) {
+ *(guint32*)(void*)(p) = GUINT32_SWAP_LE_BE (v);
+}
+static inline void __gst_fast_write_swap64 (guint8 *p, guint64 v) {
+ *(guint64*)(void*)(p) = GUINT64_SWAP_LE_BE (v);
+}
+# define _GST_FAST_WRITE(s, d, v) __gst_fast_write##s((guint8 *)(d), (v))
+# define _GST_FAST_WRITE_SWAP(s, d, v) __gst_fast_write_swap##s((guint8 *)(d), (v))
+#endif
+#endif
+
+
+/**
+ * GST_READ_UINT64_BE:
+ * @data: memory location
+ *
+ * Read a 64 bit unsigned integer value in big endian format from the memory buffer.
+ */
+
+/**
+ * GST_READ_UINT64_LE:
+ * @data: memory location
+ *
+ * Read a 64 bit unsigned integer value in little endian format from the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_READ_UINT64_BE(data) _GST_FAST_READ (64, data)
+# define GST_READ_UINT64_LE(data) _GST_FAST_READ_SWAP (64, data)
+# else
+# define GST_READ_UINT64_BE(data) _GST_FAST_READ_SWAP (64, data)
+# define GST_READ_UINT64_LE(data) _GST_FAST_READ (64, data)
+# endif
+#else
+#define _GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
+ _GST_GET (data, 1, 64, 48) | \
+ _GST_GET (data, 2, 64, 40) | \
+ _GST_GET (data, 3, 64, 32) | \
+ _GST_GET (data, 4, 64, 24) | \
+ _GST_GET (data, 5, 64, 16) | \
+ _GST_GET (data, 6, 64, 8) | \
+ _GST_GET (data, 7, 64, 0))
+
+#define _GST_READ_UINT64_LE(data) (_GST_GET (data, 7, 64, 56) | \
+ _GST_GET (data, 6, 64, 48) | \
+ _GST_GET (data, 5, 64, 40) | \
+ _GST_GET (data, 4, 64, 32) | \
+ _GST_GET (data, 3, 64, 24) | \
+ _GST_GET (data, 2, 64, 16) | \
+ _GST_GET (data, 1, 64, 8) | \
+ _GST_GET (data, 0, 64, 0))
+
+#define GST_READ_UINT64_BE(data) __gst_slow_read64_be((const guint8 *)(data))
+static inline guint64 __gst_slow_read64_be (const guint8 * data) {
+ return _GST_READ_UINT64_BE (data);
+}
+#define GST_READ_UINT64_LE(data) __gst_slow_read64_le((const guint8 *)(data))
+static inline guint64 __gst_slow_read64_le (const guint8 * data) {
+ return _GST_READ_UINT64_LE (data);
+}
+#endif
+
+/**
+ * GST_READ_UINT32_BE:
+ * @data: memory location
+ *
+ * Read a 32 bit unsigned integer value in big endian format from the memory buffer.
+ */
+
+/**
+ * GST_READ_UINT32_LE:
+ * @data: memory location
+ *
+ * Read a 32 bit unsigned integer value in little endian format from the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_READ_UINT32_BE(data) _GST_FAST_READ (32, data)
+# define GST_READ_UINT32_LE(data) _GST_FAST_READ_SWAP (32, data)
+# else
+# define GST_READ_UINT32_BE(data) _GST_FAST_READ_SWAP (32, data)
+# define GST_READ_UINT32_LE(data) _GST_FAST_READ (32, data)
+# endif
+#else
+#define _GST_READ_UINT32_BE(data) (_GST_GET (data, 0, 32, 24) | \
+ _GST_GET (data, 1, 32, 16) | \
+ _GST_GET (data, 2, 32, 8) | \
+ _GST_GET (data, 3, 32, 0))
+
+#define _GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) | \
+ _GST_GET (data, 2, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 0, 32, 0))
+
+#define GST_READ_UINT32_BE(data) __gst_slow_read32_be((const guint8 *)(data))
+static inline guint32 __gst_slow_read32_be (const guint8 * data) {
+ return _GST_READ_UINT32_BE (data);
+}
+#define GST_READ_UINT32_LE(data) __gst_slow_read32_le((const guint8 *)(data))
+static inline guint32 __gst_slow_read32_le (const guint8 * data) {
+ return _GST_READ_UINT32_LE (data);
+}
+#endif
+
+/**
+ * GST_READ_UINT24_BE:
+ * @data: memory location
+ *
+ * Read a 24 bit unsigned integer value in big endian format from the memory buffer.
+ */
+#define _GST_READ_UINT24_BE(data) (_GST_GET (data, 0, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 2, 32, 0))
+
+#define GST_READ_UINT24_BE(data) __gst_slow_read24_be((const guint8 *)(data))
+static inline guint32 __gst_slow_read24_be (const guint8 * data) {
+ return _GST_READ_UINT24_BE (data);
+}
+
+/**
+ * GST_READ_UINT24_LE:
+ * @data: memory location
+ *
+ * Read a 24 bit unsigned integer value in little endian format from the memory buffer.
+ */
+#define _GST_READ_UINT24_LE(data) (_GST_GET (data, 2, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 0, 32, 0))
+
+#define GST_READ_UINT24_LE(data) __gst_slow_read24_le((const guint8 *)(data))
+static inline guint32 __gst_slow_read24_le (const guint8 * data) {
+ return _GST_READ_UINT24_LE (data);
+}
+
+/**
+ * GST_READ_UINT16_BE:
+ * @data: memory location
+ *
+ * Read a 16 bit unsigned integer value in big endian format from the memory buffer.
+ */
+/**
+ * GST_READ_UINT16_LE:
+ * @data: memory location
+ *
+ * Read a 16 bit unsigned integer value in little endian format from the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_READ_UINT16_BE(data) _GST_FAST_READ (16, data)
+# define GST_READ_UINT16_LE(data) _GST_FAST_READ_SWAP (16, data)
+# else
+# define GST_READ_UINT16_BE(data) _GST_FAST_READ_SWAP (16, data)
+# define GST_READ_UINT16_LE(data) _GST_FAST_READ (16, data)
+# endif
+#else
+#define _GST_READ_UINT16_BE(data) (_GST_GET (data, 0, 16, 8) | \
+ _GST_GET (data, 1, 16, 0))
+
+#define _GST_READ_UINT16_LE(data) (_GST_GET (data, 1, 16, 8) | \
+ _GST_GET (data, 0, 16, 0))
+
+#define GST_READ_UINT16_BE(data) __gst_slow_read16_be((const guint8 *)(data))
+static inline guint16 __gst_slow_read16_be (const guint8 * data) {
+ return _GST_READ_UINT16_BE (data);
+}
+#define GST_READ_UINT16_LE(data) __gst_slow_read16_le((const guint8 *)(data))
+static inline guint16 __gst_slow_read16_le (const guint8 * data) {
+ return _GST_READ_UINT16_LE (data);
+}
+#endif
+
+/**
+ * GST_READ_UINT8:
+ * @data: memory location
+ *
+ * Read an 8 bit unsigned integer value from the memory buffer.
+ */
+#define GST_READ_UINT8(data) (_GST_GET (data, 0, 8, 0))
+
+/**
+ * GST_WRITE_UINT64_BE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 64 bit unsigned integer value in big endian format into the memory buffer.
+ */
+/**
+ * GST_WRITE_UINT64_LE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 64 bit unsigned integer value in little endian format into the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_WRITE_UINT64_BE(data,val) _GST_FAST_WRITE(64,data,val)
+# define GST_WRITE_UINT64_LE(data,val) _GST_FAST_WRITE_SWAP(64,data,val)
+# else
+# define GST_WRITE_UINT64_BE(data,val) _GST_FAST_WRITE_SWAP(64,data,val)
+# define GST_WRITE_UINT64_LE(data,val) _GST_FAST_WRITE(64,data,val)
+# endif
+#else
+#define GST_WRITE_UINT64_BE(data,val) do { \
+ gpointer __put_data = data; \
+ guint64 __put_val = val; \
+ _GST_PUT (__put_data, 0, 64, 56, __put_val); \
+ _GST_PUT (__put_data, 1, 64, 48, __put_val); \
+ _GST_PUT (__put_data, 2, 64, 40, __put_val); \
+ _GST_PUT (__put_data, 3, 64, 32, __put_val); \
+ _GST_PUT (__put_data, 4, 64, 24, __put_val); \
+ _GST_PUT (__put_data, 5, 64, 16, __put_val); \
+ _GST_PUT (__put_data, 6, 64, 8, __put_val); \
+ _GST_PUT (__put_data, 7, 64, 0, __put_val); \
+ } while (0)
+
+#define GST_WRITE_UINT64_LE(data,val) do { \
+ gpointer __put_data = data; \
+ guint64 __put_val = val; \
+ _GST_PUT (__put_data, 0, 64, 0, __put_val); \
+ _GST_PUT (__put_data, 1, 64, 8, __put_val); \
+ _GST_PUT (__put_data, 2, 64, 16, __put_val); \
+ _GST_PUT (__put_data, 3, 64, 24, __put_val); \
+ _GST_PUT (__put_data, 4, 64, 32, __put_val); \
+ _GST_PUT (__put_data, 5, 64, 40, __put_val); \
+ _GST_PUT (__put_data, 6, 64, 48, __put_val); \
+ _GST_PUT (__put_data, 7, 64, 56, __put_val); \
+ } while (0)
+#endif /* !GST_HAVE_UNALIGNED_ACCESS */
+
+/**
+ * GST_WRITE_UINT32_BE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 32 bit unsigned integer value in big endian format into the memory buffer.
+ */
+/**
+ * GST_WRITE_UINT32_LE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 32 bit unsigned integer value in little endian format into the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_WRITE_UINT32_BE(data,val) _GST_FAST_WRITE(32,data,val)
+# define GST_WRITE_UINT32_LE(data,val) _GST_FAST_WRITE_SWAP(32,data,val)
+# else
+# define GST_WRITE_UINT32_BE(data,val) _GST_FAST_WRITE_SWAP(32,data,val)
+# define GST_WRITE_UINT32_LE(data,val) _GST_FAST_WRITE(32,data,val)
+# endif
+#else
+#define GST_WRITE_UINT32_BE(data,val) do { \
+ gpointer __put_data = data; \
+ guint32 __put_val = val; \
+ _GST_PUT (__put_data, 0, 32, 24, __put_val); \
+ _GST_PUT (__put_data, 1, 32, 16, __put_val); \
+ _GST_PUT (__put_data, 2, 32, 8, __put_val); \
+ _GST_PUT (__put_data, 3, 32, 0, __put_val); \
+ } while (0)
+
+#define GST_WRITE_UINT32_LE(data,val) do { \
+ gpointer __put_data = data; \
+ guint32 __put_val = val; \
+ _GST_PUT (__put_data, 0, 32, 0, __put_val); \
+ _GST_PUT (__put_data, 1, 32, 8, __put_val); \
+ _GST_PUT (__put_data, 2, 32, 16, __put_val); \
+ _GST_PUT (__put_data, 3, 32, 24, __put_val); \
+ } while (0)
+#endif /* !GST_HAVE_UNALIGNED_ACCESS */
+
+/**
+ * GST_WRITE_UINT24_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 24 bit unsigned integer value in big endian format into the memory buffer.
+ */
+#define GST_WRITE_UINT24_BE(data, num) do { \
+ gpointer __put_data = data; \
+ guint32 __put_val = num; \
+ _GST_PUT (__put_data, 0, 32, 16, __put_val); \
+ _GST_PUT (__put_data, 1, 32, 8, __put_val); \
+ _GST_PUT (__put_data, 2, 32, 0, __put_val); \
+ } while (0)
+
+/**
+ * GST_WRITE_UINT24_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 24 bit unsigned integer value in little endian format into the memory buffer.
+ */
+#define GST_WRITE_UINT24_LE(data, num) do { \
+ gpointer __put_data = data; \
+ guint32 __put_val = num; \
+ _GST_PUT (__put_data, 0, 32, 0, __put_val); \
+ _GST_PUT (__put_data, 1, 32, 8, __put_val); \
+ _GST_PUT (__put_data, 2, 32, 16, __put_val); \
+ } while (0)
+
+/**
+ * GST_WRITE_UINT16_BE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 16 bit unsigned integer value in big endian format into the memory buffer.
+ */
+/**
+ * GST_WRITE_UINT16_LE:
+ * @data: memory location
+ * @val: value to store
+ *
+ * Store a 16 bit unsigned integer value in little endian format into the memory buffer.
+ */
+#if GST_HAVE_UNALIGNED_ACCESS
+# if (G_BYTE_ORDER == G_BIG_ENDIAN)
+# define GST_WRITE_UINT16_BE(data,val) _GST_FAST_WRITE(16,data,val)
+# define GST_WRITE_UINT16_LE(data,val) _GST_FAST_WRITE_SWAP(16,data,val)
+# else
+# define GST_WRITE_UINT16_BE(data,val) _GST_FAST_WRITE_SWAP(16,data,val)
+# define GST_WRITE_UINT16_LE(data,val) _GST_FAST_WRITE(16,data,val)
+# endif
+#else
+#define GST_WRITE_UINT16_BE(data,val) do { \
+ gpointer __put_data = data; \
+ guint16 __put_val = val; \
+ _GST_PUT (__put_data, 0, 16, 8, __put_val); \
+ _GST_PUT (__put_data, 1, 16, 0, __put_val); \
+ } while (0)
+
+#define GST_WRITE_UINT16_LE(data,val) do { \
+ gpointer __put_data = data; \
+ guint16 __put_val = val; \
+ _GST_PUT (__put_data, 0, 16, 0, __put_val); \
+ _GST_PUT (__put_data, 1, 16, 8, __put_val); \
+ } while (0)
+#endif /* !GST_HAVE_UNALIGNED_ACCESS */
+
+/**
+ * GST_WRITE_UINT8:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store an 8 bit unsigned integer value into the memory buffer.
+ */
+#define GST_WRITE_UINT8(data, num) do { \
+ _GST_PUT (data, 0, 8, 0, num); \
+ } while (0)
+
+/* Float endianness conversion macros */
+#ifndef __GI_SCANNER__
+
+/* FIXME: Remove this once we depend on a GLib version with this */
+#ifndef GFLOAT_FROM_LE
+/**
+ * GFLOAT_SWAP_LE_BE: (skip)
+ * @in: input value
+ *
+ * Swap byte order of a 32-bit floating point value (float).
+ *
+ * Returns: @in byte-swapped.
+ */
+static inline gfloat
+GFLOAT_SWAP_LE_BE(gfloat in)
+{
+ union
+ {
+ guint32 i;
+ gfloat f;
+ } u;
+
+ u.f = in;
+ u.i = GUINT32_SWAP_LE_BE (u.i);
+ return u.f;
+}
+
+/**
+ * GDOUBLE_SWAP_LE_BE: (skip)
+ * @in: input value
+ *
+ * Swap byte order of a 64-bit floating point value (double).
+ *
+ * Returns: @in byte-swapped.
+ */
+static inline gdouble
+GDOUBLE_SWAP_LE_BE(gdouble in)
+{
+ union
+ {
+ guint64 i;
+ gdouble d;
+ } u;
+
+ u.d = in;
+ u.i = GUINT64_SWAP_LE_BE (u.i);
+ return u.d;
+}
+
+/**
+ * GDOUBLE_TO_LE: (skip)
+ * @val: value
+ *
+ * Convert 64-bit floating point value (double) from native byte order into
+ * little endian byte order.
+ */
+/**
+ * GDOUBLE_TO_BE: (skip)
+ * @val: value
+ *
+ * Convert 64-bit floating point value (double) from native byte order into
+ * big endian byte order.
+ */
+/**
+ * GDOUBLE_FROM_LE: (skip)
+ * @val: value
+ *
+ * Convert 64-bit floating point value (double) from little endian byte order
+ * into native byte order.
+ */
+/**
+ * GDOUBLE_FROM_BE: (skip)
+ * @val: value
+ *
+ * Convert 64-bit floating point value (double) from big endian byte order
+ * into native byte order.
+ */
+
+/**
+ * GFLOAT_TO_LE: (skip)
+ * @val: value
+ *
+ * Convert 32-bit floating point value (float) from native byte order into
+ * little endian byte order.
+ */
+/**
+ * GFLOAT_TO_BE: (skip)
+ * @val: value
+ *
+ * Convert 32-bit floating point value (float) from native byte order into
+ * big endian byte order.
+ */
+/**
+ * GFLOAT_FROM_LE: (skip)
+ * @val: value
+ *
+ * Convert 32-bit floating point value (float) from little endian byte order
+ * into native byte order.
+ */
+/**
+ * GFLOAT_FROM_BE: (skip)
+ * @val: value
+ *
+ * Convert 32-bit floating point value (float) from big endian byte order
+ * into native byte order.
+ */
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GFLOAT_TO_LE(val) ((gfloat) (val))
+#define GFLOAT_TO_BE(val) (GFLOAT_SWAP_LE_BE (val))
+#define GDOUBLE_TO_LE(val) ((gdouble) (val))
+#define GDOUBLE_TO_BE(val) (GDOUBLE_SWAP_LE_BE (val))
+
+#elif G_BYTE_ORDER == G_BIG_ENDIAN
+#define GFLOAT_TO_LE(val) (GFLOAT_SWAP_LE_BE (val))
+#define GFLOAT_TO_BE(val) ((gfloat) (val))
+#define GDOUBLE_TO_LE(val) (GDOUBLE_SWAP_LE_BE (val))
+#define GDOUBLE_TO_BE(val) ((gdouble) (val))
+
+#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+#error unknown ENDIAN type
+#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+
+#define GFLOAT_FROM_LE(val) (GFLOAT_TO_LE (val))
+#define GFLOAT_FROM_BE(val) (GFLOAT_TO_BE (val))
+#define GDOUBLE_FROM_LE(val) (GDOUBLE_TO_LE (val))
+#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
+
+#endif /* !defined(GFLOAT_FROM_LE) */
+
+#endif /* !__GI_SCANNER__ */
+
+/**
+ * GST_READ_FLOAT_LE:
+ * @data: memory location
+ *
+ * Read a 32 bit float value in little endian format from the memory buffer.
+ *
+ * Returns: The floating point value read from @data
+ */
+static inline gfloat
+GST_READ_FLOAT_LE(const guint8 *data)
+{
+ union
+ {
+ guint32 i;
+ gfloat f;
+ } u;
+
+ u.i = GST_READ_UINT32_LE (data);
+ return u.f;
+}
+
+/**
+ * GST_READ_FLOAT_BE:
+ * @data: memory location
+ *
+ * Read a 32 bit float value in big endian format from the memory buffer.
+ *
+ * Returns: The floating point value read from @data
+ */
+static inline gfloat
+GST_READ_FLOAT_BE(const guint8 *data)
+{
+ union
+ {
+ guint32 i;
+ gfloat f;
+ } u;
+
+ u.i = GST_READ_UINT32_BE (data);
+ return u.f;
+}
+
+/**
+ * GST_READ_DOUBLE_LE:
+ * @data: memory location
+ *
+ * Read a 64 bit double value in little endian format from the memory buffer.
+ *
+ * Returns: The double-precision floating point value read from @data
+ */
+static inline gdouble
+GST_READ_DOUBLE_LE(const guint8 *data)
+{
+ union
+ {
+ guint64 i;
+ gdouble d;
+ } u;
+
+ u.i = GST_READ_UINT64_LE (data);
+ return u.d;
+}
+
+/**
+ * GST_READ_DOUBLE_BE:
+ * @data: memory location
+ *
+ * Read a 64 bit double value in big endian format from the memory buffer.
+ *
+ * Returns: The double-precision floating point value read from @data
+ */
+static inline gdouble
+GST_READ_DOUBLE_BE(const guint8 *data)
+{
+ union
+ {
+ guint64 i;
+ gdouble d;
+ } u;
+
+ u.i = GST_READ_UINT64_BE (data);
+ return u.d;
+}
+
+/**
+ * GST_WRITE_FLOAT_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 32 bit float value in little endian format into the memory buffer.
+ */
+static inline void
+GST_WRITE_FLOAT_LE(guint8 *data, gfloat num)
+{
+ union
+ {
+ guint32 i;
+ gfloat f;
+ } u;
+
+ u.f = num;
+ GST_WRITE_UINT32_LE (data, u.i);
+}
+
+/**
+ * GST_WRITE_FLOAT_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 32 bit float value in big endian format into the memory buffer.
+ */
+static inline void
+GST_WRITE_FLOAT_BE(guint8 *data, gfloat num)
+{
+ union
+ {
+ guint32 i;
+ gfloat f;
+ } u;
+
+ u.f = num;
+ GST_WRITE_UINT32_BE (data, u.i);
+}
+
+/**
+ * GST_WRITE_DOUBLE_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 64 bit double value in little endian format into the memory buffer.
+ */
+static inline void
+GST_WRITE_DOUBLE_LE(guint8 *data, gdouble num)
+{
+ union
+ {
+ guint64 i;
+ gdouble d;
+ } u;
+
+ u.d = num;
+ GST_WRITE_UINT64_LE (data, u.i);
+}
+
+/**
+ * GST_WRITE_DOUBLE_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 64 bit double value in big endian format into the memory buffer.
+ */
+static inline void
+GST_WRITE_DOUBLE_BE(guint8 *data, gdouble num)
+{
+ union
+ {
+ guint64 i;
+ gdouble d;
+ } u;
+
+ u.d = num;
+ GST_WRITE_UINT64_BE (data, u.i);
+}
+
+/* Miscellaneous utility macros */
+
+/**
+ * GST_ROUND_UP_2:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 2.
+ */
+#define GST_ROUND_UP_2(num) (((num)+1)&~1)
+/**
+ * GST_ROUND_UP_4:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 4.
+ */
+#define GST_ROUND_UP_4(num) (((num)+3)&~3)
+/**
+ * GST_ROUND_UP_8:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 8.
+ */
+#define GST_ROUND_UP_8(num) (((num)+7)&~7)
+/**
+ * GST_ROUND_UP_16:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 16.
+ */
+#define GST_ROUND_UP_16(num) (((num)+15)&~15)
+/**
+ * GST_ROUND_UP_32:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 32.
+ */
+#define GST_ROUND_UP_32(num) (((num)+31)&~31)
+/**
+ * GST_ROUND_UP_64:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 64.
+ */
+#define GST_ROUND_UP_64(num) (((num)+63)&~63)
+/**
+ * GST_ROUND_UP_128:
+ * @num: integer value to round up
+ *
+ * Rounds an integer value up to the next multiple of 128.
+ * Since: 1.4
+ */
+#define GST_ROUND_UP_128(num) (((num)+127)&~127)
+/**
+ * GST_ROUND_UP_N:
+ * @num: integrer value to round up
+ * @align: a power of two to round up to
+ *
+ * Rounds an integer value up to the next multiple of @align. @align MUST be a
+ * power of two.
+ */
+#define GST_ROUND_UP_N(num,align) ((((num) + ((align) - 1)) & ~((align) - 1)))
+
+
+/**
+ * GST_ROUND_DOWN_2:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 2.
+ */
+#define GST_ROUND_DOWN_2(num) ((num)&(~1))
+/**
+ * GST_ROUND_DOWN_4:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 4.
+ */
+#define GST_ROUND_DOWN_4(num) ((num)&(~3))
+/**
+ * GST_ROUND_DOWN_8:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 8.
+ */
+#define GST_ROUND_DOWN_8(num) ((num)&(~7))
+/**
+ * GST_ROUND_DOWN_16:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 16.
+ */
+#define GST_ROUND_DOWN_16(num) ((num)&(~15))
+/**
+ * GST_ROUND_DOWN_32:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 32.
+ */
+#define GST_ROUND_DOWN_32(num) ((num)&(~31))
+/**
+ * GST_ROUND_DOWN_64:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 64.
+ */
+#define GST_ROUND_DOWN_64(num) ((num)&(~63))
+/**
+ * GST_ROUND_DOWN_128:
+ * @num: integer value to round down
+ *
+ * Rounds an integer value down to the next multiple of 128.
+ * Since: 1.4
+ */
+#define GST_ROUND_DOWN_128(num) ((num)&(~127))
+/**
+ * GST_ROUND_DOWN_N:
+ * @num: integrer value to round down
+ * @align: a power of two to round down to
+ *
+ * Rounds an integer value down to the next multiple of @align. @align MUST be a
+ * power of two.
+ */
+#define GST_ROUND_DOWN_N(num,align) (((num) & ~((align) - 1)))
+
+
+GST_API
+void gst_object_default_error (GstObject * source,
+ const GError * error,
+ const gchar * debug);
+
+/* element functions */
+
+GST_API
+void gst_element_create_all_pads (GstElement *element);
+
+GST_API
+GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad,
+ GstCaps *caps);
+GST_API
+GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
+
+GST_API
+const gchar* gst_element_state_get_name (GstState state);
+
+GST_API
+const gchar * gst_element_state_change_return_get_name (GstStateChangeReturn state_ret);
+
+GST_API
+const gchar * gst_state_change_get_name (GstStateChange transition);
+
+GST_API
+gboolean gst_element_link (GstElement *src, GstElement *dest);
+
+GST_API
+gboolean gst_element_link_many (GstElement *element_1,
+ GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
+GST_API
+gboolean gst_element_link_filtered (GstElement * src,
+ GstElement * dest,
+ GstCaps *filter);
+GST_API
+void gst_element_unlink (GstElement *src, GstElement *dest);
+
+GST_API
+void gst_element_unlink_many (GstElement *element_1,
+ GstElement *element_2, ...) G_GNUC_NULL_TERMINATED;
+GST_API
+gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname,
+ GstElement *dest, const gchar *destpadname);
+GST_API
+gboolean gst_element_link_pads_full (GstElement *src, const gchar *srcpadname,
+ GstElement *dest, const gchar *destpadname,
+ GstPadLinkCheck flags);
+GST_API
+void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname,
+ GstElement *dest, const gchar *destpadname);
+GST_API
+gboolean gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
+ GstElement * dest, const gchar * destpadname,
+ GstCaps *filter);
+GST_API
+gboolean gst_element_seek_simple (GstElement *element,
+ GstFormat format,
+ GstSeekFlags seek_flags,
+ gint64 seek_pos);
+
+/* util elementfactory functions */
+
+GST_API
+gboolean gst_element_factory_can_sink_all_caps (GstElementFactory *factory, const GstCaps *caps);
+
+GST_API
+gboolean gst_element_factory_can_src_all_caps (GstElementFactory *factory, const GstCaps *caps);
+
+GST_API
+gboolean gst_element_factory_can_sink_any_caps (GstElementFactory *factory, const GstCaps *caps);
+
+GST_API
+gboolean gst_element_factory_can_src_any_caps (GstElementFactory *factory, const GstCaps *caps);
+
+/* util query functions */
+
+GST_API
+gboolean gst_element_query_position (GstElement *element, GstFormat format, gint64 *cur);
+
+GST_API
+gboolean gst_element_query_duration (GstElement *element, GstFormat format, gint64 *duration);
+
+GST_API
+gboolean gst_element_query_convert (GstElement *element, GstFormat src_format, gint64 src_val,
+ GstFormat dest_format, gint64 *dest_val);
+
+/* pad functions */
+
+GST_API
+void gst_pad_use_fixed_caps (GstPad *pad);
+
+GST_API
+GstElement* gst_pad_get_parent_element (GstPad *pad);
+
+/* util query functions */
+
+GST_API
+gboolean gst_pad_proxy_query_accept_caps (GstPad *pad, GstQuery *query);
+
+GST_API
+gboolean gst_pad_proxy_query_caps (GstPad *pad, GstQuery *query);
+
+GST_API
+gboolean gst_pad_query_position (GstPad *pad, GstFormat format, gint64 *cur);
+
+GST_API
+gboolean gst_pad_query_duration (GstPad *pad, GstFormat format, gint64 *duration);
+
+GST_API
+gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
+ GstFormat dest_format, gint64 *dest_val);
+GST_API
+GstCaps * gst_pad_query_caps (GstPad *pad, GstCaps *filter);
+
+GST_API
+gboolean gst_pad_query_accept_caps (GstPad *pad, GstCaps *caps);
+
+GST_API
+gboolean gst_pad_link_maybe_ghosting (GstPad *src,
+ GstPad *sink);
+GST_API
+gboolean gst_pad_link_maybe_ghosting_full (GstPad *src,
+ GstPad *sink,
+ GstPadLinkCheck flags);
+GST_API
+gboolean gst_pad_peer_query_position (GstPad *pad, GstFormat format, gint64 *cur);
+
+GST_API
+gboolean gst_pad_peer_query_duration (GstPad *pad, GstFormat format, gint64 *duration);
+
+GST_API
+gboolean gst_pad_peer_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,
+ GstFormat dest_format, gint64 *dest_val);
+GST_API
+GstCaps * gst_pad_peer_query_caps (GstPad * pad, GstCaps *filter);
+
+GST_API
+gboolean gst_pad_peer_query_accept_caps (GstPad * pad, GstCaps *caps);
+
+GST_API
+gchar * gst_pad_create_stream_id (GstPad * pad, GstElement * parent, const gchar *stream_id) G_GNUC_MALLOC;
+
+GST_API
+gchar * gst_pad_create_stream_id_printf (GstPad * pad, GstElement * parent, const gchar *stream_id, ...) G_GNUC_PRINTF (3, 4) G_GNUC_MALLOC;
+
+GST_API
+gchar * gst_pad_create_stream_id_printf_valist (GstPad * pad, GstElement * parent, const gchar *stream_id, va_list var_args) G_GNUC_PRINTF (3, 0) G_GNUC_MALLOC;
+
+GST_API
+gchar * gst_pad_get_stream_id (GstPad * pad);
+
+GST_API
+GstStream * gst_pad_get_stream (GstPad * pad);
+
+/* bin functions */
+
+GST_API
+void gst_bin_add_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
+
+GST_API
+void gst_bin_remove_many (GstBin *bin, GstElement *element_1, ...) G_GNUC_NULL_TERMINATED;
+
+GST_API
+GstPad * gst_bin_find_unlinked_pad (GstBin *bin, GstPadDirection direction);
+
+GST_API
+gboolean gst_bin_sync_children_states (GstBin *bin);
+
+/* parse utility functions */
+
+GST_API
+GstElement * gst_parse_bin_from_description (const gchar * bin_description,
+ gboolean ghost_unlinked_pads,
+ GError ** err);
+GST_API
+GstElement * gst_parse_bin_from_description_full (const gchar * bin_description,
+ gboolean ghost_unlinked_pads,
+ GstParseContext * context,
+ GstParseFlags flags,
+ GError ** err);
+GST_API
+GstClockTime gst_util_get_timestamp (void);
+
+/**
+ * GstSearchMode:
+ * @GST_SEARCH_MODE_EXACT : Only search for exact matches.
+ * @GST_SEARCH_MODE_BEFORE: Search for an exact match or the element just before.
+ * @GST_SEARCH_MODE_AFTER : Search for an exact match or the element just after.
+ *
+ * The different search modes.
+ */
+typedef enum {
+ GST_SEARCH_MODE_EXACT = 0,
+ GST_SEARCH_MODE_BEFORE,
+ GST_SEARCH_MODE_AFTER
+} GstSearchMode;
+
+/**
+ * GstPluginAPIFlags:
+ * @GST_PLUGIN_API_FLAG_IGNORE_ENUM_MEMBERS: Ignore enum members when generating
+ * the plugins cache. This is useful if the members of the enum are generated
+ * dynamically, in order not to expose incorrect documentation to the end user.
+ *
+ * Since: 1.18
+ */
+typedef enum {
+ GST_PLUGIN_API_FLAG_IGNORE_ENUM_MEMBERS = (1 << 0),
+} GstPluginAPIFlags;
+
+GST_API
+gpointer gst_util_array_binary_search (gpointer array, guint num_elements,
+ gsize element_size, GCompareDataFunc search_func,
+ GstSearchMode mode, gconstpointer search_data,
+ gpointer user_data);
+
+/* fraction operations */
+
+GST_API
+gint gst_util_greatest_common_divisor (gint a, gint b);
+
+GST_API
+gint64 gst_util_greatest_common_divisor_int64 (gint64 a, gint64 b);
+
+GST_API
+void gst_util_fraction_to_double (gint src_n, gint src_d, gdouble *dest);
+
+GST_API
+void gst_util_double_to_fraction (gdouble src, gint *dest_n, gint *dest_d);
+
+GST_API
+gboolean gst_util_fraction_multiply (gint a_n, gint a_d, gint b_n, gint b_d,
+ gint *res_n, gint *res_d);
+GST_API
+gboolean gst_util_fraction_add (gint a_n, gint a_d, gint b_n, gint b_d,
+ gint *res_n, gint *res_d);
+GST_API
+gint gst_util_fraction_compare (gint a_n, gint a_d, gint b_n, gint b_d);
+
+GST_API
+gboolean gst_calculate_linear_regression (const GstClockTime * xy,
+ GstClockTime * temp, guint n,
+ GstClockTime * m_num, GstClockTime * m_denom,
+ GstClockTime * b, GstClockTime * xbase,
+ gdouble * r_squared);
+
+GST_API
+void gst_type_mark_as_plugin_api (GType type, GstPluginAPIFlags flags);
+
+GST_API
+gboolean gst_type_is_plugin_api (GType type, GstPluginAPIFlags *flags);
+
+G_END_DECLS
+
+#endif /* __GST_UTILS_H__ */
diff --git a/include/gst/gstvalue.h b/include/gst/gstvalue.h
new file mode 100644
index 0000000000..1802904f3d
--- /dev/null
+++ b/include/gst/gstvalue.h
@@ -0,0 +1,821 @@
+/* GStreamer
+ * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VALUE_H__
+#define __GST_VALUE_H__
+
+#include <gst/gstconfig.h>
+#include <gst/gstcaps.h>
+#include <gst/gststructure.h>
+#include <gst/gstcapsfeatures.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_MAKE_FOURCC:
+ * @a: the first character
+ * @b: the second character
+ * @c: the third character
+ * @d: the fourth character
+ *
+ * Transform four characters into a #guint32 fourcc value with host
+ * endianness.
+ *
+ * |[
+ * guint32 fourcc = GST_MAKE_FOURCC ('M', 'J', 'P', 'G');
+ * ]|
+ *
+ */
+#define GST_MAKE_FOURCC(a,b,c,d) \
+ ( (guint32)(a) | ((guint32) (b)) << 8 | ((guint32) (c)) << 16 | ((guint32) (d)) << 24 )
+
+/**
+ * GST_STR_FOURCC:
+ * @f: a string with at least four characters
+ *
+ * Transform an input string into a #guint32 fourcc value with host
+ * endianness.
+ * Caller is responsible for ensuring the input string consists of at least
+ * four characters.
+ *
+ * |[
+ * guint32 fourcc = GST_STR_FOURCC ("MJPG");
+ * ]|
+ *
+ */
+#define GST_STR_FOURCC(f) ((guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24)))
+
+/**
+ * GST_FOURCC_FORMAT: (skip):
+ *
+ * Can be used together with #GST_FOURCC_ARGS to properly output a
+ * #guint32 fourcc value in a printf\()-style text message.
+ *
+ * |[
+ * printf ("fourcc: %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (fcc));
+ * ]|
+ *
+ */
+#define GST_FOURCC_FORMAT "c%c%c%c"
+
+/**
+ * GST_FOURCC_ARGS: (skip):
+ * @fourcc: a #guint32 fourcc value to output
+ *
+ * Can be used together with #GST_FOURCC_FORMAT to properly output a
+ * #guint32 fourcc value in a printf\()-style text message.
+ */
+
+#define __GST_PRINT_CHAR(c) \
+ g_ascii_isprint(c) ? (c) : '.'
+#define GST_FOURCC_ARGS(fourcc) \
+ __GST_PRINT_CHAR((fourcc) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 8) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 16) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 24) & 0xff)
+/**
+ * GST_VALUE_HOLDS_INT_RANGE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstIntRange value.
+ */
+#define GST_VALUE_HOLDS_INT_RANGE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_int_range_type)
+
+/**
+ * GST_VALUE_HOLDS_INT64_RANGE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstInt64Range value.
+ */
+#define GST_VALUE_HOLDS_INT64_RANGE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_int64_range_type)
+
+/**
+ * GST_VALUE_HOLDS_DOUBLE_RANGE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstDoubleRange value.
+ */
+#define GST_VALUE_HOLDS_DOUBLE_RANGE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_double_range_type)
+
+/**
+ * GST_VALUE_HOLDS_FRACTION_RANGE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstFractionRange value.
+ */
+#define GST_VALUE_HOLDS_FRACTION_RANGE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_fraction_range_type)
+
+/**
+ * GST_VALUE_HOLDS_LIST:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstValueList value.
+ */
+#define GST_VALUE_HOLDS_LIST(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_value_list_type)
+
+/**
+ * GST_VALUE_HOLDS_ARRAY:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstValueArray value.
+ */
+#define GST_VALUE_HOLDS_ARRAY(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_value_array_type)
+
+/**
+ * GST_VALUE_HOLDS_CAPS:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstCaps value.
+ */
+#define GST_VALUE_HOLDS_CAPS(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_caps_type)
+
+/**
+ * GST_VALUE_HOLDS_STRUCTURE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstStructure value.
+ */
+#define GST_VALUE_HOLDS_STRUCTURE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_structure_type)
+
+/**
+ * GST_VALUE_HOLDS_CAPS_FEATURES:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstCapsFeatures value.
+ */
+#define GST_VALUE_HOLDS_CAPS_FEATURES(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_caps_features_type)
+
+/**
+ * GST_VALUE_HOLDS_BUFFER:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstBuffer value.
+ */
+#define GST_VALUE_HOLDS_BUFFER(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_buffer_type)
+
+/**
+ * GST_VALUE_HOLDS_SAMPLE:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstSample value.
+ */
+#define GST_VALUE_HOLDS_SAMPLE(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_sample_type)
+
+/**
+ * GST_VALUE_HOLDS_FRACTION:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstFraction value.
+ */
+#define GST_VALUE_HOLDS_FRACTION(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_fraction_type)
+
+/**
+ * GST_VALUE_HOLDS_DATE_TIME:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstDateTime value.
+ */
+#define GST_VALUE_HOLDS_DATE_TIME(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_date_time_type)
+
+/**
+ * GST_VALUE_HOLDS_BITMASK:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstBitmask value.
+ */
+#define GST_VALUE_HOLDS_BITMASK(x) ((gpointer)(x) != NULL && G_VALUE_TYPE(x) == _gst_bitmask_type)
+
+/**
+ * GST_VALUE_HOLDS_FLAG_SET:
+ * @x: the #GValue to check
+ *
+ * Checks if the given #GValue contains a #GstFlagSet value.
+ *
+ * Since: 1.6
+ */
+#define GST_VALUE_HOLDS_FLAG_SET(x) (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE ((x))) == GST_TYPE_FLAG_SET)
+
+/**
+ * GST_FLAG_SET_MASK_EXACT: (value 4294967295) (type guint)
+ *
+ * A mask value with all bits set, for use as a
+ * GstFlagSet mask where all flag bits must match
+ * exactly
+ *
+ * Since: 1.6
+ */
+#define GST_FLAG_SET_MASK_EXACT ((guint)(-1))
+
+GST_API GType _gst_int_range_type;
+
+/**
+ * GstIntRange:
+ *
+ * A fundamental type that describes a #gint range
+ */
+
+/**
+ * GST_TYPE_INT_RANGE:
+ *
+ * a #GValue type that represents an integer range
+ *
+ * Returns: the #GType of GstIntRange
+ */
+#define GST_TYPE_INT_RANGE (_gst_int_range_type)
+
+GST_API GType _gst_int64_range_type;
+
+/**
+ * GstInt64Range:
+ *
+ * A fundamental type that describes a #gint64 range
+ */
+
+/**
+ * GST_TYPE_INT64_RANGE:
+ *
+ * a #GValue type that represents an #gint64 range
+ *
+ * Returns: the #GType of GstInt64Range
+ */
+#define GST_TYPE_INT64_RANGE (_gst_int64_range_type)
+
+GST_API GType _gst_double_range_type;
+
+/**
+ * GstDoubleRange:
+ *
+ * A fundamental type that describes a #gdouble range
+ */
+
+/**
+ * GST_TYPE_DOUBLE_RANGE:
+ *
+ * a #GValue type that represents a floating point range with double precision
+ *
+ * Returns: the #GType of GstIntRange
+ */
+#define GST_TYPE_DOUBLE_RANGE (_gst_double_range_type)
+
+GST_API GType _gst_fraction_range_type;
+
+/**
+ * GstFractionRange:
+ *
+ * A fundamental type that describes a #GstFractionRange range
+ */
+
+/**
+ * GST_TYPE_FRACTION_RANGE:
+ *
+ * a #GValue type that represents a GstFraction range
+ *
+ * Returns: the #GType of GstFractionRange
+ */
+#define GST_TYPE_FRACTION_RANGE (_gst_fraction_range_type)
+
+GST_API GType _gst_value_list_type;
+
+/**
+ * GstValueList:
+ *
+ * A fundamental type that describes an unordered list of #GValue
+ */
+
+/**
+ * GST_TYPE_LIST:
+ *
+ * a #GValue type that represents an unordered list of #GValue values. This
+ * is used for example to express a list of possible values for a field in
+ * a caps structure, like a list of possible sample rates, of which only one
+ * will be chosen in the end. This means that all values in the list are
+ * meaningful on their own.
+ *
+ * Returns: the #GType of GstValueList (which is not explicitly typed)
+ */
+#define GST_TYPE_LIST (_gst_value_list_type)
+
+GST_API GType _gst_value_array_type;
+
+/**
+ * GstValueArray:
+ *
+ * A fundamental type that describes an ordered list of #GValue
+ */
+
+/**
+ * GST_TYPE_ARRAY:
+ *
+ * a #GValue type that represents an ordered list of #GValue values. This is
+ * used to express a set of values that is meaningful only in their specific
+ * combination and order of values. Each value on its own is not particularly
+ * meaningful, only the ordered array in its entirety is meaningful. This is
+ * used for example to express channel layouts for multichannel audio where
+ * each channel needs to be mapped to a position in the room.
+ *
+ * Returns: the #GType of GstArrayList (which is not explicitly typed)
+ */
+#define GST_TYPE_ARRAY (_gst_value_array_type)
+
+GST_API GType _gst_fraction_type;
+
+/**
+ * GstFraction:
+ *
+ * A fundamental type that describes a fraction of an integer numerator
+ * over an integer denominator
+ */
+
+/**
+ * GST_TYPE_FRACTION:
+ *
+ * a #GValue type that represents a fraction of an integer numerator over
+ * an integer denominator
+ *
+ * Returns: the #GType of GstFraction (which is not explicitly typed)
+ */
+
+#define GST_TYPE_FRACTION (_gst_fraction_type)
+
+GST_API GType _gst_bitmask_type;
+
+/**
+ * GstBitmask:
+ *
+ * A fundamental type that describes a 64-bit bitmask
+ */
+
+/**
+ * GST_TYPE_BITMASK:
+ *
+ * a #GValue type that represents a 64-bit bitmask.
+ *
+ * Returns: the #GType of GstBitmask (which is not explicitly typed)
+ */
+
+#define GST_TYPE_BITMASK (_gst_bitmask_type)
+
+GST_API GType _gst_flagset_type;
+
+/**
+ * GstFlagSet:
+ *
+ * A fundamental type that describes a 32-bit flag bitfield, with 32-bit
+ * mask indicating which of the bits in the field are explicitly set.
+ */
+
+/**
+ * GST_TYPE_FLAG_SET:
+ *
+ * a #GValue type that represents a 32-bit flag bitfield, with 32-bit
+ * mask indicating which of the bits in the field are explicitly set.
+ * Useful for negotiation.
+ *
+ * Returns: the #GType of GstFlags (which is not explicitly typed)
+ *
+ * Since: 1.6
+ */
+#define GST_TYPE_FLAG_SET (_gst_flagset_type)
+
+/**
+ * GST_TYPE_G_THREAD:
+ *
+ * a boxed #GValue type for #GThread that represents a thread.
+ *
+ * Returns: the #GType of GstGThread
+ */
+
+#define GST_TYPE_G_THREAD gst_g_thread_get_type ()
+
+/**
+ * GST_VALUE_LESS_THAN:
+ *
+ * Indicates that the first value provided to a comparison function
+ * (gst_value_compare()) is lesser than the second one.
+ */
+#define GST_VALUE_LESS_THAN (-1)
+
+/**
+ * GST_VALUE_EQUAL:
+ *
+ * Indicates that the first value provided to a comparison function
+ * (gst_value_compare()) is equal to the second one.
+ */
+#define GST_VALUE_EQUAL 0
+
+/**
+ * GST_VALUE_GREATER_THAN:
+ *
+ * Indicates that the first value provided to a comparison function
+ * (gst_value_compare()) is greater than the second one.
+ */
+#define GST_VALUE_GREATER_THAN 1
+
+/**
+ * GST_VALUE_UNORDERED:
+ *
+ * Indicates that the comparison function (gst_value_compare()) can not
+ * determine a order for the two provided values.
+ */
+#define GST_VALUE_UNORDERED 2
+
+/**
+ * GstValueCompareFunc:
+ * @value1: first value for comparison
+ * @value2: second value for comparison
+ *
+ * Used together with gst_value_compare() to compare #GValue items.
+ *
+ * Returns: one of GST_VALUE_LESS_THAN, GST_VALUE_EQUAL, GST_VALUE_GREATER_THAN
+ * or GST_VALUE_UNORDERED
+ */
+typedef gint (* GstValueCompareFunc) (const GValue *value1,
+ const GValue *value2);
+
+/**
+ * GstValueSerializeFunc:
+ * @value1: a #GValue
+ *
+ * Used by gst_value_serialize() to obtain a non-binary form of the #GValue.
+ *
+ * Free-function: g_free
+ *
+ * Returns: (transfer full): the string representation of the value
+ */
+typedef gchar * (* GstValueSerializeFunc) (const GValue *value1);
+
+/**
+ * GstValueDeserializeFunc:
+ * @dest: a #GValue
+ * @s: a string
+ *
+ * Used by gst_value_deserialize() to parse a non-binary form into the #GValue.
+ *
+ * Returns: %TRUE for success
+ */
+typedef gboolean (* GstValueDeserializeFunc) (GValue *dest,
+ const gchar *s);
+
+/**
+ * GstValueDeserializeWithPSpecFunc:
+ * @dest: a #GValue
+ * @s: a string
+ * @pspec: a #GParamSpec describing the expected value
+ *
+ * Used by gst_value_deserialize_with_pspec() to parse a non-binary form into the #GValue.
+ *
+ * Returns: %TRUE for success
+ * Since: 1.20
+ */
+typedef gboolean (* GstValueDeserializeWithPSpecFunc) (GValue *dest,
+ const gchar *s,
+ GParamSpec *pspec);
+
+
+typedef struct _GstValueTable GstValueTable;
+/**
+ * GstValueTable:
+ * @type: a #GType
+ * @compare: a #GstValueCompareFunc
+ * @serialize: a #GstValueSerializeFunc
+ * @deserialize: a #GstValueDeserializeFunc
+ * @deserialize_with_pspec: a #GstValueDeserializeWithPSpecFunc
+ *
+ * VTable for the #GValue @type.
+ */
+struct _GstValueTable {
+ GType type;
+ GstValueCompareFunc compare;
+ GstValueSerializeFunc serialize;
+ GstValueDeserializeFunc deserialize;
+
+ /**
+ * GstValueTable.deserialize_with_pspec:
+ *
+ * a #GstValueDeserializeWithPSpecFunc
+ *
+ * Since: 1.20
+ */
+ GstValueDeserializeWithPSpecFunc deserialize_with_pspec;
+
+ /*< private >*/
+ gpointer _gst_reserved [GST_PADDING - 1];
+};
+
+GST_API
+GType gst_int_range_get_type (void);
+
+GST_API
+GType gst_int64_range_get_type (void);
+
+GST_API
+GType gst_double_range_get_type (void);
+
+GST_API
+GType gst_fraction_range_get_type (void);
+
+GST_API
+GType gst_fraction_get_type (void);
+
+GST_API
+GType gst_value_list_get_type (void);
+
+GST_API
+GType gst_value_array_get_type (void);
+
+GST_API
+GType gst_bitmask_get_type (void);
+
+GST_API
+GType gst_flagset_get_type (void);
+
+/* Hide this compatibility type from introspection */
+#ifndef __GI_SCANNER__
+GST_API
+GType gst_g_thread_get_type (void);
+#endif
+
+GST_API
+void gst_value_register (const GstValueTable *table);
+
+GST_API
+void gst_value_init_and_copy (GValue *dest,
+ const GValue *src);
+GST_API
+gchar * gst_value_serialize (const GValue *value) G_GNUC_MALLOC;
+
+GST_API
+gboolean gst_value_deserialize (GValue *dest,
+ const gchar *src);
+
+GST_API
+gboolean gst_value_deserialize_with_pspec (GValue *dest,
+ const gchar *src,
+ GParamSpec *pspec);
+
+/* list */
+
+GST_API
+void gst_value_list_append_value (GValue *value,
+ const GValue *append_value);
+GST_API
+void gst_value_list_append_and_take_value (GValue *value,
+ GValue *append_value);
+GST_API
+void gst_value_list_prepend_value (GValue *value,
+ const GValue *prepend_value);
+GST_API
+void gst_value_list_concat (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+GST_API
+void gst_value_list_merge (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+GST_API
+guint gst_value_list_get_size (const GValue *value);
+
+GST_API
+const GValue * gst_value_list_get_value (const GValue *value,
+ guint index);
+
+GST_API
+GValue * gst_value_list_init (GValue *value,
+ guint prealloc);
+/* array */
+
+GST_API
+void gst_value_array_append_value (GValue *value,
+ const GValue *append_value);
+GST_API
+void gst_value_array_append_and_take_value (GValue *value,
+ GValue *append_value);
+GST_API
+void gst_value_array_prepend_value (GValue *value,
+ const GValue *prepend_value);
+GST_API
+guint gst_value_array_get_size (const GValue *value);
+
+GST_API
+const GValue * gst_value_array_get_value (const GValue *value,
+ guint index);
+GST_API
+GValue * gst_value_array_init (GValue *value,
+ guint prealloc);
+
+/* int range */
+
+GST_API
+void gst_value_set_int_range (GValue *value,
+ gint start,
+ gint end);
+GST_API
+void gst_value_set_int_range_step (GValue *value,
+ gint start,
+ gint end,
+ gint step);
+GST_API
+gint gst_value_get_int_range_min (const GValue *value);
+
+GST_API
+gint gst_value_get_int_range_max (const GValue *value);
+
+GST_API
+gint gst_value_get_int_range_step (const GValue *value);
+
+/* int64 range */
+
+GST_API
+void gst_value_set_int64_range (GValue *value,
+ gint64 start,
+ gint64 end);
+GST_API
+void gst_value_set_int64_range_step (GValue *value,
+ gint64 start,
+ gint64 end,
+ gint64 step);
+GST_API
+gint64 gst_value_get_int64_range_min (const GValue *value);
+
+GST_API
+gint64 gst_value_get_int64_range_max (const GValue *value);
+
+GST_API
+gint64 gst_value_get_int64_range_step (const GValue *value);
+
+/* double range */
+
+GST_API
+void gst_value_set_double_range (GValue *value,
+ gdouble start,
+ gdouble end);
+GST_API
+gdouble gst_value_get_double_range_min (const GValue *value);
+
+GST_API
+gdouble gst_value_get_double_range_max (const GValue *value);
+
+/* caps */
+
+GST_API
+const GstCaps * gst_value_get_caps (const GValue *value);
+
+GST_API
+void gst_value_set_caps (GValue *value,
+ const GstCaps *caps);
+
+/* structure */
+
+GST_API
+const GstStructure *
+ gst_value_get_structure (const GValue *value);
+
+GST_API
+void gst_value_set_structure (GValue *value,
+ const GstStructure *structure);
+
+/* caps features */
+
+GST_API
+const GstCapsFeatures *
+ gst_value_get_caps_features (const GValue *value);
+
+GST_API
+void gst_value_set_caps_features (GValue *value,
+ const GstCapsFeatures *features);
+
+/* fraction */
+
+GST_API
+void gst_value_set_fraction (GValue *value,
+ gint numerator,
+ gint denominator);
+GST_API
+gint gst_value_get_fraction_numerator (const GValue *value);
+
+GST_API
+gint gst_value_get_fraction_denominator (const GValue *value);
+
+GST_API
+gboolean gst_value_fraction_multiply (GValue *product,
+ const GValue *factor1,
+ const GValue *factor2);
+GST_API
+gboolean gst_value_fraction_subtract (GValue * dest,
+ const GValue * minuend,
+ const GValue * subtrahend);
+
+/* fraction range */
+
+GST_API
+void gst_value_set_fraction_range (GValue *value,
+ const GValue *start,
+ const GValue *end);
+GST_API
+void gst_value_set_fraction_range_full (GValue *value,
+ gint numerator_start,
+ gint denominator_start,
+ gint numerator_end,
+ gint denominator_end);
+GST_API
+const GValue *gst_value_get_fraction_range_min (const GValue *value);
+
+GST_API
+const GValue *gst_value_get_fraction_range_max (const GValue *value);
+
+/* bitmask */
+
+GST_API
+guint64 gst_value_get_bitmask (const GValue *value);
+
+GST_API
+void gst_value_set_bitmask (GValue *value,
+ guint64 bitmask);
+/* flagset */
+
+GST_API
+void gst_value_set_flagset (GValue * value, guint flags, guint mask);
+
+GST_API
+guint gst_value_get_flagset_flags (const GValue * value);
+
+GST_API
+guint gst_value_get_flagset_mask (const GValue * value);
+
+/* compare */
+
+GST_API
+gint gst_value_compare (const GValue *value1,
+ const GValue *value2);
+GST_API
+gboolean gst_value_can_compare (const GValue *value1,
+ const GValue *value2);
+GST_API
+gboolean gst_value_is_subset (const GValue *value1,
+ const GValue *value2);
+
+/* union */
+
+GST_API
+gboolean gst_value_union (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+GST_API
+gboolean gst_value_can_union (const GValue *value1,
+ const GValue *value2);
+
+/* intersection */
+
+GST_API
+gboolean gst_value_intersect (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+GST_API
+gboolean gst_value_can_intersect (const GValue *value1,
+ const GValue *value2);
+
+/* subtraction */
+
+GST_API
+gboolean gst_value_subtract (GValue *dest,
+ const GValue *minuend,
+ const GValue *subtrahend);
+GST_API
+gboolean gst_value_can_subtract (const GValue *minuend,
+ const GValue *subtrahend);
+
+/* fixation */
+
+GST_API
+gboolean gst_value_is_fixed (const GValue *value);
+
+GST_API
+gboolean gst_value_fixate (GValue *dest,
+ const GValue *src);
+
+/* Flagset registration wrapper */
+
+GST_API
+GType gst_flagset_register (GType flags_type);
+
+G_END_DECLS
+
+#endif
+
+
diff --git a/include/gst/gstversion.h b/include/gst/gstversion.h
new file mode 100644
index 0000000000..2c3b206429
--- /dev/null
+++ b/include/gst/gstversion.h
@@ -0,0 +1,91 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstversion.h: Version information for GStreamer
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VERSION_H__
+#define __GST_VERSION_H__
+
+#include <glib.h>
+
+/**
+ * SECTION:gstversion
+ * @short_description: GStreamer version macros.
+ *
+ * Use the GST_VERSION_* macros e.g. when defining own plugins. The GStreamer
+ * runtime checks if these plugin and core version match and refuses to use a
+ * plugin compiled against a different version of GStreamer.
+ * You can also use the macros to keep the GStreamer version information in
+ * your application.
+ *
+ * Use the gst_version() function if you want to know which version of
+ * GStreamer you are currently linked against.
+ *
+ * The version macros get defined by including "gst/gst.h".
+ */
+
+G_BEGIN_DECLS
+
+/**
+ * GST_VERSION_MAJOR:
+ *
+ * The major version of GStreamer at compile time:
+ */
+#define GST_VERSION_MAJOR (1)
+/**
+ * GST_VERSION_MINOR:
+ *
+ * The minor version of GStreamer at compile time:
+ */
+#define GST_VERSION_MINOR (20)
+/**
+ * GST_VERSION_MICRO:
+ *
+ * The micro version of GStreamer at compile time:
+ */
+#define GST_VERSION_MICRO (3)
+/**
+ * GST_VERSION_NANO:
+ *
+ * The nano version of GStreamer at compile time:
+ * Actual releases have 0, GIT versions have 1, prerelease versions have 2-...
+ */
+#define GST_VERSION_NANO (0)
+
+/**
+ * GST_CHECK_VERSION:
+ * @major: a number indicating the major version
+ * @minor: a number indicating the minor version
+ * @micro: a number indicating the micro version
+ *
+ * Check whether a GStreamer version equal to or greater than
+ * major.minor.micro is present.
+ */
+#define GST_CHECK_VERSION(major,minor,micro) \
+ (GST_VERSION_MAJOR > (major) || \
+ (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR > (minor)) || \
+ (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR == (minor) && \
+ GST_VERSION_MICRO >= (micro)) || \
+ (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR == (minor) && \
+ GST_VERSION_MICRO + 1 == (micro) && GST_VERSION_NANO > 0))
+
+G_END_DECLS
+
+#endif /* __GST_VERSION_H__ */
diff --git a/include/gst/insertbin/gstinsertbin.h b/include/gst/insertbin/gstinsertbin.h
new file mode 100644
index 0000000000..5cd7e471a4
--- /dev/null
+++ b/include/gst/insertbin/gstinsertbin.h
@@ -0,0 +1,127 @@
+/*
+ * GStreamer
+ *
+ * Copyright 2013 Collabora Ltd
+ * @author: Olivier Crete <olivier.crete@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+
+#ifndef __GST_INSERT_BIN_H__
+#define __GST_INSERT_BIN_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The GStreamer insertbin library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+
+#ifndef GST_INSERT_BIN_API
+# ifdef BUILDING_GST_INSERT_BIN
+# define GST_INSERT_BIN_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_INSERT_BIN_API GST_API_IMPORT
+# endif
+#endif
+
+G_BEGIN_DECLS
+#define GST_TYPE_INSERT_BIN (gst_insert_bin_get_type())
+#define GST_INSERT_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INSERT_BIN,GstInsertBin))
+#define GST_IS_INSERT_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INSERT_BIN))
+#define GST_INSERT_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_INSERT_BIN,GstInsertBinClass))
+#define GST_IS_INSERT_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_INSERT_BIN))
+#define GST_INSERT_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_INSERT_BIN,GstInsertBinClass))
+typedef struct _GstInsertBin GstInsertBin;
+typedef struct _GstInsertBinClass GstInsertBinClass;
+typedef struct _GstInsertBinPrivate GstInsertBinPrivate;
+
+/**
+ * GstInsertBinCallback:
+ * @insertbin: A #GstInsertBin
+ * @element: The #GstElement on which the operation was performed
+ * @success: %TRUE if the operation was successful
+ * @user_data: The user data passed
+ *
+ * This is the prototype of callbacks to be called when the operation completes.
+ * It could be called at any time, including as a re-entrant call while the
+ * operation is requested.
+ */
+
+typedef void (*GstInsertBinCallback) (GstInsertBin *insertbin,
+ GstElement *element,
+ gboolean success,
+ gpointer user_data);
+
+/**
+ * GstInsertBin:
+ *
+ * The object structure.
+ */
+struct _GstInsertBin
+{
+ GstBin parent;
+
+ /*< private >*/
+ GstInsertBinPrivate *priv;
+};
+
+/**
+ * GstInsertBinClass:
+ *
+ * The object class structure.
+ */
+struct _GstInsertBinClass
+{
+ GstBinClass parent_class;
+};
+
+GST_INSERT_BIN_API
+GType gst_insert_bin_get_type (void);
+
+GST_INSERT_BIN_API
+GstElement *gst_insert_bin_new (const gchar * name);
+
+GST_INSERT_BIN_API
+void gst_insert_bin_prepend (GstInsertBin * self, GstElement * element,
+ GstInsertBinCallback callback, gpointer user_data);
+
+GST_INSERT_BIN_API
+void gst_insert_bin_append (GstInsertBin * self, GstElement * element,
+ GstInsertBinCallback callback, gpointer user_data);
+
+GST_INSERT_BIN_API
+void gst_insert_bin_insert_before (GstInsertBin * self,
+ GstElement * element, GstElement * sibling,
+ GstInsertBinCallback callback, gpointer user_data);
+
+GST_INSERT_BIN_API
+void gst_insert_bin_insert_after (GstInsertBin * self,
+ GstElement * element, GstElement * sibling,
+ GstInsertBinCallback callback, gpointer user_data);
+
+GST_INSERT_BIN_API
+void gst_insert_bin_remove (GstInsertBin * self, GstElement * element,
+ GstInsertBinCallback callback, gpointer user_data);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstInsertBin, gst_object_unref)
+
+G_END_DECLS
+#endif /* __GST_INSERT_BIN_H__ */
diff --git a/include/gst/interfaces/photography-enumtypes.h b/include/gst/interfaces/photography-enumtypes.h
new file mode 100644
index 0000000000..b4132877b7
--- /dev/null
+++ b/include/gst/interfaces/photography-enumtypes.h
@@ -0,0 +1,60 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/interfaces/photography-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "photography.h" */
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_noise_reduction_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_NOISE_REDUCTION (gst_photography_noise_reduction_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_white_balance_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_WHITE_BALANCE_MODE (gst_photography_white_balance_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_color_tone_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_COLOR_TONE_MODE (gst_photography_color_tone_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_scene_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_SCENE_MODE (gst_photography_scene_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_flash_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_FLASH_MODE (gst_photography_flash_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_focus_status_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_FOCUS_STATUS (gst_photography_focus_status_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_caps_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_CAPS (gst_photography_caps_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_shake_risk_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_SHAKE_RISK (gst_photography_shake_risk_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_flicker_reduction_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_FLICKER_REDUCTION_MODE (gst_photography_flicker_reduction_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_focus_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_FOCUS_MODE (gst_photography_focus_mode_get_type())
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_exposure_mode_get_type (void);
+#define GST_TYPE_PHOTOGRAPHY_EXPOSURE_MODE (gst_photography_exposure_mode_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/interfaces/photography-prelude.h b/include/gst/interfaces/photography-prelude.h
new file mode 100644
index 0000000000..dbb7f13f95
--- /dev/null
+++ b/include/gst/interfaces/photography-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Photography Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * photography-prelude.h: prelude include header for gst-photography library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PHOTOGRAPHY_PRELUDE_H__
+#define __GST_PHOTOGRAPHY_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_PHOTOGRAPHY_API
+# ifdef BUILDING_GST_PHOTOGRAPHY
+# define GST_PHOTOGRAPHY_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_PHOTOGRAPHY_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_PHOTOGRAPHY_PRELUDE_H__ */
diff --git a/include/gst/interfaces/photography.h b/include/gst/interfaces/photography.h
new file mode 100644
index 0000000000..e9ac9e668b
--- /dev/null
+++ b/include/gst/interfaces/photography.h
@@ -0,0 +1,685 @@
+/* GStreamer
+ *
+ * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
+ *
+ * photography.h: photography interface for digital imaging
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PHOTOGRAPHY_H__
+#define __GST_PHOTOGRAPHY_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The GstPhotography interface is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/interfaces/photography-prelude.h>
+#include <gst/interfaces/photography-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PHOTOGRAPHY \
+ (gst_photography_get_type ())
+#define GST_PHOTOGRAPHY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PHOTOGRAPHY, GstPhotography))
+#define GST_IS_PHOTOGRAPHY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PHOTOGRAPHY))
+#define GST_PHOTOGRAPHY_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_PHOTOGRAPHY, GstPhotographyInterface))
+
+
+/**
+ * GST_PHOTOGRAPHY_AUTOFOCUS_DONE:
+ *
+ * Name of custom GstMessage that will be posted to #GstBus when autofocusing
+ * is complete.
+ * This message contains following fields:
+ *
+ * * `status` (#GstPhotographyFocusStatus): Tells if focusing succeeded or failed.
+ *
+ * * `focus-window-rows` (#G_TYPE_INT): Tells number of focus matrix rows.
+ *
+ * * `focus-window-columns` (#G_TYPE_INT): Tells number of focus matrix columns.
+ *
+ * * `focus-window-mask` (#G_TYPE_INT): Bitmask containing rows x columns bits
+ * which mark the focus points in the focus matrix. Lowest bit (LSB) always
+ * represents the top-left corner of the focus matrix. This field is only valid
+ * when focusing status is SUCCESS.
+ */
+#define GST_PHOTOGRAPHY_AUTOFOCUS_DONE "autofocus-done"
+
+/**
+ * GST_PHOTOGRAPHY_SHAKE_RISK:
+ *
+ * Name of custom GstMessage that is posted to #GstBus during autofocusing
+ * process. It is posted if there is change in the risk of captured image
+ * becoming "shaken" due to camera movement and too long exposure time.
+ *
+ * This message contains following fields:
+ *
+ * * `status` (#GstPhotographyShakeRisk): Tells risk level of capturing shaken image.
+ */
+#define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
+
+/* Maximum white point values used in #GstPhotographySettings */
+#define MAX_WHITE_POINT_VALUES 4
+
+/* Interface property names */
+#define GST_PHOTOGRAPHY_PROP_WB_MODE "white-balance-mode"
+#define GST_PHOTOGRAPHY_PROP_COLOR_TONE "color-tone-mode"
+#define GST_PHOTOGRAPHY_PROP_SCENE_MODE "scene-mode"
+#define GST_PHOTOGRAPHY_PROP_FLASH_MODE "flash-mode"
+#define GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION "noise-reduction"
+#define GST_PHOTOGRAPHY_PROP_FOCUS_STATUS "focus-status"
+#define GST_PHOTOGRAPHY_PROP_CAPABILITIES "capabilities"
+#define GST_PHOTOGRAPHY_PROP_SHAKE_RISK "shake-risk"
+#define GST_PHOTOGRAPHY_PROP_EV_COMP "ev-compensation"
+#define GST_PHOTOGRAPHY_PROP_ISO_SPEED "iso-speed"
+#define GST_PHOTOGRAPHY_PROP_APERTURE "aperture"
+#define GST_PHOTOGRAPHY_PROP_EXPOSURE_TIME "exposure-time"
+#define GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS \
+ "image-capture-supported-caps"
+#define GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS \
+ "image-preview-supported-caps"
+#define GST_PHOTOGRAPHY_PROP_FLICKER_MODE "flicker-mode"
+#define GST_PHOTOGRAPHY_PROP_FOCUS_MODE "focus-mode"
+#define GST_PHOTOGRAPHY_PROP_ZOOM "zoom"
+#define GST_PHOTOGRAPHY_PROP_COLOR_TEMPERATURE "color-temperature"
+#define GST_PHOTOGRAPHY_PROP_WHITE_POINT "white-point"
+#define GST_PHOTOGRAPHY_PROP_ANALOG_GAIN "analog-gain"
+#define GST_PHOTOGRAPHY_PROP_EXPOSURE_MODE "exposure-mode"
+#define GST_PHOTOGRAPHY_PROP_LENS_FOCUS "lens-focus"
+#define GST_PHOTOGRAPHY_PROP_MIN_EXPOSURE_TIME "min-exposure-time"
+#define GST_PHOTOGRAPHY_PROP_MAX_EXPOSURE_TIME "max-exposure-time"
+
+/**
+ * GstPhotography:
+ *
+ * Opaque #GstPhotography data structure.
+ */
+typedef struct _GstPhotography GstPhotography;
+
+/**
+ * GstPhotographyNoiseReduction:
+ * @GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER: Adaptive noise reduction on Bayer
+ * format
+ * @GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC: reduces the noise on Y and 2-chroma
+ * images.
+ * @GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL: Multi-frame adaptive NR,
+ * provided for the video mode
+ * @GST_PHOTOGRAPHY_NOISE_REDUCTION_FIXED: Fixed Pattern Noise refers to noise
+ * that does not change between frames. The noise is removed from the sensor
+ * image, by subtracting a previously-captured black image in memory.
+ * @GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA: Extra Noise Reduction. In the case
+ * of high-ISO capturing, some noise remains after YCC NR. XNR reduces this
+ * remaining noise.
+ *
+ * Noise Reduction features of a photography capture or filter element.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER = (1 << 0),
+ GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC = (1 << 1),
+ GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL = (1 << 2),
+ GST_PHOTOGRAPHY_NOISE_REDUCTION_FIXED = (1 << 3),
+ GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA = (1 << 4)
+} GstPhotographyNoiseReduction;
+
+/**
+ * GstPhotographyWhiteBalanceMode:
+ * @GST_PHOTOGRAPHY_WB_MODE_AUTO: Choose white balance mode automatically
+ * @GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT: Mode for daylight conditions
+ * @GST_PHOTOGRAPHY_WB_MODE_CLOUDY: Mode for cloudy conditions
+ * @GST_PHOTOGRAPHY_WB_MODE_SUNSET: Mode for sunset conditions
+ * @GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN: Mode for tungsten lighting
+ * @GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT: Mode for fluorescent lighting
+ * @GST_PHOTOGRAPHY_WB_MODE_MANUAL: Disable automatic white balance adjustment
+ * and keep current values.
+ * @GST_PHOTOGRAPHY_WB_MODE_WARM_FLUORESCENT: Mode for warm fluorescent lighting (Since: 1.2)
+ * @GST_PHOTOGRAPHY_WB_MODE_SHADE: Mode for shade lighting (Since: 1.2)
+ *
+ * Modes for white balance control.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_WB_MODE_AUTO = 0,
+ GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT,
+ GST_PHOTOGRAPHY_WB_MODE_CLOUDY,
+ GST_PHOTOGRAPHY_WB_MODE_SUNSET,
+ GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN,
+ GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT,
+ GST_PHOTOGRAPHY_WB_MODE_MANUAL,
+ GST_PHOTOGRAPHY_WB_MODE_WARM_FLUORESCENT,
+ GST_PHOTOGRAPHY_WB_MODE_SHADE
+} GstPhotographyWhiteBalanceMode;
+
+/**
+ * GstPhotographyColorToneMode:
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL: No effects
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA: Sepia
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE: Negative
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE: Grayscale
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_NATURAL: Natural
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_VIVID: Vivid
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_COLORSWAP: Colorswap
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE: Solarize
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_OUT_OF_FOCUS: Out of focus
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKY_BLUE: Sky blue
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRASS_GREEN: Grass green
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKIN_WHITEN: Skin whiten
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE: Posterize (Since: 1.2)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD: Whiteboard (Since: 1.2)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD: Blackboard (Since: 1.2)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA: Aqua (Since: 1.2)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_EMBOSS: Emboss (Since: 1.18)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKETCH: Sketch (Since: 1.18)
+ * @GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEON: Neon (Since: 1.18)
+ *
+ *
+ * Modes for special color effects.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL = 0,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_NATURAL,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_VIVID,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_COLORSWAP,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_OUT_OF_FOCUS,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKY_BLUE,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRASS_GREEN,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKIN_WHITEN,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_EMBOSS,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKETCH,
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEON
+} GstPhotographyColorToneMode;
+
+/**
+ * GstPhotographySceneMode:
+ * @GST_PHOTOGRAPHY_SCENE_MODE_MANUAL: Set individual options manually
+ * @GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP: Mode for close objects
+ * @GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT: Mode for portraits
+ * @GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE: Mode for landscapes
+ * @GST_PHOTOGRAPHY_SCENE_MODE_SPORT: Mode for scene with fast motion
+ * @GST_PHOTOGRAPHY_SCENE_MODE_NIGHT: Mode for night conditions
+ * @GST_PHOTOGRAPHY_SCENE_MODE_AUTO: Choose scene mode automatically
+ * @GST_PHOTOGRAPHY_SCENE_MODE_ACTION: Take photos of fast moving
+ * objects (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT: Take people pictures
+ * at night (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_THEATRE: Take photos in a theater (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_BEACH: Take pictures on the beach (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_SNOW: Take pictures on the snow (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_SUNSET: Take sunset photos (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO: Avoid blurry pictures
+ * (for example, due to hand shake) (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS: For shooting firework
+ * displays (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_PARTY: Take indoor low-light shot (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT: Capture the naturally warm color
+ * of scenes lit by candles (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_BARCODE: Applications are looking for
+ * a barcode (Since: 1.2)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_BACKLIGHT: Backlit photos (Since: 1.18)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_FLOWERS: For shooting flowers (Since: 1.18)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_AR: Specific for Augmented Reality (Since: 1.18)
+ * @GST_PHOTOGRAPHY_SCENE_MODE_HDR: High Dynamic Range photography (Since: 1.18)
+ *
+ * Each mode contains preset #GstPhotography options in order to produce
+ * good capturing result in certain scene.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_SCENE_MODE_MANUAL = 0,
+ GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP,
+ GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT,
+ GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE,
+ GST_PHOTOGRAPHY_SCENE_MODE_SPORT,
+ GST_PHOTOGRAPHY_SCENE_MODE_NIGHT,
+ GST_PHOTOGRAPHY_SCENE_MODE_AUTO,
+ GST_PHOTOGRAPHY_SCENE_MODE_ACTION,
+ GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT,
+ GST_PHOTOGRAPHY_SCENE_MODE_THEATRE,
+ GST_PHOTOGRAPHY_SCENE_MODE_BEACH,
+ GST_PHOTOGRAPHY_SCENE_MODE_SNOW,
+ GST_PHOTOGRAPHY_SCENE_MODE_SUNSET,
+ GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO,
+ GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS,
+ GST_PHOTOGRAPHY_SCENE_MODE_PARTY,
+ GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT,
+ GST_PHOTOGRAPHY_SCENE_MODE_BARCODE,
+ GST_PHOTOGRAPHY_SCENE_MODE_BACKLIGHT,
+ GST_PHOTOGRAPHY_SCENE_MODE_FLOWERS,
+ GST_PHOTOGRAPHY_SCENE_MODE_AR,
+ GST_PHOTOGRAPHY_SCENE_MODE_HDR
+} GstPhotographySceneMode;
+
+/**
+ * GstPhotographyFlashMode:
+ * @GST_PHOTOGRAPHY_FLASH_MODE_AUTO: Fire flash automatically according to
+ * lighting conditions.
+ * @GST_PHOTOGRAPHY_FLASH_MODE_OFF: Never fire flash
+ * @GST_PHOTOGRAPHY_FLASH_MODE_ON: Always fire flash
+ * @GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN: Fill in flash
+ * @GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE: Flash mode for reducing chance of
+ * capturing red eyes
+ *
+ * Modes for flash control.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_FLASH_MODE_AUTO = 0,
+ GST_PHOTOGRAPHY_FLASH_MODE_OFF,
+ GST_PHOTOGRAPHY_FLASH_MODE_ON,
+ GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN,
+ GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE
+} GstPhotographyFlashMode;
+
+/**
+ * GstPhotographyFocusStatus:
+ * @GST_PHOTOGRAPHY_FOCUS_STATUS_NONE: No status available
+ * @GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING: Focusing is ongoing
+ * @GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL: Focusing failed
+ * @GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS: Focusing succeeded
+ *
+ * Status of the focusing operation, used in #GST_PHOTOGRAPHY_AUTOFOCUS_DONE
+ * message.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_FOCUS_STATUS_NONE = 0,
+ GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING,
+ GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL,
+ GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS
+} GstPhotographyFocusStatus;
+
+/**
+ * GstPhotographyCaps:
+ *
+ * Bitmask that indicates which #GstPhotography interface features an instance
+ * supports.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_CAPS_NONE = (0 << 0),
+ GST_PHOTOGRAPHY_CAPS_EV_COMP = (1 << 0),
+ GST_PHOTOGRAPHY_CAPS_ISO_SPEED = (1 << 1),
+ GST_PHOTOGRAPHY_CAPS_WB_MODE = (1 << 2),
+ GST_PHOTOGRAPHY_CAPS_TONE = (1 << 3),
+ GST_PHOTOGRAPHY_CAPS_SCENE = (1 << 4),
+ GST_PHOTOGRAPHY_CAPS_FLASH = (1 << 5),
+ GST_PHOTOGRAPHY_CAPS_ZOOM = (1 << 6),
+ GST_PHOTOGRAPHY_CAPS_FOCUS = (1 << 7),
+ GST_PHOTOGRAPHY_CAPS_APERTURE = (1 << 8),
+ GST_PHOTOGRAPHY_CAPS_EXPOSURE = (1 << 9),
+ GST_PHOTOGRAPHY_CAPS_SHAKE = (1 << 10),
+ GST_PHOTOGRAPHY_CAPS_WHITE_BALANCE = (1 << 11),
+ GST_PHOTOGRAPHY_CAPS_NOISE_REDUCTION = (1 << 12),
+ GST_PHOTOGRAPHY_CAPS_FLICKER_REDUCTION = (1 << 13),
+ GST_PHOTOGRAPHY_CAPS_ALL = (~0)
+} GstPhotographyCaps;
+
+/**
+ * GstPhotographyShakeRisk:
+ * @GST_PHOTOGRAPHY_SHAKE_RISK_LOW: Low risk
+ * @GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM: Medium risk
+ * @GST_PHOTOGRAPHY_SHAKE_RISK_HIGH: High risk
+ *
+ * Risk level of captured image becoming "shaken" due to camera movement and
+ * too long exposure time. Used in #GST_PHOTOGRAPHY_SHAKE_RISK #GstMessage.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_SHAKE_RISK_LOW = 0,
+ GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM,
+ GST_PHOTOGRAPHY_SHAKE_RISK_HIGH,
+} GstPhotographyShakeRisk;
+
+/**
+ * GstPhotographyFlickerReductionMode:
+ * @GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF: Disable flicker reduction
+ * @GST_PHOTOGRAPHY_FLICKER_REDUCTION_50HZ: 50Hz flicker reduction
+ * @GST_PHOTOGRAPHY_FLICKER_REDUCTION_60HZ: 60Hz flicker reduction
+ * @GST_PHOTOGRAPHY_FLICKER_REDUCTION_AUTO: Choose mode automatically
+ *
+ * Reduce flicker in video caused by light source fluctuation.
+ */
+typedef enum
+{
+ GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF = 0,
+ GST_PHOTOGRAPHY_FLICKER_REDUCTION_50HZ,
+ GST_PHOTOGRAPHY_FLICKER_REDUCTION_60HZ,
+ GST_PHOTOGRAPHY_FLICKER_REDUCTION_AUTO,
+} GstPhotographyFlickerReductionMode;
+
+/**
+ * GstPhotographyFocusMode:
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_AUTO: Choose focus mode automatically
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_MACRO: Mode for focusing objects close to lens
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT: Mode for portraits
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY: Mode for landscapes and far away objects
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL: Mode for maximum depth of field, keeping
+ * focus acceptable both in infinify and as close objects as possible
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED: Extended focus mode
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL: Continuous autofocus mode
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED: Extended continuous
+ * autofocus mode
+ * @GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL: Disable automatic focusing
+ * and keep current value. #GstPhotography:lens-focus property can
+ * be used to change focus manually.
+ *
+ * Choose mode for focusing algorithm.
+ */
+typedef enum {
+ GST_PHOTOGRAPHY_FOCUS_MODE_AUTO = 0,
+ GST_PHOTOGRAPHY_FOCUS_MODE_MACRO,
+ GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT,
+ GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY,
+ GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL,
+ GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED,
+ GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL,
+ GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED,
+ GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL
+} GstPhotographyFocusMode;
+
+/**
+ * GstPhotographyExposureMode:
+ * @GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO: Adjust exposure automatically
+ * @GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL: Disable automatic exposure adjustment
+ * and keep current values.
+ *
+ */
+typedef enum {
+ GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO = 0,
+ GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL
+} GstPhotographyExposureMode;
+
+/**
+ * GstPhotographySettings:
+ *
+ * Structure containing all #GstPhotography settings, used to set all
+ * settings in one call with @gst_photography_set_config().
+ */
+typedef struct
+{
+ GstPhotographyWhiteBalanceMode wb_mode;
+ GstPhotographyColorToneMode tone_mode;
+ GstPhotographySceneMode scene_mode;
+ GstPhotographyFlashMode flash_mode;
+ guint32 exposure_time;
+ guint aperture;
+ gfloat ev_compensation;
+ guint iso_speed;
+ gfloat zoom;
+ GstPhotographyFlickerReductionMode flicker_mode;
+ GstPhotographyFocusMode focus_mode;
+ GstPhotographyNoiseReduction noise_reduction;
+ GstPhotographyExposureMode exposure_mode;
+ guint color_temperature;
+ guint white_point[MAX_WHITE_POINT_VALUES];
+ gfloat analog_gain;
+ gfloat lens_focus;
+ guint min_exposure_time;
+ guint max_exposure_time;
+ /* FIXME: add padding? */
+} GstPhotographySettings;
+
+/**
+ * GstPhotographyCapturePrepared:
+ * @data: user data that has been given, when registering the callback
+ * @configured_caps: #GstCaps defining the configured capture format.
+ * Ownership of these caps stays in the element.
+ *
+ * This callback will be called when the element has finished preparations
+ * and is ready for image capture. The next buffer that element produces
+ * will be of @configured_caps format, so this callback allows the application
+ * to e.g. reconfigure capsfilters in pipeline if any.
+ */
+typedef void (*GstPhotographyCapturePrepared) (gpointer data, const GstCaps *configured_caps);
+
+/**
+ * GstPhotographyInterface:
+ * @parent: parent interface type.
+ * @get_ev_compensation: vmethod to get ev exposure compensation value
+ * @get_iso_speed: vmethod to get iso speed (light sensitivity) value
+ * @get_aperture: vmethod to get aperture value
+ * @get_exposure: vmethod to get exposure time value
+ * @get_white_balance_mode: vmethod to get white balance mode value
+ * @get_color_tone_mode: vmethod to get color tone mode value
+ * @get_scene_mode: vmethod to get scene mode value
+ * @get_flash_mode: vmethod to get flash mode value
+ * @get_noise_reduction: vmethod to get noise reduction mode value
+ * @get_zoom: vmethod to get zoom factor value
+ * @set_ev_compensation: vmethod to set ev exposure compensation value
+ * @set_iso_speed: vmethod to set iso speed (light sensitivity) value
+ * @set_aperture: vmethod to set aperture value
+ * @set_exposure: vmethod to set exposure time value
+ * @set_white_balance_mode: vmethod to set white balance mode value
+ * @set_color_tone_mode: vmethod to set color tone mode value
+ * @set_scene_mode: vmethod to set scene mode value
+ * @set_flash_mode: vmethod to set flash mode value
+ * @set_noise_reduction: vmethod to set noise reduction mode value
+ * @set_zoom: vmethod to set zoom factor value
+ * @get_capabilities: vmethod to get supported capabilities of the interface
+ * @prepare_for_capture: vmethod to tell the element to prepare for capturing
+ * @set_autofocus: vmethod to set autofocus on/off
+ * @set_config: vmethod to set all configuration parameters at once
+ * @get_config: vmethod to get all configuration parameters at once
+ * @get_image_capture_supported_caps: vmethod to get caps describing supported image capture formats
+ * @set_exposure_mode: vmethod to set exposure mode (Since: 1.18)
+ * @get_exposure_mode: vmethod to get exposure mode (Since: 1.18)
+ * @set_analog_gain: vmethod to set analog gain (Since: 1.18)
+ * @get_analog_gain: vmethod to get analog gain (Since: 1.18)
+ * @set_lens_focus: vmethod to set lens focus (Since: 1.18)
+ * @get_lens_focus: vmethod to get lens focus (Since: 1.18)
+ * @set_color_temperature: vmethod to set color temperature (Since: 1.18)
+ * @get_color_temperature: vmethod to get color temperature (Since: 1.18)
+ * @set_min_exposure_time: vmethod to set min exposure time (Since: 1.18)
+ * @get_min_exposure_time: vmethod to get min exposure time (Since: 1.18)
+ * @set_max_exposure_time: vmethod to set max exposure time (Since: 1.18)
+ * @get_max_exposure_time: vmethod to get max exposure time (Since: 1.18)
+ *
+ * #GstPhotographyInterface interface.
+ */
+typedef struct _GstPhotographyInterface
+{
+ GTypeInterface parent;
+
+ /* virtual functions */
+ gboolean (*get_ev_compensation) (GstPhotography * photo, gfloat * ev_comp);
+ gboolean (*get_iso_speed) (GstPhotography * photo, guint * iso_speed);
+ gboolean (*get_aperture) (GstPhotography * photo, guint * aperture);
+ gboolean (*get_exposure) (GstPhotography * photo, guint32 * exposure);
+ gboolean (*get_white_balance_mode) (GstPhotography * photo, GstPhotographyWhiteBalanceMode * wb_mode);
+ gboolean (*get_color_tone_mode) (GstPhotography * photo, GstPhotographyColorToneMode * tone_mode);
+ gboolean (*get_scene_mode) (GstPhotography * photo, GstPhotographySceneMode * scene_mode);
+ gboolean (*get_flash_mode) (GstPhotography * photo, GstPhotographyFlashMode * flash_mode);
+ gboolean (*get_zoom) (GstPhotography * photo, gfloat * zoom);
+ gboolean (*get_flicker_mode) (GstPhotography * photo, GstPhotographyFlickerReductionMode * flicker_mode);
+ gboolean (*get_focus_mode) (GstPhotography * photo, GstPhotographyFocusMode * focus_mode);
+
+ gboolean (*set_ev_compensation) (GstPhotography * photo, gfloat ev_comp);
+ gboolean (*set_iso_speed) (GstPhotography * photo, guint iso_speed);
+ gboolean (*set_aperture) (GstPhotography * photo, guint aperture);
+ gboolean (*set_exposure) (GstPhotography * photo, guint32 exposure);
+ gboolean (*set_white_balance_mode) (GstPhotography * photo, GstPhotographyWhiteBalanceMode wb_mode);
+ gboolean (*set_color_tone_mode) (GstPhotography * photo, GstPhotographyColorToneMode tone_mode);
+ gboolean (*set_scene_mode) (GstPhotography * photo, GstPhotographySceneMode scene_mode);
+ gboolean (*set_flash_mode) (GstPhotography * photo, GstPhotographyFlashMode flash_mode);
+ gboolean (*set_zoom) (GstPhotography * photo, gfloat zoom);
+ gboolean (*set_flicker_mode) (GstPhotography * photo, GstPhotographyFlickerReductionMode flicker_mode);
+ gboolean (*set_focus_mode) (GstPhotography * photo, GstPhotographyFocusMode focus_mode);
+
+ GstPhotographyCaps (*get_capabilities) (GstPhotography * photo);
+
+ gboolean (*prepare_for_capture) (GstPhotography * photo, GstPhotographyCapturePrepared func, GstCaps *capture_caps, gpointer user_data);
+
+ void (*set_autofocus) (GstPhotography * photo, gboolean on);
+
+ gboolean (*set_config) (GstPhotography * photo, GstPhotographySettings * config);
+ gboolean (*get_config) (GstPhotography * photo, GstPhotographySettings * config);
+
+ gboolean (*get_noise_reduction) (GstPhotography * photo, GstPhotographyNoiseReduction * noise_reduction);
+ gboolean (*set_noise_reduction) (GstPhotography * photo, GstPhotographyNoiseReduction noise_reduction);
+
+ gboolean (*set_exposure_mode) (GstPhotography * photo, GstPhotographyExposureMode exposure_mode);
+ gboolean (*get_exposure_mode) (GstPhotography * photo, GstPhotographyExposureMode * exposure_mode);
+ gboolean (*set_analog_gain) (GstPhotography * photo, gfloat analog_gain);
+ gboolean (*get_analog_gain) (GstPhotography * photo, gfloat * analog_gain);
+ gboolean (*set_lens_focus) (GstPhotography * photo, gfloat lens_focus);
+ gboolean (*get_lens_focus) (GstPhotography * photo, gfloat * lens_focus);
+ gboolean (*set_color_temperature) (GstPhotography * photo, guint color_temperature);
+ gboolean (*get_color_temperature) (GstPhotography * photo, guint * color_temperature);
+ gboolean (*set_min_exposure_time) (GstPhotography * photo, guint min_exposure_time);
+ gboolean (*get_min_exposure_time) (GstPhotography * photo, guint * min_exposure_time);
+ gboolean (*set_max_exposure_time) (GstPhotography * photo, guint max_exposure_time);
+ gboolean (*get_max_exposure_time) (GstPhotography * photo, guint * max_exposure_time);
+
+ /* FIXME: remove padding, not needed for interfaces */
+ /*< private > */
+ gpointer _gst_reserved[GST_PADDING];
+} GstPhotographyInterface;
+
+GST_PHOTOGRAPHY_API
+GType gst_photography_get_type (void);
+
+/* virtual class function wrappers */
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_ev_compensation (GstPhotography * photo,
+ gfloat * ev_comp);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_iso_speed (GstPhotography * photo,
+ guint * iso_speed);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_aperture (GstPhotography * photo,
+ guint * aperture);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_exposure (GstPhotography * photo,
+ guint32 * exposure);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_white_balance_mode (GstPhotography * photo,
+ GstPhotographyWhiteBalanceMode * wb_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_color_tone_mode (GstPhotography * photo,
+ GstPhotographyColorToneMode * tone_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_scene_mode (GstPhotography * photo,
+ GstPhotographySceneMode * scene_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_flash_mode (GstPhotography * photo,
+ GstPhotographyFlashMode * flash_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_noise_reduction (GstPhotography * photo,
+ GstPhotographyNoiseReduction * noise_reduction);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_zoom (GstPhotography * photo, gfloat * zoom);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_flicker_mode (GstPhotography * photo,
+ GstPhotographyFlickerReductionMode * mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_focus_mode (GstPhotography * photo,
+ GstPhotographyFocusMode * mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_ev_compensation (GstPhotography * photo,
+ gfloat ev_comp);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_iso_speed (GstPhotography * photo,
+ guint iso_speed);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_aperture (GstPhotography * photo, guint aperture);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_exposure (GstPhotography * photo, guint exposure);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_white_balance_mode (GstPhotography * photo,
+ GstPhotographyWhiteBalanceMode wb_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_color_tone_mode (GstPhotography * photo,
+ GstPhotographyColorToneMode tone_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_scene_mode (GstPhotography * photo,
+ GstPhotographySceneMode scene_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_flash_mode (GstPhotography * photo,
+ GstPhotographyFlashMode flash_mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_noise_reduction (GstPhotography * photo,
+ GstPhotographyNoiseReduction noise_reduction);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_zoom (GstPhotography * photo, gfloat zoom);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_flicker_mode (GstPhotography * photo,
+ GstPhotographyFlickerReductionMode mode);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_focus_mode (GstPhotography * photo,
+ GstPhotographyFocusMode mode);
+
+GST_PHOTOGRAPHY_API
+GstPhotographyCaps gst_photography_get_capabilities (GstPhotography * photo);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_prepare_for_capture (GstPhotography * photo,
+ GstPhotographyCapturePrepared func,
+ GstCaps *capture_caps,
+ gpointer user_data);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_set_config (GstPhotography * photo,
+ GstPhotographySettings * config);
+
+GST_PHOTOGRAPHY_API
+gboolean gst_photography_get_config (GstPhotography * photo,
+ GstPhotographySettings * config);
+
+GST_PHOTOGRAPHY_API
+void gst_photography_set_autofocus (GstPhotography * photo, gboolean on);
+
+G_END_DECLS
+
+#endif /* __GST_PHOTOGRAPHY_H__ */
diff --git a/include/gst/isoff/gstisoff.h b/include/gst/isoff/gstisoff.h
new file mode 100644
index 0000000000..43d337516d
--- /dev/null
+++ b/include/gst/isoff/gstisoff.h
@@ -0,0 +1,299 @@
+/*
+ * ISO File Format parsing library
+ *
+ * gstisoff.h
+ *
+ * Copyright (C) 2015 Samsung Electronics. All rights reserved.
+ * Author: Thiago Santos <thiagoss@osg.samsung.com>
+ *
+ * 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.1 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 (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_ISOFF_H__
+#define __GST_ISOFF_H__
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+
+G_BEGIN_DECLS
+
+#ifndef GST_ISOFF_API
+# ifdef BUILDING_GST_ISOFF
+# define GST_ISOFF_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_ISOFF_API GST_API_IMPORT
+# endif
+#endif
+
+typedef enum {
+ GST_ISOFF_PARSER_OK,
+ GST_ISOFF_PARSER_DONE,
+ GST_ISOFF_PARSER_UNEXPECTED,
+ GST_ISOFF_PARSER_ERROR
+} GstIsoffParserResult;
+
+GST_ISOFF_API
+gboolean gst_isoff_parse_box_header (GstByteReader * reader, guint32 * type, guint8 extended_type[16], guint * header_size, guint64 * size);
+
+#define GST_ISOFF_FOURCC_UUID GST_MAKE_FOURCC('u','u','i','d')
+#define GST_ISOFF_FOURCC_MOOF GST_MAKE_FOURCC('m','o','o','f')
+#define GST_ISOFF_FOURCC_MFHD GST_MAKE_FOURCC('m','f','h','d')
+#define GST_ISOFF_FOURCC_TFHD GST_MAKE_FOURCC('t','f','h','d')
+#define GST_ISOFF_FOURCC_TRUN GST_MAKE_FOURCC('t','r','u','n')
+#define GST_ISOFF_FOURCC_TRAF GST_MAKE_FOURCC('t','r','a','f')
+#define GST_ISOFF_FOURCC_TFDT GST_MAKE_FOURCC('t','f','d','t')
+#define GST_ISOFF_FOURCC_MDAT GST_MAKE_FOURCC('m','d','a','t')
+#define GST_ISOFF_FOURCC_MOOV GST_MAKE_FOURCC('m','o','o','v')
+#define GST_ISOFF_FOURCC_TRAK GST_MAKE_FOURCC('t','r','a','k')
+#define GST_ISOFF_FOURCC_TKHD GST_MAKE_FOURCC('t','k','h','d')
+#define GST_ISOFF_FOURCC_MDIA GST_MAKE_FOURCC('m','d','i','a')
+#define GST_ISOFF_FOURCC_MDHD GST_MAKE_FOURCC('m','d','h','d')
+#define GST_ISOFF_FOURCC_HDLR GST_MAKE_FOURCC('h','d','l','r')
+#define GST_ISOFF_FOURCC_SIDX GST_MAKE_FOURCC('s','i','d','x')
+
+/* handler type */
+#define GST_ISOFF_FOURCC_SOUN GST_MAKE_FOURCC('s','o','u','n')
+#define GST_ISOFF_FOURCC_VIDE GST_MAKE_FOURCC('v','i','d','e')
+
+#define GST_ISOFF_SAMPLE_FLAGS_IS_LEADING(flags) (((flags) >> 26) & 0x03)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_DEPENDS_ON(flags) (((flags) >> 24) & 0x03)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_IS_DEPENDED_ON(flags) (((flags) >> 22) & 0x03)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_HAS_REDUNDANCY(flags) (((flags) >> 20) & 0x03)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_PADDING_VALUE(flags) (((flags) >> 17) & 0x07)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_IS_NON_SYNC_SAMPLE(flags) (((flags) >> 16) & 0x01)
+#define GST_ISOFF_SAMPLE_FLAGS_SAMPLE_DEGRADATION_PRIORITY(flags) (((flags) >> 0) & 0x0f)
+
+/* Smooth-Streaming specific boxes */
+typedef struct _GstTfxdBox
+{
+ guint8 version;
+ guint32 flags;
+
+ guint64 time;
+ guint64 duration;
+} GstTfxdBox;
+
+typedef struct _GstTfrfBoxEntry
+{
+ guint64 time;
+ guint64 duration;
+} GstTfrfBoxEntry;
+
+typedef struct _GstTfrfBox
+{
+ guint8 version;
+ guint32 flags;
+
+ gint entries_count;
+ GArray *entries;
+} GstTfrfBox;
+
+/* Common boxes */
+typedef struct _GstMfhdBox
+{
+ guint32 sequence_number;
+} GstMfhdBox;
+
+typedef enum
+{
+ GST_TFHD_FLAGS_BASE_DATA_OFFSET_PRESENT = 0x000001,
+ GST_TFHD_FLAGS_SAMPLE_DESCRIPTION_INDEX_PRESENT = 0x000002,
+ GST_TFHD_FLAGS_DEFAULT_SAMPLE_DURATION_PRESENT = 0x000008,
+ GST_TFHD_FLAGS_DEFAULT_SAMPLE_SIZE_PRESENT = 0x000010,
+ GST_TFHD_FLAGS_DEFAULT_SAMPLE_FLAGS_PRESENT = 0x000020,
+ GST_TFHD_FLAGS_DURATION_IS_EMPTY = 0x010000,
+ GST_TFHD_FLAGS_DEFAULT_BASE_IS_MOOF = 0x020000
+} GstTfhdFlags;
+
+typedef struct _GstTfhdBox
+{
+ guint8 version;
+ GstTfhdFlags flags;
+
+ guint32 track_id;
+
+ /* optional */
+ guint64 base_data_offset;
+ guint32 sample_description_index;
+ guint32 default_sample_duration;
+ guint32 default_sample_size;
+ guint32 default_sample_flags;
+} GstTfhdBox;
+
+typedef enum
+{
+ GST_TRUN_FLAGS_DATA_OFFSET_PRESENT = 0x000001,
+ GST_TRUN_FLAGS_FIRST_SAMPLE_FLAGS_PRESENT = 0x000004,
+ GST_TRUN_FLAGS_SAMPLE_DURATION_PRESENT = 0x000100,
+ GST_TRUN_FLAGS_SAMPLE_SIZE_PRESENT = 0x000200,
+ GST_TRUN_FLAGS_SAMPLE_FLAGS_PRESENT = 0x000400,
+ GST_TRUN_FLAGS_SAMPLE_COMPOSITION_TIME_OFFSETS_PRESENT = 0x000800
+} GstTrunFlags;
+
+typedef struct _GstTrunBox
+{
+ guint8 version;
+ GstTrunFlags flags;
+
+ guint32 sample_count;
+
+ /* optional */
+ gint32 data_offset;
+ guint32 first_sample_flags;
+ GArray *samples;
+} GstTrunBox;
+
+typedef struct _GstTrunSample
+{
+ guint32 sample_duration;
+ guint32 sample_size;
+ guint32 sample_flags;
+
+ union {
+ guint32 u; /* version 0 */
+ gint32 s; /* others */
+ } sample_composition_time_offset;
+} GstTrunSample;
+
+typedef struct _GstTdftBox
+{
+ guint64 decode_time;
+} GstTfdtBox;
+
+typedef struct _GstTrafBox
+{
+ GstTfhdBox tfhd;
+ GstTfdtBox tfdt;
+ GArray *trun;
+
+ /* smooth-streaming specific */
+ GstTfrfBox *tfrf;
+ GstTfxdBox *tfxd;
+} GstTrafBox;
+
+typedef struct _GstMoofBox
+{
+ GstMfhdBox mfhd;
+ GArray *traf;
+} GstMoofBox;
+
+GST_ISOFF_API
+GstMoofBox * gst_isoff_moof_box_parse (GstByteReader *reader);
+
+GST_ISOFF_API
+void gst_isoff_moof_box_free (GstMoofBox *moof);
+
+typedef struct _GstTkhdBox
+{
+ guint32 track_id;
+} GstTkhdBox;
+
+typedef struct _GstMdhdBox
+{
+ guint32 timescale;
+} GstMdhdBox;
+
+typedef struct _GstHdlrBox
+{
+ guint32 handler_type;
+} GstHdlrBox;
+
+typedef struct _GstMdiaBox
+{
+ GstMdhdBox mdhd;
+ GstHdlrBox hdlr;
+} GstMdiaBox;
+
+typedef struct _GstTrakBox
+{
+ GstTkhdBox tkhd;
+ GstMdiaBox mdia;
+} GstTrakBox;
+
+typedef struct _GstMoovBox
+{
+ GArray *trak;
+} GstMoovBox;
+
+GST_ISOFF_API
+GstMoovBox * gst_isoff_moov_box_parse (GstByteReader *reader);
+
+GST_ISOFF_API
+void gst_isoff_moov_box_free (GstMoovBox *moov);
+
+typedef struct _GstSidxBoxEntry
+{
+ gboolean ref_type;
+ guint32 size;
+ GstClockTime duration;
+ gboolean starts_with_sap;
+ guint8 sap_type;
+ guint32 sap_delta_time;
+
+ guint64 offset;
+ GstClockTime pts;
+} GstSidxBoxEntry;
+
+typedef struct _GstSidxBox
+{
+ guint8 version;
+ guint32 flags;
+
+ guint32 ref_id;
+ guint32 timescale;
+ guint64 earliest_pts;
+ guint64 first_offset;
+
+ gint entry_index;
+ gint entries_count;
+
+ GstSidxBoxEntry *entries;
+} GstSidxBox;
+
+typedef enum _GstSidxParserStatus
+{
+ GST_ISOFF_SIDX_PARSER_INIT,
+ GST_ISOFF_SIDX_PARSER_HEADER,
+ GST_ISOFF_SIDX_PARSER_DATA,
+ GST_ISOFF_SIDX_PARSER_FINISHED
+} GstSidxParserStatus;
+
+typedef struct _GstSidxParser
+{
+ GstSidxParserStatus status;
+
+ guint64 size;
+ guint64 cumulative_entry_size;
+ guint64 cumulative_pts;
+
+ GstSidxBox sidx;
+} GstSidxParser;
+
+GST_ISOFF_API
+void gst_isoff_sidx_parser_init (GstSidxParser * parser);
+
+GST_ISOFF_API
+void gst_isoff_sidx_parser_clear (GstSidxParser * parser);
+
+GST_ISOFF_API
+GstIsoffParserResult gst_isoff_sidx_parser_parse (GstSidxParser * parser, GstByteReader * reader, guint * consumed);
+
+GST_ISOFF_API
+GstIsoffParserResult gst_isoff_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buf, guint * consumed);
+
+G_END_DECLS
+
+#endif /* __GST_ISOFF_H__ */
diff --git a/include/gst/math-compat.h b/include/gst/math-compat.h
new file mode 100644
index 0000000000..fe3fe95153
--- /dev/null
+++ b/include/gst/math-compat.h
@@ -0,0 +1,116 @@
+/* GStreamer
+ * Copyright (C) 2010 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MATH_COMPAT_H__
+#define __GST_MATH_COMPAT_H__
+
+#ifndef __GI_SCANNER__
+
+/* This header is not included automatically via gst/gst.h, you need to
+ * include it explicitly if you need it. */
+
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES /* so MSVC defines M_PI etc. */
+#endif
+#include <math.h>
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* http://en.wikipedia.org/wiki/Math.h */
+
+#define __GST_MATH_COMPAT_NEED_RINT
+#define __GST_MATH_COMPAT_NEED_RINTF
+#define __GST_MATH_COMPAT_NEED_ISNAN
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#undef __GST_MATH_COMPAT_NEED_RINT
+#undef __GST_MATH_COMPAT_NEED_RINTF
+#undef __GST_MATH_COMPAT_NEED_ISNAN
+#endif
+
+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
+#undef __GST_MATH_COMPAT_NEED_RINT
+#undef __GST_MATH_COMPAT_NEED_RINTF
+#undef __GST_MATH_COMPAT_NEED_ISNAN
+#endif
+
+#ifndef M_PI
+#define M_PI G_PI
+#endif
+
+#ifndef M_PI_2
+#define M_PI_2 G_PI_2
+#endif
+
+#ifndef M_PI_4
+#define M_PI_4 G_PI_4
+#endif
+
+static inline double
+__gst_math_compat_rint (double x)
+{
+ return floor (x + 0.5);
+}
+
+static inline float
+__gst_math_compat_rintf (float x)
+{
+ return floorf (x + 0.5);
+}
+
+static inline gboolean
+__gst_math_compat_isnan (double x)
+{
+ return x != x;
+}
+
+#if defined (__GST_MATH_COMPAT_NEED_RINT) && !defined (rint)
+#define rint(x) __gst_math_compat_rint(x)
+#endif
+
+#if defined (__GST_MATH_COMPAT_NEED_RINTF) && !defined (rintf)
+#define rintf(x) __gst_math_compat_rintf(x)
+#endif
+
+#if defined (__GST_MATH_COMPAT_NEED_ISNAN) && !defined (isnan)
+#define isnan(x) __gst_math_compat_isnan (x)
+#endif
+
+#ifndef NAN
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define __GST_NAN_BYTES { 0x7f, 0xc0, 0, 0 }
+#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define __GST_NAN_BYTES { 0, 0, 0xc0, 0x7f }
+#endif
+static union {
+ unsigned char __c[4];
+ float __d;
+} __gst_nan_union G_GNUC_UNUSED = {
+ __GST_NAN_BYTES
+};
+#define NAN (__gst_nan_union.__d)
+#endif
+
+G_END_DECLS
+
+#endif /* !__GI_SCANNER__ */
+
+#endif /* __GST_MATH_COMPAT_H__ */
diff --git a/include/gst/mpegts/gst-atsc-descriptor.h b/include/gst/mpegts/gst-atsc-descriptor.h
new file mode 100644
index 0000000000..dc9037c5ac
--- /dev/null
+++ b/include/gst/mpegts/gst-atsc-descriptor.h
@@ -0,0 +1,87 @@
+/*
+ * gstmpegtsdescriptor.h -
+ * Copyright (C) 2020 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_ATSC_DESCRIPTOR_H
+#define GST_ATSC_DESCRIPTOR_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/mpegts-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION:gst-atsc-descriptor
+ * @title: ATSC variants of MPEG-TS descriptors
+ * @short_description: Descriptors for the various ATSC specifications
+ * @include: gst/mpegts/mpegts.h
+ *
+ * This contains the various descriptors defined by the ATSC specifications
+ */
+
+/**
+ * GstMpegtsATSCDescriptorType:
+ *
+ * These values correspond to the registered descriptor type from
+ * the various ATSC specifications.
+ *
+ * Consult the relevant specifications for more details.
+ */
+typedef enum {
+ /* ATSC A/65 2009 */
+ GST_MTS_DESC_ATSC_STUFFING = 0x80,
+ GST_MTS_DESC_ATSC_AC3 = 0x81,
+ GST_MTS_DESC_ATSC_CAPTION_SERVICE = 0x86,
+ GST_MTS_DESC_ATSC_CONTENT_ADVISORY = 0x87,
+ GST_MTS_DESC_ATSC_EXTENDED_CHANNEL_NAME = 0xA0,
+ GST_MTS_DESC_ATSC_SERVICE_LOCATION = 0xA1,
+ GST_MTS_DESC_ATSC_TIME_SHIFTED_SERVICE = 0xA2,
+ GST_MTS_DESC_ATSC_COMPONENT_NAME = 0xA3,
+ GST_MTS_DESC_ATSC_DCC_DEPARTING_REQUEST = 0xA8,
+ GST_MTS_DESC_ATSC_DCC_ARRIVING_REQUEST = 0xA9,
+ GST_MTS_DESC_ATSC_REDISTRIBUTION_CONTROL = 0xAA,
+ GST_MTS_DESC_ATSC_GENRE = 0xAB,
+ GST_MTS_DESC_ATSC_PRIVATE_INFORMATION = 0xAD,
+ GST_MTS_DESC_ATSC_EAC3 = 0xCC,
+
+ /* ATSC A/53:3 2009 */
+ GST_MTS_DESC_ATSC_ENHANCED_SIGNALING = 0xB2,
+
+ /* ATSC A/90 */
+ GST_MTS_DESC_ATSC_DATA_SERVICE = 0xA4,
+ GST_MTS_DESC_ATSC_PID_COUNT = 0xA5,
+ GST_MTS_DESC_ATSC_DOWNLOAD_DESCRIPTOR = 0xA6,
+ GST_MTS_DESC_ATSC_MULTIPROTOCOL_ENCAPSULATION = 0xA7,
+ GST_MTS_DESC_ATSC_MODULE_LINK = 0xB4,
+ GST_MTS_DESC_ATSC_CRC32 = 0xB5,
+ GST_MTS_DESC_ATSC_GROUP_LINK = 0xB8,
+} GstMpegtsATSCDescriptorType;
+
+/* For backwards compatibility */
+/**
+ * GST_MTS_DESC_AC3_AUDIO_STREAM: (skip) (attributes doc.skip=true)
+ */
+#define GST_MTS_DESC_AC3_AUDIO_STREAM GST_MTS_DESC_ATSC_AC3
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/mpegts/gst-atsc-section.h b/include/gst/mpegts/gst-atsc-section.h
new file mode 100644
index 0000000000..4d53ee8374
--- /dev/null
+++ b/include/gst/mpegts/gst-atsc-section.h
@@ -0,0 +1,543 @@
+/*
+ * mpegtspacketizer.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_ATSC_SECTION_H
+#define GST_ATSC_SECTION_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/gstmpegtssection.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegtsSectionATSCTableID:
+ * @GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE: Master Guide Table (MGT)
+ * @GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL: Terrestrial Virtual Channel Table (TVCT)
+ * @GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL: Cable Virtual Channel Table (CVCT)
+ * @GST_MTS_TABLE_ID_ATSC_RATING_REGION: Rating Region Table (RRT)
+ * @GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION: Event Information Table (EIT)
+ * @GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT: Extended Text Table (ETT)
+ * @GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME: System Time Table (STT)
+ * @GST_MTS_TABLE_ID_ATSC_DATA_EVENT: A/90: Data Event Table (DET)
+ * @GST_MTS_TABLE_ID_ATSC_DATA_SERVICE: A/90: Data Service Table (DST)
+ * @GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE: A/90: Network Resources Table (NRT)
+ * @GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE: A/90: Long Term Service Table (LTST)
+ * @GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE: Directed Channel Change Table (DCCT)
+ * @GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE: Directed Channel Change Selection Code Table (DCCSCT)
+ * @GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL: A/81: Satellite Virtual Channel Table
+ *
+ * Values for a #GstMpegtsSection table_id.
+ *
+ * These are the registered ATSC section `table_id` variants. Unless specified
+ * otherwise, they are defined in the "ATSC A/65" specification.
+ *
+ * see also: #GstMpegtsSectionTableID and other variants.
+ */
+typedef enum {
+
+ /* ATSC (A/65) */
+ GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE = 0xC7,
+ GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL = 0xC8,
+ GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL = 0xC9,
+ GST_MTS_TABLE_ID_ATSC_RATING_REGION = 0xCA,
+ GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION = 0xCB,
+ GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT = 0xCC,
+ GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME = 0xCD,
+ /* ATSC (A/90) */
+ GST_MTS_TABLE_ID_ATSC_DATA_EVENT = 0xCE,
+ GST_MTS_TABLE_ID_ATSC_DATA_SERVICE = 0xCF,
+
+ /* ATSC (A/57B) */
+ /**
+ * GST_MTS_TABLE_ID_ATSC_PROGRAM_IDENTIFIER:
+ *
+ * A/57B: Program Identifier Table.
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_ATSC_PROGRAM_IDENTIFIER = 0xD0,
+ /* ATSC (A/90) */
+ GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE = 0xD1,
+ GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE = 0xD2,
+ /* ATSC (A/65) */
+ GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE = 0xD3,
+ GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE = 0xD4,
+ /* 0xD5-0xD9 covered in CEA/SCTE */
+ GST_MTS_TABLE_ID_ATSC_AGGREGATE_EVENT_INFORMATION = 0xD6,
+ GST_MTS_TABLE_ID_ATSC_AGGREGATE_EXTENDED_TEXT = 0xD7,
+ GST_MTS_TABLE_ID_ATSC_AGGREGATE_DATA_EVENT = 0xD9,
+ /* */
+ GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL = 0xDA,
+} GstMpegtsSectionATSCTableID;
+
+/**
+ * GstMpegtsATSCStreamType:
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_DCII_VIDEO: DigiCipher II video | Identical to ITU-T Rec. H.262 | ISO/IEC 13818-2 Video
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_AC3: ATSC A/53 Audio | AC-3
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_SUBTITLING: SCTE-27 Subtitling
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_ISOCH_DATA: SCTE-19 Isochronous data | Reserved
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_SIT: SCTE-35 Splice Information Table
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_EAC3: E-AC-3 A/52:2018
+ * @GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_DTS_HD: E-AC-3 A/107 (ATSC 2.0)
+ *
+ * Type of mpeg-ts streams for ATSC, as defined by the ATSC Code Points
+ * Registry. For convenience, some stream types from %GstMpegtsScteStreamType
+ * are also included.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_MPEGTS_STREAM_TYPE_ATSC_DCII_VIDEO = 0x80,
+ GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_AC3 = 0x81,
+ GST_MPEGTS_STREAM_TYPE_ATSC_SUBTITLING = 0x82,
+ GST_MPEGTS_STREAM_TYPE_ATSC_ISOCH_DATA = 0x83,
+ /* 0x84-0x85 : RESERVED */
+ GST_MPEGTS_STREAM_TYPE_ATSC_SIT = 0x86,
+ GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_EAC3 = 0x87,
+ GST_MPEGTS_STREAM_TYPE_ATSC_AUDIO_DTS_HD = 0x88,
+} GstMpegtsATSCStreamType;
+
+/* TVCT/CVCT */
+#define GST_TYPE_MPEGTS_ATSC_VCT (gst_mpegts_atsc_vct_get_type ())
+#define GST_TYPE_MPEGTS_ATSC_VCT_SOURCE (gst_mpegts_atsc_vct_source_get_type ())
+
+typedef struct _GstMpegtsAtscVCTSource GstMpegtsAtscVCTSource;
+typedef struct _GstMpegtsAtscVCT GstMpegtsAtscVCT;
+
+/**
+ * GstMpegtsAtscVCTSource:
+ * @short_name: The short name of a source
+ * @major_channel_number: The major channel number
+ * @minor_channel_number: The minor channel number
+ * @modulation_mode: The modulation mode
+ * @carrier_frequency: The carrier frequency
+ * @channel_TSID: The transport stream ID
+ * @program_number: The program number (see #GstMpegtsPatProgram)
+ * @ETM_location: The ETM location
+ * @access_controlled: is access controlled
+ * @hidden: is hidden
+ * @path_select: is path select, CVCT only
+ * @out_of_band: is out of band, CVCT only
+ * @hide_guide: is hide guide
+ * @service_type: The service type
+ * @source_id: The source id
+ * @descriptors: (element-type GstMpegtsDescriptor): an array of #GstMpegtsDescriptor
+ *
+ * Source from a %GstMpegtsAtscVCT, can be used both for TVCT and CVCT tables
+ */
+struct _GstMpegtsAtscVCTSource
+{
+ gchar *short_name;
+ guint16 major_channel_number;
+ guint16 minor_channel_number;
+ guint8 modulation_mode;
+ guint32 carrier_frequency;
+ guint16 channel_TSID;
+ guint16 program_number;
+ /* FIXME: */
+ guint8 ETM_location;
+ gboolean access_controlled;
+ gboolean hidden;
+ gboolean path_select; /* CVCT only - reserved bit in TVCT */
+ gboolean out_of_band; /* CVCT only - reserved bit in TVCT */
+ gboolean hide_guide;
+ /* FIXME: */
+ guint8 service_type;
+ guint16 source_id;
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsAtscVCT:
+ * @transport_stream_id: The transport stream
+ * @protocol_version: The protocol version
+ * @sources: (element-type GstMpegtsAtscVCTSource): sources
+ * @descriptors: (element-type GstMpegtsDescriptor): descriptors
+ *
+ * Represents both:
+ * Terrestrial Virtual Channel Table (A65)
+ * Cable Virtual Channel Table (A65)
+ *
+ */
+struct _GstMpegtsAtscVCT
+{
+ guint16 transport_stream_id;
+ guint8 protocol_version;
+ GPtrArray *sources;
+ GPtrArray *descriptors;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_vct_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_vct_source_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_tvct (GstMpegtsSection * section);
+
+GST_MPEGTS_API
+const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_cvct (GstMpegtsSection * section);
+
+/* MGT */
+#define GST_TYPE_MPEGTS_ATSC_MGT (gst_mpegts_atsc_mgt_get_type ())
+#define GST_TYPE_MPEGTS_ATSC_MGT_TABLE (gst_mpegts_atsc_mgt_table_get_type ())
+
+typedef struct _GstMpegtsAtscMGTTable GstMpegtsAtscMGTTable;
+typedef struct _GstMpegtsAtscMGT GstMpegtsAtscMGT;
+
+typedef enum {
+ GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT0 = 0x0100,
+ GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT127 = 0x017F,
+ GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT0 = 0x0200,
+ GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT127 = 0x027F
+} GstMpegtsAtscMGTTableType;
+
+/**
+ * GstMpegtsAtscMGTTable:
+ * @table_type: #GstMpegtsAtscMGTTableType
+ * @pid: The packet ID
+ * @version_number: The version number
+ * @number_bytes:
+ * @descriptors: (element-type GstMpegtsDescriptor): descriptors
+ *
+ * Source from a @GstMpegtsAtscMGT
+ */
+struct _GstMpegtsAtscMGTTable
+{
+ guint16 table_type;
+ guint16 pid;
+ guint8 version_number;
+ guint32 number_bytes;
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsAtscMGT:
+ * @protocol_version: The protocol version
+ * @tables_defined: The numbers of subtables
+ * @tables: (element-type GstMpegtsAtscMGTTable): the tables
+ * @descriptors: (element-type GstMpegtsDescriptor): descriptors
+ *
+ * Master Guide Table (A65)
+ *
+ */
+struct _GstMpegtsAtscMGT
+{
+ guint8 protocol_version;
+ guint16 tables_defined;
+ GPtrArray *tables;
+ GPtrArray *descriptors;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_mgt_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_mgt_table_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscMGT * gst_mpegts_section_get_atsc_mgt (GstMpegtsSection * section);
+
+GST_MPEGTS_API
+GstMpegtsSection * gst_mpegts_section_from_atsc_mgt (GstMpegtsAtscMGT * mgt);
+
+GST_MPEGTS_API
+GstMpegtsAtscMGT * gst_mpegts_atsc_mgt_new (void);
+
+/* Multiple string structure (used in ETT and EIT) */
+
+#define GST_TYPE_MPEGTS_ATSC_STRING_SEGMENT (gst_mpegts_atsc_string_segment_get_type())
+#define GST_TYPE_MPEGTS_ATSC_MULT_STRING (gst_mpegts_atsc_mult_string_get_type())
+
+typedef struct _GstMpegtsAtscStringSegment GstMpegtsAtscStringSegment;
+typedef struct _GstMpegtsAtscMultString GstMpegtsAtscMultString;
+
+/**
+ * GstMpegtsAtscStringSegment:
+ * @compression_type: The compression type
+ * @mode: The mode
+ * @compressed_data_size: The size of compressed data
+ * @compressed_data: The compressed data
+ * @cached_string:
+ *
+ * A string segment
+ */
+struct _GstMpegtsAtscStringSegment {
+ guint8 compression_type;
+ guint8 mode;
+ guint8 compressed_data_size;
+ guint8 *compressed_data;
+
+ gchar *cached_string;
+};
+
+GST_MPEGTS_API
+const gchar * gst_mpegts_atsc_string_segment_get_string (GstMpegtsAtscStringSegment * seg);
+
+GST_MPEGTS_API
+gboolean
+gst_mpegts_atsc_string_segment_set_string (GstMpegtsAtscStringSegment * seg,
+ gchar *string,
+ guint8 compression_type,
+ guint8 mode);
+
+/**
+ * GstMpegtsAtscMultString:
+ * @iso_639_langcode: The ISO639 language code
+ * @segments: (element-type GstMpegtsAtscStringSegment)
+ *
+ */
+struct _GstMpegtsAtscMultString {
+ gchar iso_639_langcode[4];
+ GPtrArray *segments;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_string_segment_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_mult_string_get_type (void);
+
+/* EIT */
+
+#define GST_TYPE_MPEGTS_ATSC_EIT_EVENT (gst_mpegts_atsc_eit_event_get_type())
+#define GST_TYPE_MPEGTS_ATSC_EIT (gst_mpegts_atsc_eit_get_type())
+
+typedef struct _GstMpegtsAtscEITEvent GstMpegtsAtscEITEvent;
+typedef struct _GstMpegtsAtscEIT GstMpegtsAtscEIT;
+
+/**
+ * GstMpegtsAtscEITEvent:
+ * @event_id: The event id
+ * @start_time: The start time
+ * @etm_location: The etm location
+ * @length_in_seconds: The length in seconds
+ * @titles: (element-type GstMpegtsAtscMultString): the titles
+ * @descriptors: (element-type GstMpegtsDescriptor): descriptors
+ *
+ * An ATSC EIT Event
+ */
+struct _GstMpegtsAtscEITEvent {
+ guint16 event_id;
+ guint32 start_time;
+ guint8 etm_location;
+ guint32 length_in_seconds;
+ GPtrArray *titles;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsAtscEIT:
+ * @source_id: The source id
+ * @protocol_version: The protocol version
+ * @events: (element-type GstMpegtsAtscEITEvent): Events
+ *
+ * Event Information Table (ATSC)
+ *
+ */
+struct _GstMpegtsAtscEIT
+{
+ guint16 source_id;
+ guint8 protocol_version;
+
+ GPtrArray *events;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_eit_event_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_eit_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscEIT *gst_mpegts_section_get_atsc_eit (GstMpegtsSection *section);
+
+/* ETT */
+
+#define GST_TYPE_MPEGTS_ATSC_ETT (gst_mpegts_atsc_ett_get_type())
+
+typedef struct _GstMpegtsAtscETT GstMpegtsAtscETT;
+
+/**
+ * GstMpegtsAtscETT:
+ * @ett_table_id_extension:
+ * @protocol_version: The protocol version
+ * @etm_id: The etm id
+ * @messages: (element-type GstMpegtsAtscMultString): List of texts
+ *
+ * Extended Text Table (ATSC)
+ *
+ */
+struct _GstMpegtsAtscETT
+{
+ guint16 ett_table_id_extension;
+ guint16 protocol_version;
+ guint32 etm_id;
+
+ GPtrArray *messages;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_ett_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscETT *gst_mpegts_section_get_atsc_ett (GstMpegtsSection *section);
+
+/* STT */
+#define GST_TYPE_MPEGTS_ATSC_STT (gst_mpegts_atsc_stt_get_type ())
+
+typedef struct _GstMpegtsAtscSTT GstMpegtsAtscSTT;
+
+/**
+ * GstMpegtsAtscSTT:
+ * @protocol_version: The protocol version
+ * @system_time: The system time
+ * @gps_utc_offset: The GPS to UTC offset
+ * @ds_status:
+ * @ds_dayofmonth: The day of month
+ * @ds_hour: The hour
+ * @descriptors: (element-type GstMpegtsDescriptor): descriptors
+ * @utc_datetime: The UTC date and time
+ *
+ * System Time Table (A65)
+ *
+ */
+struct _GstMpegtsAtscSTT
+{
+ guint8 protocol_version;
+ guint32 system_time;
+ guint8 gps_utc_offset;
+ gboolean ds_status;
+ guint8 ds_dayofmonth;
+ guint8 ds_hour;
+ GPtrArray *descriptors;
+
+ GstDateTime *utc_datetime;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_stt_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscSTT * gst_mpegts_section_get_atsc_stt (GstMpegtsSection * section);
+/* FIXME receive a non-const parameter but we only provide a const getter */
+
+GST_MPEGTS_API
+GstDateTime * gst_mpegts_atsc_stt_get_datetime_utc (GstMpegtsAtscSTT * stt);
+
+GST_MPEGTS_API
+GstMpegtsSection * gst_mpegts_section_from_atsc_stt (GstMpegtsAtscSTT * stt);
+
+GST_MPEGTS_API
+GstMpegtsAtscSTT * gst_mpegts_atsc_stt_new (void);
+
+/* RRT */
+#define GST_TYPE_MPEGTS_ATSC_RRT (gst_mpegts_atsc_rrt_get_type ())
+#define GST_TYPE_MPEGTS_ATSC_RRT_DIMENSION (gst_mpegts_atsc_rrt_dimension_get_type ())
+#define GST_TYPE_MPEGTS_ATSC_RRT_DIMENSION_VALUE (gst_mpegts_atsc_rrt_dimension_value_get_type ())
+
+typedef struct _GstMpegtsAtscRRT GstMpegtsAtscRRT;
+typedef struct _GstMpegtsAtscRRTDimension GstMpegtsAtscRRTDimension;
+typedef struct _GstMpegtsAtscRRTDimensionValue GstMpegtsAtscRRTDimensionValue;
+
+/**
+ * GstMpegtsAtscRRTDimensionValue:
+ * @abbrev_ratings: (element-type GstMpegtsAtscMultString): the abbreviated ratings
+ * @ratings: (element-type GstMpegtsAtscMultString): the ratings
+ *
+ * Since: 1.18
+ */
+struct _GstMpegtsAtscRRTDimensionValue
+{
+ GPtrArray *abbrev_ratings;
+ GPtrArray *ratings;
+};
+
+/**
+ * GstMpegtsAtscRRTDimension:
+ * @names: (element-type GstMpegtsAtscMultString): the names
+ * @graduated_scale: whether the ratings represent a graduated scale
+ * @values_defined: the number of values defined for this dimension
+ * @values: (element-type GstMpegtsAtscRRTDimensionValue): set of values
+ *
+ * Since: 1.18
+ */
+struct _GstMpegtsAtscRRTDimension
+{
+ GPtrArray * names;
+ gboolean graduated_scale;
+ guint8 values_defined;
+ GPtrArray * values;
+};
+
+/**
+ * GstMpegtsAtscRRT:
+ * @protocol_version: The protocol version
+ * @names: (element-type GstMpegtsAtscMultString): the names
+ * @dimensions_defined: the number of dimensions defined for this rating table
+ * @dimensions: (element-type GstMpegtsAtscRRTDimension): A set of dimensions
+ * @descriptors: descriptors
+ *
+ * Region Rating Table (A65)
+ *
+ * Since: 1.18
+ */
+struct _GstMpegtsAtscRRT
+{
+ guint8 protocol_version;
+ GPtrArray * names;
+ guint8 dimensions_defined;
+ GPtrArray * dimensions;
+ GPtrArray * descriptors;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_rrt_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_rrt_dimension_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_rrt_dimension_value_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsAtscRRT * gst_mpegts_section_get_atsc_rrt (GstMpegtsSection * section);
+
+GST_MPEGTS_API
+GstMpegtsSection * gst_mpegts_section_from_atsc_rrt (GstMpegtsAtscRRT * rrt);
+
+GST_MPEGTS_API
+GstMpegtsAtscRRT * gst_mpegts_atsc_rrt_new (void);
+
+GST_MPEGTS_API
+GstMpegtsAtscRRTDimension * gst_mpegts_atsc_rrt_dimension_new (void);
+
+GST_MPEGTS_API
+GstMpegtsAtscRRTDimensionValue * gst_mpegts_atsc_rrt_dimension_value_new (void);
+
+G_END_DECLS
+
+#endif /* GST_MPEGTS_SECTION_H */
diff --git a/include/gst/mpegts/gst-dvb-descriptor.h b/include/gst/mpegts/gst-dvb-descriptor.h
new file mode 100644
index 0000000000..d88de84854
--- /dev/null
+++ b/include/gst/mpegts/gst-dvb-descriptor.h
@@ -0,0 +1,1139 @@
+/*
+ * gstmpegtsdescriptor.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Some parts of this code come from the Fluendo MPEG Demuxer plugin.
+ *
+ * The Initial Developer of the Original Code is Fluendo, S.L.
+ * Portions created by Fluendo, S.L. are Copyright (C) 2005
+ * Fluendo, S.L. All Rights Reserved.
+ *
+ * Contributor(s): Wim Taymans <wim@fluendo.com>
+ */
+
+#ifndef GST_DVB_DESCRIPTOR_H
+#define GST_DVB_DESCRIPTOR_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/mpegts-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegtsDVBDescriptorType:
+ *
+ * The type of #GstMpegtsDescriptor
+ *
+ * These values correspond to the registered descriptor type from
+ * the various DVB specifications.
+ *
+ * Consult the relevant specifications for more details.
+ */
+typedef enum {
+ /* 64-127 DVB tags ETSI EN 300 468
+ * (Specification for Service Information (SI) in DVB systems)
+ */
+ GST_MTS_DESC_DVB_NETWORK_NAME = 0x40,
+ GST_MTS_DESC_DVB_SERVICE_LIST = 0x41,
+ GST_MTS_DESC_DVB_STUFFING = 0x42,
+ GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM = 0x43,
+ GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM = 0x44,
+ GST_MTS_DESC_DVB_VBI_DATA = 0x45,
+ GST_MTS_DESC_DVB_VBI_TELETEXT = 0x46,
+ GST_MTS_DESC_DVB_BOUQUET_NAME = 0x47,
+ GST_MTS_DESC_DVB_SERVICE = 0x48,
+ GST_MTS_DESC_DVB_COUNTRY_AVAILABILITY = 0x49,
+ GST_MTS_DESC_DVB_LINKAGE = 0x4A,
+ GST_MTS_DESC_DVB_NVOD_REFERENCE = 0x4B,
+ GST_MTS_DESC_DVB_TIME_SHIFTED_SERVICE = 0x4C,
+ GST_MTS_DESC_DVB_SHORT_EVENT = 0x4D,
+ GST_MTS_DESC_DVB_EXTENDED_EVENT = 0x4E,
+ GST_MTS_DESC_DVB_TIME_SHIFTED_EVENT = 0x4F,
+ GST_MTS_DESC_DVB_COMPONENT = 0x50,
+ GST_MTS_DESC_DVB_MOSAIC = 0x51,
+ GST_MTS_DESC_DVB_STREAM_IDENTIFIER = 0x52,
+ GST_MTS_DESC_DVB_CA_IDENTIFIER = 0x53,
+ GST_MTS_DESC_DVB_CONTENT = 0x54,
+ GST_MTS_DESC_DVB_PARENTAL_RATING = 0x55,
+ GST_MTS_DESC_DVB_TELETEXT = 0x56,
+ GST_MTS_DESC_DVB_TELEPHONE = 0x57,
+ GST_MTS_DESC_DVB_LOCAL_TIME_OFFSET = 0x58,
+ GST_MTS_DESC_DVB_SUBTITLING = 0x59,
+ GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM = 0x5A,
+ GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME = 0x5B,
+ GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME = 0x5C,
+ GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME = 0x5D,
+ GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT = 0x5E,
+ GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER = 0x5F,
+ GST_MTS_DESC_DVB_SERVICE_MOVE = 0x60,
+ GST_MTS_DESC_DVB_SHORT_SMOOTHING_BUFFER = 0x61,
+ GST_MTS_DESC_DVB_FREQUENCY_LIST = 0x62,
+ /**
+ * GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM:
+ *
+ * Partial Transport Stream descriptor. Only present in SIT Sections.
+ *
+ * See also: %GST_MPEGTS_SECTION_SIT, %GstMpegtsSIT
+ */
+ GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM = 0x63,
+ GST_MTS_DESC_DVB_DATA_BROADCAST = 0x64,
+ GST_MTS_DESC_DVB_SCRAMBLING = 0x65,
+ GST_MTS_DESC_DVB_DATA_BROADCAST_ID = 0x66,
+ GST_MTS_DESC_DVB_TRANSPORT_STREAM = 0x67,
+ GST_MTS_DESC_DVB_DSNG = 0x68,
+ GST_MTS_DESC_DVB_PDC = 0x69,
+ GST_MTS_DESC_DVB_AC3 = 0x6A,
+ GST_MTS_DESC_DVB_ANCILLARY_DATA = 0x6B,
+ GST_MTS_DESC_DVB_CELL_LIST = 0x6C,
+ GST_MTS_DESC_DVB_CELL_FREQUENCY_LINK = 0x6D,
+ GST_MTS_DESC_DVB_ANNOUNCEMENT_SUPPORT = 0x6E,
+ GST_MTS_DESC_DVB_APPLICATION_SIGNALLING = 0x6F,
+ GST_MTS_DESC_DVB_ADAPTATION_FIELD_DATA = 0x70,
+ GST_MTS_DESC_DVB_SERVICE_IDENTIFIER = 0x71,
+ GST_MTS_DESC_DVB_SERVICE_AVAILABILITY = 0x72,
+ GST_MTS_DESC_DVB_DEFAULT_AUTHORITY = 0x73,
+ GST_MTS_DESC_DVB_RELATED_CONTENT = 0x74,
+ GST_MTS_DESC_DVB_TVA_ID = 0x75,
+ GST_MTS_DESC_DVB_CONTENT_IDENTIFIER = 0x76,
+ GST_MTS_DESC_DVB_TIMESLICE_FEC_IDENTIFIER = 0x77,
+ GST_MTS_DESC_DVB_ECM_REPETITION_RATE = 0x78,
+ GST_MTS_DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM = 0x79,
+ GST_MTS_DESC_DVB_ENHANCED_AC3 = 0x7A,
+ GST_MTS_DESC_DVB_DTS = 0x7B,
+ GST_MTS_DESC_DVB_AAC = 0x7C,
+ GST_MTS_DESC_DVB_XAIT_LOCATION = 0x7D,
+ GST_MTS_DESC_DVB_FTA_CONTENT_MANAGEMENT = 0x7E,
+ GST_MTS_DESC_DVB_EXTENSION = 0x7F,
+} GstMpegtsDVBDescriptorType;
+
+/**
+ * GstMpegtsDVBExtendedDescriptorType:
+ *
+ * The type of #GstMpegtsDescriptor
+ *
+ * These values correspond to the registered extended descriptor
+ * type from the various DVB specifications.
+ *
+ * Consult the relevant specifications for more details.
+ */
+typedef enum {
+ /* 00 - 0x7F DVB extended tags ETSI EN 300 468
+ * (Specification for Service Information (SI) in DVB systems)
+ */
+ GST_MTS_DESC_EXT_DVB_IMAGE_ICON = 0x00,
+ /* TS/TR 102 825 */
+ GST_MTS_DESC_EXT_DVB_CPCM_DELIVERY_SIGNALLING = 0x01,
+ GST_MTS_DESC_EXT_DVB_CP = 0x02,
+ GST_MTS_DESC_EXT_DVB_CP_IDENTIFIER = 0x03,
+ GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM = 0x04,
+ GST_MTS_DESC_EXT_DVB_SH_DELIVERY_SYSTEM = 0x05,
+ GST_MTS_DESC_EXT_DVB_SUPPLEMENTARY_AUDIO = 0x06,
+ GST_MTS_DESC_EXT_DVB_NETWORK_CHANGE_NOTIFY = 0x07,
+ GST_MTS_DESC_EXT_DVB_MESSAGE = 0x08,
+ GST_MTS_DESC_EXT_DVB_TARGET_REGION = 0x09,
+ GST_MTS_DESC_EXT_DVB_TARGET_REGION_NAME = 0x0A,
+ GST_MTS_DESC_EXT_DVB_SERVICE_RELOCATED = 0x0B,
+ GST_MTS_DESC_EXT_DVB_XAIT_PID = 0x0C,
+ GST_MTS_DESC_EXT_DVB_C2_DELIVERY_SYSTEM = 0x0D,
+ GST_MTS_DESC_EXT_DVB_DTS_HD_AUDIO_STREAM = 0x0E,
+ GST_MTS_DESC_EXT_DVB_DTS_NEUTRAL = 0x0F,
+ GST_MTS_DESC_EXT_DVB_VIDEO_DEPTH_RANGE = 0x10,
+ GST_MTS_DESC_EXT_DVB_T2MI = 0x11,
+ GST_MTS_DESC_EXT_DVB_URI_LINKAGE = 0x13,
+ GST_MTS_DESC_EXT_DVB_AC4 = 0x15,
+ /**
+ * GST_MTS_DESC_EXT_DVB_AUDIO_PRESELECTION:
+ *
+ * Provide all avaliable audio programme for user selection
+ *
+ * Since: 1.20
+ */
+ GST_MTS_DESC_EXT_DVB_AUDIO_PRESELECTION = 0x19
+} GstMpegtsDVBExtendedDescriptorType;
+
+/* GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER (0x13) */
+/* FIXME : Implement */
+
+/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_network_name (const GstMpegtsDescriptor *descriptor,
+ gchar **name);
+
+GST_MPEGTS_API
+GstMpegtsDescriptor *gst_mpegts_descriptor_from_dvb_network_name (const gchar * name);
+
+/* GST_MTS_DESC_DVB_STUFFING (0x42) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_stuffing (const GstMpegtsDescriptor * descriptor,
+ guint8 ** stuffing_bytes);
+
+
+/* GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM (0x43) */
+typedef struct _GstMpegtsSatelliteDeliverySystemDescriptor GstMpegtsSatelliteDeliverySystemDescriptor;
+
+typedef enum {
+ GST_MPEGTS_MODULATION_QPSK = 0,
+ GST_MPEGTS_MODULATION_QAM_16,
+ GST_MPEGTS_MODULATION_QAM_32,
+ GST_MPEGTS_MODULATION_QAM_64,
+ GST_MPEGTS_MODULATION_QAM_128,
+ GST_MPEGTS_MODULATION_QAM_256,
+ GST_MPEGTS_MODULATION_QAM_AUTO,
+ GST_MPEGTS_MODULATION_VSB_8,
+ GST_MPEGTS_MODULATION_VSB_16,
+ GST_MPEGTS_MODULATION_PSK_8,
+ GST_MPEGTS_MODULATION_APSK_16,
+ GST_MPEGTS_MODULATION_APSK_32,
+ GST_MPEGTS_MODULATION_DQPSK,
+ GST_MPEGTS_MODULATION_QAM_4_NR_,
+ GST_MPEGTS_MODULATION_NONE
+} GstMpegtsModulationType;
+
+typedef enum {
+ GST_MPEGTS_FEC_NONE = 0,
+ GST_MPEGTS_FEC_1_2,
+ GST_MPEGTS_FEC_2_3,
+ GST_MPEGTS_FEC_3_4,
+ GST_MPEGTS_FEC_4_5,
+ GST_MPEGTS_FEC_5_6,
+ GST_MPEGTS_FEC_6_7,
+ GST_MPEGTS_FEC_7_8,
+ GST_MPEGTS_FEC_8_9,
+ GST_MPEGTS_FEC_AUTO,
+ GST_MPEGTS_FEC_3_5,
+ GST_MPEGTS_FEC_9_10,
+ GST_MPEGTS_FEC_2_5
+} GstMpegtsDVBCodeRate;
+
+typedef enum {
+ GST_MPEGTS_ROLLOFF_35 = 0,
+ GST_MPEGTS_ROLLOFF_20,
+ GST_MPEGTS_ROLLOFF_25,
+ GST_MPEGTS_ROLLOFF_RESERVED,
+ GST_MPEGTS_ROLLOFF_AUTO
+} GstMpegtsSatelliteRolloff;
+
+typedef enum {
+ GST_MPEGTS_POLARIZATION_LINEAR_HORIZONTAL = 0,
+ GST_MPEGTS_POLARIZATION_LINEAR_VERTICAL,
+ GST_MPEGTS_POLARIZATION_CIRCULAR_LEFT,
+ GST_MPEGTS_POLARIZATION_CIRCULAR_RIGHT
+} GstMpegtsSatellitePolarizationType;
+
+/**
+ * GstMpegtsSatelliteDeliverySystemDescriptor:
+ * @frequency: the frequency in kHz (kiloHertz)
+ * @orbital_position: the orbital position in degrees
+ * @west_east: If %TRUE, the satellite is in the eastern part of the orbit,
+ * else in the western part.
+ * @polarization: The polarization of the transmitted signal
+ * @roll_off: Roll-off factor used in DVB-S2
+ * @modulation_system: modulation system, %TRUE if DVB-S2, else DVB-S
+ * @modulation_type: Modulation scheme used
+ * @symbol_rate: Symbol rate (in symbols per second)
+ * @fec_inner: inner FEC scheme used
+ *
+ * Satellite Delivery System Descriptor (EN 300 468 v.1.13.1)
+ */
+struct _GstMpegtsSatelliteDeliverySystemDescriptor
+{
+ guint32 frequency;
+ gfloat orbital_position;
+ gboolean west_east;
+ GstMpegtsSatellitePolarizationType polarization;
+
+ GstMpegtsSatelliteRolloff roll_off;
+ gboolean modulation_system;
+ GstMpegtsModulationType modulation_type;
+
+ guint32 symbol_rate;
+ GstMpegtsDVBCodeRate fec_inner;
+};
+
+#define GST_TYPE_MPEGTS_SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR (gst_mpegts_satellite_delivery_system_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_satellite_delivery_system_descriptor_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsSatelliteDeliverySystemDescriptor *res);
+
+
+/* GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM (0x44) */
+typedef enum {
+ GST_MPEGTS_CABLE_OUTER_FEC_UNDEFINED = 0,
+ GST_MPEGTS_CABLE_OUTER_FEC_NONE,
+ GST_MPEGTS_CABLE_OUTER_FEC_RS_204_188,
+} GstMpegtsCableOuterFECScheme;
+
+typedef struct _GstMpegtsCableDeliverySystemDescriptor GstMpegtsCableDeliverySystemDescriptor;
+/**
+ * GstMpegtsCableDeliverySystemDescriptor:
+ * @frequency: the frequency in Hz (Hertz)
+ * @outer_fec: the outer FEC scheme used
+ * @modulation: Modulation scheme used
+ * @symbol_rate: Symbol rate (in symbols per second)
+ * @fec_inner: inner FEC scheme used
+ *
+ * Cable Delivery System Descriptor (EN 300 468 v.1.13.1)
+ */
+struct _GstMpegtsCableDeliverySystemDescriptor
+{
+ guint32 frequency;
+ GstMpegtsCableOuterFECScheme outer_fec;
+ GstMpegtsModulationType modulation;
+
+ guint32 symbol_rate;
+ GstMpegtsDVBCodeRate fec_inner;
+};
+
+#define GST_TYPE_MPEGTS_DVB_CABLE_DELIVERY_SYSTEM_DESCRIPTOR ( gst_mpegts_dvb_cable_system_delivery_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_cable_delivery_system_descriptor_get_type (void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_cable_delivery_system (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsCableDeliverySystemDescriptor *res);
+
+GST_MPEGTS_API
+void gst_mpegts_dvb_cable_delivery_system_descriptor_free (GstMpegtsCableDeliverySystemDescriptor * source);
+
+/* GST_MTS_DESC_DVB_BOUQUET_NAME (0x47) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_bouquet_name (const GstMpegtsDescriptor * descriptor,
+ gchar ** bouquet_name);
+
+/* GST_MTS_DESC_DVB_SERVICE (0x48) */
+/**
+ * GstMpegtsDVBServiceType:
+ *
+ * The type of service of a channel.
+ *
+ * As specified in Table 87 of ETSI EN 300 468 v1.13.1
+ */
+typedef enum {
+ GST_DVB_SERVICE_RESERVED_00 = 0x00,
+ GST_DVB_SERVICE_DIGITAL_TELEVISION,
+ GST_DVB_SERVICE_DIGITAL_RADIO_SOUND,
+ GST_DVB_SERVICE_TELETEXT,
+ GST_DVB_SERVICE_NVOD_REFERENCE,
+ GST_DVB_SERVICE_NVOD_TIME_SHIFTED,
+ GST_DVB_SERVICE_MOSAIC,
+ GST_DVB_SERVICE_FM_RADIO,
+ GST_DVB_SERVICE_DVB_SRM,
+ GST_DVB_SERVICE_RESERVED_09,
+ GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND,
+ GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC,
+ GST_DVB_SERVICE_DATA_BROADCAST,
+ GST_DVB_SERVICE_RESERVED_0D_COMMON_INTERFACE,
+ GST_DVB_SERVICE_RCS_MAP,
+ GST_DVB_SERVICE_RCS_FLS,
+ GST_DVB_SERVICE_DVB_MHP,
+ GST_DVB_SERVICE_MPEG2_HD_DIGITAL_TELEVISION,
+ /* 0x12 - 015 Reserved for future use */
+ GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION = 0x16,
+ GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED,
+ GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE,
+ GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION,
+ GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED,
+ GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE,
+ GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION,
+ GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED,
+ GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE,
+ /* 0x1F - 0x7f Reserved for future use */
+ /* 0x80 - 0xfe user defined */
+ /* 0xff Reserved for future use */
+ GST_DVB_SERVICE_RESERVED_FF
+} GstMpegtsDVBServiceType;
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_service (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsDVBServiceType *service_type,
+ gchar **service_name,
+ gchar **provider_name);
+
+GST_MPEGTS_API
+GstMpegtsDescriptor *gst_mpegts_descriptor_from_dvb_service (GstMpegtsDVBServiceType service_type,
+ const gchar * service_name,
+ const gchar * service_provider);
+
+/* GST_MTS_DESC_DVB_SERVICE_LIST (0x41) */
+typedef struct _GstMpegtsDVBServiceListItem GstMpegtsDVBServiceListItem;
+
+/**
+ * GstMpegtsDVBServiceListItem:
+ * @service_id: the id of a service
+ * @type: the type of a service
+ */
+struct _GstMpegtsDVBServiceListItem
+{
+ guint16 service_id;
+ GstMpegtsDVBServiceType type;
+};
+
+#define GST_TYPE_MPEGTS_DVB_SERVICE_LIST_ITEM (gst_mpegts_dvb_service_list_item_get_type ())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_service_list_item_get_type (void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_service_list (const GstMpegtsDescriptor * descriptor,
+ GPtrArray ** list);
+
+/* GST_MTS_DESC_DVB_LINKAGE (0x4A) */
+/**
+ * GstMpegtsDVBLinkageType:
+ *
+ * Linkage Type (EN 300 468 v.1.13.1)
+ */
+typedef enum {
+ /* 0x00, 0x0F-0x7F reserved for future use */
+ GST_MPEGTS_DVB_LINKAGE_RESERVED_00 = 0x00,
+ GST_MPEGTS_DVB_LINKAGE_INFORMATION = 0x01,
+ GST_MPEGTS_DVB_LINKAGE_EPG = 0x02,
+ GST_MPEGTS_DVB_LINKAGE_CA_REPLACEMENT = 0x03,
+ GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_COMPLETE_SI = 0x04,
+ GST_MPEGTS_DVB_LINKAGE_SERVICE_REPLACEMENT = 0x05,
+ GST_MPEGTS_DVB_LINKAGE_DATA_BROADCAST = 0x06,
+ GST_MPEGTS_DVB_LINKAGE_RCS_MAP = 0x07,
+ GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER = 0x08,
+ GST_MPEGTS_DVB_LINKAGE_SYSTEM_SOFTWARE_UPDATE = 0x09,
+ GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_SSU = 0x0A,
+ GST_MPEGTS_DVB_LINKAGE_IP_MAC_NOTIFICATION = 0x0B,
+ GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_INT = 0x0C,
+ GST_MPEGTS_DVB_LINKAGE_EVENT = 0x0D,
+ GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT = 0x0E,
+} GstMpegtsDVBLinkageType;
+
+typedef enum {
+ GST_MPEGTS_DVB_LINKAGE_HAND_OVER_RESERVED = 0x00,
+ GST_MPEGTS_DVB_LINKAGE_HAND_OVER_IDENTICAL = 0x01,
+ GST_MPEGTS_DVB_LINKAGE_HAND_OVER_LOCAL_VARIATION = 0x02,
+ GST_MPEGTS_DVB_LINKAGE_HAND_OVER_ASSOCIATED = 0x03,
+} GstMpegtsDVBLinkageHandOverType;
+
+typedef struct _GstMpegtsDVBLinkageMobileHandOver GstMpegtsDVBLinkageMobileHandOver;
+typedef struct _GstMpegtsDVBLinkageEvent GstMpegtsDVBLinkageEvent;
+typedef struct _GstMpegtsDVBLinkageExtendedEvent GstMpegtsDVBLinkageExtendedEvent;
+typedef struct _GstMpegtsDVBLinkageDescriptor GstMpegtsDVBLinkageDescriptor;
+
+struct _GstMpegtsDVBLinkageMobileHandOver
+{
+ GstMpegtsDVBLinkageHandOverType hand_over_type;
+ /* 0 = NIT, 1 = SDT */
+ gboolean origin_type;
+ guint16 network_id;
+ guint16 initial_service_id;
+};
+
+struct _GstMpegtsDVBLinkageEvent
+{
+ guint16 target_event_id;
+ gboolean target_listed;
+ gboolean event_simulcast;
+};
+
+struct _GstMpegtsDVBLinkageExtendedEvent
+{
+ guint16 target_event_id;
+ gboolean target_listed;
+ gboolean event_simulcast;
+ /* FIXME: */
+ guint8 link_type;
+ /* FIXME: */
+ guint8 target_id_type;
+ gboolean original_network_id_flag;
+ gboolean service_id_flag;
+ /* if (target_id_type == 3) */
+ guint16 user_defined_id;
+ /* else */
+ guint16 target_transport_stream_id;
+ guint16 target_original_network_id;
+ guint16 target_service_id;
+};
+
+/**
+ * GstMpegtsDVBLinkageDescriptor:
+ * @transport_stream_id: the transport id
+ * @original_network_id: the original network id
+ * @service_id: the service id
+ * @linkage_type: the type which @linkage_data has
+ * @private_data_length: the length for @private_data_bytes
+ * @private_data_bytes: additional data bytes
+ */
+struct _GstMpegtsDVBLinkageDescriptor
+{
+ guint16 transport_stream_id;
+ guint16 original_network_id;
+ guint16 service_id;
+ GstMpegtsDVBLinkageType linkage_type;
+ /*< private >*/
+ gpointer linkage_data;
+ /*< public >*/
+ guint8 private_data_length;
+ guint8 *private_data_bytes;
+};
+
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_DESCRIPTOR ( gst_mpegts_dvb_linkage_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_descriptor_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_dvb_linkage_descriptor_free (GstMpegtsDVBLinkageDescriptor * source);
+
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER (gst_mpegts_dvb_linkage_mobile_hand_over_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_mobile_hand_over_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsDVBLinkageMobileHandOver * gst_mpegts_dvb_linkage_descriptor_get_mobile_hand_over
+ (const GstMpegtsDVBLinkageDescriptor * desc);
+
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_EVENT (gst_mpegts_dvb_linkage_event_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_event_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsDVBLinkageEvent * gst_mpegts_dvb_linkage_descriptor_get_event
+ (const GstMpegtsDVBLinkageDescriptor * desc);
+
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT (gst_mpegts_dvb_linkage_extended_event_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_extended_event_get_type (void);
+
+GST_MPEGTS_API
+const GPtrArray * gst_mpegts_dvb_linkage_descriptor_get_extended_event
+ (const GstMpegtsDVBLinkageDescriptor * desc);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegtsDescriptor * descriptor,
+ GstMpegtsDVBLinkageDescriptor ** res);
+
+/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegtsDescriptor *descriptor,
+ gchar **language_code,
+ gchar **event_name,
+ gchar **text);
+
+/* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */
+typedef struct _GstMpegtsExtendedEventDescriptor GstMpegtsExtendedEventDescriptor;
+typedef struct _GstMpegtsExtendedEventItem GstMpegtsExtendedEventItem;
+
+/* FIXME : Maybe make a separate method for getting a specific item entry ? */
+struct _GstMpegtsExtendedEventItem
+{
+ gchar *item_description;
+ gchar *item;
+};
+
+#define GST_TYPE_MPEGTS_EXTENDED_EVENT_ITEM (gst_mpegts_extended_event_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_extended_event_item_get_type(void);
+
+/**
+ * GstMpegtsExtendedEventDescriptor:
+ * @descriptor_number:
+ * @last_descriptor_number:
+ * @language_code: NULL terminated language code.
+ * @items: (element-type GstMpegtsExtendedEventItem): the #GstMpegtsExtendedEventItem
+ * @text:
+ *
+ * Extended Event Descriptor (EN 300 468 v.1.13.1)
+ */
+struct _GstMpegtsExtendedEventDescriptor
+{
+ guint8 descriptor_number;
+ guint8 last_descriptor_number;
+ gchar *language_code;
+ GPtrArray *items;
+ gchar *text;
+};
+
+#define GST_TYPE_MPEGTS_EXTENDED_EVENT_DESCRIPTOR (gst_mpegts_extended_event_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_extended_event_descriptor_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_extended_event_descriptor_free (GstMpegtsExtendedEventDescriptor * source);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsExtendedEventDescriptor **res);
+
+/* GST_MTS_DESC_DVB_COMPONENT (0x50) */
+#define GST_TYPE_MPEGTS_COMPONENT_DESCRIPTOR (gst_mpegts_component_descriptor_get_type ())
+typedef enum {
+ GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO = 0x01,
+ GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO = 0x02,
+ GST_MPEGTS_STREAM_CONTENT_TELETEXT_OR_SUBTITLE = 0x03,
+ GST_MPEGTS_STREAM_CONTENT_AC_3 = 0x04,
+ GST_MPEGTS_STREAM_CONTENT_AVC = 0x05,
+ GST_MPEGTS_STREAM_CONTENT_AAC = 0x06,
+ GST_MPEGTS_STREAM_CONTENT_DTS = 0x07,
+ GST_MPEGTS_STREAM_CONTENT_SRM_CPCM = 0x08
+} GstMpegtsComponentStreamContent;
+
+typedef struct _GstMpegtsComponentDescriptor GstMpegtsComponentDescriptor;
+struct _GstMpegtsComponentDescriptor
+{
+ guint8 stream_content;
+ guint8 component_type;
+ guint8 component_tag;
+ gchar *language_code;
+ gchar *text;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_component_descriptor_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_dvb_component_descriptor_free (GstMpegtsComponentDescriptor * source);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_component (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsComponentDescriptor **res);
+
+/* GST_MTS_DESC_DVB_STREAM_IDENTIFIER (0x52) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegtsDescriptor *descriptor,
+ guint8 *component_tag);
+
+/* GST_MTS_DESC_DVB_CA_IDENTIFIER (0x53) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_ca_identifier (const GstMpegtsDescriptor * descriptor,
+ GArray ** list);
+
+/* GST_MTS_DESC_DVB_CONTENT (0x54) */
+typedef enum {
+ GST_MPEGTS_CONTENT_MOVIE_DRAMA = 0x01,
+ GST_MPEGTS_CONTENT_NEWS_CURRENT_AFFAIRS = 0x02,
+ GST_MPEGTS_CONTENT_SHOW_GAME_SHOW = 0x03,
+ GST_MPEGTS_CONTENT_SPORTS = 0x04,
+ GST_MPEGTS_CONTENT_CHILDREN_YOUTH_PROGRAM = 0x05,
+ GST_MPEGTS_CONTENT_MUSIC_BALLET_DANCE = 0x06,
+ GST_MPEGTS_CONTENT_ARTS_CULTURE = 0x07,
+ GST_MPEGTS_CONTENT_SOCIAL_POLITICAL_ECONOMICS = 0x08,
+ GST_MPEGTS_CONTENT_EDUCATION_SCIENCE_FACTUAL = 0x09,
+ GST_MPEGTS_CONTENT_LEISURE_HOBBIES = 0x0A,
+ GST_MPEGTS_CONTENT_SPECIAL_CHARACTERISTICS = 0x0B
+} GstMpegtsContentNibbleHi;
+
+typedef struct _GstMpegtsContent GstMpegtsContent;
+struct _GstMpegtsContent
+{
+ GstMpegtsContentNibbleHi content_nibble_1;
+ guint8 content_nibble_2;
+ guint8 user_byte;
+};
+
+#define GST_TYPE_MPEGTS_CONTENT (gst_mpegts_content_get_type ())
+
+GST_MPEGTS_API
+GType gst_mpegts_content_get_type (void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_content (const GstMpegtsDescriptor *
+ descriptor, GPtrArray ** content);
+
+/* GST_MTS_DESC_DVB_PARENTAL_RATING (0x55) */
+typedef struct _GstMpegtsDVBParentalRatingItem GstMpegtsDVBParentalRatingItem;
+
+#define GST_TYPE_MPEGTS_DVB_PARENTAL_RATING_ITEM (gst_mpegts_dvb_parental_rating_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_parental_rating_item_get_type (void);
+
+/**
+ * GstMpegtsDVBParentalRating:
+ * @country_code: This 24-bit field identifies a country using the 3-character
+ * code as specified in ISO 3166
+ * @rating: the rating age
+ */
+struct _GstMpegtsDVBParentalRatingItem
+{
+ gchar *country_code;
+ guint8 rating;
+};
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_parental_rating (const GstMpegtsDescriptor
+ * descriptor, GPtrArray ** rating);
+
+/* GST_MTS_DESC_DVB_TELETEXT (0x56) */
+/**
+ * GstMpegtsDVBTeletextType:
+ *
+ * The type of teletext page.
+ *
+ * As specified in Table 100 of ETSI EN 300 468 v1.13.1
+ */
+typedef enum {
+ INITIAL_PAGE = 0x01,
+ SUBTITLE_PAGE,
+ ADDITIONAL_INFO_PAGE,
+ PROGRAMME_SCHEDULE_PAGE,
+ HEARING_IMPAIRED_PAGE
+} GstMpegtsDVBTeletextType;
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegtsDescriptor *
+ descriptor, guint idx, gchar ** language_code,
+ GstMpegtsDVBTeletextType * teletext_type, guint8 * magazine_number,
+ guint8 * page_number);
+
+GST_MPEGTS_API
+guint gst_mpegts_descriptor_parse_dvb_teletext_nb (const GstMpegtsDescriptor *
+ descriptor);
+
+/* GST_MTS_DESC_DVB_SUBTITLING (0x59) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegtsDescriptor *descriptor,
+ guint idx, gchar ** lang,
+ guint8 *type, guint16 *composition_page_id,
+ guint16 *ancillary_page_id);
+
+GST_MPEGTS_API
+guint gst_mpegts_descriptor_parse_dvb_subtitling_nb (const GstMpegtsDescriptor *descriptor);
+
+GST_MPEGTS_API
+GstMpegtsDescriptor * gst_mpegts_descriptor_from_dvb_subtitling (const gchar *lang,
+ guint8 type, guint16 composition, guint16 ancillary);
+
+
+
+/* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */
+typedef struct _GstMpegtsTerrestrialDeliverySystemDescriptor GstMpegtsTerrestrialDeliverySystemDescriptor;
+
+typedef enum {
+ GST_MPEGTS_TRANSMISSION_MODE_2K = 0,
+ GST_MPEGTS_TRANSMISSION_MODE_8K,
+ GST_MPEGTS_TRANSMISSION_MODE_AUTO,
+ GST_MPEGTS_TRANSMISSION_MODE_4K,
+ GST_MPEGTS_TRANSMISSION_MODE_1K,
+ GST_MPEGTS_TRANSMISSION_MODE_16K,
+ GST_MPEGTS_TRANSMISSION_MODE_32K,
+ GST_MPEGTS_TRANSMISSION_MODE_C1,
+ GST_MPEGTS_TRANSMISSION_MODE_C3780
+} GstMpegtsTerrestrialTransmissionMode;
+
+typedef enum {
+ GST_MPEGTS_GUARD_INTERVAL_1_32 = 0,
+ GST_MPEGTS_GUARD_INTERVAL_1_16,
+ GST_MPEGTS_GUARD_INTERVAL_1_8,
+ GST_MPEGTS_GUARD_INTERVAL_1_4,
+ GST_MPEGTS_GUARD_INTERVAL_AUTO,
+ GST_MPEGTS_GUARD_INTERVAL_1_128,
+ GST_MPEGTS_GUARD_INTERVAL_19_128,
+ GST_MPEGTS_GUARD_INTERVAL_19_256,
+ GST_MPEGTS_GUARD_INTERVAL_PN420,
+ GST_MPEGTS_GUARD_INTERVAL_PN595,
+ GST_MPEGTS_GUARD_INTERVAL_PN945
+} GstMpegtsTerrestrialGuardInterval;
+
+typedef enum {
+ GST_MPEGTS_HIERARCHY_NONE = 0,
+ GST_MPEGTS_HIERARCHY_1,
+ GST_MPEGTS_HIERARCHY_2,
+ GST_MPEGTS_HIERARCHY_4,
+ GST_MPEGTS_HIERARCHY_AUTO
+} GstMpegtsTerrestrialHierarchy;
+
+/**
+ * GstMpegtsTerrestrialDeliverySystemDescriptor:
+ * @frequency: the frequency in Hz (Hertz)
+ * @bandwidth: the bandwidth in Hz (Hertz)
+ * @priority: %TRUE High Priority %FALSE Low Priority
+ * @time_slicing: %TRUE no time slicing %FALSE time slicing
+ * @mpe_fec: %TRUE no mpe-fec is used %FALSE mpe-fec is use
+ * @constellation: the constellation
+ * @hierarchy: the hierarchy
+ * @code_rate_hp:
+ * @code_rate_lp:
+ * @guard_interval:
+ * @transmission_mode:
+ * @other_frequency: %TRUE more frequency are use, else not
+ *
+ * Terrestrial Delivery System Descriptor (EN 300 468 v.1.13.1)
+ */
+
+struct _GstMpegtsTerrestrialDeliverySystemDescriptor
+{
+ guint32 frequency;
+ guint32 bandwidth;
+ gboolean priority;
+ gboolean time_slicing;
+ gboolean mpe_fec;
+ GstMpegtsModulationType constellation;
+ GstMpegtsTerrestrialHierarchy hierarchy;
+ GstMpegtsDVBCodeRate code_rate_hp;
+ GstMpegtsDVBCodeRate code_rate_lp;
+ GstMpegtsTerrestrialGuardInterval guard_interval;
+ GstMpegtsTerrestrialTransmissionMode transmission_mode;
+ gboolean other_frequency;
+};
+
+#define GST_TYPE_MPEGTS_TERRESTRIAL_DELIVERY_SYSTEM_DESCRIPTOR (gst_mpegts_terrestrial_delivery_system_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_terrestrial_delivery_system_descriptor_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_terrestrial_delivery_system (const GstMpegtsDescriptor
+ *descriptor, GstMpegtsTerrestrialDeliverySystemDescriptor * res);
+
+/* GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME (0x5B) */
+typedef struct _GstMpegtsDvbMultilingualNetworkNameItem GstMpegtsDvbMultilingualNetworkNameItem;
+
+/**
+ * GstMpegtsDvbMultilingualNetworkNameItem:
+ * @language_code: the ISO 639 language code
+ * @network_name: the network name
+ *
+ * a multilingual network name entry
+ */
+struct _GstMpegtsDvbMultilingualNetworkNameItem
+{
+ gchar *language_code;
+ gchar *network_name;
+};
+
+#define GST_TYPE_MPEGTS_DVB_MULTILINGUAL_NETWORK_NAME_ITEM (gst_mpegts_dvb_multilingual_network_name_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_multilingual_network_name_item_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_multilingual_network_name (const GstMpegtsDescriptor
+ *descriptor, GPtrArray ** network_name_items);
+
+/* GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME (0x5C) */
+typedef struct _GstMpegtsDvbMultilingualBouquetNameItem GstMpegtsDvbMultilingualBouquetNameItem;
+
+/**
+ * GstMpegtsDvbMultilingualBouquetNameItem:
+ * @language_code: the ISO 639 language code
+ * @bouquet_name: the bouquet name
+ *
+ * a multilingual bouquet name entry
+ */
+struct _GstMpegtsDvbMultilingualBouquetNameItem
+{
+ gchar *language_code;
+ gchar *bouquet_name;
+};
+
+#define GST_TYPE_MPEGTS_DVB_MULTILINGUAL_BOUQUET_NAME_ITEM (gst_mpegts_dvb_multilingual_bouquet_name_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_multilingual_bouquet_name_item_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const GstMpegtsDescriptor
+ *descriptor, GPtrArray ** bouquet_name_items);
+
+/* GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME (0x5D) */
+typedef struct _GstMpegtsDvbMultilingualServiceNameItem GstMpegtsDvbMultilingualServiceNameItem;
+
+/**
+ * GstMpegtsDvbMultilingualServiceNameItem:
+ * @language_code: the ISO 639 language code
+ * @provider_name: the provider name
+ * @service_name: the service name
+ *
+ * a multilingual service name entry
+ */
+struct _GstMpegtsDvbMultilingualServiceNameItem
+{
+ gchar *language_code;
+ gchar *provider_name;
+ gchar *service_name;
+};
+
+#define GST_TYPE_MPEGTS_DVB_MULTILINGUAL_SERVICE_NAME_ITEM (gst_mpegts_dvb_multilingual_service_name_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_multilingual_service_name_item_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const GstMpegtsDescriptor
+ *descriptor, GPtrArray ** service_name_items);
+
+/* GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT (0x5E) */
+typedef struct _GstMpegtsDvbMultilingualComponentItem GstMpegtsDvbMultilingualComponentItem;
+
+/**
+ * GstMpegtsDvbMultilingualComponentItem:
+ * @language_code: the ISO 639 language code
+ * @description: the component description
+ */
+struct _GstMpegtsDvbMultilingualComponentItem
+{
+ gchar *language_code;
+ gchar *description;
+};
+
+#define GST_TYPE_MPEGTS_DVB_MULTILINGUAL_COMPONENT_ITEM (gst_mpegts_dvb_multilingual_component_item_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_multilingual_component_item_get_type(void);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_multilingual_component (const GstMpegtsDescriptor
+ *descriptor, guint8 * component_tag, GPtrArray ** component_description_items);
+
+/* GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER (0x5F) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_private_data_specifier (const GstMpegtsDescriptor
+ * descriptor, guint32 * private_data_specifier, guint8 ** private_data,
+ guint8 * length);
+
+/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_frequency_list (const GstMpegtsDescriptor
+ * descriptor, gboolean * offset, GArray ** list);
+
+/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
+typedef struct _GstMpegtsDataBroadcastDescriptor GstMpegtsDataBroadcastDescriptor;
+
+/**
+ * GstMpegtsDataBroadcastDescriptor:
+ * @data_broadcast_id: the data broadcast id
+ * @component_tag: the component tag
+ * @selector_bytes: the selector byte field
+ * @language_code: language of @text
+ * @text: description of data broadcast
+ */
+struct _GstMpegtsDataBroadcastDescriptor
+{
+ guint16 data_broadcast_id;
+ guint8 component_tag;
+ guint8 length;
+ guint8 *selector_bytes;
+ gchar *language_code;
+ gchar *text;
+};
+
+
+#define GST_TYPE_MPEGTS_DVB_DATA_BROADCAST_DESCRIPTOR (gst_mpegts_dvb_data_broadcast_descriptor_get_type ())
+GST_MPEGTS_API
+GType gst_mpegts_dvb_data_broadcast_descriptor_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_dvb_data_broadcast_descriptor_free (GstMpegtsDataBroadcastDescriptor * source);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegtsDescriptor
+ *descriptor, GstMpegtsDataBroadcastDescriptor ** res);
+
+/* GST_MTS_DESC_DVB_SCRAMBLING (0x65) */
+typedef enum
+{
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_RESERVED = 0x00,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA1 = 0x01,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA2 = 0x02,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_STANDARD = 0x03,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_MINIMAL_ENHANCED = 0x04,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_FULL_ENHANCED = 0x05,
+ /* 0x06 - 0x0f reserved for future use */
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_CISSA = 0x10,
+ /* 0x11 - 0x1f reserved for future DVB-CISSA versions */
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_0 = 0x70,
+ GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_F = 0x7f,
+} GstMpegtsDVBScramblingModeType;
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_scrambling (const GstMpegtsDescriptor * descriptor,
+ GstMpegtsDVBScramblingModeType * scrambling_mode);
+
+/* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegtsDescriptor
+ * descriptor, guint16 * data_broadcast_id, guint8 ** id_selector_bytes, guint8 * len);
+
+/* GST_MTS_DESC_DVB_AC3 (0x6a) */
+/* FIXME : Implement */
+
+/* GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM (0x7F && 0x04) */
+typedef struct _GstMpegtsT2DeliverySystemCellExtension GstMpegtsT2DeliverySystemCellExtension;
+
+/**
+ * GstMpegtsT2DeliverySystemCellExtension:
+ * @cell_id_extension: id of the sub cell
+ * @transposer_frequency: centre frequency of the sub cell in Hz
+ */
+struct _GstMpegtsT2DeliverySystemCellExtension
+{
+ guint8 cell_id_extension;
+ guint32 transposer_frequency;
+};
+
+#define GST_TYPE_MPEGTS_T2_DELIVERY_SYSTEM_CELL_EXTENSION (gst_mpegts_t2_delivery_system_cell_extension_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_t2_delivery_system_cell_extension_get_type(void);
+
+typedef struct _GstMpegtsT2DeliverySystemCell GstMpegtsT2DeliverySystemCell;
+
+/**
+ * GstMpegtsT2DeliverySystemCell:
+ * @cell_id: id of the cell
+ * @centre_frequencies: (element-type guint32): centre frequencies in Hz
+ * @sub_cells: (element-type GstMpegtsT2DeliverySystemCellExtension):
+ */
+struct _GstMpegtsT2DeliverySystemCell
+{
+ guint16 cell_id;
+ GArray *centre_frequencies;
+ GPtrArray *sub_cells;
+};
+
+#define GST_TYPE_MPEGTS_T2_DELIVERY_SYSTEM_CELL (gst_mpegts_t2_delivery_system_cell_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_t2_delivery_system_cell_get_type(void);
+
+typedef struct _GstMpegtsT2DeliverySystemDescriptor GstMpegtsT2DeliverySystemDescriptor;
+
+/**
+ * GstMpegtsT2DeliverySystemDescriptor:
+ * @plp_id:
+ * @t2_system_id:
+ * @siso_miso:
+ * @bandwidth:
+ * @guard_interval:
+ * @transmission_mode:
+ * @other_frequency:
+ * @tfs:
+ * @cells: (element-type GstMpegtsT2DeliverySystemCell):
+ *
+ * describe DVB-T2 transmissions according to EN 302 755
+ */
+struct _GstMpegtsT2DeliverySystemDescriptor
+{
+ guint8 plp_id;
+ guint16 t2_system_id;
+ /* FIXME: */
+ guint8 siso_miso;
+ guint32 bandwidth;
+ GstMpegtsTerrestrialGuardInterval guard_interval;
+ GstMpegtsTerrestrialTransmissionMode transmission_mode;
+ gboolean other_frequency;
+ gboolean tfs;
+ GPtrArray *cells;
+};
+
+#define GST_TYPE_MPEGTS_T2_DELIVERY_SYSTEM_DESCRIPTOR (gst_mpegts_t2_delivery_system_descriptor_get_type ())
+GST_MPEGTS_API
+GType gst_mpegts_t2_delivery_system_descriptor_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_t2_delivery_system_descriptor_free (GstMpegtsT2DeliverySystemDescriptor * source);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegtsDescriptor
+ *descriptor, GstMpegtsT2DeliverySystemDescriptor ** res);
+
+/**
+ * GstMpegtsAudioPreselectionDescriptor:
+ * @preselection_id: 5-bit
+ * @audio_rendering_indication: 3-bit field
+ * @audio_description: visually impaired
+ * @spoken_subtitles:
+ * @dialogue_enhancement:
+ * @interactivity_enabled:
+ * @language_code_present:
+ * @text_label_present:
+ * @multi_stream_info_present: indicates if this PID conveys a complete audio programme
+ * @future_extension:
+ * @language_code: NULL terminated ISO 639 language code.
+ * @message_id:
+ * @items: (element-type GstMpegtsExtendedEventItem): the #GstMpegtsExtendedEventItem
+ * @text:
+ *
+ * Table 110: Audio Preselection Descriptor (ETSI EN 300 468 v1.16.1)
+ *
+ * Since: 1.20
+ */
+typedef struct _GstMpegtsAudioPreselectionDescriptor GstMpegtsAudioPreselectionDescriptor;
+struct _GstMpegtsAudioPreselectionDescriptor
+{
+ guint8 preselection_id;
+ guint8 audio_rendering_indication;
+ gboolean audio_description;
+ gboolean spoken_subtitles;
+ gboolean dialogue_enhancement;
+ gboolean interactivity_enabled;
+ gboolean language_code_present;
+ gboolean text_label_present;
+ gboolean multi_stream_info_present;
+ gboolean future_extension;
+ gchar *language_code;
+ guint8 message_id;
+};
+
+GST_MPEGTS_API
+gboolean
+gst_mpegts_descriptor_parse_audio_preselection_list (const GstMpegtsDescriptor
+ * descriptor, GPtrArray ** list);
+
+/**
+ * gst_mpegts_descriptor_parse_audio_preselection_free:
+ *
+ * Since: 1.20
+ */
+GST_MPEGTS_API
+void
+gst_mpegts_descriptor_parse_audio_preselection_free (GstMpegtsAudioPreselectionDescriptor
+ * source);
+
+/**
+ * gst_mpegts_descriptor_parse_audio_preselection_dump:
+ *
+ * Since: 1.20
+ */
+GST_MPEGTS_API
+void
+gst_mpegts_descriptor_parse_audio_preselection_dump (GstMpegtsAudioPreselectionDescriptor
+ * source);
+
+
+G_END_DECLS
+
+#endif /* GST_MPEGTS_DESCRIPTOR_H */
diff --git a/include/gst/mpegts/gst-dvb-section.h b/include/gst/mpegts/gst-dvb-section.h
new file mode 100644
index 0000000000..665bb5d0cf
--- /dev/null
+++ b/include/gst/mpegts/gst-dvb-section.h
@@ -0,0 +1,500 @@
+/*
+ * mpegtspacketizer.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_DVB_SECTION_H
+#define GST_DVB_SECTION_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/gstmpegtssection.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegtsSectionDVBTableID:
+ * @GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK: Network Information Table (NIT), Actual Network
+ * @GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK: Network Information Table (NIT), Other Network
+ * @GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS: Service Description Table (SDT), Actual Transport Stream
+ * @GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS: Service Description Table (SDT), Other Transport Stream
+ * @GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION: Bouquet Association Table (BAT)
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT: Event Information Table (EIT), Actual Transport Stream, present/following
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT: Event Information Table (EIT), Other Transport Stream, present/following
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1: Event Information Table (EIT), Actual Transport Stream, Schedule (first)
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N: Event Information Table (EIT), Actual Transport Stream, Schedule (last)
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1: Event Information Table (EIT), Other Transport Stream, Schedule (first)
+ * @GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N: Event Information Table (EIT), Other Transport Stream, Schedule (last)
+ * @GST_MTS_TABLE_ID_TIME_DATE: Time Date Table (TDT)
+ * @GST_MTS_TABLE_ID_RUNNING_STATUS: Running Status Table (RST)
+ * @GST_MTS_TABLE_ID_STUFFING: Stuffing Table (ST)
+ * @GST_MTS_TABLE_ID_TIME_OFFSET: Time Offset Table (TOT)
+ * @GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE: ETSI TS 102 323: Application Information Table (AIT)
+ * @GST_MTS_TABLE_ID_CONTAINER: ETSI TS 102 323: Container Section
+ * @GST_MTS_TABLE_ID_RELATED_CONTENT: ETSI TS 102 323: Related Content Table (RCT)
+ * @GST_MTS_TABLE_ID_CONTENT_IDENTIFIER: ETSI TS 102 323: Content Identifier Table (CIT)
+ * @GST_MTS_TABLE_ID_MPE_FEC: ETSI TS 301 192: MPE-FEC Section
+ * @GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION: ETSI 103 323: Resolution Provider Notification Table (RNT)
+ * @GST_MTS_TABLE_ID_MPE_IFEC: ETSI TS 102 772: MPE-IFEC Section
+ * @GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION: Discontinuity Information Table (DIT)
+ * @GST_MTS_TABLE_ID_SELECTION_INFORMATION: Selection Information Table (SIT)
+ * @GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0: ETSI TR 289: CA Message Table (CMT): ECM 0
+ * @GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1: ETSI TR 289: CA Message Table (CMT): ECM 1
+ * @GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1: ETSI TR 289: CA Message Table (CMT): CA System Private (First)
+ * @GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N: ETSI TR 289: CA Message Table (CMT): CA System Private (Last)
+ *
+ * Values for a #GstMpegtsSection table_id.
+ *
+ * These are the registered DVB table_id variants. Unless specified otherwise,
+ * they come from the DVB Specification for SI (ETSI EN 300 468).
+ *
+ * see also: #GstMpegtsSectionTableID
+ */
+typedef enum {
+ /* EN 300 468 (DVB) v 1.12.1 */
+ GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK = 0x40,
+ GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK = 0x41,
+ GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS = 0x42,
+ GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS = 0x46,
+ GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION = 0x4A,
+
+ /* ETSI TS 102 006 */
+ /**
+ * GST_MTS_TABLE_ID_UPDATE_NOTIFICATION:
+ *
+ * ETSI TS 102 006: Update Notification Table (UNT)
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_UPDATE_NOTIFICATION = 0x4B,
+
+ /* ETSI EN 303 560 */
+ /**
+ * GST_MTS_TABLE_ID_DOWNLOADABLE_FONT_INFO:
+ *
+ * ETSI EN 303 560: Downloadable Font Info
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_DOWNLOADABLE_FONT_INFO = 0x4C,
+
+ /* EN 300 468 */
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT = 0x4E,
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT = 0x4F,
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1 = 0x50,
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N = 0x5F,
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1 = 0x60,
+ GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N = 0x6F,
+ GST_MTS_TABLE_ID_TIME_DATE = 0x70,
+ GST_MTS_TABLE_ID_RUNNING_STATUS = 0x71,
+ GST_MTS_TABLE_ID_STUFFING = 0x72,
+ GST_MTS_TABLE_ID_TIME_OFFSET = 0x73,
+
+ /* TS 102 812 (MHP v1.1.3) */
+ GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE = 0x74,
+
+ /* TS 102 323 (DVB TV Anytime v1.5.1) */
+ GST_MTS_TABLE_ID_CONTAINER = 0x75,
+ GST_MTS_TABLE_ID_RELATED_CONTENT = 0x76,
+ GST_MTS_TABLE_ID_CONTENT_IDENTIFIER = 0x77,
+
+ /* EN 301 192 (DVB specification for data broadcasting) */
+ GST_MTS_TABLE_ID_MPE_FEC = 0x78,
+
+ /* TS 102 323 (DVB TV Anytime v1.5.1) */
+ GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION = 0x79,
+
+ /* TS 102 772 (DVB-SH Multi-Protocol Encapsulation) */
+ GST_MTS_TABLE_ID_MPE_IFEC = 0x7A,
+
+ /* TS 102 809 (DVB Hybrid Broadcast/Broadband) */
+ /**
+ * GST_MTS_TABLE_ID_PROTECTION_MESSAGE:
+ *
+ * ETSI TS 102 809: Protection Message Section
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_PROTECTION_MESSAGE = 0x7B,
+
+ /* EN 300 468 (DVB) v 1.12.1 */
+ GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION = 0x7E,
+ GST_MTS_TABLE_ID_SELECTION_INFORMATION = 0x7F,
+
+ /* ETR 289 (DVB Support for use of scrambling and CA) */
+ GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0 = 0x80,
+ GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1 = 0x81,
+ GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1 = 0x82,
+ GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N = 0x8F,
+
+ /* ... */
+
+ /* EN 301 790 (DVB interaction channel for satellite distribution channels) */
+ /* Note: Not 100% sure we want those exposed here ... */
+ GST_MTS_TABLE_ID_SCT = 0xA0,
+ GST_MTS_TABLE_ID_FCT = 0xA1,
+ GST_MTS_TABLE_ID_TCT = 0xA2,
+ GST_MTS_TABLE_ID_SPT = 0xA3,
+ GST_MTS_TABLE_ID_CMT = 0xA4,
+ GST_MTS_TABLE_ID_TBTP = 0xA5,
+ GST_MTS_TABLE_ID_PCR_PACKET_PAYLOAD = 0xA6,
+ GST_MTS_TABLE_ID_TRANSMISSION_MODE_SUPPORT_PAYLOAD = 0xAA,
+ GST_MTS_TABLE_ID_TIM = 0xB0,
+ GST_MTS_TABLE_ID_LL_FEC_PARITY_DATA_TABLE = 0xB1
+
+} GstMpegtsSectionDVBTableID;
+
+/**
+ * GstMpegtsRunningStatus:
+ *
+ * Running status of a service.
+ *
+ * Corresponds to table 6 of ETSI EN 300 468 (v1.13.0)
+ */
+typedef enum
+{
+ GST_MPEGTS_RUNNING_STATUS_UNDEFINED = 0,
+ GST_MPEGTS_RUNNING_STATUS_NOT_RUNNING,
+ GST_MPEGTS_RUNNING_STATUS_STARTS_IN_FEW_SECONDS,
+ GST_MPEGTS_RUNNING_STATUS_PAUSING,
+ GST_MPEGTS_RUNNING_STATUS_RUNNING,
+ GST_MPEGTS_RUNNING_STATUS_OFF_AIR
+} GstMpegtsRunningStatus;
+
+
+
+/* NIT */
+
+typedef struct _GstMpegtsNITStream GstMpegtsNITStream;
+typedef struct _GstMpegtsNIT GstMpegtsNIT;
+
+#define GST_TYPE_MPEGTS_NIT (gst_mpegts_nit_get_type())
+#define GST_TYPE_MPEGTS_NIT_STREAM (gst_mpegts_nit_stream_get_type())
+
+/**
+ * GstMpegtsNITStream:
+ * @transport_stream_id:
+ * @original_network_id:
+ * @descriptors: (element-type GstMpegtsDescriptor):
+ *
+ */
+struct _GstMpegtsNITStream
+{
+ guint16 transport_stream_id;
+ guint16 original_network_id;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsNIT:
+ * @actual_network: Whether this NIT corresponds to the actual stream
+ * @network_id: ID of the network that this NIT describes
+ * @descriptors: (element-type GstMpegtsDescriptor): the global descriptors
+ * @streams: (element-type GstMpegtsNITStream): the streams
+ *
+ * Network Information Table (ISO/IEC 13818-1 / EN 300 468)
+ *
+ */
+struct _GstMpegtsNIT
+{
+ gboolean actual_network;
+ guint16 network_id;
+
+ GPtrArray *descriptors;
+
+ GPtrArray *streams;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_nit_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_nit_stream_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsNIT *gst_mpegts_section_get_nit (GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_from_nit (GstMpegtsNIT *nit);
+
+GST_MPEGTS_API
+GstMpegtsNIT *gst_mpegts_nit_new (void);
+
+GST_MPEGTS_API
+GstMpegtsNITStream *gst_mpegts_nit_stream_new (void);
+
+
+/* BAT */
+
+typedef struct _GstMpegtsBATStream GstMpegtsBATStream;
+typedef struct _GstMpegtsBAT GstMpegtsBAT;
+
+#define GST_TYPE_MPEGTS_BAT (gst_mpegts_bat_get_type())
+#define GST_TYPE_MPEGTS_BAT_STREAM (gst_mpegts_bat_get_type())
+
+struct _GstMpegtsBATStream
+{
+ guint16 transport_stream_id;
+ guint16 original_network_id;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsBAT:
+ * @descriptors: (element-type GstMpegtsDescriptor):
+ * @streams: (element-type GstMpegtsBATStream):
+ *
+ * DVB Bouquet Association Table (EN 300 468)
+ */
+struct _GstMpegtsBAT
+{
+ GPtrArray *descriptors;
+
+ GPtrArray *streams;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_bat_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_bat_stream_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsBAT *gst_mpegts_section_get_bat (GstMpegtsSection *section);
+
+/* SDT */
+#define GST_TYPE_MPEGTS_SDT (gst_mpegts_sdt_get_type())
+#define GST_TYPE_MPEGTS_SDT_SERVICE (gst_mpegts_sdt_service_get_type())
+
+typedef struct _GstMpegtsSDTService GstMpegtsSDTService;
+typedef struct _GstMpegtsSDT GstMpegtsSDT;
+
+/**
+ * GstMpegtsSDTService:
+ * @service_id: The program number this table belongs to
+ * @EIT_schedule_flag: EIT schedule information is present in this transport stream
+ * @EIT_present_following_flag: EIT present/following information is present in this transport stream
+ * @running_status: Status of this service
+ * @free_CA_mode: True if one or more streams is controlled by a CA system
+ * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
+ *
+ */
+struct _GstMpegtsSDTService
+{
+ guint16 service_id;
+
+ gboolean EIT_schedule_flag;
+ gboolean EIT_present_following_flag;
+ GstMpegtsRunningStatus running_status;
+ gboolean free_CA_mode;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsSDT:
+ * @original_network_id: Network ID of the originating delivery system
+ * @actual_ts: True if the table describes this transport stream
+ * @transport_stream_id: ID of this transport stream
+ * @services: (element-type GstMpegtsSDTService): List of services
+ *
+ * Service Description Table (EN 300 468)
+ *
+ */
+struct _GstMpegtsSDT
+{
+ guint16 original_network_id;
+ gboolean actual_ts;
+ guint16 transport_stream_id;
+
+ GPtrArray *services;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_sdt_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_sdt_service_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsSDT *gst_mpegts_section_get_sdt (GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_from_sdt (GstMpegtsSDT * sdt);
+
+GST_MPEGTS_API
+GstMpegtsSDT *gst_mpegts_sdt_new (void);
+
+GST_MPEGTS_API
+GstMpegtsSDTService *gst_mpegts_sdt_service_new (void);
+
+/* EIT */
+
+#define GST_TYPE_MPEGTS_EIT (gst_mpegts_eit_get_type())
+#define GST_TYPE_MPEGTS_EIT_EVENT (gst_mpegts_eit_event_get_type())
+
+typedef struct _GstMpegtsEITEvent GstMpegtsEITEvent;
+typedef struct _GstMpegtsEIT GstMpegtsEIT;
+
+/**
+ * GstMpegtsEITEvent:
+ * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
+ *
+ * Event from a @GstMpegtsEIT
+ */
+struct _GstMpegtsEITEvent
+{
+ guint16 event_id;
+
+ GstDateTime *start_time;
+ guint32 duration;
+
+ GstMpegtsRunningStatus running_status;
+ gboolean free_CA_mode;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsEIT:
+ * @events: (element-type GstMpegtsEITEvent): List of events
+ *
+ * Event Information Table (EN 300 468)
+ *
+ */
+struct _GstMpegtsEIT
+{
+ guint16 transport_stream_id;
+ guint16 original_network_id;
+ guint8 segment_last_section_number;
+ guint8 last_table_id;
+
+ gboolean actual_stream;
+ gboolean present_following;
+
+ GPtrArray *events;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_eit_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_eit_event_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsEIT *gst_mpegts_section_get_eit (GstMpegtsSection *section);
+
+/* TDT */
+
+GST_MPEGTS_API
+GstDateTime *gst_mpegts_section_get_tdt (GstMpegtsSection *section);
+
+/* TOT */
+
+typedef struct _GstMpegtsTOT GstMpegtsTOT;
+#define GST_TYPE_MPEGTS_TOT (gst_mpegts_tot_get_type())
+/**
+ * GstMpegtsTOT:
+ * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
+ *
+ * Time Offset Table (EN 300 468)
+ *
+ */
+struct _GstMpegtsTOT
+{
+ GstDateTime *utc_time;
+
+ GPtrArray *descriptors;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_tot_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsTOT *gst_mpegts_section_get_tot (GstMpegtsSection *section);
+
+/* SIT */
+
+typedef struct _GstMpegtsSITService GstMpegtsSITService;
+/**
+ * GST_TYPE_MPEGTS_SIT_SERVICE:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_MPEGTS_SIT_SERVICE (gst_mpegts_sit_service_get_type())
+
+typedef struct _GstMpegtsSIT GstMpegtsSIT;
+/**
+ * GST_TYPE_MPEGTS_SIT:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_MPEGTS_SIT (gst_mpegts_sit_get_type())
+
+/**
+ * GstMpegtsSITService:
+ * @service_id: The Program number this table belongs to
+ * @running_status: Status of this service
+ * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
+ *
+ * SIT Service entry
+ *
+ * Since: 1.20
+ */
+struct _GstMpegtsSITService
+{
+ guint16 service_id;
+ GstMpegtsRunningStatus running_status;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsSIT:
+ * @descriptors: (element-type GstMpegtsDescriptor): List of descriptors
+ * @services: (element-type GstMpegtsSITService): List of services
+ *
+ * Selection Information Table (EN 300 468)
+ *
+ * Since: 1.20
+ */
+struct _GstMpegtsSIT
+{
+ GPtrArray *descriptors;
+ GPtrArray *services;
+};
+
+
+GST_MPEGTS_API
+GType gst_mpegts_sit_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_sit_service_get_type (void);
+
+GST_MPEGTS_API
+const GstMpegtsSIT *gst_mpegts_section_get_sit (GstMpegtsSection *section);
+
+
+G_END_DECLS
+
+#endif /* GST_MPEGTS_SECTION_H */
diff --git a/include/gst/mpegts/gst-hdmv-section.h b/include/gst/mpegts/gst-hdmv-section.h
new file mode 100644
index 0000000000..e5356dc5f4
--- /dev/null
+++ b/include/gst/mpegts/gst-hdmv-section.h
@@ -0,0 +1,66 @@
+/*
+ * gst-hdmv-section.h -
+ * Copyright (C) 2020, Centricular ltd
+ *
+ * Authors:
+ * Edward Hervey <edward@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_HDMV_SECTION_H
+#define GST_HDMV_SECTION_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/gstmpegtssection.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION:gst-hdmv-section
+ * @title: HDMV variants of MPEG-TS (Bluray, AVCHD, ...)
+ * @short_description: Stream Types for the various Bluray specifications
+ * @include: gst/mpegts/mpegts.h
+ */
+
+/**
+ * GstMpegtsHdmvStreamType:
+ *
+ * Type of mpeg-ts streams for Blu-ray formats. To be matched with the
+ * stream-type of a #GstMpegtsSection.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_LPCM = 0x80,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_AC3 = 0x81,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_DTS = 0x82,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_AC3_TRUE_HD = 0x83,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_AC3_PLUS = 0x84,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_DTS_HD = 0x85,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_DTS_HD_MASTER_AUDIO = 0x86,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_EAC3 = 0x87,
+ GST_MPEGTS_STREAM_TYPE_HDMV_SUBPICTURE_PGS = 0x90,
+ GST_MPEGTS_STREAM_TYPE_HDMV_IGS = 0x91,
+ GST_MPEGTS_STREAM_TYPE_HDMV_SUBTITLE = 0x92,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_AC3_PLUS_SECONDARY = 0xa1,
+ GST_MPEGTS_STREAM_TYPE_HDMV_AUDIO_DTS_HD_SECONDARY = 0xa2,
+} GstMpegtsHdmvStreamType;
+
+G_END_DECLS
+
+#endif /* GST_HDMV_SECTION_H */
diff --git a/include/gst/mpegts/gst-isdb-descriptor.h b/include/gst/mpegts/gst-isdb-descriptor.h
new file mode 100644
index 0000000000..0206c669c9
--- /dev/null
+++ b/include/gst/mpegts/gst-isdb-descriptor.h
@@ -0,0 +1,89 @@
+/*
+ * gst-isdb-descriptor.h -
+ * Copyright (C) 2020 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_ISDB_DESCRIPTOR_H
+#define GST_ISDB_DESCRIPTOR_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/mpegts-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION:gst-isdb-descriptor
+ * @title: ISDB variants of MPEG-TS descriptors
+ * @short_description: Descriptors for the various ISDB specifications
+ * @include: gst/mpegts/mpegts.h
+ *
+ * This contains the various descriptors defined by the ISDB specifications
+ */
+
+/**
+ * GstMpegtsISDBDescriptorType:
+ *
+ * These values correspond to the registered descriptor type from
+ * the various ISDB specifications.
+ *
+ * Consult the relevant specifications for more details.
+ */
+typedef enum {
+ /* ISDB ARIB B10 v4.6 */
+ GST_MTS_DESC_ISDB_HIERARCHICAL_TRANSMISSION = 0xC0,
+ GST_MTS_DESC_ISDB_DIGITAL_COPY_CONTROL = 0xC1,
+ GST_MTS_DESC_ISDB_NETWORK_IDENTIFICATION = 0xC2,
+ GST_MTS_DESC_ISDB_PARTIAL_TS_TIME = 0xc3,
+ GST_MTS_DESC_ISDB_AUDIO_COMPONENT = 0xc4,
+ GST_MTS_DESC_ISDB_HYPERLINK = 0xc5,
+ GST_MTS_DESC_ISDB_TARGET_REGION = 0xc6,
+ GST_MTS_DESC_ISDB_DATA_CONTENT = 0xc7,
+ GST_MTS_DESC_ISDB_VIDEO_DECODE_CONTROL = 0xc8,
+ GST_MTS_DESC_ISDB_DOWNLOAD_CONTENT = 0xc9,
+ GST_MTS_DESC_ISDB_CA_EMM_TS = 0xca,
+ GST_MTS_DESC_ISDB_CA_CONTRACT_INFORMATION = 0xcb,
+ GST_MTS_DESC_ISDB_CA_SERVICE = 0xcc,
+ GST_MTS_DESC_ISDB_TS_INFORMATION = 0xcd,
+ GST_MTS_DESC_ISDB_EXTENDED_BROADCASTER = 0xce,
+ GST_MTS_DESC_ISDB_LOGO_TRANSMISSION = 0xcf,
+ GST_MTS_DESC_ISDB_BASIC_LOCAL_EVENT = 0xd0,
+ GST_MTS_DESC_ISDB_REFERENCE = 0xd1,
+ GST_MTS_DESC_ISDB_NODE_RELATION = 0xd2,
+ GST_MTS_DESC_ISDB_SHORT_NODE_INFORMATION = 0xd3,
+ GST_MTS_DESC_ISDB_STC_REFERENCE = 0xd4,
+ GST_MTS_DESC_ISDB_SERIES = 0xd5,
+ GST_MTS_DESC_ISDB_EVENT_GROUP = 0xd6,
+ GST_MTS_DESC_ISDB_SI_PARAMETER = 0xd7,
+ GST_MTS_DESC_ISDB_BROADCASTER_NAME = 0xd8,
+ GST_MTS_DESC_ISDB_COMPONENT_GROUP = 0xd9,
+ GST_MTS_DESC_ISDB_SI_PRIME_TS = 0xda,
+ GST_MTS_DESC_ISDB_BOARD_INFORMATION = 0xdb,
+ GST_MTS_DESC_ISDB_LDT_LINKAGE = 0xdc,
+ GST_MTS_DESC_ISDB_CONNECTED_TRANSMISSION = 0xdd,
+ GST_MTS_DESC_ISDB_CONTENT_AVAILABILITY = 0xde,
+ /* ... */
+ GST_MTS_DESC_ISDB_SERVICE_GROUP = 0xe0
+
+} GstMpegtsISDBDescriptorType;
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/mpegts/gst-scte-section.h b/include/gst/mpegts/gst-scte-section.h
new file mode 100644
index 0000000000..bc7f9d4499
--- /dev/null
+++ b/include/gst/mpegts/gst-scte-section.h
@@ -0,0 +1,287 @@
+/*
+ * gst-scte-section.h -
+ * Copyright (C) 2013, CableLabs, Louisville, CO 80027
+ * (c) 2019, Centricular ltd
+ *
+ * Authors:
+ * RUIH Team <ruih@cablelabs.com>
+ * Edward Hervey <edward@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_SCTE_SECTION_H
+#define GST_SCTE_SECTION_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/gstmpegtssection.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstMpegtsScteStreamType:
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING: SCTE-27 Subtitling
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA: SCTE-19 Isochronous data
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_SIT: SCTE-35 Splice Information Table
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT: SCTE-07 Data Service or
+ * Network Resource Table
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB: Type B - DSM-CC Data Carousel
+ * [IEC 13818-6])
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING: Enhanced Television Application
+ * Signaling (OC-SP-ETV-AM1.0.1-120614)
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA: SCTE-07 Synchronous data
+ * @GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA: SCTE-53 Asynchronous data
+ *
+ * Type of mpeg-ts streams for SCTE. Most users would want to use the
+ * #GstMpegtsATSCStreamType instead since it also covers these stream types
+ *
+ */
+typedef enum {
+
+ /* 0x01 - 0x7f : defined in other specs */
+ GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING = 0x82, /* Subtitling data */
+ GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA = 0x83, /* Isochronous data */
+ /* 0x84 - 0x85 : defined in other specs */
+ GST_MPEGTS_STREAM_TYPE_SCTE_SIT = 0x86, /* Splice Information Table */
+ /* 0x87 - 0x94 : defined in other specs */
+ GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT = 0x95, /* DST / NRT data */
+ /* 0x96 - 0xaf : defined in other specs */
+ GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB = 0xb0, /* Data Carousel Type B */
+ /* 0xb1 - 0xbf : User Private (or defined in other specs) */
+ GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING = 0xc0, /* EBIF Signaling */
+ GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA = 0xc2, /* Synchronous data */
+ GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA = 0xc3, /* Asynchronous data */
+ /* 0xc4 - 0xff : User Private (or defined in other specs) */
+
+} GstMpegtsScteStreamType;
+
+
+/**
+ * GstMpegtsSectionSCTETableID:
+ * @GST_MTS_TABLE_ID_SCTE_EAS: SCTE-18 Emergency Alert System
+ * @GST_MTS_TABLE_ID_SCTE_EBIF: CL-SP-ETV-AM 1.0.1 EBIF message
+ * @GST_MTS_TABLE_ID_SCTE_EISS: CL-SP-ETV-AM 1.0.1 EBIF Int. Signaling Sect.
+ * @GST_MTS_TABLE_ID_SCTE_DII: CL-SP-ETV-AM 1.0.1 DSMCC DII message
+ * @GST_MTS_TABLE_ID_SCTE_DDB: CL-SP-ETV-AM 1.0.1 DSMCC Data Download Block
+ * @GST_MTS_TABLE_ID_SCTE_SPLICE: SCTE-35 splice information is carried in a
+ * section stream on a separate PID in the program’s Map Table (PMT) allowing
+ * Splice Event notifications to remain associated with the program and pass
+ * through multiplexers.
+ *
+ * Values for a #GstMpegtsSection table_id.
+ *
+ * These are the registered SCTE table_id variants.
+ *
+ * see also: #GstMpegtsSectionTableID
+ */
+typedef enum {
+
+ /* 0x01 - 0xd7 : defined in other specs */
+ GST_MTS_TABLE_ID_SCTE_EAS = 0xd8, /* emergency alert information */
+ /* 0xd8 - 0xdf : defined in other specs */
+ GST_MTS_TABLE_ID_SCTE_EBIF = 0xE0, /* EBIF message */
+ GST_MTS_TABLE_ID_SCTE_RESERVED = 0xE1,
+ GST_MTS_TABLE_ID_SCTE_EISS = 0xE2, /* EBIF Int. Signaling Sect. */
+ GST_MTS_TABLE_ID_SCTE_DII = 0xE3, /* DSMCC DII message */
+ GST_MTS_TABLE_ID_SCTE_DDB = 0xE4, /* DSMCC Data Download Block */
+ /* 0xe5 - 0xfb : defined in other specs */
+ GST_MTS_TABLE_ID_SCTE_SPLICE = 0xfc, /* splice information table */
+
+} GstMpegtsSectionSCTETableID;
+
+#define GST_MPEGTS_TYPE_SCTE_SPLICE_COMPONENT (gst_mpegts_scte_splice_component_get_type())
+typedef struct _GstMpegtsSCTESpliceComponent GstMpegtsSCTESpliceComponent;
+
+/**
+ * GstMpegtsSCTESpliceComponent:
+ * @tag: the elementary PID stream containing the Splice Point
+ * @splice_time_specified: Whether @splice_time was specified
+ * @splice_time: the presentation time of the signaled splice event
+ * @utc_splice_time: The UTC time of the signaled splice event
+ *
+ * Per-PID splice information.
+ *
+ * Since: 1.20
+ */
+struct _GstMpegtsSCTESpliceComponent {
+ guint8 tag;
+
+ gboolean splice_time_specified; /* Only valid for insert_event */
+ guint64 splice_time; /* Only valid for insert_event */
+
+ guint32 utc_splice_time; /* Only valid for !insert_event (schedule) */
+};
+
+/* Splice Information Table (SIT) */
+#define GST_TYPE_MPEGTS_SCTE_SPLICE_EVENT (gst_mpegts_scte_splice_event_get_type())
+typedef struct _GstMpegtsSCTESpliceEvent GstMpegtsSCTESpliceEvent;
+
+struct _GstMpegtsSCTESpliceEvent {
+ /* TRUE if from/to an insert event (else belongs to a schedule event) */
+ gboolean insert_event;
+
+ guint32 splice_event_id;
+ gboolean splice_event_cancel_indicator;
+
+ /* If splice_event_cancel_indicator == 0 */
+ gboolean out_of_network_indicator;
+ gboolean program_splice_flag;
+ gboolean duration_flag;
+
+ gboolean splice_immediate_flag; /* Only valid for insert_event */
+
+ gboolean program_splice_time_specified; /* Only valid for insert_event && program_splice */
+ guint64 program_splice_time; /* Only valid for insert_event && program_splice */
+
+ /**
+ * GstMpegtsSCTESpliceEvent.utc_splice_time:
+ *
+ * The UTC time of the signaled splice event
+ *
+ * Since: 1.20
+ */
+ guint32 utc_splice_time; /* Only valid for !insert_event (schedule) && program_splice */
+
+ /**
+ * GstMpegtsSCTESpliceEvent.components:
+ *
+ * Per-PID splice time information
+ *
+ * Since: 1.20
+ */
+ GPtrArray *components; /* Only valid for !program_splice */
+
+ gboolean break_duration_auto_return;
+ guint64 break_duration;
+
+ guint16 unique_program_id;
+ guint8 avail_num;
+ guint8 avails_expected;
+
+};
+
+/*
+ * Types of descriptors
+ *
+ * Note: These are only for the descriptors *WITHIN* a SIT */
+typedef enum {
+ GST_MTS_SCTE_DESC_AVAIL = 0x00,
+ GST_MTS_SCTE_DESC_DTMF = 0x01,
+ GST_MTS_SCTE_DESC_SEGMENTATION = 0x02,
+ GST_MTS_SCTE_DESC_TIME = 0x03,
+ GST_MTS_SCTE_DESC_AUDIO = 0x04
+} GstMpegtsSCTESpliceDescriptor;
+
+typedef enum {
+ GST_MTS_SCTE_SPLICE_COMMAND_NULL = 0x00,
+ GST_MTS_SCTE_SPLICE_COMMAND_SCHEDULE = 0x04,
+ GST_MTS_SCTE_SPLICE_COMMAND_INSERT = 0x05,
+ GST_MTS_SCTE_SPLICE_COMMAND_TIME = 0x06,
+ GST_MTS_SCTE_SPLICE_COMMAND_BANDWIDTH = 0x07,
+ GST_MTS_SCTE_SPLICE_COMMAND_PRIVATE = 0xff
+} GstMpegtsSCTESpliceCommandType;
+
+#define GST_TYPE_MPEGTS_SCTE_SIT (gst_mpegts_scte_sit_get_type())
+
+typedef struct _GstMpegtsSCTESIT GstMpegtsSCTESIT;
+
+struct _GstMpegtsSCTESIT
+{
+ gboolean encrypted_packet;
+ guint8 encryption_algorithm;
+
+ guint64 pts_adjustment;
+ guint8 cw_index;
+ guint16 tier;
+
+ guint16 splice_command_length;
+
+ GstMpegtsSCTESpliceCommandType splice_command_type;
+
+ /* For time_signal commands */
+ gboolean splice_time_specified;
+ guint64 splice_time;
+
+ GPtrArray *splices;
+
+ GPtrArray *descriptors;
+
+ /**
+ * GstMpegtsSCTESIT.fully_parsed:
+ *
+ * When encrypted, or when encountering an unknown command type,
+ * we may still want to pass the sit through.
+ *
+ * Since: 1.20
+ */
+ gboolean fully_parsed;
+
+ /**
+ * GstMpegtsSCTESIT.is_running_time:
+ *
+ * When the SIT was constructed by the application, splice times
+ * are in running_time and must be translated before packetizing.
+ *
+ * Since: 1.20
+ */
+ gboolean is_running_time;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_sit_get_type (void);
+
+GST_MPEGTS_API
+GstMpegtsSCTESIT *gst_mpegts_scte_sit_new (void);
+
+GST_MPEGTS_API
+GstMpegtsSCTESIT *gst_mpegts_scte_null_new (void);
+
+GST_MPEGTS_API
+GstMpegtsSCTESIT *gst_mpegts_scte_cancel_new (guint32 event_id);
+
+GST_MPEGTS_API
+GstMpegtsSCTESIT *gst_mpegts_scte_splice_in_new (guint32 event_id,
+ GstClockTime splice_time);
+
+GST_MPEGTS_API
+GstMpegtsSCTESIT *gst_mpegts_scte_splice_out_new (guint32 event_id,
+ GstClockTime splice_time,
+ GstClockTime duration);
+
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_splice_event_get_type (void);
+
+GST_MPEGTS_API
+GstMpegtsSCTESpliceEvent *gst_mpegts_scte_splice_event_new (void);
+
+GST_MPEGTS_API
+const GstMpegtsSCTESIT *gst_mpegts_section_get_scte_sit (GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_from_scte_sit (GstMpegtsSCTESIT * sit, guint16 pid);
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_splice_component_get_type (void);
+
+GST_MPEGTS_API
+GstMpegtsSCTESpliceComponent *gst_mpegts_scte_splice_component_new (guint8 tag);
+
+
+G_END_DECLS
+
+#endif /* GST_SCTE_SECTION_H */
diff --git a/include/gst/mpegts/gstmpegts-enumtypes.h b/include/gst/mpegts/gstmpegts-enumtypes.h
new file mode 100644
index 0000000000..ef7cb04569
--- /dev/null
+++ b/include/gst/mpegts/gstmpegts-enumtypes.h
@@ -0,0 +1,180 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/mpegts/mpegts-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gst-atsc-descriptor.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_ATSC_DESCRIPTOR_TYPE (gst_mpegts_atsc_descriptor_type_get_type())
+
+/* enumerations from "gst-atsc-section.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_section_atsc_table_id_get_type (void);
+#define GST_TYPE_MPEGTS_SECTION_ATSC_TABLE_ID (gst_mpegts_section_atsc_table_id_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_stream_type_get_type (void);
+#define GST_TYPE_MPEGTS_ATSC_STREAM_TYPE (gst_mpegts_atsc_stream_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_atsc_mgt_table_type_get_type (void);
+#define GST_TYPE_MPEGTS_ATSC_MGT_TABLE_TYPE (gst_mpegts_atsc_mgt_table_type_get_type())
+
+/* enumerations from "gst-dvb-descriptor.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_DESCRIPTOR_TYPE (gst_mpegts_dvb_descriptor_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_extended_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_EXTENDED_DESCRIPTOR_TYPE (gst_mpegts_dvb_extended_descriptor_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_modulation_type_get_type (void);
+#define GST_TYPE_MPEGTS_MODULATION_TYPE (gst_mpegts_modulation_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_code_rate_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_CODE_RATE (gst_mpegts_dvb_code_rate_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_satellite_rolloff_get_type (void);
+#define GST_TYPE_MPEGTS_SATELLITE_ROLLOFF (gst_mpegts_satellite_rolloff_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_satellite_polarization_type_get_type (void);
+#define GST_TYPE_MPEGTS_SATELLITE_POLARIZATION_TYPE (gst_mpegts_satellite_polarization_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_cable_outer_fec_scheme_get_type (void);
+#define GST_TYPE_MPEGTS_CABLE_OUTER_FEC_SCHEME (gst_mpegts_cable_outer_fec_scheme_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_service_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_SERVICE_TYPE (gst_mpegts_dvb_service_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_TYPE (gst_mpegts_dvb_linkage_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_linkage_hand_over_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_LINKAGE_HAND_OVER_TYPE (gst_mpegts_dvb_linkage_hand_over_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_component_stream_content_get_type (void);
+#define GST_TYPE_MPEGTS_COMPONENT_STREAM_CONTENT (gst_mpegts_component_stream_content_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_content_nibble_hi_get_type (void);
+#define GST_TYPE_MPEGTS_CONTENT_NIBBLE_HI (gst_mpegts_content_nibble_hi_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_teletext_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_TELETEXT_TYPE (gst_mpegts_dvb_teletext_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_terrestrial_transmission_mode_get_type (void);
+#define GST_TYPE_MPEGTS_TERRESTRIAL_TRANSMISSION_MODE (gst_mpegts_terrestrial_transmission_mode_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_terrestrial_guard_interval_get_type (void);
+#define GST_TYPE_MPEGTS_TERRESTRIAL_GUARD_INTERVAL (gst_mpegts_terrestrial_guard_interval_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_terrestrial_hierarchy_get_type (void);
+#define GST_TYPE_MPEGTS_TERRESTRIAL_HIERARCHY (gst_mpegts_terrestrial_hierarchy_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_dvb_scrambling_mode_type_get_type (void);
+#define GST_TYPE_MPEGTS_DVB_SCRAMBLING_MODE_TYPE (gst_mpegts_dvb_scrambling_mode_type_get_type())
+
+/* enumerations from "gst-dvb-section.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_section_dvb_table_id_get_type (void);
+#define GST_TYPE_MPEGTS_SECTION_DVB_TABLE_ID (gst_mpegts_section_dvb_table_id_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_running_status_get_type (void);
+#define GST_TYPE_MPEGTS_RUNNING_STATUS (gst_mpegts_running_status_get_type())
+
+/* enumerations from "gst-hdmv-section.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_hdmv_stream_type_get_type (void);
+#define GST_TYPE_MPEGTS_HDMV_STREAM_TYPE (gst_mpegts_hdmv_stream_type_get_type())
+
+/* enumerations from "gst-isdb-descriptor.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_isdb_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_ISDB_DESCRIPTOR_TYPE (gst_mpegts_isdb_descriptor_type_get_type())
+
+/* enumerations from "gst-scte-section.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_stream_type_get_type (void);
+#define GST_TYPE_MPEGTS_SCTE_STREAM_TYPE (gst_mpegts_scte_stream_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_section_scte_table_id_get_type (void);
+#define GST_TYPE_MPEGTS_SECTION_SCTE_TABLE_ID (gst_mpegts_section_scte_table_id_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_splice_descriptor_get_type (void);
+#define GST_TYPE_MPEGTS_SCTE_SPLICE_DESCRIPTOR (gst_mpegts_scte_splice_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_splice_command_type_get_type (void);
+#define GST_TYPE_MPEGTS_SCTE_SPLICE_COMMAND_TYPE (gst_mpegts_scte_splice_command_type_get_type())
+
+/* enumerations from "gstmpegtsdescriptor.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_DESCRIPTOR_TYPE (gst_mpegts_descriptor_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_misc_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_MISC_DESCRIPTOR_TYPE (gst_mpegts_misc_descriptor_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_scte_descriptor_type_get_type (void);
+#define GST_TYPE_MPEGTS_SCTE_DESCRIPTOR_TYPE (gst_mpegts_scte_descriptor_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_registration_id_get_type (void);
+#define GST_TYPE_MPEGTS_REGISTRATION_ID (gst_mpegts_registration_id_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_iso639_audio_type_get_type (void);
+#define GST_TYPE_MPEGTS_ISO639_AUDIO_TYPE (gst_mpegts_iso639_audio_type_get_type())
+
+/* enumerations from "gstmpegtssection.h" */
+
+GST_MPEGTS_API
+GType gst_mpegts_section_type_get_type (void);
+#define GST_TYPE_MPEGTS_SECTION_TYPE (gst_mpegts_section_type_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_section_table_id_get_type (void);
+#define GST_TYPE_MPEGTS_SECTION_TABLE_ID (gst_mpegts_section_table_id_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_stream_type_get_type (void);
+#define GST_TYPE_MPEGTS_STREAM_TYPE (gst_mpegts_stream_type_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/mpegts/gstmpegtsdescriptor.h b/include/gst/mpegts/gstmpegtsdescriptor.h
new file mode 100644
index 0000000000..3e4d95d6c4
--- /dev/null
+++ b/include/gst/mpegts/gstmpegtsdescriptor.h
@@ -0,0 +1,393 @@
+/*
+ * gstmpegtsdescriptor.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Some parts of this code come from the Fluendo MPEG Demuxer plugin.
+ *
+ * The Initial Developer of the Original Code is Fluendo, S.L.
+ * Portions created by Fluendo, S.L. are Copyright (C) 2005
+ * Fluendo, S.L. All Rights Reserved.
+ *
+ * Contributor(s): Wim Taymans <wim@fluendo.com>
+ */
+
+#ifndef GST_MPEGTS_DESCRIPTOR_H
+#define GST_MPEGTS_DESCRIPTOR_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/mpegts-prelude.h>
+
+G_BEGIN_DECLS
+
+/*
+ * descriptor_tag TS PS Identification
+ * 0 n/a n/a Reserved
+ * 1 n/a n/a Reserved
+ * 2 X X video_stream_descriptor
+ * 3 X X audio_stream_descriptor
+ * 4 X X hierarchy_descriptor
+ * 5 X X registration_descriptor
+ * 6 X X data_stream_alignment_descriptor
+ * 7 X X target_background_grid_descriptor
+ * 8 X X video_window_descriptor
+ * 9 X X CA_descriptor
+ * 10 X X ISO_639_language_descriptor
+ * 11 X X system_clock_descriptor
+ * 12 X X multiplex_buffer_utilization_descriptor
+ * 13 X X copyright_descriptor
+ * 14 X maximum bitrate descriptor
+ * 15 X X private data indicator descriptor
+ * 16 X X smoothing buffer descriptor
+ * 17 X STD_descriptor
+ * 18 X X IBP descriptor
+ * 19-63 n/a n/a ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
+ * 64-255 n/a n/a User Private
+ */
+
+/**
+ * GstMpegtsDescriptorType:
+ *
+ * The type of #GstMpegtsDescriptor
+ *
+ * These values correspond to the registered descriptor type from
+ * the base MPEG-TS specifications (ITU H.222.0 | ISO/IEC 13818-1).
+ *
+ * Consult the relevant specifications for more details.
+ */
+typedef enum {
+ /* 0-18 ISO/IEC 13818-1 (H222.0 06/2012) */
+ GST_MTS_DESC_RESERVED_00 = 0x00,
+ GST_MTS_DESC_RESERVED_01 = 0x01,
+ GST_MTS_DESC_VIDEO_STREAM = 0x02,
+ GST_MTS_DESC_AUDIO_STREAM = 0x03,
+ GST_MTS_DESC_HIERARCHY = 0x04,
+ GST_MTS_DESC_REGISTRATION = 0x05,
+ GST_MTS_DESC_DATA_STREAM_ALIGNMENT = 0x06,
+ GST_MTS_DESC_TARGET_BACKGROUND_GRID = 0x07,
+ GST_MTS_DESC_VIDEO_WINDOW = 0x08,
+ GST_MTS_DESC_CA = 0x09,
+ GST_MTS_DESC_ISO_639_LANGUAGE = 0x0A,
+ GST_MTS_DESC_SYSTEM_CLOCK = 0x0B,
+ GST_MTS_DESC_MULTIPLEX_BUFFER_UTILISATION = 0x0C,
+ GST_MTS_DESC_COPYRIGHT = 0x0D,
+ GST_MTS_DESC_MAXIMUM_BITRATE = 0x0E,
+ GST_MTS_DESC_PRIVATE_DATA_INDICATOR = 0x0F,
+ GST_MTS_DESC_SMOOTHING_BUFFER = 0x10,
+ GST_MTS_DESC_STD = 0x11,
+ GST_MTS_DESC_IBP = 0x12,
+
+ /* 19-26 Defined in ISO/IEC 13818-6 (Extensions for DSM-CC) */
+ GST_MTS_DESC_DSMCC_CAROUSEL_IDENTIFIER = 0x13,
+ GST_MTS_DESC_DSMCC_ASSOCIATION_TAG = 0x14,
+ GST_MTS_DESC_DSMCC_DEFERRED_ASSOCIATION_TAG = 0x15,
+ /* 0x16 is reserved (so far) */
+ GST_MTS_DESC_DSMCC_NPT_REFERENCE = 0x17,
+ GST_MTS_DESC_DSMCC_NPT_ENDPOINT = 0x18,
+ GST_MTS_DESC_DSMCC_STREAM_MODE = 0x19,
+ GST_MTS_DESC_DSMCC_STREAM_EVENT = 0x1A,
+
+ /* 27-54 Later additions to ISO/IEC 13818-1 (H222.0 06/2012) */
+ GST_MTS_DESC_MPEG4_VIDEO = 0x1B,
+ GST_MTS_DESC_MPEG4_AUDIO = 0x1C,
+ GST_MTS_DESC_IOD = 0x1D,
+ GST_MTS_DESC_SL = 0x1E,
+ GST_MTS_DESC_FMC = 0x1F,
+ GST_MTS_DESC_EXTERNAL_ES_ID = 0x20,
+ GST_MTS_DESC_MUX_CODE = 0x21,
+ GST_MTS_DESC_FMX_BUFFER_SIZE = 0x22,
+ GST_MTS_DESC_MULTIPLEX_BUFFER = 0x23,
+ GST_MTS_DESC_CONTENT_LABELING = 0x24,
+ GST_MTS_DESC_METADATA_POINTER = 0x25,
+ GST_MTS_DESC_METADATA = 0x26,
+ GST_MTS_DESC_METADATA_STD = 0x27,
+ GST_MTS_DESC_AVC_VIDEO = 0x28,
+ /* defined in ISO/IEC 13818-11, MPEG-2 IPMP */
+ GST_MTS_DESC_IPMP = 0x29,
+ GST_MTS_DESC_AVC_TIMING_AND_HRD = 0x2A,
+ GST_MTS_DESC_MPEG2_AAC_AUDIO = 0x2B,
+ GST_MTS_DESC_FLEX_MUX_TIMING = 0x2C,
+ GST_MTS_DESC_MPEG4_TEXT = 0x2D,
+ GST_MTS_DESC_MPEG4_AUDIO_EXTENSION = 0x2E,
+ GST_MTS_DESC_AUXILIARY_VIDEO_STREAM = 0x2F,
+ GST_MTS_DESC_SVC_EXTENSION = 0x30,
+ GST_MTS_DESC_MVC_EXTENSION = 0x31,
+ GST_MTS_DESC_J2K_VIDEO = 0x32,
+ GST_MTS_DESC_MVC_OPERATION_POINT = 0x33,
+ GST_MTS_DESC_MPEG2_STEREOSCOPIC_VIDEO_FORMAT = 0x34,
+ GST_MTS_DESC_STEREOSCOPIC_PROGRAM_INFO = 0x35,
+ GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO = 0x36,
+
+ /* 55-63 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved */
+} GstMpegtsDescriptorType;
+
+/**
+ * GstMpegtsMiscDescriptorType:
+ *
+ * The type of #GstMpegtsDescriptor
+ *
+ * These values correspond to miscellaneous descriptor types that are
+ * not yet identified from known specifications.
+ */
+typedef enum {
+ /* 0x80 - 0xFE are user defined */
+ GST_MTS_DESC_DTG_LOGICAL_CHANNEL = 0x83, /* from DTG D-Book, only present in NIT */
+} GstMpegtsMiscDescriptorType;
+
+/**
+ * GstMpegtsSCTEDescriptorType:
+ *
+ * These values correspond to the ones defined by SCTE (amongst other in ANSI/SCTE 57)
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_MTS_DESC_SCTE_STUFFING = 0x80,
+ GST_MTS_DESC_SCTE_AC3 = 0x81,
+ GST_MTS_DESC_SCTE_FRAME_RATE = 0x82,
+ GST_MTS_DESC_SCTE_EXTENDED_VIDEO = 0x83,
+ GST_MTS_DESC_SCTE_COMPONENT_NAME = 0x84,
+ GST_MTS_DESC_SCTE_FREQUENCY_SPEC = 0x90,
+ GST_MTS_DESC_SCTE_MODULATION_PARAMS = 0x91,
+ GST_MTS_DESC_SCTE_TRANSPORT_STREAM_ID = 0x92
+} GstMpegtsSCTEDescriptorType;
+
+
+
+typedef struct _GstMpegtsDescriptor GstMpegtsDescriptor;
+
+#define GST_TYPE_MPEGTS_DESCRIPTOR (gst_mpegts_descriptor_get_type())
+GST_MPEGTS_API
+GType gst_mpegts_descriptor_get_type (void);
+
+/**
+ * GstMpegtsDescriptor:
+ * @tag: the type of descriptor
+ * @tag_extension: the extended type (if @descriptor_tag is 0x7f)
+ * @length: the length of the descriptor content (excluding tag/length field)
+ * @data: the full descriptor data (including tag, extension, length). The first
+ * two bytes are the @tag and @length.
+ *
+ * Mpeg-TS descriptor (ISO/IEC 13818-1).
+ */
+struct _GstMpegtsDescriptor
+{
+ guint8 tag;
+ guint8 tag_extension;
+ guint8 length;
+ guint8 *data;
+
+ /*< private >*/
+ /* Padding for future extension */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_MPEGTS_API
+void gst_mpegts_descriptor_free (GstMpegtsDescriptor *desc);
+
+GST_MPEGTS_API
+GPtrArray *gst_mpegts_parse_descriptors (guint8 * buffer, gsize buf_len);
+
+GST_MPEGTS_API
+const GstMpegtsDescriptor * gst_mpegts_find_descriptor (GPtrArray *descriptors,
+ guint8 tag);
+
+GST_MPEGTS_API
+const GstMpegtsDescriptor * gst_mpegts_find_descriptor_with_extension (GPtrArray *descriptors,
+ guint8 tag, guint8 tag_extension);
+/**
+ * GstMpegtsRegistrationId:
+ * @GST_MTS_REGISTRATION_0: Undefined registration id
+ * @GST_MTS_REGISTRATION_AC_3: Audio AC-3, ATSC A/52
+ * @GST_MTS_REGISTRATION_AC_4: Audio AC-4, ETSI 103 190-2
+ * @GST_MTS_REGISTRATION_CUEI: SCTE 35, "Digital Program Insertion Cueing Message"
+ * @GST_MTS_REGISTRATION_drac: Dirac Video codec
+ * @GST_MTS_REGISTRATION_DTS1: DTS Audio
+ * @GST_MTS_REGISTRATION_DTS2: DTS Audio
+ * @GST_MTS_REGISTRATION_DTS3: DTS Audio
+ * @GST_MTS_REGISTRATION_EAC3: Enhanced AC-3 (i.e. EAC3)
+ * @GST_MTS_REGISTRATION_ETV1: Cablelabs ETV
+ * @GST_MTS_REGISTRATION_BSSD: SMPTE 302M, Mapping of AES3 Data in mpeg-ts
+ * @GST_MTS_REGISTRATION_GA94: ATSC A/53 compliant stream (i.e. ATSC)
+ * @GST_MTS_REGISTRATION_HDMV: Blu-ray, "System Description Blu-ray Disc
+ * Read-Only Format part 3 Audio Visual Basic Specifications"
+ * @GST_MTS_REGISTRATION_KLVA: SMPTE RP217 : Non-synchronized Mapping of KLV
+ * Packets in mpeg-ts
+ * @GST_MTS_REGISTRATION_OPUS: Opus Audio
+ * @GST_MTS_REGISTRATION_TSHV: HDV (Sony)
+ * @GST_MTS_REGISTRATION_VC_1: Video VC-1, SMPTE RP227 "VC-1 Bitstream Transport Encodings"
+ * @GST_MTS_REGISTRATION_OTHER_HEVC: HEVC / h265
+ *
+ * Well-known registration ids, expressed as native-endian 32bit integers. These
+ * are used in descriptors of type %GST_MTS_DESC_REGISTRATION. Unless specified
+ * otherwise (by use of the "OTHER" prefix), they are all registered by the
+ * [SMPTE Registration Authority](https://smpte-ra.org/) or specified in
+ * "official" documentation for the given format.
+ *
+ * Since: 1.20
+ */
+
+/**
+ * REG_TO_UINT32: (skip) (attributes doc.skip=true)
+ */
+#define REG_TO_UINT32(a,b,c,d)((a) << 24 | (b) << 16 | (c) << 8 | (d))
+
+typedef enum {
+ GST_MTS_REGISTRATION_0 = 0,
+
+ /* SMPTE-RA registered */
+ GST_MTS_REGISTRATION_AC_3 = REG_TO_UINT32 ('A', 'C', '-', '3'),
+ GST_MTS_REGISTRATION_CUEI = REG_TO_UINT32 ('C', 'U', 'E', 'I'),
+ GST_MTS_REGISTRATION_drac = REG_TO_UINT32 ('d', 'r', 'a', 'c'),
+ GST_MTS_REGISTRATION_DTS1 = REG_TO_UINT32 ('D', 'T', 'S', '1'),
+ GST_MTS_REGISTRATION_DTS2 = REG_TO_UINT32 ('D', 'T', 'S', '2'),
+ GST_MTS_REGISTRATION_DTS3 = REG_TO_UINT32 ('D', 'T', 'S', '3'),
+ GST_MTS_REGISTRATION_BSSD = REG_TO_UINT32 ('B', 'S', 'S', 'D'),
+ GST_MTS_REGISTRATION_EAC3 = REG_TO_UINT32 ('E', 'A', 'C', '3'),
+ GST_MTS_REGISTRATION_ETV1 = REG_TO_UINT32 ('E', 'T', 'V', '1'),
+ GST_MTS_REGISTRATION_GA94 = REG_TO_UINT32 ('G', 'A', '9', '4'),
+ GST_MTS_REGISTRATION_HDMV = REG_TO_UINT32 ('H', 'D', 'M', 'V'),
+ GST_MTS_REGISTRATION_KLVA = REG_TO_UINT32 ('K', 'L', 'V', 'A'),
+ GST_MTS_REGISTRATION_OPUS = REG_TO_UINT32 ('O', 'P', 'U', 'S'),
+ GST_MTS_REGISTRATION_TSHV = REG_TO_UINT32 ('T', 'S', 'H', 'V'),
+ GST_MTS_REGISTRATION_VC_1 = REG_TO_UINT32 ('V', 'C', '-', '1'),
+
+ /* Self-registered by formats, but not in SMPTE-RA registry */
+ GST_MTS_REGISTRATION_AC_4 = REG_TO_UINT32 ('A', 'C', '-', '4'),
+
+ /* Found elsewhere */
+ GST_MTS_REGISTRATION_OTHER_HEVC = REG_TO_UINT32 ('H', 'E', 'V', 'C')
+} GstMpegtsRegistrationId;
+
+/* GST_MTS_DESC_REGISTRATION (0x05) */
+
+GST_MPEGTS_API
+GstMpegtsDescriptor *gst_mpegts_descriptor_from_registration (
+ const gchar *format_identifier,
+ guint8 *additional_info, gsize additional_info_length);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_registration(GstMpegtsDescriptor *descriptor,
+ guint32 *registration_id,
+ guint8 **additional_info,
+ gsize *additional_info_length);
+
+/* GST_MTS_DESC_CA (0x09) */
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_ca (GstMpegtsDescriptor *descriptor,
+ guint16 *ca_system_id,
+ guint16 *ca_pid,
+ const guint8 **private_data,
+ gsize *private_data_size);
+
+/* GST_MTS_DESC_ISO_639_LANGUAGE (0x0A) */
+/**
+ * GstMpegtsISO639AudioType:
+ *
+ * Type of audio streams
+ *
+ * Defined in ITU H.222.0 Table 2-60
+ */
+typedef enum {
+ GST_MPEGTS_AUDIO_TYPE_UNDEFINED = 0,
+ GST_MPEGTS_AUDIO_TYPE_CLEAN_EFFECTS,
+ GST_MPEGTS_AUDIO_TYPE_HEARING_IMPAIRED,
+ GST_MPEGTS_AUDIO_TYPE_VISUAL_IMPAIRED_COMMENTARY
+} GstMpegtsIso639AudioType;
+
+typedef struct _GstMpegtsISO639LanguageDescriptor GstMpegtsISO639LanguageDescriptor;
+struct _GstMpegtsISO639LanguageDescriptor
+{
+ guint nb_language;
+ gchar *language[64];
+ GstMpegtsIso639AudioType audio_type[64];
+};
+
+#define GST_TYPE_MPEGTS_ISO_639_LANGUAGE (gst_mpegts_iso_639_language_get_type ())
+GST_MPEGTS_API
+GType gst_mpegts_iso_639_language_get_type (void);
+
+GST_MPEGTS_API
+void gst_mpegts_iso_639_language_descriptor_free (GstMpegtsISO639LanguageDescriptor * desc);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_iso_639_language (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsISO639LanguageDescriptor **res);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegtsDescriptor *descriptor,
+ guint idx, gchar **lang,
+ GstMpegtsIso639AudioType *audio_type);
+
+GST_MPEGTS_API
+guint gst_mpegts_descriptor_parse_iso_639_language_nb (const GstMpegtsDescriptor *descriptor);
+
+GST_MPEGTS_API
+GstMpegtsDescriptor * gst_mpegts_descriptor_from_iso_639_language (const gchar * language);
+
+
+
+/* GST_MTS_DESC_DTG_LOGICAL_CHANNEL (0x83) */
+typedef struct _GstMpegtsLogicalChannelDescriptor GstMpegtsLogicalChannelDescriptor;
+typedef struct _GstMpegtsLogicalChannel GstMpegtsLogicalChannel;
+
+struct _GstMpegtsLogicalChannel
+{
+ guint16 service_id;
+ gboolean visible_service;
+ guint16 logical_channel_number;
+};
+
+struct _GstMpegtsLogicalChannelDescriptor
+{
+ guint nb_channels;
+ GstMpegtsLogicalChannel channels[64];
+};
+
+#define GST_TYPE_MPEGTS_LOGICAL_CHANNEL_DESCRIPTOR (gst_mpegts_logical_channel_descriptor_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_logical_channel_descriptor_get_type(void);
+
+#define GST_TYPE_MPEGTS_LOGICAL_CHANNEL (gst_mpegts_logical_channel_get_type())
+
+GST_MPEGTS_API
+GType gst_mpegts_logical_channel_get_type(void);
+
+/* FIXME : Maybe make two methods. One for getting the number of channels,
+ * and the other for getting the content for one channel ? */
+GST_MPEGTS_API
+gboolean
+gst_mpegts_descriptor_parse_logical_channel (const GstMpegtsDescriptor *descriptor,
+ GstMpegtsLogicalChannelDescriptor *res);
+
+GST_MPEGTS_API
+GstMpegtsDescriptor *
+gst_mpegts_descriptor_from_custom (guint8 tag, const guint8 *data, gsize length);
+
+
+GST_MPEGTS_API
+GstMpegtsDescriptor *
+gst_mpegts_descriptor_from_custom_with_extension (guint8 tag, guint8 tag_extension, const guint8 *data, gsize length);
+
+G_END_DECLS
+
+#endif /* GST_MPEGTS_DESCRIPTOR_H */
diff --git a/include/gst/mpegts/gstmpegtssection.h b/include/gst/mpegts/gstmpegtssection.h
new file mode 100644
index 0000000000..b40c84f13b
--- /dev/null
+++ b/include/gst/mpegts/gstmpegtssection.h
@@ -0,0 +1,508 @@
+/*
+ * mpegtspacketizer.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_MPEGTS_SECTION_H
+#define GST_MPEGTS_SECTION_H
+
+#include <gst/gst.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpegtsSection GstMpegtsSection;
+
+#define GST_TYPE_MPEGTS_SECTION (gst_mpegts_section_get_type())
+#define GST_MPEGTS_SECTION(section) ((GstMpegtsSection*) section)
+
+#define GST_MPEGTS_SECTION_TYPE(section) (GST_MPEGTS_SECTION (section)->section_type)
+
+GST_MPEGTS_API
+GType gst_mpegts_section_get_type (void);
+
+/**
+ * GstMpegtsSectionType:
+ * @GST_MPEGTS_SECTION_UNKNOWN: Unknown section type
+ * @GST_MPEGTS_SECTION_PAT: Program Association Table (ISO/IEC 13818-1)
+ * @GST_MPEGTS_SECTION_PMT: Program Map Table (ISO/IEC 13818-1)
+ * @GST_MPEGTS_SECTION_CAT: Conditional Access Table (ISO/IEC 13818-1)
+ * @GST_MPEGTS_SECTION_TSDT: Transport Stream Description Table (ISO/IEC 13818-1)
+ * @GST_MPEGTS_SECTION_EIT: Event Information Table (EN 300 468)
+ * @GST_MPEGTS_SECTION_NIT: Network Information Table (ISO/IEC 13818-1 / EN 300 468)
+ * @GST_MPEGTS_SECTION_BAT: Bouquet Association Table ((EN 300 468)
+ * @GST_MPEGTS_SECTION_SDT: Service Description Table (EN 300 468)
+ * @GST_MPEGTS_SECTION_TDT: Time and Date Table (EN 300 468)
+ * @GST_MPEGTS_SECTION_TOT: Time Offset Table (EN 300 468)
+ * @GST_MPEGTS_SECTION_ATSC_TVCT: ATSC Terrestrial Virtual Channel Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_CVCT: ATSC Cable Virtual Channel Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_MGT: ATSC Master Guide Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_ETT: ATSC Extended Text Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_EIT: ATSC Event Information Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_STT: ATSC System Time Table (A65)
+ * @GST_MPEGTS_SECTION_ATSC_RRT: ATSC Rating Region Table (A65)
+ * @GST_MPEGTS_SECTION_SCTE_SIT: SCTE Splice Information Table (SCTE-35)
+ *
+ * Types of #GstMpegtsSection that the library handles. This covers all the
+ * MPEG-TS and derivate specification that the library can properly identify and
+ * use.
+ */
+typedef enum {
+ GST_MPEGTS_SECTION_UNKNOWN = 0,
+ GST_MPEGTS_SECTION_PAT,
+ GST_MPEGTS_SECTION_PMT,
+ GST_MPEGTS_SECTION_CAT,
+ GST_MPEGTS_SECTION_TSDT,
+ GST_MPEGTS_SECTION_EIT,
+ GST_MPEGTS_SECTION_NIT,
+ GST_MPEGTS_SECTION_BAT,
+ GST_MPEGTS_SECTION_SDT,
+ GST_MPEGTS_SECTION_TDT,
+ GST_MPEGTS_SECTION_TOT,
+ /**
+ * GST_MPEGTS_SECTION_SIT:
+ *
+ * Selection Information Table (EN 300 468)
+ *
+ * Since: 1.20
+ */
+ GST_MPEGTS_SECTION_SIT,
+ GST_MPEGTS_SECTION_ATSC_TVCT,
+ GST_MPEGTS_SECTION_ATSC_CVCT,
+ GST_MPEGTS_SECTION_ATSC_MGT,
+ GST_MPEGTS_SECTION_ATSC_ETT,
+ GST_MPEGTS_SECTION_ATSC_EIT,
+ GST_MPEGTS_SECTION_ATSC_STT,
+ GST_MPEGTS_SECTION_ATSC_RRT,
+ GST_MPEGTS_SECTION_SCTE_SIT
+} GstMpegtsSectionType;
+
+/**
+ * GstMpegtsSectionTableID:
+ * @GST_MTS_TABLE_ID_PROGRAM_ASSOCIATION: Program Association Table (PAT)
+ * @GST_MTS_TABLE_ID_CONDITIONAL_ACCESS: Conditional Access Table (CAT)
+ * @GST_MTS_TABLE_ID_TS_PROGRAM_MAP: Program Map Table (PMT)
+ * @GST_MTS_TABLE_ID_TS_DESCRIPTION: Transport Stream Description Table
+ * @GST_MTS_TABLE_ID_14496_SCENE_DESCRIPTION: ISO/IEC 14496 Scene Description Table
+ * @GST_MTS_TABLE_ID_14496_OBJET_DESCRIPTOR: ISO/IEC 14496 Object Descriptor Table
+ * @GST_MTS_TABLE_ID_METADATA: Metadata Section
+ * @GST_MTS_TABLE_ID_IPMP_CONTROL_INFORMATION: IPMP Control Information
+ * @GST_MTS_TABLE_ID_DSM_CC_MULTIPROTO_ENCAPSULATED_DATA: DSM-CC Multi-Protocol Encapsulated (MPE) Data
+ * @GST_MTS_TABLE_ID_DSM_CC_U_N_MESSAGES: DSM-CC U-N Messages
+ * @GST_MTS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGES: DSM-CC Download Data Messages
+ * @GST_MTS_TABLE_ID_DSM_CC_STREAM_DESCRIPTORS: DSM-CC Stream Descriptors
+ * @GST_MTS_TABLE_ID_DSM_CC_PRIVATE_DATA: DSM-CC Private Data
+ * @GST_MTS_TABLE_ID_DSM_CC_ADDRESSABLE_SECTIONS: DSM-CC Addressable Section
+ * @GST_MTS_TABLE_ID_UNSET: Unset section table_id (value is forbidden to use in actual sections)
+ *
+ * Values for a #GstMpegtsSection table_id
+ *
+ * These are the registered ITU H.222.0 | ISO/IEC 13818-1 table_id variants.
+ *
+ * see also #GstMpegtsSectionATSCTableID, #GstMpegtsSectionDVBTableID, and
+ * #GstMpegtsSectionSCTETableID
+ */
+typedef enum {
+ /* ITU H.222.0 / IEC 13818-1 */
+ GST_MTS_TABLE_ID_PROGRAM_ASSOCIATION = 0x00,
+ GST_MTS_TABLE_ID_CONDITIONAL_ACCESS = 0x01,
+ GST_MTS_TABLE_ID_TS_PROGRAM_MAP = 0x02,
+ GST_MTS_TABLE_ID_TS_DESCRIPTION = 0x03,
+ GST_MTS_TABLE_ID_14496_SCENE_DESCRIPTION = 0x04,
+ GST_MTS_TABLE_ID_14496_OBJET_DESCRIPTOR = 0x05,
+ GST_MTS_TABLE_ID_METADATA = 0x06,
+ GST_MTS_TABLE_ID_IPMP_CONTROL_INFORMATION = 0x07,
+ /**
+ * GST_MTS_TABLE_ID_14496_SECTION:
+ *
+ * ISO/IEC 14496 Section.
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_14496_SECTION = 0x08,
+
+ /**
+ * GST_MTS_TABLE_ID_23001_11_SECTION:
+ *
+ * ISO/IEC 23001-11 (Green Access Unit) Section.
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_23001_11_SECTION = 0x09,
+
+ /**
+ * GST_MTS_TABLE_ID_23001_10_SECTION:
+ *
+ * ISO/ISO 23001-10 (Quality Access Unit) Section.
+ *
+ * Since: 1.20
+ */
+ GST_MTS_TABLE_ID_23001_10_SECTION = 0x0A,
+
+ /* 0x08 - 0x39 : ITU H.222.0 | ISO/IEC 13818-1 reserved */
+
+ /* IEC 13818-6 (DSM-CC) */
+ GST_MTS_TABLE_ID_DSM_CC_MULTIPROTO_ENCAPSULATED_DATA = 0x3A,
+ GST_MTS_TABLE_ID_DSM_CC_U_N_MESSAGES = 0x3B,
+ GST_MTS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGES = 0x3C,
+ GST_MTS_TABLE_ID_DSM_CC_STREAM_DESCRIPTORS = 0x3D,
+ GST_MTS_TABLE_ID_DSM_CC_PRIVATE_DATA = 0x3E,
+ GST_MTS_TABLE_ID_DSM_CC_ADDRESSABLE_SECTIONS = 0x3F,
+
+ /* Unset */
+ GST_MTS_TABLE_ID_UNSET = 0xFF
+
+} GstMpegtsSectionTableID;
+
+/**
+ * GstMpegtsPacketizeFunc: (attributes doc.skip=true)
+ */
+typedef gboolean (*GstMpegtsPacketizeFunc) (GstMpegtsSection *section);
+
+/**
+ * GstMpegtsSection:
+ * @section_type: The type of section.
+ * @pid: The PID on which this section was found or belongs to.
+ * @table_id: The table id of this section. See %GstMpegtsSectionTableID and
+ * derivates for more information.
+ * @subtable_extension: This meaning differs per section. See the documentation
+ * of the parsed section type for the meaning of this field
+ * @version_number: Version of the section.
+ * @current_next_indicator: Applies to current/next stream or not
+ * @section_number: Number of the section (if multiple)
+ * @last_section_number: Number of the last expected section (if multiple)
+ * @crc: Checksum (if applicable)
+ *
+ * Mpeg-TS Section Information (SI) (ISO/IEC 13818-1) object.
+ */
+struct _GstMpegtsSection
+{
+ /*< private >*/
+ GstMiniObject parent;
+
+ /*< public >*/
+ GstMpegtsSectionType section_type;
+
+ guint16 pid;
+ guint8 table_id;
+
+ guint16 subtable_extension;
+ guint8 version_number;
+
+ gboolean current_next_indicator;
+
+ guint8 section_number;
+ guint8 last_section_number;
+
+ guint32 crc;
+
+ /*< private >*/
+ /* data: Points to beginning of section data
+ * i.e. the first byte is the table_id field */
+ guint8 *data;
+ /* section_length: length of data (including final CRC if present) */
+ guint section_length;
+ /* cached_parsed: cached copy of parsed section */
+ gpointer *cached_parsed;
+ /* destroy_parsed: function to clear cached_parsed */
+ GDestroyNotify destroy_parsed;
+ /* offset: offset of the section within the container stream */
+ guint64 offset;
+ /* short_section: TRUE if section_syntax_indicator == 0
+ * FIXME : Maybe make public later on when allowing creation of
+ * sections to that people can create private short sections ? */
+ gboolean short_section;
+
+ GstMpegtsPacketizeFunc packetizer;
+
+ /* Padding for future extension */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_MPEGTS_API
+GBytes *gst_mpegts_section_get_data (GstMpegtsSection *section);
+
+/* PAT */
+#define GST_TYPE_MPEGTS_PAT_PROGRAM (gst_mpegts_pat_program_get_type())
+
+typedef struct _GstMpegtsPatProgram GstMpegtsPatProgram;
+/**
+ * GstMpegtsPatProgram:
+ * @program_number: the program number
+ * @network_or_program_map_PID: the network of program map PID
+ *
+ * A program entry from a Program Association Table (ITU H.222.0, ISO/IEC 13818-1).
+ */
+struct _GstMpegtsPatProgram
+{
+ guint16 program_number;
+ guint16 network_or_program_map_PID;
+};
+
+GST_MPEGTS_API
+GPtrArray *gst_mpegts_section_get_pat (GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GType gst_mpegts_pat_program_get_type (void);
+
+GST_MPEGTS_API
+GPtrArray *gst_mpegts_pat_new (void);
+
+GST_MPEGTS_API
+GstMpegtsPatProgram *gst_mpegts_pat_program_new (void);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_from_pat (GPtrArray * programs,
+ guint16 ts_id);
+
+/* CAT */
+
+GST_MPEGTS_API
+GPtrArray *gst_mpegts_section_get_cat (GstMpegtsSection *section);
+
+/* PMT */
+typedef struct _GstMpegtsPMTStream GstMpegtsPMTStream;
+typedef struct _GstMpegtsPMT GstMpegtsPMT;
+#define GST_TYPE_MPEGTS_PMT (gst_mpegts_pmt_get_type())
+#define GST_TYPE_MPEGTS_PMT_STREAM (gst_mpegts_pmt_stream_get_type())
+
+/**
+ * GstMpegtsStreamType:
+ * @GST_MPEGTS_STREAM_TYPE_RESERVED_00: ITU-T | ISO/IEC Reserved
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG1: ISO/IEC 11172-2 Video (i.e. MPEG-1 Video)
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2: Rec. ITU-T H.262 | ISO/IEC 13818-2
+ * Video or ISO/IEC 11172-2 constrained parameter video stream (i.e.
+ * MPEG-2 Video)
+ * @GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG1: ISO/IEC 11172-3 Audio
+ * @GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG2: ISO/IEC 13818-3 Audio
+ * @GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS: private sections
+ * @GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS: PES packets containing private data
+ * @GST_MPEGTS_STREAM_TYPE_MHEG: ISO/IEC 13522 MHEG
+ * @GST_MPEGTS_STREAM_TYPE_DSM_CC: Annex A DSM-CC
+ * @GST_MPEGTS_STREAM_TYPE_H_222_1: Rec. ITU-T H.222.1
+ * @GST_MPEGTS_STREAM_TYPE_DSMCC_A: ISO/IEC 13818-6 type A
+ * @GST_MPEGTS_STREAM_TYPE_DSMCC_B: ISO/IEC 13818-6 type B
+ * @GST_MPEGTS_STREAM_TYPE_DSMCC_C: ISO/IEC 13818-6 type C
+ * @GST_MPEGTS_STREAM_TYPE_DSMCC_D: ISO/IEC 13818-6 type D
+ * @GST_MPEGTS_STREAM_TYPE_AUXILIARY: auxiliary streams
+ * @GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_ADTS: ISO/IEC 13818-7 Audio (AAC) with ADTS
+ * transport syntax
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG4: ISO/IEC 14496-2 Visual (MPEG-4 Video)
+ * @GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_LATM: ISO/IEC 14496-3 Audio (AAC) with the LATM
+ * transport syntax as defined in ISO/IEC 14496-3
+ * @GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS: ISO/IEC 14496-1
+ * SL-packetized stream or FlexMux stream carried in PES packets
+ * @GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS: ISO/IEC 14496-1 SL-packetized
+ * stream or FlexMux stream carried in ISO/IEC 14496_sections
+ * @GST_MPEGTS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD: ISO/IEC 13818-6 Synchronized
+ * Download Protocol
+ * @GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS: Metadata carried in PES packets
+ * @GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS: Metadata carried in metadata_sections
+ * @GST_MPEGTS_STREAM_TYPE_METADATA_DATA_CAROUSEL: Metadata carried in ISO/IEC
+ * 13818-6 Data Carousel
+ * @GST_MPEGTS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL: Metadata carried in
+ * ISO/IEC 13818-6 Object Carousel
+ * @GST_MPEGTS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD: Metadata carried in
+ * ISO/IEC 13818-6 Synchronized Download Protocol
+ * @GST_MPEGTS_STREAM_TYPE_MPEG2_IPMP: IPMP stream (defined in ISO/IEC 13818-11,
+ * MPEG-2 IPMP)
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_H264: AVC video stream conforming to one or
+ * more profiles defined in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 or
+ * AVC video sub-bitstream of SVC as defined in 2.1.78 or MVC base view
+ * sub-bitstream, as defined in 2.1.85, or AVC video sub-bitstream of MVC, as
+ * defined in 2.1.88
+ * @GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_CLEAN: ISO/IEC 14496-3 (AAC) Audio, without
+ * using any additional transport syntax, such as DST, ALS and SLS
+ * @GST_MPEGTS_STREAM_TYPE_MPEG4_TIMED_TEXT: ISO/IEC 14496-17 Text
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_RVC: Auxiliary video stream as defined in
+ * ISO/IEC 23002-3
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM: SVC video sub-bitstream
+ * of an AVC video stream conforming to one or more profiles defined in Annex G
+ * of Rec. ITU-T H.264 | ISO/IEC 14496-10
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM: MVC video sub-bitstream
+ * of an AVC video stream conforming to one or more profiles defined in Annex H
+ * of Rec. ITU-T H.264 | ISO/IEC 14496-10
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K: Video stream conforming to one or more
+ * profiles as defined in Rec. ITU-T T.800 | ISO/IEC 15444-1 (i.e. JPEG 2000)
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW: Additional view
+ * Rec. ITU-T H.262 | ISO/IEC 13818-2 video stream for service-compatible
+ * stereoscopic 3D services
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW: Additional view
+ * Rec. ITU-T H.264 | ISO/IEC 14496-10 video stream conforming to one or more
+ * profiles defined in Annex A for service-compatible stereoscopic 3D services
+ * @GST_MPEGTS_STREAM_TYPE_VIDEO_HEVC: Rec. ITU-T H.265 | ISO/IEC 23008-2 video
+ * stream or an HEVC temporal video sub-bitstream
+ * @GST_MPEGTS_STREAM_TYPE_IPMP_STREAM: IPMP stream
+ *
+ * Type of MPEG-TS stream type.
+ *
+ * These values correspond to the base standard registered types. Depending
+ * on the variant of mpeg-ts being used (Bluray, ATSC, DVB, ...), other
+ * types might also be used, but will not conflict with these.
+ *
+ * Corresponds to table 2-34 of ITU H.222.0 | ISO/IEC 13818-1
+ */
+typedef enum {
+ GST_MPEGTS_STREAM_TYPE_RESERVED_00 = 0x00,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
+ GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
+ GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
+ GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS = 0x05,
+ GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS = 0x06,
+ GST_MPEGTS_STREAM_TYPE_MHEG = 0x07,
+ GST_MPEGTS_STREAM_TYPE_DSM_CC = 0x08,
+ GST_MPEGTS_STREAM_TYPE_H_222_1 = 0x09,
+ GST_MPEGTS_STREAM_TYPE_DSMCC_A = 0x0a,
+ GST_MPEGTS_STREAM_TYPE_DSMCC_B = 0x0b,
+ GST_MPEGTS_STREAM_TYPE_DSMCC_C = 0x0c,
+ GST_MPEGTS_STREAM_TYPE_DSMCC_D = 0x0d,
+ GST_MPEGTS_STREAM_TYPE_AUXILIARY = 0x0e,
+ GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_ADTS = 0x0f,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG4 = 0x10,
+ GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_LATM = 0x11,
+ GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS = 0x12,
+ GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS = 0x13,
+ GST_MPEGTS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD = 0x14,
+ GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS = 0x15,
+ GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS = 0x16,
+ GST_MPEGTS_STREAM_TYPE_METADATA_DATA_CAROUSEL = 0x17,
+ GST_MPEGTS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL = 0x18,
+ GST_MPEGTS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD = 0x19,
+ GST_MPEGTS_STREAM_TYPE_MPEG2_IPMP = 0x1a,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_H264 = 0x1b,
+ GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_CLEAN = 0x1c,
+ GST_MPEGTS_STREAM_TYPE_MPEG4_TIMED_TEXT = 0x1d,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_RVC = 0x1e,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM = 0x1f,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM = 0x20,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K = 0x21,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW = 0x22,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW = 0x23,
+ GST_MPEGTS_STREAM_TYPE_VIDEO_HEVC = 0x24,
+ /* 0x24 - 0x7e : Rec. ITU-T H.222.0 | ISO/IEC 13818-1 Reserved */
+ GST_MPEGTS_STREAM_TYPE_IPMP_STREAM = 0x7f,
+ /* 0x80 - 0xff : User Private (or defined in other specs) */
+
+ /**
+ * GST_MPEGTS_STREAM_TYPE_USER_PRIVATE_EA:
+ *
+ * User Private stream id (used for VC-1) as defined by SMPTE RP227.
+ *
+ * Since: 1.20
+ */
+ GST_MPEGTS_STREAM_TYPE_USER_PRIVATE_EA = 0xea,
+} GstMpegtsStreamType;
+
+/**
+ * GstMpegtsPMTStream:
+ * @stream_type: the type of stream. See #GstMpegtsStreamType
+ * @pid: the PID of the stream
+ * @descriptors: (element-type GstMpegtsDescriptor): the descriptors of the
+ * stream
+ *
+ * An individual stream definition of a #GstMpegtsPMT.
+ */
+struct _GstMpegtsPMTStream
+{
+ guint8 stream_type;
+ guint16 pid;
+
+ GPtrArray *descriptors;
+};
+
+/**
+ * GstMpegtsPMT:
+ * @pcr_pid: PID of the stream containing the PCR for this program.
+ * @program_number: The program to which this PMT is applicable.
+ * @descriptors: (element-type GstMpegtsDescriptor): Array of #GstMpegtsDescriptor
+ * @streams: (element-type GstMpegtsPMTStream): Array of #GstMpegtsPMTStream
+ *
+ * Program Map Table (ISO/IEC 13818-1). Provides the mappings between program
+ * numbers and the program elements that comprise them.
+ *
+ * The program_number is contained in the subtable_extension field of the
+ * container #GstMpegtsSection.
+ */
+struct _GstMpegtsPMT
+{
+ guint16 pcr_pid;
+ guint16 program_number;
+
+ GPtrArray *descriptors;
+ GPtrArray *streams;
+};
+
+GST_MPEGTS_API
+GType gst_mpegts_pmt_get_type (void);
+
+GST_MPEGTS_API
+GType gst_mpegts_pmt_stream_get_type (void);
+
+GST_MPEGTS_API
+GstMpegtsPMT *gst_mpegts_pmt_new (void);
+
+GST_MPEGTS_API
+GstMpegtsPMTStream *gst_mpegts_pmt_stream_new (void);
+
+GST_MPEGTS_API
+const GstMpegtsPMT *gst_mpegts_section_get_pmt (GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_from_pmt (GstMpegtsPMT *pmt, guint16 pid);
+
+/* TSDT */
+
+GST_MPEGTS_API
+GPtrArray *gst_mpegts_section_get_tsdt (GstMpegtsSection *section);
+
+
+/* generic */
+
+#define gst_mpegts_section_ref(section) ((GstMpegtsSection*) gst_mini_object_ref (GST_MINI_OBJECT_CAST (section)))
+#define gst_mpegts_section_unref(section) (gst_mini_object_unref (GST_MINI_OBJECT_CAST (section)))
+
+GST_MPEGTS_API
+GstMessage *gst_message_new_mpegts_section (GstObject *parent, GstMpegtsSection *section);
+
+GST_MPEGTS_API
+GstEvent *gst_event_new_mpegts_section (GstMpegtsSection * section);
+
+GST_MPEGTS_API
+gboolean gst_mpegts_section_send_event (GstMpegtsSection * section, GstElement * element);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_event_parse_mpegts_section (GstEvent * event);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_message_parse_mpegts_section (GstMessage *message);
+
+GST_MPEGTS_API
+GstMpegtsSection *gst_mpegts_section_new (guint16 pid,
+ guint8 * data,
+ gsize data_size);
+
+GST_MPEGTS_API
+guint8 *gst_mpegts_section_packetize (GstMpegtsSection * section, gsize * output_size);
+
+G_END_DECLS
+
+#endif /* GST_MPEGTS_SECTION_H */
diff --git a/include/gst/mpegts/mpegts-prelude.h b/include/gst/mpegts/mpegts-prelude.h
new file mode 100644
index 0000000000..2b66e26d98
--- /dev/null
+++ b/include/gst/mpegts/mpegts-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer MpegTS Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * mpegts-prelude.h: prelude include header for gst-mpegts library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MPEGTS_PRELUDE_H__
+#define __GST_MPEGTS_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_MPEGTS_API
+# ifdef BUILDING_GST_MPEGTS
+# define GST_MPEGTS_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_MPEGTS_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_MPEGTS_PRELUDE_H__ */
diff --git a/include/gst/mpegts/mpegts.h b/include/gst/mpegts/mpegts.h
new file mode 100644
index 0000000000..80be35bb3b
--- /dev/null
+++ b/include/gst/mpegts/mpegts.h
@@ -0,0 +1,51 @@
+/*
+ * mpegts.h -
+ * Copyright (C) 2013 Edward Hervey
+ *
+ * Authors:
+ * Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_MPEGTS_H_
+#define _GST_MPEGTS_H_
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The GStreamer mpegts library is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/mpegts/mpegts-prelude.h>
+#include <gst/mpegts/gstmpegtsdescriptor.h>
+#include <gst/mpegts/gst-atsc-descriptor.h>
+#include <gst/mpegts/gst-dvb-descriptor.h>
+#include <gst/mpegts/gst-isdb-descriptor.h>
+#include <gst/mpegts/gstmpegtssection.h>
+#include <gst/mpegts/gst-atsc-section.h>
+#include <gst/mpegts/gst-dvb-section.h>
+#include <gst/mpegts/gst-scte-section.h>
+#include <gst/mpegts/gstmpegts-enumtypes.h>
+#include <gst/mpegts/gst-hdmv-section.h>
+
+G_BEGIN_DECLS
+
+GST_MPEGTS_API
+void gst_mpegts_initialize (void);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/net/gstnet.h b/include/gst/net/gstnet.h
new file mode 100644
index 0000000000..28173809c2
--- /dev/null
+++ b/include/gst/net/gstnet.h
@@ -0,0 +1,31 @@
+/* GStreamer
+ * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NET_H__
+#define __GST_NET_H__
+
+#include <gst/net/net-prelude.h>
+
+#include <gst/net/gstnetaddressmeta.h>
+#include <gst/net/gstnetclientclock.h>
+#include <gst/net/gstnettimepacket.h>
+#include <gst/net/gstnettimeprovider.h>
+
+#endif /* __GST_NET_H__ */
diff --git a/include/gst/net/gstnetaddressmeta.h b/include/gst/net/gstnetaddressmeta.h
new file mode 100644
index 0000000000..e949b3117e
--- /dev/null
+++ b/include/gst/net/gstnetaddressmeta.h
@@ -0,0 +1,63 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_NET_ADDRESS_META_H__
+#define __GST_NET_ADDRESS_META_H__
+
+#include <gst/gst.h>
+#include <gio/gio.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstNetAddressMeta GstNetAddressMeta;
+
+/**
+ * GstNetAddressMeta:
+ * @meta: the parent type
+ * @addr: a #GSocketAddress stored as metadata
+ *
+ * Buffer metadata for network addresses.
+ */
+struct _GstNetAddressMeta {
+ GstMeta meta;
+
+ GSocketAddress *addr;
+};
+
+GST_NET_API
+GType gst_net_address_meta_api_get_type (void);
+#define GST_NET_ADDRESS_META_API_TYPE (gst_net_address_meta_api_get_type())
+
+/* implementation */
+
+GST_NET_API
+const GstMetaInfo *gst_net_address_meta_get_info (void);
+#define GST_NET_ADDRESS_META_INFO (gst_net_address_meta_get_info())
+
+GST_NET_API
+GstNetAddressMeta * gst_buffer_add_net_address_meta (GstBuffer *buffer,
+ GSocketAddress *addr);
+GST_NET_API
+GstNetAddressMeta * gst_buffer_get_net_address_meta (GstBuffer *buffer);
+
+G_END_DECLS
+
+#endif /* __GST_NET_ADDRESS_META_H__ */
+
diff --git a/include/gst/net/gstnetclientclock.h b/include/gst/net/gstnetclientclock.h
new file mode 100644
index 0000000000..506270c7d5
--- /dev/null
+++ b/include/gst/net/gstnetclientclock.h
@@ -0,0 +1,106 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ * 2005 Andy Wingo <wingo@pobox.com>
+ * Copyright (C) 2012 Collabora Ltd. <tim.muller@collabora.co.uk>
+ *
+ * gstnetclientclock.h: clock that synchronizes itself to a time provider over
+ * the network
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NET_CLIENT_CLOCK_H__
+#define __GST_NET_CLIENT_CLOCK_H__
+
+#include <gst/gst.h>
+#include <gst/gstsystemclock.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_NET_CLIENT_CLOCK \
+ (gst_net_client_clock_get_type())
+#define GST_NET_CLIENT_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClock))
+#define GST_NET_CLIENT_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_CLIENT_CLOCK,GstNetClientClockClass))
+#define GST_IS_NET_CLIENT_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_CLIENT_CLOCK))
+#define GST_IS_NET_CLIENT_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_CLIENT_CLOCK))
+
+typedef struct _GstNetClientClock GstNetClientClock;
+typedef struct _GstNetClientClockClass GstNetClientClockClass;
+typedef struct _GstNetClientClockPrivate GstNetClientClockPrivate;
+
+/**
+ * GstNetClientClock:
+ *
+ * Opaque #GstNetClientClock structure.
+ */
+struct _GstNetClientClock {
+ GstSystemClock clock;
+
+ /*< private >*/
+ GstNetClientClockPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstNetClientClockClass {
+ GstSystemClockClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_NET_API
+GType gst_net_client_clock_get_type (void);
+
+GST_NET_API
+GstClock* gst_net_client_clock_new (const gchar *name, const gchar *remote_address,
+ gint remote_port, GstClockTime base_time);
+
+#define GST_TYPE_NTP_CLOCK \
+ (gst_ntp_clock_get_type())
+#define GST_NTP_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NTP_CLOCK,GstNtpClock))
+#define GST_NTP_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NTP_CLOCK,GstNtpClockClass))
+#define GST_IS_NTP_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NTP_CLOCK))
+#define GST_IS_NTP_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NTP_CLOCK))
+
+typedef struct _GstNetClientClock GstNtpClock;
+typedef struct _GstNetClientClockClass GstNtpClockClass;
+
+GST_NET_API
+GType gst_ntp_clock_get_type (void);
+
+GST_NET_API
+GstClock* gst_ntp_clock_new (const gchar *name, const gchar *remote_address,
+ gint remote_port, GstClockTime base_time);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNetClientClock, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNtpClock, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_NET_CLIENT_CLOCK_H__ */
diff --git a/include/gst/net/gstnetcontrolmessagemeta.h b/include/gst/net/gstnetcontrolmessagemeta.h
new file mode 100644
index 0000000000..b51b87683c
--- /dev/null
+++ b/include/gst/net/gstnetcontrolmessagemeta.h
@@ -0,0 +1,69 @@
+/* GStreamer
+ * Copyright (C) <2014> William Manley <will@williammanley.net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_NET_CONTROL_MESSAGE_META_H__
+#define __GST_NET_CONTROL_MESSAGE_META_H__
+
+#include <gst/gst.h>
+#include <gio/gio.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstNetControlMessageMeta GstNetControlMessageMeta;
+
+/**
+ * GstNetControlMessageMeta:
+ * @meta: the parent type
+ * @message: a #GSocketControlMessage stored as metadata
+ *
+ * Buffer metadata for GSocket control messages, AKA ancillary data attached to
+ * data sent across a socket.
+ */
+struct _GstNetControlMessageMeta {
+ GstMeta meta;
+
+ GSocketControlMessage *message;
+};
+
+GST_NET_API
+GType gst_net_control_message_meta_api_get_type (void);
+
+#define GST_NET_CONTROL_MESSAGE_META_API_TYPE \
+ (gst_net_control_message_meta_api_get_type())
+
+#define gst_buffer_get_net_control_message_meta(b) ((GstNetControlMessageMeta*)\
+ gst_buffer_get_meta((b),GST_NET_CONTROL_MESSAGE_META_API_TYPE))
+
+/* implementation */
+
+GST_NET_API
+const GstMetaInfo *gst_net_control_message_meta_get_info (void);
+
+#define GST_NET_CONTROL_MESSAGE_META_INFO \
+ (gst_net_control_message_meta_get_info())
+
+GST_NET_API
+GstNetControlMessageMeta * gst_buffer_add_net_control_message_meta (GstBuffer * buffer,
+ GSocketControlMessage * message);
+
+G_END_DECLS
+
+#endif /* __GST_NET_CONTROL_MESSAGE_META_H__ */
+
diff --git a/include/gst/net/gstnettimepacket.h b/include/gst/net/gstnettimepacket.h
new file mode 100644
index 0000000000..a8f2f661bd
--- /dev/null
+++ b/include/gst/net/gstnettimepacket.h
@@ -0,0 +1,81 @@
+/* GStreamer
+ * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NET_TIME_PACKET_H__
+#define __GST_NET_TIME_PACKET_H__
+
+#include <gst/gst.h>
+#include <gio/gio.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_NET_TIME_PACKET_SIZE:
+ *
+ * The size of the packets sent between network clocks.
+ */
+#define GST_NET_TIME_PACKET_SIZE 16
+
+typedef struct _GstNetTimePacket GstNetTimePacket;
+
+/**
+ * GstNetTimePacket:
+ * @local_time: the local time when this packet was sent
+ * @remote_time: the remote time observation
+ *
+ * Content of a #GstNetTimePacket.
+ */
+struct _GstNetTimePacket {
+ GstClockTime local_time;
+ GstClockTime remote_time;
+};
+
+GST_NET_API
+GType gst_net_time_packet_get_type (void);
+
+GST_NET_API
+GstNetTimePacket* gst_net_time_packet_new (const guint8 *buffer);
+
+GST_NET_API
+GstNetTimePacket* gst_net_time_packet_copy (const GstNetTimePacket *packet);
+
+GST_NET_API
+void gst_net_time_packet_free (GstNetTimePacket *packet);
+
+GST_NET_API
+guint8* gst_net_time_packet_serialize (const GstNetTimePacket *packet);
+
+GST_NET_API
+GstNetTimePacket* gst_net_time_packet_receive (GSocket * socket,
+ GSocketAddress ** src_address,
+ GError ** error);
+GST_NET_API
+gboolean gst_net_time_packet_send (const GstNetTimePacket * packet,
+ GSocket * socket,
+ GSocketAddress * dest_address,
+ GError ** error);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNetTimePacket, gst_net_time_packet_free)
+
+G_END_DECLS
+
+
+#endif /* __GST_NET_TIME_PACKET_H__ */
diff --git a/include/gst/net/gstnettimeprovider.h b/include/gst/net/gstnettimeprovider.h
new file mode 100644
index 0000000000..40eeef318d
--- /dev/null
+++ b/include/gst/net/gstnettimeprovider.h
@@ -0,0 +1,79 @@
+/* GStreamer
+ * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ * 2006 Joni Valtanen <joni.valtanen@movial.fi>
+ * Copyright (C) 2012 Collabora Ltd. <tim.muller@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NET_TIME_PROVIDER_H__
+#define __GST_NET_TIME_PROVIDER_H__
+
+#include <gst/gst.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_NET_TIME_PROVIDER \
+ (gst_net_time_provider_get_type())
+#define GST_NET_TIME_PROVIDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProvider))
+#define GST_NET_TIME_PROVIDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NET_TIME_PROVIDER,GstNetTimeProviderClass))
+#define GST_IS_NET_TIME_PROVIDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_TIME_PROVIDER))
+#define GST_IS_NET_TIME_PROVIDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_TIME_PROVIDER))
+
+typedef struct _GstNetTimeProvider GstNetTimeProvider;
+typedef struct _GstNetTimeProviderClass GstNetTimeProviderClass;
+typedef struct _GstNetTimeProviderPrivate GstNetTimeProviderPrivate;
+
+/**
+ * GstNetTimeProvider:
+ *
+ * Opaque #GstNetTimeProvider structure.
+ */
+struct _GstNetTimeProvider {
+ GstObject parent;
+
+ /*< private >*/
+ GstNetTimeProviderPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstNetTimeProviderClass {
+ GstObjectClass parent_class;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_NET_API
+GType gst_net_time_provider_get_type (void);
+
+GST_NET_API
+GstNetTimeProvider* gst_net_time_provider_new (GstClock *clock,
+ const gchar *address,
+ gint port);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstNetTimeProvider, gst_object_unref)
+
+G_END_DECLS
+
+
+#endif /* __GST_NET_TIME_PROVIDER_H__ */
diff --git a/include/gst/net/gstnetutils.h b/include/gst/net/gstnetutils.h
new file mode 100644
index 0000000000..d2b4043be8
--- /dev/null
+++ b/include/gst/net/gstnetutils.h
@@ -0,0 +1,37 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2017 Robert Rosengren <robertr@axis.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_NET_UTILS_H__
+#define __GST_NET_UTILS_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+GST_NET_API
+gboolean gst_net_utils_set_socket_tos (GSocket * socket,
+ gint qos_dscp);
+
+G_END_DECLS
+
+#endif /* __GST_NET_UTILS_H__ */
diff --git a/include/gst/net/gstptpclock.h b/include/gst/net/gstptpclock.h
new file mode 100644
index 0000000000..3182431b9f
--- /dev/null
+++ b/include/gst/net/gstptpclock.h
@@ -0,0 +1,161 @@
+/* GStreamer
+ * Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PTP_CLOCK_H__
+#define __GST_PTP_CLOCK_H__
+
+#include <gst/gst.h>
+#include <gst/gstsystemclock.h>
+#include <gst/net/net-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PTP_CLOCK \
+ (gst_ptp_clock_get_type())
+#define GST_PTP_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PTP_CLOCK,GstPtpClock))
+#define GST_PTP_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PTP_CLOCK,GstPtpClockClass))
+#define GST_IS_PTP_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PTP_CLOCK))
+#define GST_IS_PTP_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PTP_CLOCK))
+
+typedef struct _GstPtpClock GstPtpClock;
+typedef struct _GstPtpClockClass GstPtpClockClass;
+typedef struct _GstPtpClockPrivate GstPtpClockPrivate;
+
+/**
+ * GstPtpClock:
+ *
+ * Opaque #GstPtpClock structure.
+ */
+struct _GstPtpClock {
+ GstSystemClock clock;
+
+ /*< private >*/
+ GstPtpClockPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstPtpClockClass:
+ * @parent_class: parented to #GstSystemClockClass
+ *
+ * Opaque #GstPtpClockClass structure.
+ */
+struct _GstPtpClockClass {
+ GstSystemClockClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GST_PTP_CLOCK_ID_NONE:
+ * PTP clock identification that can be passed to gst_ptp_init() to
+ * automatically select one based on the MAC address of interfaces
+ */
+#define GST_PTP_CLOCK_ID_NONE ((guint64) -1)
+
+GST_NET_API
+GType gst_ptp_clock_get_type (void);
+
+GST_NET_API
+gboolean gst_ptp_is_supported (void);
+
+GST_NET_API
+gboolean gst_ptp_is_initialized (void);
+
+GST_NET_API
+gboolean gst_ptp_init (guint64 clock_id,
+ gchar ** interfaces);
+GST_NET_API
+void gst_ptp_deinit (void);
+
+#define GST_PTP_STATISTICS_NEW_DOMAIN_FOUND "GstPtpStatisticsNewDomainFound"
+#define GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED "GstPtpStatisticsBestMasterClockSelected"
+#define GST_PTP_STATISTICS_PATH_DELAY_MEASURED "GstPtpStatisticsPathDelayMeasured"
+#define GST_PTP_STATISTICS_TIME_UPDATED "GstPtpStatisticsTimeUpdated"
+
+/**
+ * GstPtpStatisticsCallback:
+ * @domain: PTP domain identifier
+ * @stats: New statistics
+ * @user_data: Data passed to gst_ptp_statistics_callback_add()
+ *
+ * The statistics can be the following structures:
+ *
+ * GST_PTP_STATISTICS_NEW_DOMAIN_FOUND:
+ * "domain" G_TYPE_UINT The domain identifier of the domain
+ * "clock" GST_TYPE_CLOCK The internal clock that is slaved to the
+ * PTP domain
+ *
+ * GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED:
+ * "domain" G_TYPE_UINT The domain identifier of the domain
+ * "master-clock-id" G_TYPE_UINT64 PTP clock identifier of the selected master
+ * clock
+ * "master-clock-port" G_TYPE_UINT PTP port number of the selected master clock
+ * "grandmaster-clock-id" G_TYPE_UINT64 PTP clock identifier of the grandmaster clock
+ *
+ * GST_PTP_STATISTICS_PATH_DELAY_MEASURED:
+ * "domain" G_TYPE_UINT The domain identifier of the domain
+ * "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay
+ * "mean-path-delay" GST_TYPE_CLOCK_TIME Latest mean path delay
+ * "delay-request-delay" GST_TYPE_CLOCK_TIME Delay of DELAY_REQ / DELAY_RESP messages
+ *
+ * GST_PTP_STATISTICS_TIME_UPDATED:
+ * "domain" G_TYPE_UINT The domain identifier of the domain
+ * "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay
+ * "local-time" GST_TYPE_CLOCK_TIME Local time that corresponds to ptp-time
+ * "ptp-time" GST_TYPE_CLOCK_TIME Newly measured PTP time at local-time
+ * "estimated-ptp-time" GST_TYPE_CLOCK_TIME Estimated PTP time based on previous measurements
+ * "discontinuity" G_TYPE_INT64 Difference between estimated and measured PTP time
+ * "synced" G_TYPE_BOOLEAN Currently synced to the remote clock
+ * "r-squared" G_TYPE_DOUBLE R² of clock estimation regression
+ * "internal-time" GST_TYPE_CLOCK_TIME Internal time clock parameter
+ * "external-time" GST_TYPE_CLOCK_TIME External time clock parameter
+ * "rate-num" G_TYPE_UINT64 Internal/external rate numerator
+ * "rate-den" G_TYPE_UINT64 Internal/external rate denominator
+ * "rate" G_TYPE_DOUBLE Internal/external rate
+ *
+ * If %FALSE is returned, the callback is removed and never called again.
+ *
+ */
+typedef gboolean (*GstPtpStatisticsCallback) (guint8 domain,
+ const GstStructure * stats,
+ gpointer user_data);
+GST_NET_API
+gulong gst_ptp_statistics_callback_add (GstPtpStatisticsCallback callback,
+ gpointer user_data, GDestroyNotify destroy_data);
+GST_NET_API
+void gst_ptp_statistics_callback_remove (gulong id);
+
+GST_NET_API
+GstClock* gst_ptp_clock_new (const gchar *name,
+ guint domain);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPtpClock, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PTP_CLOCK_H__ */
+
diff --git a/include/gst/net/net-prelude.h b/include/gst/net/net-prelude.h
new file mode 100644
index 0000000000..47224fe048
--- /dev/null
+++ b/include/gst/net/net-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer Net Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * net-prelude.h: prelude include header for gst-net library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_NET_PRELUDE_H__
+#define __GST_NET_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_NET_API
+#ifdef BUILDING_GST_NET
+#define GST_NET_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_NET_API GST_API_IMPORT
+#endif
+#endif
+
+#endif /* __GST_NET_PRELUDE_H__ */
diff --git a/include/gst/net/net.h b/include/gst/net/net.h
new file mode 100644
index 0000000000..4a11a94f23
--- /dev/null
+++ b/include/gst/net/net.h
@@ -0,0 +1,36 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * net.h: single include header for gst-net library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_NET__H__
+#define __GST_NET__H__
+
+#include <gst/net/net-prelude.h>
+
+#include <gst/net/gstnet.h>
+#include <gst/net/gstnetaddressmeta.h>
+#include <gst/net/gstnetcontrolmessagemeta.h>
+#include <gst/net/gstnetclientclock.h>
+#include <gst/net/gstnettimepacket.h>
+#include <gst/net/gstnettimeprovider.h>
+#include <gst/net/gstnetutils.h>
+#include <gst/net/gstptpclock.h>
+
+#endif /* __GST_NET__H__ */
diff --git a/include/gst/pbutils/codec-utils.h b/include/gst/pbutils/codec-utils.h
new file mode 100644
index 0000000000..1aa72467c1
--- /dev/null
+++ b/include/gst/pbutils/codec-utils.h
@@ -0,0 +1,162 @@
+/* GStreamer base utils library codec-specific utility functions
+ * Copyright (C) 2010 Arun Raghavan <arun.raghavan@collabora.co.uk>
+ * 2010 Collabora Multimedia
+ * 2010 Nokia Corporation
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PB_UTILS_CODEC_UTILS_H__
+#define __GST_PB_UTILS_CODEC_UTILS_H__
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+/* AAC */
+
+GST_PBUTILS_API
+guint gst_codec_utils_aac_get_sample_rate_from_index (guint sr_idx);
+
+GST_PBUTILS_API
+gint gst_codec_utils_aac_get_index_from_sample_rate (guint rate);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_aac_get_profile (const guint8 * audio_config, guint len);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len);
+
+GST_PBUTILS_API
+guint gst_codec_utils_aac_get_sample_rate (const guint8 * audio_config, guint len);
+
+GST_PBUTILS_API
+guint gst_codec_utils_aac_get_channels (const guint8 * audio_config, guint len);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps,
+ const guint8 * audio_config,
+ guint len);
+
+/* H.264 */
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_h264_get_profile (const guint8 * sps, guint len);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_h264_get_level (const guint8 * sps, guint len);
+
+GST_PBUTILS_API
+guint8 gst_codec_utils_h264_get_level_idc (const gchar * level);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_h264_caps_set_level_and_profile (GstCaps * caps,
+ const guint8 * sps,
+ guint len);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_h264_get_profile_flags_level (const guint8 * codec_data,
+ guint len,
+ guint8 * profile,
+ guint8 * flags,
+ guint8 * level);
+
+/* H.265 */
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level,
+ guint len);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level,
+ guint len);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level,
+ guint len);
+
+GST_PBUTILS_API
+guint8 gst_codec_utils_h265_get_level_idc (const gchar * level);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps,
+ const guint8 * profile_tier_level,
+ guint len);
+/* MPEG-4 part 2 */
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len);
+
+GST_PBUTILS_API
+const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps,
+ const guint8 * vis_obj_seq,
+ guint len);
+
+/* Opus */
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_opus_parse_caps (GstCaps * caps,
+ guint32 * rate,
+ guint8 * channels,
+ guint8 * channel_mapping_family,
+ guint8 * stream_count,
+ guint8 * coupled_count,
+ guint8 channel_mapping[256]);
+
+GST_PBUTILS_API
+GstCaps * gst_codec_utils_opus_create_caps (guint32 rate,
+ guint8 channels,
+ guint8 channel_mapping_family,
+ guint8 stream_count,
+ guint8 coupled_count,
+ const guint8 * channel_mapping);
+
+GST_PBUTILS_API
+GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments);
+
+GST_PBUTILS_API
+GstBuffer * gst_codec_utils_opus_create_header (guint32 rate,
+ guint8 channels,
+ guint8 channel_mapping_family,
+ guint8 stream_count,
+ guint8 coupled_count,
+ const guint8 * channel_mapping,
+ guint16 pre_skip,
+ gint16 output_gain);
+
+GST_PBUTILS_API
+gboolean gst_codec_utils_opus_parse_header (GstBuffer * header,
+ guint32 * rate,
+ guint8 * channels,
+ guint8 * channel_mapping_family,
+ guint8 * stream_count,
+ guint8 * coupled_count,
+ guint8 channel_mapping[256],
+ guint16 * pre_skip,
+ gint16 * output_gain);
+
+/* General */
+GST_PBUTILS_API
+gchar * gst_codec_utils_caps_get_mime_codec (GstCaps * caps);
+
+
+G_END_DECLS
+
+#endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */
diff --git a/include/gst/pbutils/descriptions.h b/include/gst/pbutils/descriptions.h
new file mode 100644
index 0000000000..8b28bf7214
--- /dev/null
+++ b/include/gst/pbutils/descriptions.h
@@ -0,0 +1,101 @@
+/* GStreamer base utils library source/sink/codec description support
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PB_UTILS_DESCRIPTIONS_H__
+#define __GST_PB_UTILS_DESCRIPTIONS_H__
+
+#include <gst/gsttaglist.h>
+#include <gst/gstcaps.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPbUtilsCapsDescriptionFlags:
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER: Caps describe a container format.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO: Caps describe an audio format, or a
+ * container format that can store audio.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO: Caps describe an video format, or a
+ * container format that can store video.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE: Caps describe an image format, or a
+ * container format that can store image.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE: Caps describe an subtitle format, or a
+ * container format that can store subtitles.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG: Container format is a tags container.
+ * @GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC: Container format can store any kind of
+ * stream type.
+ *
+ * Flags that are returned by gst_pb_utils_get_caps_description_flags() and
+ * describe the format of the caps.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER = 1 << 0,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO = 1 << 1,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO = 1 << 2,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE = 1 << 3,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE = 1 << 4,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG = 1 << 5,
+ GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC = 1 << 6,
+} GstPbUtilsCapsDescriptionFlags;
+
+/*
+ * functions for use by demuxers or decoders to add CODEC tags to tag lists
+ * from caps
+ */
+
+GST_PBUTILS_API
+gboolean gst_pb_utils_add_codec_description_to_tag_list (GstTagList * taglist,
+ const gchar * codec_tag,
+ const GstCaps * caps);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_codec_description (const GstCaps * caps);
+
+/*
+ * functions mainly used by the missing plugins message creation functions to
+ * find descriptions of what exactly is missing
+ */
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_source_description (const gchar * protocol);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_sink_description (const gchar * protocol);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_decoder_description (const GstCaps * caps);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_encoder_description (const GstCaps * caps);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_element_description (const gchar * factory_name);
+
+GST_PBUTILS_API
+GstPbUtilsCapsDescriptionFlags gst_pb_utils_get_caps_description_flags (const GstCaps * caps);
+
+GST_PBUTILS_API
+gchar * gst_pb_utils_get_file_extension_from_caps (const GstCaps *caps);
+
+G_END_DECLS
+
+#endif /* __GST_PB_UTILS_DESCRIPTIONS_H__ */
+
diff --git a/include/gst/pbutils/encoding-profile.h b/include/gst/pbutils/encoding-profile.h
new file mode 100644
index 0000000000..ad97d01f0b
--- /dev/null
+++ b/include/gst/pbutils/encoding-profile.h
@@ -0,0 +1,286 @@
+/* GStreamer encoding profiles library
+ * Copyright (C) 2009-2010 Edward Hervey <edward.hervey@collabora.co.uk>
+ * (C) 2009-2010 Nokia Corporation
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PROFILE_H__
+#define __GST_PROFILE_H__
+
+#include <gst/gst.h>
+
+#include <gst/pbutils/pbutils-enumtypes.h>
+#include <gst/pbutils/gstdiscoverer.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstEncodingProfile:
+ *
+ * The opaque base class object for all encoding profiles. This contains generic
+ * information like name, description, format and preset.
+ */
+
+#define GST_TYPE_ENCODING_PROFILE \
+ (gst_encoding_profile_get_type ())
+#define GST_ENCODING_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_PROFILE, GstEncodingProfile))
+#define GST_IS_ENCODING_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_PROFILE))
+typedef struct _GstEncodingProfile GstEncodingProfile;
+typedef struct _GstEncodingProfileClass GstEncodingProfileClass;
+
+GST_PBUTILS_API
+GType gst_encoding_profile_get_type (void);
+
+
+
+/**
+ * GstEncodingContainerProfile:
+ *
+ * Encoding profiles for containers. Keeps track of a list of #GstEncodingProfile
+ */
+#define GST_TYPE_ENCODING_CONTAINER_PROFILE \
+ (gst_encoding_container_profile_get_type ())
+#define GST_ENCODING_CONTAINER_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_CONTAINER_PROFILE, GstEncodingContainerProfile))
+#define GST_IS_ENCODING_CONTAINER_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_CONTAINER_PROFILE))
+typedef struct _GstEncodingContainerProfile GstEncodingContainerProfile;
+typedef struct _GstEncodingContainerProfileClass GstEncodingContainerProfileClass;
+
+GST_PBUTILS_API
+GType gst_encoding_container_profile_get_type (void);
+
+
+
+/**
+ * GstEncodingVideoProfile:
+ *
+ * Variant of #GstEncodingProfile for video streams, allows specifying the @pass.
+ */
+#define GST_TYPE_ENCODING_VIDEO_PROFILE \
+ (gst_encoding_video_profile_get_type ())
+#define GST_ENCODING_VIDEO_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_VIDEO_PROFILE, GstEncodingVideoProfile))
+#define GST_IS_ENCODING_VIDEO_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_VIDEO_PROFILE))
+typedef struct _GstEncodingVideoProfile GstEncodingVideoProfile;
+typedef struct _GstEncodingVideoProfileClass GstEncodingVideoProfileClass;
+
+GST_PBUTILS_API
+GType gst_encoding_video_profile_get_type (void);
+
+
+
+/**
+ * GstEncodingAudioProfile:
+ *
+ * Variant of #GstEncodingProfile for audio streams.
+ */
+#define GST_TYPE_ENCODING_AUDIO_PROFILE \
+ (gst_encoding_audio_profile_get_type ())
+#define GST_ENCODING_AUDIO_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_AUDIO_PROFILE, GstEncodingAudioProfile))
+#define GST_IS_ENCODING_AUDIO_PROFILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_AUDIO_PROFILE))
+typedef struct _GstEncodingAudioProfile GstEncodingAudioProfile;
+typedef struct _GstEncodingAudioProfileClass GstEncodingAudioProfileClass;
+
+GST_PBUTILS_API
+GType gst_encoding_audio_profile_get_type (void);
+
+
+
+/* GstEncodingProfile API */
+
+/**
+ * gst_encoding_profile_unref:
+ * @profile: a #GstEncodingProfile
+ *
+ * Decreases the reference count of the @profile, possibly freeing the @profile.
+ */
+#define gst_encoding_profile_unref(profile) (g_object_unref ((GObject*) profile))
+
+/**
+ * gst_encoding_profile_ref:
+ * @profile: a #GstEncodingProfile
+ *
+ * Increases the reference count of the @profile.
+ */
+#define gst_encoding_profile_ref(profile) (g_object_ref ((GObject*) profile))
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_name (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_name (GstEncodingProfile *profile,
+ const gchar *name);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_description (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_description (GstEncodingProfile *profile,
+ const gchar *description);
+
+GST_PBUTILS_API
+GstCaps * gst_encoding_profile_get_format (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_format (GstEncodingProfile *profile,
+ GstCaps *format);
+
+GST_PBUTILS_API
+gboolean gst_encoding_profile_get_allow_dynamic_output (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_allow_dynamic_output (GstEncodingProfile *profile,
+ gboolean allow_dynamic_output);
+
+GST_PBUTILS_API
+gboolean gst_encoding_profile_get_single_segment (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_single_segment (GstEncodingProfile *profile,
+ gboolean single_segment);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_preset (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_preset_name (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_preset (GstEncodingProfile *profile,
+ const gchar *preset);
+
+GST_PBUTILS_API
+guint gst_encoding_profile_get_presence (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_presence (GstEncodingProfile *profile,
+ guint presence);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
+ const gchar * preset_name);
+
+GST_PBUTILS_API
+GstCaps * gst_encoding_profile_get_restriction (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_restriction (GstEncodingProfile *profile,
+ GstCaps *restriction);
+
+GST_PBUTILS_API
+gboolean gst_encoding_profile_is_equal (GstEncodingProfile *a,
+ GstEncodingProfile *b);
+
+GST_PBUTILS_API
+GstCaps * gst_encoding_profile_get_input_caps (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_type_nick (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_profile_get_file_extension (GstEncodingProfile * profile);
+
+GST_PBUTILS_API
+GstEncodingProfile * gst_encoding_profile_find (const gchar *targetname,
+ const gchar *profilename,
+ const gchar *category);
+
+GST_PBUTILS_API
+gboolean gst_encoding_profile_is_enabled (GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_enabled (GstEncodingProfile *profile,
+ gboolean enabled);
+/* GstEncodingContainerProfile API */
+
+GST_PBUTILS_API
+gboolean gst_encoding_container_profile_add_profile (GstEncodingContainerProfile *container,
+ GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+gboolean gst_encoding_container_profile_contains_profile (GstEncodingContainerProfile * container,
+ GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+const GList * gst_encoding_container_profile_get_profiles (GstEncodingContainerProfile *profile);
+
+
+GST_PBUTILS_API
+GstEncodingContainerProfile * gst_encoding_container_profile_new (const gchar *name,
+ const gchar *description,
+ GstCaps *format,
+ const gchar *preset);
+
+
+/* Individual stream encodingprofile API */
+
+GST_PBUTILS_API
+GstEncodingVideoProfile * gst_encoding_video_profile_new (GstCaps *format,
+ const gchar *preset,
+ GstCaps *restriction,
+ guint presence);
+
+GST_PBUTILS_API
+GstEncodingAudioProfile * gst_encoding_audio_profile_new (GstCaps *format,
+ const gchar *preset,
+ GstCaps *restriction,
+ guint presence);
+
+GST_PBUTILS_API
+guint gst_encoding_video_profile_get_pass (GstEncodingVideoProfile *prof);
+
+GST_PBUTILS_API
+gboolean gst_encoding_video_profile_get_variableframerate (GstEncodingVideoProfile *prof);
+
+GST_PBUTILS_API
+void gst_encoding_video_profile_set_pass (GstEncodingVideoProfile *prof,
+ guint pass);
+
+GST_PBUTILS_API
+void gst_encoding_video_profile_set_variableframerate (GstEncodingVideoProfile *prof,
+ gboolean variableframerate);
+
+GST_PBUTILS_API
+GstEncodingProfile * gst_encoding_profile_from_discoverer (GstDiscovererInfo *info);
+
+GST_PBUTILS_API
+GstEncodingProfile * gst_encoding_profile_copy (GstEncodingProfile *self);
+
+GST_PBUTILS_API
+void gst_encoding_profile_set_element_properties (GstEncodingProfile *self,
+ GstStructure *element_properties);
+
+GST_PBUTILS_API
+GstStructure *gst_encoding_profile_get_element_properties (GstEncodingProfile *self);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingAudioProfile, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingContainerProfile, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingProfile, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingVideoProfile, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PROFILE_H__ */
diff --git a/include/gst/pbutils/encoding-target.h b/include/gst/pbutils/encoding-target.h
new file mode 100644
index 0000000000..9a51dac55f
--- /dev/null
+++ b/include/gst/pbutils/encoding-target.h
@@ -0,0 +1,181 @@
+/* GStreamer encoding profile registry
+ * Copyright (C) 2010 Edward Hervey <edward.hervey@collabora.co.uk>
+ * (C) 2010 Nokia Corporation
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PROFILE_REGISTRY_H__
+#define __GST_PROFILE_REGISTRY_H__
+
+#include <gst/pbutils/encoding-profile.h>
+
+G_BEGIN_DECLS
+
+
+/* FIXME/UNKNOWNS
+ *
+ * Should encoding categories be well-known strings/quarks ?
+ *
+ */
+
+/**
+ * GST_ENCODING_CATEGORY_DEVICE:
+ *
+ * #GstEncodingTarget category for device-specific targets.
+ * The name of the target will usually be the constructor and model of the device,
+ * and that target will contain #GstEncodingProfiles suitable for that device.
+ */
+#define GST_ENCODING_CATEGORY_DEVICE "device"
+
+/**
+ * GST_ENCODING_CATEGORY_ONLINE_SERVICE:
+ *
+ * #GstEncodingTarget category for online-services.
+ * The name of the target will usually be the name of the online service
+ * and that target will contain #GstEncodingProfiles suitable for that online
+ * service.
+ */
+
+#define GST_ENCODING_CATEGORY_ONLINE_SERVICE "online-service"
+
+/**
+ * GST_ENCODING_CATEGORY_STORAGE_EDITING:
+ *
+ * #GstEncodingTarget category for storage, archiving and editing targets.
+ * Those targets can be lossless and/or provide very fast random access content.
+ * The name of the target will usually be the container type or editing target,
+ * and that target will contain #GstEncodingProfiles suitable for editing or
+ * storage.
+ */
+#define GST_ENCODING_CATEGORY_STORAGE_EDITING "storage-editing"
+
+/**
+ * GST_ENCODING_CATEGORY_CAPTURE:
+ *
+ * #GstEncodingTarget category for recording and capture.
+ * Targets within this category are optimized for low latency encoding.
+ */
+#define GST_ENCODING_CATEGORY_CAPTURE "capture"
+
+/**
+ * GST_ENCODING_CATEGORY_FILE_EXTENSION:
+ *
+ * #GstEncodingTarget category for file extensions.
+ * The name of the target will be the name of the file extensions possible
+ * for a particular target. Those targets are defining like 'default' formats
+ * usually used for a particular file extension.
+ */
+
+#define GST_ENCODING_CATEGORY_FILE_EXTENSION "file-extension"
+
+/**
+ * GstEncodingTarget:
+ *
+ * Collection of #GstEncodingProfile for a specific target or use-case.
+ *
+ * When being stored/loaded, targets come from a specific category, like
+ * #GST_ENCODING_CATEGORY_DEVICE.
+ */
+#define GST_TYPE_ENCODING_TARGET \
+ (gst_encoding_target_get_type ())
+#define GST_ENCODING_TARGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_TARGET, GstEncodingTarget))
+#define GST_IS_ENCODING_TARGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_TARGET))
+
+typedef struct _GstEncodingTarget GstEncodingTarget;
+typedef GObjectClass GstEncodingTargetClass;
+
+GST_PBUTILS_API
+GType gst_encoding_target_get_type (void);
+
+/**
+ * gst_encoding_target_unref:
+ * @target: a #GstEncodingTarget
+ *
+ * Decreases the reference count of the @target, possibly freeing it.
+ */
+#define gst_encoding_target_unref(target) \
+ (g_object_unref ((GObject*) target))
+
+/**
+ * gst_encoding_target_ref:
+ * @target: a #GstEncodingTarget
+ *
+ * Increases the reference count of the @target.
+ */
+#define gst_encoding_target_ref(target) \
+ (g_object_ref ((GObject*) target))
+
+GST_PBUTILS_API
+GstEncodingTarget * gst_encoding_target_new (const gchar *name,
+ const gchar *category,
+ const gchar *description,
+ const GList *profiles);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_target_get_name (GstEncodingTarget *target);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_target_get_category (GstEncodingTarget *target);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_target_get_description (GstEncodingTarget *target);
+
+GST_PBUTILS_API
+const gchar * gst_encoding_target_get_path (GstEncodingTarget *target);
+
+GST_PBUTILS_API
+const GList * gst_encoding_target_get_profiles (GstEncodingTarget *target);
+
+GST_PBUTILS_API
+GstEncodingProfile * gst_encoding_target_get_profile (GstEncodingTarget *target,
+ const gchar *name);
+
+GST_PBUTILS_API
+gboolean gst_encoding_target_add_profile (GstEncodingTarget *target,
+ GstEncodingProfile *profile);
+
+GST_PBUTILS_API
+gboolean gst_encoding_target_save (GstEncodingTarget *target,
+ GError **error);
+
+GST_PBUTILS_API
+gboolean gst_encoding_target_save_to_file (GstEncodingTarget *target,
+ const gchar *filepath,
+ GError **error);
+
+GST_PBUTILS_API
+GstEncodingTarget * gst_encoding_target_load (const gchar *name,
+ const gchar *category,
+ GError **error);
+
+GST_PBUTILS_API
+GstEncodingTarget * gst_encoding_target_load_from_file (const gchar *filepath,
+ GError **error);
+
+GST_PBUTILS_API
+GList * gst_encoding_list_available_categories (void);
+
+GST_PBUTILS_API
+GList * gst_encoding_list_all_targets (const gchar * categoryname);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingTarget, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_PROFILE_REGISTRY_H__ */
diff --git a/include/gst/pbutils/gstaudiovisualizer.h b/include/gst/pbutils/gstaudiovisualizer.h
new file mode 100644
index 0000000000..5c9fb48925
--- /dev/null
+++ b/include/gst/pbutils/gstaudiovisualizer.h
@@ -0,0 +1,112 @@
+/* GStreamer
+ * Copyright (C) <2011> Stefan Kost <ensonic@users.sf.net>
+ * Copyright (C) <2015> Luis de Bethencourt <luis@debethencourt.com>
+ *
+ * gstaudiovisualizer.c: base class for audio visualisation elements
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_VISUALIZER_H__
+#define __GST_AUDIO_VISUALIZER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+#include <gst/video/video.h>
+#include <gst/audio/audio.h>
+#include <gst/base/gstadapter.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_AUDIO_VISUALIZER (gst_audio_visualizer_get_type())
+#define GST_AUDIO_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizer))
+#define GST_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizerClass))
+#define GST_AUDIO_VISUALIZER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizerClass))
+#define GST_IS_SYNAESTHESIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_VISUALIZER))
+#define GST_IS_SYNAESTHESIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_VISUALIZER))
+typedef struct _GstAudioVisualizer GstAudioVisualizer;
+typedef struct _GstAudioVisualizerClass GstAudioVisualizerClass;
+typedef struct _GstAudioVisualizerPrivate GstAudioVisualizerPrivate;
+
+typedef void (*GstAudioVisualizerShaderFunc)(GstAudioVisualizer *scope, const GstVideoFrame *s, GstVideoFrame *d);
+
+/**
+ * GstAudioVisualizerShader:
+ * @GST_AUDIO_VISUALIZER_SHADER_NONE: no shading
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE: plain fading
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP: fade and move up
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN: fade and move down
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT: fade and move left
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT: fade and move right
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT: fade and move horizontally out
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN: fade and move horizontally in
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT: fade and move vertically out
+ * @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN: fade and move vertically in
+ *
+ * Different types of supported background shading functions.
+ */
+typedef enum {
+ GST_AUDIO_VISUALIZER_SHADER_NONE,
+ GST_AUDIO_VISUALIZER_SHADER_FADE,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
+ GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN
+} GstAudioVisualizerShader;
+
+struct _GstAudioVisualizer
+{
+ GstElement parent;
+
+ guint req_spf; /* min samples per frame wanted by the subclass */
+
+ /* video state */
+ GstVideoInfo vinfo;
+
+ /* audio state */
+ GstAudioInfo ainfo;
+
+ /*< private >*/
+ GstAudioVisualizerPrivate *priv;
+};
+
+struct _GstAudioVisualizerClass
+{
+ /*< private >*/
+ GstElementClass parent_class;
+
+ /*< public >*/
+ /* virtual function, called whenever the format changes */
+ gboolean (*setup) (GstAudioVisualizer * scope);
+
+ /* virtual function for rendering a frame */
+ gboolean (*render) (GstAudioVisualizer * scope, GstBuffer * audio, GstVideoFrame * video);
+
+ gboolean (*decide_allocation) (GstAudioVisualizer * scope, GstQuery *query);
+};
+
+GST_PBUTILS_API
+GType gst_audio_visualizer_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstAudioVisualizer, gst_object_unref)
+
+G_END_DECLS
+#endif /* __GST_AUDIO_VISUALIZER_H__ */
diff --git a/include/gst/pbutils/gstdiscoverer.h b/include/gst/pbutils/gstdiscoverer.h
new file mode 100644
index 0000000000..61a6575391
--- /dev/null
+++ b/include/gst/pbutils/gstdiscoverer.h
@@ -0,0 +1,435 @@
+/* GStreamer
+ * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
+ * 2009 Nokia Corporation
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_DISCOVERER_H_
+#define _GST_DISCOVERER_H_
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DISCOVERER_STREAM_INFO \
+ (gst_discoverer_stream_info_get_type ())
+#define GST_DISCOVERER_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_STREAM_INFO, GstDiscovererStreamInfo))
+#define GST_IS_DISCOVERER_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_STREAM_INFO))
+typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
+typedef GObjectClass GstDiscovererStreamInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_stream_info_get_type (void);
+
+/**
+ * GstDiscovererStreamInfo:
+ *
+ * Base structure for information concerning a media stream. Depending on the
+ * stream type, one can find more media-specific information in
+ * #GstDiscovererAudioInfo, #GstDiscovererVideoInfo, and
+ * #GstDiscovererContainerInfo.
+ *
+ * The #GstDiscovererStreamInfo represents the topology of the stream. Siblings
+ * can be iterated over with gst_discoverer_stream_info_get_next() and
+ * gst_discoverer_stream_info_get_previous(). Children (sub-streams) of a
+ * stream can be accessed using the #GstDiscovererContainerInfo API.
+ *
+ * As a simple example, if you run #GstDiscoverer on an AVI file with one audio
+ * and one video stream, you will get a #GstDiscovererContainerInfo
+ * corresponding to the AVI container, which in turn will have a
+ * #GstDiscovererAudioInfo sub-stream and a #GstDiscovererVideoInfo sub-stream
+ * for the audio and video streams respectively.
+ */
+#define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) g_object_ref((GObject*) info))
+#define gst_discoverer_stream_info_unref(info) (g_object_unref((GObject*) info))
+
+GST_PBUTILS_API
+GstDiscovererStreamInfo* gst_discoverer_stream_info_get_previous(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+GstDiscovererStreamInfo* gst_discoverer_stream_info_get_next(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+GstCaps* gst_discoverer_stream_info_get_caps(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+const GstTagList* gst_discoverer_stream_info_get_tags(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+const GstToc* gst_discoverer_stream_info_get_toc(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+const gchar* gst_discoverer_stream_info_get_stream_id(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_DEPRECATED_FOR(gst_discoverer_info_get_missing_elements_installer_details)
+const GstStructure* gst_discoverer_stream_info_get_misc(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
+
+GST_PBUTILS_API
+gint gst_discoverer_stream_info_get_stream_number(GstDiscovererStreamInfo *info);
+
+/**
+ * GstDiscovererContainerInfo:
+ *
+ * #GstDiscovererStreamInfo specific to container streams.
+ */
+#define GST_TYPE_DISCOVERER_CONTAINER_INFO \
+ (gst_discoverer_container_info_get_type ())
+#define GST_DISCOVERER_CONTAINER_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO, GstDiscovererContainerInfo))
+#define GST_IS_DISCOVERER_CONTAINER_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_CONTAINER_INFO))
+typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
+typedef GObjectClass GstDiscovererContainerInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_container_info_get_type (void);
+
+GST_PBUTILS_API
+GList *gst_discoverer_container_info_get_streams(GstDiscovererContainerInfo *info);
+
+GST_PBUTILS_API
+const GstTagList* gst_discoverer_container_info_get_tags(const GstDiscovererContainerInfo *info);
+
+
+/**
+ * GstDiscovererAudioInfo:
+ *
+ * #GstDiscovererStreamInfo specific to audio streams.
+ */
+#define GST_TYPE_DISCOVERER_AUDIO_INFO \
+ (gst_discoverer_audio_info_get_type ())
+#define GST_DISCOVERER_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_AUDIO_INFO, GstDiscovererAudioInfo))
+#define GST_IS_DISCOVERER_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_AUDIO_INFO))
+typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
+typedef GObjectClass GstDiscovererAudioInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_audio_info_get_type (void);
+
+GST_PBUTILS_API
+guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+guint64 gst_discoverer_audio_info_get_channel_mask(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_audio_info_get_depth(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_audio_info_get_bitrate(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_audio_info_get_max_bitrate(const GstDiscovererAudioInfo* info);
+
+GST_PBUTILS_API
+const gchar * gst_discoverer_audio_info_get_language(const GstDiscovererAudioInfo* info);
+
+/**
+ * GstDiscovererVideoInfo:
+ *
+ * #GstDiscovererStreamInfo specific to video streams (this includes images).
+ */
+#define GST_TYPE_DISCOVERER_VIDEO_INFO \
+ (gst_discoverer_video_info_get_type ())
+#define GST_DISCOVERER_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_VIDEO_INFO, GstDiscovererVideoInfo))
+#define GST_IS_DISCOVERER_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_VIDEO_INFO))
+typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
+typedef GObjectClass GstDiscovererVideoInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_video_info_get_type (void);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_width(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_height(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_depth(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_framerate_num(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_framerate_denom(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_par_num(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_par_denom(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+gboolean gst_discoverer_video_info_is_interlaced(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_bitrate(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+guint gst_discoverer_video_info_get_max_bitrate(const GstDiscovererVideoInfo* info);
+
+GST_PBUTILS_API
+gboolean gst_discoverer_video_info_is_image(const GstDiscovererVideoInfo* info);
+
+/**
+ * GstDiscovererSubtitleInfo:
+ *
+ * #GstDiscovererStreamInfo specific to subtitle streams (this includes text and
+ * image based ones).
+ */
+#define GST_TYPE_DISCOVERER_SUBTITLE_INFO \
+ (gst_discoverer_subtitle_info_get_type ())
+#define GST_DISCOVERER_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO, GstDiscovererSubtitleInfo))
+#define GST_IS_DISCOVERER_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_SUBTITLE_INFO))
+typedef struct _GstDiscovererSubtitleInfo GstDiscovererSubtitleInfo;
+typedef GObjectClass GstDiscovererSubtitleInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_subtitle_info_get_type (void);
+
+GST_PBUTILS_API
+const gchar * gst_discoverer_subtitle_info_get_language(const GstDiscovererSubtitleInfo* info);
+
+/**
+ * GstDiscovererResult:
+ * @GST_DISCOVERER_OK: The discovery was successful
+ * @GST_DISCOVERER_URI_INVALID: the URI is invalid
+ * @GST_DISCOVERER_ERROR: an error happened and the GError is set
+ * @GST_DISCOVERER_TIMEOUT: the discovery timed-out
+ * @GST_DISCOVERER_BUSY: the discoverer was already discovering a file
+ * @GST_DISCOVERER_MISSING_PLUGINS: Some plugins are missing for full discovery
+ *
+ * Result values for the discovery process.
+ */
+typedef enum {
+ GST_DISCOVERER_OK = 0,
+ GST_DISCOVERER_URI_INVALID = 1,
+ GST_DISCOVERER_ERROR = 2,
+ GST_DISCOVERER_TIMEOUT = 3,
+ GST_DISCOVERER_BUSY = 4,
+ GST_DISCOVERER_MISSING_PLUGINS = 5
+} GstDiscovererResult;
+
+/**
+ * GstDiscovererSerializeFlags:
+ * @GST_DISCOVERER_SERIALIZE_BASIC: Serialize only basic information, excluding
+ * caps, tags and miscellaneous information
+ * @GST_DISCOVERER_SERIALIZE_CAPS: Serialize the caps for each stream
+ * @GST_DISCOVERER_SERIALIZE_TAGS: Serialize the tags for each stream
+ * @GST_DISCOVERER_SERIALIZE_MISC: Serialize miscellaneous information for each stream
+ * @GST_DISCOVERER_SERIALIZE_ALL: Serialize all the available info, including
+ * caps, tags and miscellaneous information
+ *
+ * You can use these flags to control what is serialized by
+ * gst_discoverer_info_to_variant()
+ *
+ * Since: 1.6
+ */
+
+typedef enum {
+ GST_DISCOVERER_SERIALIZE_BASIC = 0,
+ GST_DISCOVERER_SERIALIZE_CAPS = 1 << 0,
+ GST_DISCOVERER_SERIALIZE_TAGS = 1 << 1,
+ GST_DISCOVERER_SERIALIZE_MISC = 1 << 2,
+ GST_DISCOVERER_SERIALIZE_ALL = GST_DISCOVERER_SERIALIZE_CAPS | GST_DISCOVERER_SERIALIZE_TAGS | GST_DISCOVERER_SERIALIZE_MISC
+} GstDiscovererSerializeFlags;
+
+/**
+ * GstDiscovererInfo:
+ *
+ * Structure containing the information of a URI analyzed by #GstDiscoverer.
+ */
+typedef struct _GstDiscovererInfo GstDiscovererInfo;
+
+#define GST_TYPE_DISCOVERER_INFO \
+ (gst_discoverer_info_get_type ())
+#define GST_DISCOVERER_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER_INFO, GstDiscovererInfo))
+#define GST_IS_DISCOVERER_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER_INFO))
+typedef GObjectClass GstDiscovererInfoClass;
+
+GST_PBUTILS_API
+GType gst_discoverer_info_get_type (void);
+
+#define gst_discoverer_info_unref(info) (g_object_unref((GObject*)info))
+#define gst_discoverer_info_ref(info) (g_object_ref((GObject*)info))
+
+GST_PBUTILS_API
+GstDiscovererInfo* gst_discoverer_info_copy (GstDiscovererInfo * ptr);
+
+GST_PBUTILS_API
+const gchar* gst_discoverer_info_get_uri(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+GstDiscovererResult gst_discoverer_info_get_result(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+GstDiscovererStreamInfo* gst_discoverer_info_get_stream_info(GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+GList* gst_discoverer_info_get_stream_list(GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+GstClockTime gst_discoverer_info_get_duration(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+gboolean gst_discoverer_info_get_seekable(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+gboolean gst_discoverer_info_get_live(const GstDiscovererInfo* info);
+
+GST_PBUTILS_DEPRECATED_FOR(gst_discoverer_info_get_missing_elements_installer_details)
+const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
+
+GST_PBUTILS_DEPRECATED
+const GstTagList* gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
+GST_PBUTILS_API
+const GstToc* gst_discoverer_info_get_toc(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+const gchar** gst_discoverer_info_get_missing_elements_installer_details(const GstDiscovererInfo* info);
+
+GST_PBUTILS_API
+GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info,
+ GType streamtype);
+
+GST_PBUTILS_API
+GList * gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info);
+
+GST_PBUTILS_API
+GList * gst_discoverer_info_get_video_streams (GstDiscovererInfo *info);
+
+GST_PBUTILS_API
+GList * gst_discoverer_info_get_subtitle_streams (GstDiscovererInfo *info);
+
+GST_PBUTILS_API
+GList * gst_discoverer_info_get_container_streams (GstDiscovererInfo *info);
+
+GST_PBUTILS_API
+GVariant * gst_discoverer_info_to_variant (GstDiscovererInfo *info,
+ GstDiscovererSerializeFlags flags);
+
+GST_PBUTILS_API
+GstDiscovererInfo * gst_discoverer_info_from_variant (GVariant *variant);
+
+GST_PBUTILS_API
+void gst_discoverer_stream_info_list_free (GList *infos);
+
+#define GST_TYPE_DISCOVERER \
+ (gst_discoverer_get_type())
+#define GST_DISCOVERER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DISCOVERER,GstDiscoverer))
+#define GST_DISCOVERER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DISCOVERER,GstDiscovererClass))
+#define GST_IS_DISCOVERER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DISCOVERER))
+#define GST_IS_DISCOVERER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DISCOVERER))
+
+typedef struct _GstDiscoverer GstDiscoverer;
+typedef struct _GstDiscovererClass GstDiscovererClass;
+typedef struct _GstDiscovererPrivate GstDiscovererPrivate;
+
+/**
+ * GstDiscoverer:
+ *
+ * The #GstDiscoverer structure.
+ **/
+struct _GstDiscoverer {
+ GObject parent;
+
+ /*< private >*/
+ GstDiscovererPrivate *priv;
+
+ gpointer _reserved[GST_PADDING];
+};
+
+struct _GstDiscovererClass {
+ GObjectClass parentclass;
+
+ /* signals */
+ void (*finished) (GstDiscoverer *discoverer);
+ void (*starting) (GstDiscoverer *discoverer);
+ void (*discovered) (GstDiscoverer *discoverer,
+ GstDiscovererInfo *info,
+ const GError *err);
+ void (*source_setup) (GstDiscoverer *discoverer,
+ GstElement *source);
+
+ gpointer _reserved[GST_PADDING];
+};
+
+GST_PBUTILS_API
+GType gst_discoverer_get_type (void);
+
+GST_PBUTILS_API
+GstDiscoverer *gst_discoverer_new (GstClockTime timeout, GError **err);
+
+/* Asynchronous API */
+
+GST_PBUTILS_API
+void gst_discoverer_start (GstDiscoverer *discoverer);
+
+GST_PBUTILS_API
+void gst_discoverer_stop (GstDiscoverer *discoverer);
+
+GST_PBUTILS_API
+gboolean gst_discoverer_discover_uri_async (GstDiscoverer *discoverer,
+ const gchar *uri);
+
+/* Synchronous API */
+
+GST_PBUTILS_API
+GstDiscovererInfo *
+gst_discoverer_discover_uri (GstDiscoverer * discoverer,
+ const gchar * uri,
+ GError ** err);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscoverer, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererAudioInfo, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererContainerInfo, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererInfo, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererStreamInfo, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererSubtitleInfo, gst_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDiscovererVideoInfo, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* _GST_DISCOVERER_H */
diff --git a/include/gst/pbutils/gstpluginsbaseversion.h b/include/gst/pbutils/gstpluginsbaseversion.h
new file mode 100644
index 0000000000..807096a8e0
--- /dev/null
+++ b/include/gst/pbutils/gstpluginsbaseversion.h
@@ -0,0 +1,79 @@
+/* GStreamer base plugins libraries version information
+ * Copyright (C) 2010 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLUGINS_BASE_VERSION_H__
+#define __GST_PLUGINS_BASE_VERSION_H__
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_PLUGINS_BASE_VERSION_MAJOR:
+ *
+ * The major version of GStreamer's gst-plugins-base libraries at compile time.
+ */
+#define GST_PLUGINS_BASE_VERSION_MAJOR (1)
+/**
+ * GST_PLUGINS_BASE_VERSION_MINOR:
+ *
+ * The minor version of GStreamer's gst-plugins-base libraries at compile time.
+ */
+#define GST_PLUGINS_BASE_VERSION_MINOR (20)
+/**
+ * GST_PLUGINS_BASE_VERSION_MICRO:
+ *
+ * The micro version of GStreamer's gst-plugins-base libraries at compile time.
+ */
+#define GST_PLUGINS_BASE_VERSION_MICRO (3)
+/**
+ * GST_PLUGINS_BASE_VERSION_NANO:
+ *
+ * The nano version of GStreamer's gst-plugins-base libraries at compile time.
+ * Actual releases have 0, GIT versions have 1, prerelease versions have 2-...
+ */
+#define GST_PLUGINS_BASE_VERSION_NANO (0)
+
+/**
+ * GST_CHECK_PLUGIN_BASE_VERSION:
+ * @major: a number indicating the major version
+ * @minor: a number indicating the minor version
+ * @micro: a number indicating the micro version
+ *
+ * Check whether a GStreamer's gst-plugins-base libraries' version equal to
+ * or greater than major.minor.micro is present.
+ */
+#define GST_CHECK_PLUGINS_BASE_VERSION(major,minor,micro) \
+ (GST_PLUGINS_BASE_VERSION_MAJOR > (major) || \
+ (GST_PLUGINS_BASE_VERSION_MAJOR == (major) && GST_PLUGINS_BASE_VERSION_MINOR > (minor)) || \
+ (GST_PLUGINS_BASE_VERSION_MAJOR == (major) && GST_PLUGINS_BASE_VERSION_MINOR == (minor) && \
+ GST_PLUGINS_BASE_VERSION_MICRO >= (micro)) || \
+ (GST_PLUGINS_BASE_VERSION_MAJOR == (major) && GST_PLUGINS_BASE_VERSION_MINOR == (minor) && \
+ GST_PLUGINS_BASE_VERSION_MICRO + 1 == (micro) && GST_PLUGINS_BASE_VERSION_NANO > 0))
+
+GST_PBUTILS_API
+void gst_plugins_base_version (guint *major, guint *minor, guint *micro, guint *nano);
+
+GST_PBUTILS_API
+gchar * gst_plugins_base_version_string (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLUGINS_BASE_VERSION_H__ */
diff --git a/include/gst/pbutils/install-plugins.h b/include/gst/pbutils/install-plugins.h
new file mode 100644
index 0000000000..4a8878d67e
--- /dev/null
+++ b/include/gst/pbutils/install-plugins.h
@@ -0,0 +1,164 @@
+/* GStreamer base utils library plugin install support for applications
+ * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2006 Ryan Lortie <desrt desrt ca>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PB_UTILS_INSTALL_PLUGINS_H__
+#define __GST_PB_UTILS_INSTALL_PLUGINS_H__
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+/*
+ * functions for use by applications to initiate installation of missing plugins
+ */
+
+/**
+ * GstInstallPluginsReturn:
+ * @GST_INSTALL_PLUGINS_SUCCESS: all of the requested plugins could be
+ * installed
+ * @GST_INSTALL_PLUGINS_NOT_FOUND: no appropriate installation candidate for
+ * any of the requested plugins could be found. Only return this if nothing
+ * has been installed. Return #GST_INSTALL_PLUGINS_PARTIAL_SUCCESS if
+ * some (but not all) of the requested plugins could be installed.
+ * @GST_INSTALL_PLUGINS_ERROR: an error occurred during the installation. If
+ * this happens, the user has already seen an error message and another
+ * one should not be displayed
+ * @GST_INSTALL_PLUGINS_CRASHED: the installer had an unclean exit code
+ * (ie. death by signal)
+ * @GST_INSTALL_PLUGINS_PARTIAL_SUCCESS: some of the requested plugins could
+ * be installed, but not all
+ * @GST_INSTALL_PLUGINS_USER_ABORT: the user has aborted the installation
+ * @GST_INSTALL_PLUGINS_INVALID: the helper returned an invalid status code
+ * @GST_INSTALL_PLUGINS_STARTED_OK: returned by gst_install_plugins_async() to
+ * indicate that everything went fine so far and the provided callback
+ * will be called with the result of the installation later
+ * @GST_INSTALL_PLUGINS_INTERNAL_FAILURE: some internal failure has
+ * occurred when trying to start the installer
+ * @GST_INSTALL_PLUGINS_HELPER_MISSING: the helper script to call the
+ * actual installer is not installed
+ * @GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS: a previously-started plugin
+ * installation is still in progress, try again later
+ *
+ * Result codes returned by gst_install_plugins_async() and
+ * gst_install_plugins_sync(), and also the result code passed to the
+ * #GstInstallPluginsResultFunc specified with gst_install_plugins_async().
+ *
+ * These codes indicate success or failure of starting an external installer
+ * program and to what extent the requested plugins could be installed.
+ */
+typedef enum {
+ /* Return codes from the installer. Returned by gst_install_plugins_sync(),
+ * or passed as result code to your #GstInstallPluginsResultFunc */
+ GST_INSTALL_PLUGINS_SUCCESS = 0,
+ GST_INSTALL_PLUGINS_NOT_FOUND = 1,
+ GST_INSTALL_PLUGINS_ERROR = 2,
+ GST_INSTALL_PLUGINS_PARTIAL_SUCCESS = 3,
+ GST_INSTALL_PLUGINS_USER_ABORT = 4,
+
+ /* Returned by gst_install_plugins_sync(), or passed as result code to your
+ * #GstInstallPluginsResultFunc */
+ GST_INSTALL_PLUGINS_CRASHED = 100,
+ GST_INSTALL_PLUGINS_INVALID,
+
+ /* Return codes from starting the external helper, may be returned by both
+ * gst_install_plugins_sync() and gst_install_plugins_async(), but should
+ * never be seen by a #GstInstallPluginsResultFunc */
+ GST_INSTALL_PLUGINS_STARTED_OK = 200,
+ GST_INSTALL_PLUGINS_INTERNAL_FAILURE,
+ GST_INSTALL_PLUGINS_HELPER_MISSING,
+ GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS
+} GstInstallPluginsReturn;
+
+/**
+ * GstInstallPluginsContext:
+ *
+ * Opaque context structure for the plugin installation. Use the provided
+ * API to set details on it.
+ */
+
+#define GST_TYPE_INSTALL_PLUGINS_CONTEXT (gst_install_plugins_context_get_type())
+
+typedef struct _GstInstallPluginsContext GstInstallPluginsContext;
+
+GST_PBUTILS_API
+GstInstallPluginsContext * gst_install_plugins_context_new (void);
+
+GST_PBUTILS_API
+GstInstallPluginsContext * gst_install_plugins_context_copy (GstInstallPluginsContext * ctx);
+GST_PBUTILS_API
+void gst_install_plugins_context_free (GstInstallPluginsContext * ctx);
+
+GST_PBUTILS_API
+void gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx,
+ gboolean confirm_search);
+
+GST_PBUTILS_API
+void gst_install_plugins_context_set_desktop_id (GstInstallPluginsContext * ctx,
+ const gchar * desktop_id);
+
+GST_PBUTILS_API
+void gst_install_plugins_context_set_startup_notification_id (GstInstallPluginsContext * ctx,
+ const gchar * startup_id);
+
+GST_PBUTILS_API
+void gst_install_plugins_context_set_xid (GstInstallPluginsContext * ctx,
+ guint xid);
+
+GST_PBUTILS_API
+GType gst_install_plugins_context_get_type (void);
+
+/**
+ * GstInstallPluginsResultFunc:
+ * @result: whether the installation of the requested plugins succeeded or not
+ * @user_data: the user data passed to gst_install_plugins_async()
+ *
+ * The prototype of the callback function that will be called once the
+ * external plugin installer program has returned. You only need to provide
+ * a callback function if you are using the asynchronous interface.
+ */
+typedef void (*GstInstallPluginsResultFunc) (GstInstallPluginsReturn result,
+ gpointer user_data);
+
+GST_PBUTILS_API
+GstInstallPluginsReturn gst_install_plugins_async (const gchar * const * details,
+ GstInstallPluginsContext * ctx,
+ GstInstallPluginsResultFunc func,
+ gpointer user_data);
+
+GST_PBUTILS_API
+GstInstallPluginsReturn gst_install_plugins_sync (const gchar * const * details,
+ GstInstallPluginsContext * ctx);
+
+GST_PBUTILS_API
+const gchar * gst_install_plugins_return_get_name (GstInstallPluginsReturn ret);
+
+GST_PBUTILS_API
+gboolean gst_install_plugins_installation_in_progress (void);
+
+GST_PBUTILS_API
+gboolean gst_install_plugins_supported (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstInstallPluginsContext, gst_install_plugins_context_free)
+
+G_END_DECLS
+
+#endif /* __GST_PB_UTILS_INSTALL_PLUGINS_H__ */
+
diff --git a/include/gst/pbutils/missing-plugins.h b/include/gst/pbutils/missing-plugins.h
new file mode 100644
index 0000000000..c1e6c42e88
--- /dev/null
+++ b/include/gst/pbutils/missing-plugins.h
@@ -0,0 +1,90 @@
+/* GStreamer base utils library missing plugins support
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PB_UTILS_MISSING_PLUGINS_H__
+#define __GST_PB_UTILS_MISSING_PLUGINS_H__
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils-prelude.h>
+
+G_BEGIN_DECLS
+
+/*
+ * functions to create missing-plugin messages, for use by plugins primarily
+ */
+
+GST_PBUTILS_API
+GstMessage * gst_missing_uri_source_message_new (GstElement * element,
+ const gchar * protocol);
+
+GST_PBUTILS_API
+GstMessage * gst_missing_uri_sink_message_new (GstElement * element,
+ const gchar * protocol);
+
+GST_PBUTILS_API
+GstMessage * gst_missing_element_message_new (GstElement * element,
+ const gchar * factory_name);
+
+GST_PBUTILS_API
+GstMessage * gst_missing_decoder_message_new (GstElement * element,
+ const GstCaps * decode_caps);
+
+GST_PBUTILS_API
+GstMessage * gst_missing_encoder_message_new (GstElement * element,
+ const GstCaps * encode_caps);
+
+/*
+ * functions for use by applications when dealing with missing-plugin messages
+ */
+
+GST_PBUTILS_API
+gchar * gst_missing_plugin_message_get_installer_detail (GstMessage * msg);
+
+GST_PBUTILS_API
+gchar * gst_missing_plugin_message_get_description (GstMessage * msg);
+
+GST_PBUTILS_API
+gboolean gst_is_missing_plugin_message (GstMessage * msg);
+
+
+/*
+ * functions for use by applications that know exactly what plugins they are
+ * missing and want to request them directly rather than just react to
+ * missing-plugin messages posted by elements such as playbin or decodebin
+ */
+
+GST_PBUTILS_API
+gchar * gst_missing_uri_source_installer_detail_new (const gchar * protocol);
+
+GST_PBUTILS_API
+gchar * gst_missing_uri_sink_installer_detail_new (const gchar * protocol);
+
+GST_PBUTILS_API
+gchar * gst_missing_element_installer_detail_new (const gchar * factory_name);
+
+GST_PBUTILS_API
+gchar * gst_missing_decoder_installer_detail_new (const GstCaps * decode_caps);
+
+GST_PBUTILS_API
+gchar * gst_missing_encoder_installer_detail_new (const GstCaps * encode_caps);
+
+G_END_DECLS
+
+#endif /* __GST_PB_UTILS_MISSING_PLUGINS_H__ */
+
diff --git a/include/gst/pbutils/pbutils-enumtypes.h b/include/gst/pbutils/pbutils-enumtypes.h
new file mode 100644
index 0000000000..3fea241e65
--- /dev/null
+++ b/include/gst/pbutils/pbutils-enumtypes.h
@@ -0,0 +1,42 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/pbutils/pbutils-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "descriptions.h" */
+
+GST_PBUTILS_API
+GType gst_pb_utils_caps_description_flags_get_type (void);
+#define GST_TYPE_PB_UTILS_CAPS_DESCRIPTION_FLAGS (gst_pb_utils_caps_description_flags_get_type())
+
+/* enumerations from "gstaudiovisualizer.h" */
+
+GST_PBUTILS_API
+GType gst_audio_visualizer_shader_get_type (void);
+#define GST_TYPE_AUDIO_VISUALIZER_SHADER (gst_audio_visualizer_shader_get_type())
+
+/* enumerations from "gstdiscoverer.h" */
+
+GST_PBUTILS_API
+GType gst_discoverer_result_get_type (void);
+#define GST_TYPE_DISCOVERER_RESULT (gst_discoverer_result_get_type())
+
+GST_PBUTILS_API
+GType gst_discoverer_serialize_flags_get_type (void);
+#define GST_TYPE_DISCOVERER_SERIALIZE_FLAGS (gst_discoverer_serialize_flags_get_type())
+
+/* enumerations from "install-plugins.h" */
+
+GST_PBUTILS_API
+GType gst_install_plugins_return_get_type (void);
+#define GST_TYPE_INSTALL_PLUGINS_RETURN (gst_install_plugins_return_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/pbutils/pbutils-prelude.h b/include/gst/pbutils/pbutils-prelude.h
new file mode 100644
index 0000000000..eefec47664
--- /dev/null
+++ b/include/gst/pbutils/pbutils-prelude.h
@@ -0,0 +1,41 @@
+/* GStreamer Plugins Base Utils Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * pbutils-prelude.h: prelude include header for gst-pbutils library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PBUTILS_PRELUDE_H__
+#define __GST_PBUTILS_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_PBUTILS
+#define GST_PBUTILS_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_PBUTILS_API GST_API_IMPORT
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_PBUTILS_DEPRECATED GST_PBUTILS_API
+#define GST_PBUTILS_DEPRECATED_FOR(f) GST_PBUTILS_API
+#else
+#define GST_PBUTILS_DEPRECATED G_DEPRECATED GST_PBUTILS_API
+#define GST_PBUTILS_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_PBUTILS_API
+#endif
+
+#endif /* __GST_PBUTILS_PRELUDE_H__ */
diff --git a/include/gst/pbutils/pbutils.h b/include/gst/pbutils/pbutils.h
new file mode 100644
index 0000000000..f04070b3a3
--- /dev/null
+++ b/include/gst/pbutils/pbutils.h
@@ -0,0 +1,44 @@
+/* GStreamer base utils library
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PB_UTILS_BASE_UTILS_H__
+#define __GST_PB_UTILS_BASE_UTILS_H__
+
+#include <gst/gst.h>
+
+#include <gst/pbutils/gstpluginsbaseversion.h>
+#include <gst/pbutils/descriptions.h>
+#include <gst/pbutils/missing-plugins.h>
+#include <gst/pbutils/install-plugins.h>
+#include <gst/pbutils/codec-utils.h>
+#include <gst/pbutils/pbutils-enumtypes.h>
+#include <gst/pbutils/gstdiscoverer.h>
+#include <gst/pbutils/encoding-profile.h>
+#include <gst/pbutils/encoding-target.h>
+#include <gst/pbutils/gstaudiovisualizer.h>
+
+G_BEGIN_DECLS
+
+GST_PBUTILS_API
+void gst_pb_utils_init (void);
+
+G_END_DECLS
+
+#endif /* __GST_PB_UTILS_BASE_UTILS_H__ */
+
diff --git a/include/gst/play/gstplay-media-info.h b/include/gst/play/gstplay-media-info.h
new file mode 100644
index 0000000000..6796a380ac
--- /dev/null
+++ b/include/gst/play/gstplay-media-info.h
@@ -0,0 +1,280 @@
+/* GStreamer
+ *
+ * Copyright (C) 2015 Brijesh Singh <brijesh.ksingh@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_MEDIA_INFO_H__
+#define __GST_PLAY_MEDIA_INFO_H__
+
+#include <gst/gst.h>
+#include <gst/play/play-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_TYPE_PLAY_STREAM_INFO:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_STREAM_INFO \
+ (gst_play_stream_info_get_type ())
+#define GST_PLAY_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_STREAM_INFO,GstPlayStreamInfo))
+#define GST_PLAY_STREAM_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_STREAM_INFO,GstPlayStreamInfo))
+#define GST_IS_PLAY_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_STREAM_INFO))
+#define GST_IS_PLAY_STREAM_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_STREAM_INFO))
+
+/**
+ * GstPlayStreamInfo:
+ *
+ * Base structure for information concerning a media stream. Depending on
+ * the stream type, one can find more media-specific information in
+ * #GstPlayVideoInfo, #GstPlayAudioInfo, #GstPlaySubtitleInfo.
+ * Since: 1.20
+ */
+typedef struct _GstPlayStreamInfo GstPlayStreamInfo;
+typedef struct _GstPlayStreamInfoClass GstPlayStreamInfoClass;
+
+GST_PLAY_API
+GType gst_play_stream_info_get_type (void);
+
+GST_PLAY_API
+gint gst_play_stream_info_get_index (const GstPlayStreamInfo *info);
+
+GST_PLAY_API
+const gchar* gst_play_stream_info_get_stream_type (const GstPlayStreamInfo *info);
+
+GST_PLAY_API
+GstTagList* gst_play_stream_info_get_tags (const GstPlayStreamInfo *info);
+
+GST_PLAY_API
+GstCaps* gst_play_stream_info_get_caps (const GstPlayStreamInfo *info);
+
+GST_PLAY_API
+const gchar* gst_play_stream_info_get_codec (const GstPlayStreamInfo *info);
+
+/**
+ * GST_TYPE_PLAY_VIDEO_INFO:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_VIDEO_INFO \
+ (gst_play_video_info_get_type ())
+#define GST_PLAY_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_VIDEO_INFO, GstPlayVideoInfo))
+#define GST_PLAY_VIDEO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((obj),GST_TYPE_PLAY_VIDEO_INFO, GstPlayVideoInfoClass))
+#define GST_IS_PLAY_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_VIDEO_INFO))
+#define GST_IS_PLAY_VIDEO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((obj),GST_TYPE_PLAY_VIDEO_INFO))
+
+/**
+ * GstPlayVideoInfo:
+ *
+ * #GstPlayStreamInfo specific to video streams.
+ * Since: 1.20
+ */
+typedef struct _GstPlayVideoInfo GstPlayVideoInfo;
+typedef struct _GstPlayVideoInfoClass GstPlayVideoInfoClass;
+
+GST_PLAY_API
+GType gst_play_video_info_get_type (void);
+
+GST_PLAY_API
+gint gst_play_video_info_get_bitrate (const GstPlayVideoInfo * info);
+
+GST_PLAY_API
+gint gst_play_video_info_get_max_bitrate (const GstPlayVideoInfo * info);
+
+GST_PLAY_API
+gint gst_play_video_info_get_width (const GstPlayVideoInfo * info);
+
+GST_PLAY_API
+gint gst_play_video_info_get_height (const GstPlayVideoInfo * info);
+
+GST_PLAY_API
+void gst_play_video_info_get_framerate (const GstPlayVideoInfo * info,
+ gint * fps_n,
+ gint * fps_d);
+
+GST_PLAY_API
+void gst_play_video_info_get_pixel_aspect_ratio (const GstPlayVideoInfo * info,
+ guint * par_n,
+ guint * par_d);
+
+/**
+ * GST_TYPE_PLAY_AUDIO_INFO:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_AUDIO_INFO \
+ (gst_play_audio_info_get_type ())
+#define GST_PLAY_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_AUDIO_INFO, GstPlayAudioInfo))
+#define GST_PLAY_AUDIO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_AUDIO_INFO, GstPlayAudioInfoClass))
+#define GST_IS_PLAY_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_AUDIO_INFO))
+#define GST_IS_PLAY_AUDIO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_AUDIO_INFO))
+
+/**
+ * GstPlayAudioInfo:
+ *
+ * #GstPlayStreamInfo specific to audio streams.
+ * Since: 1.20
+ */
+typedef struct _GstPlayAudioInfo GstPlayAudioInfo;
+typedef struct _GstPlayAudioInfoClass GstPlayAudioInfoClass;
+
+GST_PLAY_API
+GType gst_play_audio_info_get_type (void);
+
+GST_PLAY_API
+gint gst_play_audio_info_get_channels (const GstPlayAudioInfo* info);
+
+GST_PLAY_API
+gint gst_play_audio_info_get_sample_rate (const GstPlayAudioInfo* info);
+
+GST_PLAY_API
+gint gst_play_audio_info_get_bitrate (const GstPlayAudioInfo* info);
+
+GST_PLAY_API
+gint gst_play_audio_info_get_max_bitrate (const GstPlayAudioInfo* info);
+
+GST_PLAY_API
+const gchar* gst_play_audio_info_get_language (const GstPlayAudioInfo* info);
+
+/**
+ * GST_TYPE_PLAY_SUBTITLE_INFO:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_SUBTITLE_INFO \
+ (gst_play_subtitle_info_get_type ())
+#define GST_PLAY_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_SUBTITLE_INFO, GstPlaySubtitleInfo))
+#define GST_PLAY_SUBTITLE_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_SUBTITLE_INFO,GstPlaySubtitleInfoClass))
+#define GST_IS_PLAY_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_SUBTITLE_INFO))
+#define GST_IS_PLAY_SUBTITLE_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_SUBTITLE_INFO))
+
+/**
+ * GstPlaySubtitleInfo:
+ *
+ * #GstPlayStreamInfo specific to subtitle streams.
+ * Since: 1.20
+ */
+typedef struct _GstPlaySubtitleInfo GstPlaySubtitleInfo;
+typedef struct _GstPlaySubtitleInfoClass GstPlaySubtitleInfoClass;
+
+GST_PLAY_API
+GType gst_play_subtitle_info_get_type (void);
+
+GST_PLAY_API
+const gchar * gst_play_subtitle_info_get_language (const GstPlaySubtitleInfo* info);
+
+/**
+ * GST_TYPE_PLAY_MEDIA_INFO:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_MEDIA_INFO \
+ (gst_play_media_info_get_type())
+#define GST_PLAY_MEDIA_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_MEDIA_INFO,GstPlayMediaInfo))
+#define GST_PLAY_MEDIA_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_MEDIA_INFO,GstPlayMediaInfoClass))
+#define GST_IS_PLAY_MEDIA_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_MEDIA_INFO))
+#define GST_IS_PLAY_MEDIA_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_MEDIA_INFO))
+
+/**
+ * GstPlayMediaInfo:
+ *
+ * Structure containing the media information of a URI.
+ * Since: 1.20
+ */
+typedef struct _GstPlayMediaInfo GstPlayMediaInfo;
+typedef struct _GstPlayMediaInfoClass GstPlayMediaInfoClass;
+
+GST_PLAY_API
+GType gst_play_media_info_get_type (void);
+
+GST_PLAY_API
+const gchar * gst_play_media_info_get_uri (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+gboolean gst_play_media_info_is_seekable (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+gboolean gst_play_media_info_is_live (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GstClockTime gst_play_media_info_get_duration (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GList* gst_play_media_info_get_stream_list (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+guint gst_play_media_info_get_number_of_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GList* gst_play_media_info_get_video_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+guint gst_play_media_info_get_number_of_video_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GList* gst_play_media_info_get_audio_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+guint gst_play_media_info_get_number_of_audio_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GList* gst_play_media_info_get_subtitle_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+guint gst_play_media_info_get_number_of_subtitle_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GstTagList* gst_play_media_info_get_tags (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+const gchar* gst_play_media_info_get_title (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+const gchar* gst_play_media_info_get_container_format (const GstPlayMediaInfo *info);
+
+GST_PLAY_API
+GstSample* gst_play_media_info_get_image_sample (const GstPlayMediaInfo *info);
+
+GST_PLAY_DEPRECATED_FOR(gst_play_media_info_get_video_streams)
+GList* gst_play_get_video_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_DEPRECATED_FOR(gst_play_media_info_get_audio_streams)
+GList* gst_play_get_audio_streams (const GstPlayMediaInfo *info);
+
+GST_PLAY_DEPRECATED_FOR(gst_play_media_info_get_subtitle_streams)
+GList* gst_play_get_subtitle_streams (const GstPlayMediaInfo *info);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_MEDIA_INFO_H */
diff --git a/include/gst/play/gstplay-signal-adapter.h b/include/gst/play/gstplay-signal-adapter.h
new file mode 100644
index 0000000000..4159ce22df
--- /dev/null
+++ b/include/gst/play/gstplay-signal-adapter.h
@@ -0,0 +1,59 @@
+/* GStreamer
+ *
+ * Copyright (C) 2019-2020 Stephan Hesse <stephan@emliri.com>
+ * Copyright (C) 2020 Philippe Normand <philn@igalia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_SIGNAL_ADAPTER_H__
+#define __GST_PLAY_SIGNAL_ADAPTER_H__
+
+#include <gst/play/gstplay-types.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PLAY_SIGNAL_ADAPTER (gst_play_signal_adapter_get_type ())
+#define GST_IS_PLAY_SIGNAL_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY_SIGNAL_ADAPTER))
+#define GST_IS_PLAY_SIGNAL_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY_SIGNAL_ADAPTER))
+#define GST_PLAY_SIGNAL_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY_SIGNAL_ADAPTER, GstPlaySignalAdapterClass))
+#define GST_PLAY_SIGNAL_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY_SIGNAL_ADAPTER, GstPlaySignalAdapter))
+#define GST_PLAY_SIGNAL_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY_SIGNAL_ADAPTER, GstPlaySignalAdapterClass))
+
+/**
+ * GST_PLAY_SIGNAL_ADAPTER_CAST:
+ * Since: 1.20
+ */
+#define GST_PLAY_SIGNAL_ADAPTER_CAST(obj) ((GstPlaySignalAdapter*)(obj))
+
+GST_PLAY_API
+GType gst_play_signal_adapter_get_type (void);
+
+GST_PLAY_API
+GstPlaySignalAdapter * gst_play_signal_adapter_new (GstPlay * play);
+
+GST_PLAY_API
+GstPlaySignalAdapter * gst_play_signal_adapter_new_with_main_context (GstPlay * play, GMainContext * context);
+
+GST_PLAY_API
+GstPlaySignalAdapter * gst_play_signal_adapter_new_sync_emit (GstPlay * play);
+
+GST_PLAY_API
+GstPlay * gst_play_signal_adapter_get_play (GstPlaySignalAdapter * adapter);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_SIGNAL_ADAPTER_H__ */
diff --git a/include/gst/play/gstplay-types.h b/include/gst/play/gstplay-types.h
new file mode 100644
index 0000000000..da6c19f802
--- /dev/null
+++ b/include/gst/play/gstplay-types.h
@@ -0,0 +1,47 @@
+/* GStreamer
+ *
+ * Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_TYPES_H__
+#define __GST_PLAY_TYPES_H__
+
+#include <gst/gst.h>
+#include <gst/play/play-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPlay:
+ * Since: 1.20
+ */
+typedef struct _GstPlay GstPlay;
+typedef struct _GstPlayClass GstPlayClass;
+
+/**
+ * GstPlaySignalAdapter:
+ * Since: 1.20
+ */
+typedef struct _GstPlaySignalAdapter GstPlaySignalAdapter;
+typedef struct _GstPlaySignalAdapterClass GstPlaySignalAdapterClass;
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_TYPES_H__ */
+
+
diff --git a/include/gst/play/gstplay-video-overlay-video-renderer.h b/include/gst/play/gstplay-video-overlay-video-renderer.h
new file mode 100644
index 0000000000..1390f9aa7c
--- /dev/null
+++ b/include/gst/play/gstplay-video-overlay-video-renderer.h
@@ -0,0 +1,77 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_H__
+#define __GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_H__
+
+#include <gst/play/gstplay-types.h>
+#include <gst/play/gstplay-video-renderer.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPlayVideoOverlayVideoRenderer:
+ * Since: 1.20
+ */
+typedef struct _GstPlayVideoOverlayVideoRenderer
+ GstPlayVideoOverlayVideoRenderer;
+typedef struct _GstPlayVideoOverlayVideoRendererClass
+ GstPlayVideoOverlayVideoRendererClass;
+
+#define GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER (gst_play_video_overlay_video_renderer_get_type ())
+#define GST_IS_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER))
+#define GST_IS_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER))
+#define GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayVideoOverlayVideoRendererClass))
+#define GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayVideoOverlayVideoRenderer))
+#define GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayVideoOverlayVideoRendererClass))
+
+/**
+ * GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_CAST:
+ * Since: 1.20
+ */
+#define GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_CAST(obj) ((GstPlayVideoOverlayVideoRenderer*)(obj))
+
+GST_PLAY_API
+GType gst_play_video_overlay_video_renderer_get_type (void);
+
+GST_PLAY_API
+GstPlayVideoRenderer * gst_play_video_overlay_video_renderer_new (gpointer window_handle);
+
+GST_PLAY_API
+GstPlayVideoRenderer * gst_play_video_overlay_video_renderer_new_with_sink (gpointer window_handle, GstElement * video_sink);
+
+GST_PLAY_API
+void gst_play_video_overlay_video_renderer_set_window_handle (GstPlayVideoOverlayVideoRenderer * self, gpointer window_handle);
+
+GST_PLAY_API
+gpointer gst_play_video_overlay_video_renderer_get_window_handle (GstPlayVideoOverlayVideoRenderer * self);
+
+GST_PLAY_API
+void gst_play_video_overlay_video_renderer_expose (GstPlayVideoOverlayVideoRenderer * self);
+
+GST_PLAY_API
+void gst_play_video_overlay_video_renderer_set_render_rectangle (GstPlayVideoOverlayVideoRenderer * self, gint x, gint y, gint width, gint height);
+
+GST_PLAY_API
+void gst_play_video_overlay_video_renderer_get_render_rectangle (GstPlayVideoOverlayVideoRenderer * self, gint *x, gint *y, gint *width, gint *height);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_VIDEO_OVERLAY_VIDEO_RENDERER_H__ */
diff --git a/include/gst/play/gstplay-video-renderer.h b/include/gst/play/gstplay-video-renderer.h
new file mode 100644
index 0000000000..d140ba6f30
--- /dev/null
+++ b/include/gst/play/gstplay-video-renderer.h
@@ -0,0 +1,57 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_VIDEO_RENDERER_H__
+#define __GST_PLAY_VIDEO_RENDERER_H__
+
+#include <gst/gst.h>
+#include <gst/play/gstplay-types.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstPlayVideoRenderer:
+ * Since: 1.20
+ */
+typedef struct _GstPlayVideoRenderer GstPlayVideoRenderer;
+typedef struct _GstPlayVideoRendererInterface GstPlayVideoRendererInterface;
+
+#define GST_TYPE_PLAY_VIDEO_RENDERER (gst_play_video_renderer_get_type ())
+#define GST_PLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY_VIDEO_RENDERER, GstPlayVideoRenderer))
+#define GST_IS_PLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY_VIDEO_RENDERER))
+
+/**
+ * GST_PLAY_VIDEO_RENDERER_GET_INTERFACE:
+ * Since: 1.20
+ */
+#define GST_PLAY_VIDEO_RENDERER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_PLAY_VIDEO_RENDERER, GstPlayVideoRendererInterface))
+
+struct _GstPlayVideoRendererInterface {
+ GTypeInterface parent_iface;
+
+ GstElement * (*create_video_sink) (GstPlayVideoRenderer * self, GstPlay * play);
+};
+
+GST_PLAY_API
+GType gst_play_video_renderer_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_VIDEO_RENDERER_H__ */
diff --git a/include/gst/play/gstplay-visualization.h b/include/gst/play/gstplay-visualization.h
new file mode 100644
index 0000000000..6f08bf5171
--- /dev/null
+++ b/include/gst/play/gstplay-visualization.h
@@ -0,0 +1,61 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Brijesh Singh <brijesh.ksingh@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_VISUALIZATION_H__
+#define __GST_PLAY_VISUALIZATION_H__
+
+#include <gst/gst.h>
+#include <gst/play/play-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayVisualization GstPlayVisualization;
+/**
+ * GstPlayVisualization:
+ * @name: name of the visualization.
+ * @description: description of the visualization.
+ *
+ * A #GstPlayVisualization descriptor.
+ * Since: 1.20
+ */
+struct _GstPlayVisualization {
+ gchar *name;
+ gchar *description;
+};
+
+GST_PLAY_API
+GType gst_play_visualization_get_type (void);
+
+GST_PLAY_API
+GstPlayVisualization * gst_play_visualization_copy (const GstPlayVisualization *vis);
+
+GST_PLAY_API
+void gst_play_visualization_free (GstPlayVisualization *vis);
+
+GST_PLAY_API
+GstPlayVisualization ** gst_play_visualizations_get (void);
+
+GST_PLAY_API
+void gst_play_visualizations_free (GstPlayVisualization **viss);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_VISUALIZATION_H__ */
diff --git a/include/gst/play/gstplay.h b/include/gst/play/gstplay.h
new file mode 100644
index 0000000000..9ffc1e1dff
--- /dev/null
+++ b/include/gst/play/gstplay.h
@@ -0,0 +1,442 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2019-2020 Stephan Hesse <stephan@emliri.com>
+ * Copyright (C) 2020 Philippe Normand <philn@igalia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_H__
+#define __GST_PLAY_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/play/play-prelude.h>
+#include <gst/play/gstplay-types.h>
+#include <gst/play/gstplay-video-renderer.h>
+#include <gst/play/gstplay-media-info.h>
+
+G_BEGIN_DECLS
+
+GST_PLAY_API
+GType gst_play_state_get_type (void);
+
+/**
+ * GST_TYPE_PLAY_STATE:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_STATE (gst_play_state_get_type ())
+
+GST_PLAY_API
+GType gst_play_message_get_type (void);
+
+/**
+ * GST_TYPE_PLAY_MESSAGE:
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_MESSAGE (gst_play_message_get_type ())
+
+/**
+ * GstPlayState:
+ * @GST_PLAY_STATE_STOPPED: the play is stopped.
+ * @GST_PLAY_STATE_BUFFERING: the play is buffering.
+ * @GST_PLAY_STATE_PAUSED: the play is paused.
+ * @GST_PLAY_STATE_PLAYING: the play is currently playing a
+ * stream.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_PLAY_STATE_STOPPED,
+ GST_PLAY_STATE_BUFFERING,
+ GST_PLAY_STATE_PAUSED,
+ GST_PLAY_STATE_PLAYING
+} GstPlayState;
+
+/**
+ * GstPlayMessage:
+ * @GST_PLAY_MESSAGE_URI_LOADED: Source element was initalized for set URI
+ * @GST_PLAY_MESSAGE_POSITION_UPDATED: Sink position changed
+ * @GST_PLAY_MESSAGE_DURATION_CHANGED: Duration of stream changed
+ * @GST_PLAY_MESSAGE_STATE_CHANGED: State changed, see #GstPlayState
+ * @GST_PLAY_MESSAGE_BUFFERING: Pipeline is in buffering state, message contains the percentage value of the decoding buffer
+ * @GST_PLAY_MESSAGE_END_OF_STREAM: Sink has received EOS
+ * @GST_PLAY_MESSAGE_ERROR: Message contains an error
+ * @GST_PLAY_MESSAGE_WARNING: Message contains an error
+ * @GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED: Video sink received format in different dimensions than before
+ * @GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED: A media-info property has changed, message contains current #GstPlayMediaInfo
+ * @GST_PLAY_MESSAGE_VOLUME_CHANGED: The volume of the audio ouput has changed
+ * @GST_PLAY_MESSAGE_MUTE_CHANGED: Audio muting flag has been toggled
+ * @GST_PLAY_MESSAGE_SEEK_DONE: Any pending seeking operation has been completed
+ *
+ * Since: 1.20
+ *
+ * Types of messages that will be posted on the play API bus.
+ *
+ * See also #gst_play_get_message_bus()
+ *
+ */
+typedef enum
+{
+ GST_PLAY_MESSAGE_URI_LOADED,
+ GST_PLAY_MESSAGE_POSITION_UPDATED,
+ GST_PLAY_MESSAGE_DURATION_CHANGED,
+ GST_PLAY_MESSAGE_STATE_CHANGED,
+ GST_PLAY_MESSAGE_BUFFERING,
+ GST_PLAY_MESSAGE_END_OF_STREAM,
+ GST_PLAY_MESSAGE_ERROR,
+ GST_PLAY_MESSAGE_WARNING,
+ GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED,
+ GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED,
+ GST_PLAY_MESSAGE_VOLUME_CHANGED,
+ GST_PLAY_MESSAGE_MUTE_CHANGED,
+ GST_PLAY_MESSAGE_SEEK_DONE
+} GstPlayMessage;
+
+GST_PLAY_API
+const gchar *gst_play_state_get_name (GstPlayState state);
+
+GST_PLAY_API
+const gchar *gst_play_message_get_name (GstPlayMessage message_type);
+
+GST_PLAY_API
+GQuark gst_play_error_quark (void);
+
+GST_PLAY_API
+GType gst_play_error_get_type (void);
+
+/**
+ * GST_PLAY_ERROR:
+ *
+ * Since: 1.20
+ */
+#define GST_PLAY_ERROR (gst_play_error_quark ())
+
+/**
+ * GST_TYPE_PLAY_ERROR:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_ERROR (gst_play_error_get_type ())
+
+/**
+ * GstPlayError:
+ * @GST_PLAY_ERROR_FAILED: generic error.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_PLAY_ERROR_FAILED = 0
+} GstPlayError;
+
+GST_PLAY_API
+const gchar *gst_play_error_get_name (GstPlayError error);
+
+GST_PLAY_API
+GType gst_play_color_balance_type_get_type (void);
+
+/**
+ * GST_TYPE_PLAY_COLOR_BALANCE_TYPE:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_PLAY_COLOR_BALANCE_TYPE (gst_play_color_balance_type_get_type ())
+
+/**
+ * GstPlayColorBalanceType:
+ * @GST_PLAY_COLOR_BALANCE_BRIGHTNESS: brightness or black level.
+ * @GST_PLAY_COLOR_BALANCE_CONTRAST: contrast or luma gain.
+ * @GST_PLAY_COLOR_BALANCE_SATURATION: color saturation or chroma
+ * gain.
+ * @GST_PLAY_COLOR_BALANCE_HUE: hue or color balance.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_PLAY_COLOR_BALANCE_BRIGHTNESS,
+ GST_PLAY_COLOR_BALANCE_CONTRAST,
+ GST_PLAY_COLOR_BALANCE_SATURATION,
+ GST_PLAY_COLOR_BALANCE_HUE,
+} GstPlayColorBalanceType;
+
+GST_PLAY_API
+const gchar *gst_play_color_balance_type_get_name (GstPlayColorBalanceType type);
+
+#define GST_TYPE_PLAY (gst_play_get_type ())
+#define GST_IS_PLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY))
+#define GST_IS_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
+#define GST_PLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY, GstPlayClass))
+#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
+#define GST_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
+
+/**
+ * GST_PLAY_CAST:
+ * Since: 1.20
+ */
+#define GST_PLAY_CAST(obj) ((GstPlay*)(obj))
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlay, gst_object_unref)
+#endif
+
+GST_PLAY_API
+GType gst_play_get_type (void);
+
+GST_PLAY_API
+GstPlay * gst_play_new (GstPlayVideoRenderer * video_renderer);
+
+GST_PLAY_API
+GstBus * gst_play_get_message_bus (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_play (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_pause (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_stop (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_seek (GstPlay * play,
+ GstClockTime position);
+
+GST_PLAY_API
+void gst_play_set_rate (GstPlay * play,
+ gdouble rate);
+
+GST_PLAY_API
+gdouble gst_play_get_rate (GstPlay * play);
+
+GST_PLAY_API
+gchar * gst_play_get_uri (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_uri (GstPlay * play,
+ const gchar * uri);
+
+GST_PLAY_API
+gchar * gst_play_get_subtitle_uri (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_subtitle_uri (GstPlay * play,
+ const gchar *uri);
+
+GST_PLAY_API
+GstClockTime gst_play_get_position (GstPlay * play);
+
+GST_PLAY_API
+GstClockTime gst_play_get_duration (GstPlay * play);
+
+GST_PLAY_API
+gdouble gst_play_get_volume (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_volume (GstPlay * play,
+ gdouble val);
+
+GST_PLAY_API
+gboolean gst_play_get_mute (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_mute (GstPlay * play,
+ gboolean val);
+
+GST_PLAY_API
+GstElement * gst_play_get_pipeline (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_video_track_enabled (GstPlay * play,
+ gboolean enabled);
+
+GST_PLAY_API
+void gst_play_set_audio_track_enabled (GstPlay * play,
+ gboolean enabled);
+
+GST_PLAY_API
+void gst_play_set_subtitle_track_enabled (GstPlay * play,
+ gboolean enabled);
+
+GST_PLAY_API
+gboolean gst_play_set_audio_track (GstPlay *play,
+ gint stream_index);
+
+GST_PLAY_API
+gboolean gst_play_set_video_track (GstPlay *play,
+ gint stream_index);
+
+GST_PLAY_API
+gboolean gst_play_set_subtitle_track (GstPlay *play,
+ gint stream_index);
+
+GST_PLAY_API
+GstPlayMediaInfo * gst_play_get_media_info (GstPlay * play);
+
+GST_PLAY_API
+GstPlayAudioInfo * gst_play_get_current_audio_track (GstPlay * play);
+
+GST_PLAY_API
+GstPlayVideoInfo * gst_play_get_current_video_track (GstPlay * play);
+
+GST_PLAY_API
+GstPlaySubtitleInfo * gst_play_get_current_subtitle_track (GstPlay * play);
+
+GST_PLAY_API
+gboolean gst_play_set_visualization (GstPlay * play,
+ const gchar *name);
+
+GST_PLAY_API
+void gst_play_set_visualization_enabled (GstPlay * play,
+ gboolean enabled);
+
+GST_PLAY_API
+gchar * gst_play_get_current_visualization (GstPlay * play);
+
+GST_PLAY_API
+gboolean gst_play_has_color_balance (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_color_balance (GstPlay * play,
+ GstPlayColorBalanceType type,
+ gdouble value);
+
+GST_PLAY_API
+gdouble gst_play_get_color_balance (GstPlay * play,
+ GstPlayColorBalanceType type);
+
+
+GST_PLAY_API
+GstVideoMultiviewFramePacking gst_play_get_multiview_mode (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_multiview_mode (GstPlay * play,
+ GstVideoMultiviewFramePacking mode);
+
+GST_PLAY_API
+GstVideoMultiviewFlags gst_play_get_multiview_flags (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_multiview_flags (GstPlay * play,
+ GstVideoMultiviewFlags flags);
+
+GST_PLAY_API
+gint64 gst_play_get_audio_video_offset (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_audio_video_offset (GstPlay * play,
+ gint64 offset);
+
+GST_PLAY_API
+gint64 gst_play_get_subtitle_video_offset (GstPlay * play);
+
+GST_PLAY_API
+void gst_play_set_subtitle_video_offset (GstPlay * play,
+ gint64 offset);
+
+GST_PLAY_API
+gboolean gst_play_set_config (GstPlay * play,
+ GstStructure * config);
+
+GST_PLAY_API
+GstStructure * gst_play_get_config (GstPlay * play);
+
+/* helpers for configuring the config structure */
+
+GST_PLAY_API
+void gst_play_config_set_user_agent (GstStructure * config,
+ const gchar * agent);
+
+GST_PLAY_API
+gchar * gst_play_config_get_user_agent (const GstStructure * config);
+
+GST_PLAY_API
+void gst_play_config_set_position_update_interval (GstStructure * config,
+ guint interval);
+
+GST_PLAY_API
+guint gst_play_config_get_position_update_interval (const GstStructure * config);
+
+GST_PLAY_API
+void gst_play_config_set_seek_accurate (GstStructure * config, gboolean accurate);
+
+GST_PLAY_API
+gboolean gst_play_config_get_seek_accurate (const GstStructure * config);
+
+/**
+ * GstPlaySnapshotFormat:
+ * @GST_PLAY_THUMBNAIL_RAW_NATIVE: raw native format.
+ * @GST_PLAY_THUMBNAIL_RAW_xRGB: raw xRGB format.
+ * @GST_PLAY_THUMBNAIL_RAW_BGRx: raw BGRx format.
+ * @GST_PLAY_THUMBNAIL_JPG: jpeg format.
+ * @GST_PLAY_THUMBNAIL_PNG: png format.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_PLAY_THUMBNAIL_RAW_NATIVE = 0,
+ GST_PLAY_THUMBNAIL_RAW_xRGB,
+ GST_PLAY_THUMBNAIL_RAW_BGRx,
+ GST_PLAY_THUMBNAIL_JPG,
+ GST_PLAY_THUMBNAIL_PNG
+} GstPlaySnapshotFormat;
+
+GST_PLAY_API
+GstSample * gst_play_get_video_snapshot (GstPlay * play,
+ GstPlaySnapshotFormat format, const GstStructure * config);
+
+GST_PLAY_API
+gboolean gst_play_is_play_message (GstMessage *msg);
+
+GST_PLAY_API
+void gst_play_message_parse_type (GstMessage *msg, GstPlayMessage *type);
+
+GST_PLAY_API
+void gst_play_message_parse_duration_updated (GstMessage *msg, GstClockTime *duration);
+
+GST_PLAY_API
+void gst_play_message_parse_position_updated (GstMessage *msg, GstClockTime *position);
+
+GST_PLAY_API
+void gst_play_message_parse_state_changed (GstMessage *msg, GstPlayState *state);
+
+GST_PLAY_API
+void gst_play_message_parse_buffering_percent (GstMessage *msg, guint *percent);
+
+GST_PLAY_API
+void gst_play_message_parse_error (GstMessage *msg, GError **error, GstStructure **details);
+
+GST_PLAY_API
+void gst_play_message_parse_warning (GstMessage *msg, GError **error, GstStructure **details);
+
+GST_PLAY_API
+void gst_play_message_parse_video_dimensions_changed (GstMessage *msg, guint *width, guint *height);
+
+GST_PLAY_API
+void gst_play_message_parse_media_info_updated (GstMessage *msg, GstPlayMediaInfo **info);
+
+GST_PLAY_API
+void gst_play_message_parse_volume_changed (GstMessage *msg, gdouble *volume);
+
+GST_PLAY_API
+void gst_play_message_parse_muted_changed (GstMessage *msg, gboolean *muted);
+
+G_END_DECLS
+
+#endif /* __GST_PLAY_H__ */
diff --git a/include/gst/play/play-prelude.h b/include/gst/play/play-prelude.h
new file mode 100644
index 0000000000..466903eac2
--- /dev/null
+++ b/include/gst/play/play-prelude.h
@@ -0,0 +1,43 @@
+/* GStreamer Play Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * play-prelude.h: prelude include header for gst-play library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAY_PRELUDE_H__
+#define __GST_PLAY_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_PLAY_API
+# ifdef BUILDING_GST_PLAY
+# define GST_PLAY_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_PLAY_API GST_API_IMPORT
+# endif
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_PLAY_DEPRECATED GST_PLAY_API
+#define GST_PLAY_DEPRECATED_FOR(f) GST_PLAY_API
+#else
+#define GST_PLAY_DEPRECATED G_DEPRECATED GST_PLAY_API
+#define GST_PLAY_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_PLAY_API
+#endif
+
+#endif /* __GST_PLAY_PRELUDE_H__ */
diff --git a/include/gst/play/play.h b/include/gst/play/play.h
new file mode 100644
index 0000000000..b1044a5e01
--- /dev/null
+++ b/include/gst/play/play.h
@@ -0,0 +1,31 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __PLAY_H__
+#define __PLAY_H__
+
+#include <gst/play/play-prelude.h>
+#include <gst/play/gstplay.h>
+#include <gst/play/gstplay-media-info.h>
+#include <gst/play/gstplay-video-overlay-video-renderer.h>
+#include <gst/play/gstplay-visualization.h>
+#include <gst/play/gstplay-signal-adapter.h>
+
+#endif /* __PLAY_H__ */
diff --git a/include/gst/player/gstplayer-g-main-context-signal-dispatcher.h b/include/gst/player/gstplayer-g-main-context-signal-dispatcher.h
new file mode 100644
index 0000000000..d27d697497
--- /dev/null
+++ b/include/gst/player/gstplayer-g-main-context-signal-dispatcher.h
@@ -0,0 +1,50 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_H__
+#define __GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_H__
+
+#include <gst/player/gstplayer-types.h>
+#include <gst/player/gstplayer-signal-dispatcher.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayerGMainContextSignalDispatcher
+ GstPlayerGMainContextSignalDispatcher;
+typedef struct _GstPlayerGMainContextSignalDispatcherClass
+ GstPlayerGMainContextSignalDispatcherClass;
+
+#define GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER (gst_player_g_main_context_signal_dispatcher_get_type ())
+#define GST_IS_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER))
+#define GST_IS_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER))
+#define GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER, GstPlayerGMainContextSignalDispatcherClass))
+#define GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER, GstPlayerGMainContextSignalDispatcher))
+#define GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER, GstPlayerGMainContextSignalDispatcherClass))
+#define GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_CAST(obj) ((GstPlayerGMainContextSignalDispatcher*)(obj))
+
+GST_PLAYER_API
+GType gst_player_g_main_context_signal_dispatcher_get_type (void);
+
+GST_PLAYER_API
+GstPlayerSignalDispatcher * gst_player_g_main_context_signal_dispatcher_new (GMainContext * application_context);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_G_MAIN_CONTEXT_SIGNAL_DISPATCHER_H__ */
diff --git a/include/gst/player/gstplayer-media-info.h b/include/gst/player/gstplayer-media-info.h
new file mode 100644
index 0000000000..ab034b1584
--- /dev/null
+++ b/include/gst/player/gstplayer-media-info.h
@@ -0,0 +1,255 @@
+/* GStreamer
+ *
+ * Copyright (C) 2015 Brijesh Singh <brijesh.ksingh@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_MEDIA_INFO_H__
+#define __GST_PLAYER_MEDIA_INFO_H__
+
+#include <gst/gst.h>
+#include <gst/player/player-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PLAYER_STREAM_INFO \
+ (gst_player_stream_info_get_type ())
+#define GST_PLAYER_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_STREAM_INFO,GstPlayerStreamInfo))
+#define GST_PLAYER_STREAM_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_STREAM_INFO,GstPlayerStreamInfo))
+#define GST_IS_PLAYER_STREAM_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_STREAM_INFO))
+#define GST_IS_PLAYER_STREAM_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_STREAM_INFO))
+
+/**
+ * GstPlayerStreamInfo:
+ *
+ * Base structure for information concerning a media stream. Depending on
+ * the stream type, one can find more media-specific information in
+ * #GstPlayerVideoInfo, #GstPlayerAudioInfo, #GstPlayerSubtitleInfo.
+ */
+typedef struct _GstPlayerStreamInfo GstPlayerStreamInfo;
+typedef struct _GstPlayerStreamInfoClass GstPlayerStreamInfoClass;
+
+GST_PLAYER_API
+GType gst_player_stream_info_get_type (void);
+
+GST_PLAYER_API
+gint gst_player_stream_info_get_index (const GstPlayerStreamInfo *info);
+
+GST_PLAYER_API
+const gchar* gst_player_stream_info_get_stream_type (const GstPlayerStreamInfo *info);
+
+GST_PLAYER_API
+GstTagList* gst_player_stream_info_get_tags (const GstPlayerStreamInfo *info);
+
+GST_PLAYER_API
+GstCaps* gst_player_stream_info_get_caps (const GstPlayerStreamInfo *info);
+
+GST_PLAYER_API
+const gchar* gst_player_stream_info_get_codec (const GstPlayerStreamInfo *info);
+
+#define GST_TYPE_PLAYER_VIDEO_INFO \
+ (gst_player_video_info_get_type ())
+#define GST_PLAYER_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_VIDEO_INFO, GstPlayerVideoInfo))
+#define GST_PLAYER_VIDEO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((obj),GST_TYPE_PLAYER_VIDEO_INFO, GstPlayerVideoInfoClass))
+#define GST_IS_PLAYER_VIDEO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_VIDEO_INFO))
+#define GST_IS_PLAYER_VIDEO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((obj),GST_TYPE_PLAYER_VIDEO_INFO))
+
+/**
+ * GstPlayerVideoInfo:
+ *
+ * #GstPlayerStreamInfo specific to video streams.
+ */
+typedef struct _GstPlayerVideoInfo GstPlayerVideoInfo;
+typedef struct _GstPlayerVideoInfoClass GstPlayerVideoInfoClass;
+
+GST_PLAYER_API
+GType gst_player_video_info_get_type (void);
+
+GST_PLAYER_API
+gint gst_player_video_info_get_bitrate (const GstPlayerVideoInfo * info);
+
+GST_PLAYER_API
+gint gst_player_video_info_get_max_bitrate (const GstPlayerVideoInfo * info);
+
+GST_PLAYER_API
+gint gst_player_video_info_get_width (const GstPlayerVideoInfo * info);
+
+GST_PLAYER_API
+gint gst_player_video_info_get_height (const GstPlayerVideoInfo * info);
+
+GST_PLAYER_API
+void gst_player_video_info_get_framerate (const GstPlayerVideoInfo * info,
+ gint * fps_n,
+ gint * fps_d);
+
+GST_PLAYER_API
+void gst_player_video_info_get_pixel_aspect_ratio (const GstPlayerVideoInfo * info,
+ guint * par_n,
+ guint * par_d);
+
+#define GST_TYPE_PLAYER_AUDIO_INFO \
+ (gst_player_audio_info_get_type ())
+#define GST_PLAYER_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_AUDIO_INFO, GstPlayerAudioInfo))
+#define GST_PLAYER_AUDIO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_AUDIO_INFO, GstPlayerAudioInfoClass))
+#define GST_IS_PLAYER_AUDIO_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_AUDIO_INFO))
+#define GST_IS_PLAYER_AUDIO_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_AUDIO_INFO))
+
+/**
+ * GstPlayerAudioInfo:
+ *
+ * #GstPlayerStreamInfo specific to audio streams.
+ */
+typedef struct _GstPlayerAudioInfo GstPlayerAudioInfo;
+typedef struct _GstPlayerAudioInfoClass GstPlayerAudioInfoClass;
+
+GST_PLAYER_API
+GType gst_player_audio_info_get_type (void);
+
+GST_PLAYER_API
+gint gst_player_audio_info_get_channels (const GstPlayerAudioInfo* info);
+
+GST_PLAYER_API
+gint gst_player_audio_info_get_sample_rate (const GstPlayerAudioInfo* info);
+
+GST_PLAYER_API
+gint gst_player_audio_info_get_bitrate (const GstPlayerAudioInfo* info);
+
+GST_PLAYER_API
+gint gst_player_audio_info_get_max_bitrate (const GstPlayerAudioInfo* info);
+
+GST_PLAYER_API
+const gchar* gst_player_audio_info_get_language (const GstPlayerAudioInfo* info);
+
+#define GST_TYPE_PLAYER_SUBTITLE_INFO \
+ (gst_player_subtitle_info_get_type ())
+#define GST_PLAYER_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_SUBTITLE_INFO, GstPlayerSubtitleInfo))
+#define GST_PLAYER_SUBTITLE_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_SUBTITLE_INFO,GstPlayerSubtitleInfoClass))
+#define GST_IS_PLAYER_SUBTITLE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_SUBTITLE_INFO))
+#define GST_IS_PLAYER_SUBTITLE_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_SUBTITLE_INFO))
+
+/**
+ * GstPlayerSubtitleInfo:
+ *
+ * #GstPlayerStreamInfo specific to subtitle streams.
+ */
+typedef struct _GstPlayerSubtitleInfo GstPlayerSubtitleInfo;
+typedef struct _GstPlayerSubtitleInfoClass GstPlayerSubtitleInfoClass;
+
+GST_PLAYER_API
+GType gst_player_subtitle_info_get_type (void);
+
+GST_PLAYER_API
+const gchar * gst_player_subtitle_info_get_language (const GstPlayerSubtitleInfo* info);
+
+#define GST_TYPE_PLAYER_MEDIA_INFO \
+ (gst_player_media_info_get_type())
+#define GST_PLAYER_MEDIA_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAYER_MEDIA_INFO,GstPlayerMediaInfo))
+#define GST_PLAYER_MEDIA_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAYER_MEDIA_INFO,GstPlayerMediaInfoClass))
+#define GST_IS_PLAYER_MEDIA_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYER_MEDIA_INFO))
+#define GST_IS_PLAYER_MEDIA_INFO_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYER_MEDIA_INFO))
+
+/**
+ * GstPlayerMediaInfo:
+ *
+ * Structure containing the media information of a URI.
+ */
+typedef struct _GstPlayerMediaInfo GstPlayerMediaInfo;
+typedef struct _GstPlayerMediaInfoClass GstPlayerMediaInfoClass;
+
+GST_PLAYER_API
+GType gst_player_media_info_get_type (void);
+
+GST_PLAYER_API
+const gchar * gst_player_media_info_get_uri (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+gboolean gst_player_media_info_is_seekable (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+gboolean gst_player_media_info_is_live (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GstClockTime gst_player_media_info_get_duration (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GList* gst_player_media_info_get_stream_list (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+guint gst_player_media_info_get_number_of_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GList* gst_player_media_info_get_video_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+guint gst_player_media_info_get_number_of_video_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GList* gst_player_media_info_get_audio_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+guint gst_player_media_info_get_number_of_audio_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GList* gst_player_media_info_get_subtitle_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+guint gst_player_media_info_get_number_of_subtitle_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GstTagList* gst_player_media_info_get_tags (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+const gchar* gst_player_media_info_get_title (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+const gchar* gst_player_media_info_get_container_format (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_API
+GstSample* gst_player_media_info_get_image_sample (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_video_streams)
+GList* gst_player_get_video_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_audio_streams)
+GList* gst_player_get_audio_streams (const GstPlayerMediaInfo *info);
+
+GST_PLAYER_DEPRECATED_FOR(gst_player_media_info_get_subtitle_streams)
+GList* gst_player_get_subtitle_streams (const GstPlayerMediaInfo *info);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_MEDIA_INFO_H */
diff --git a/include/gst/player/gstplayer-signal-dispatcher.h b/include/gst/player/gstplayer-signal-dispatcher.h
new file mode 100644
index 0000000000..554f1e34f2
--- /dev/null
+++ b/include/gst/player/gstplayer-signal-dispatcher.h
@@ -0,0 +1,54 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_SIGNAL_DISPATCHER_H__
+#define __GST_PLAYER_SIGNAL_DISPATCHER_H__
+
+#include <gst/gst.h>
+#include <gst/player/gstplayer-types.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayerSignalDispatcher GstPlayerSignalDispatcher;
+typedef struct _GstPlayerSignalDispatcherInterface GstPlayerSignalDispatcherInterface;
+
+#define GST_TYPE_PLAYER_SIGNAL_DISPATCHER (gst_player_signal_dispatcher_get_type ())
+#define GST_PLAYER_SIGNAL_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER_SIGNAL_DISPATCHER, GstPlayerSignalDispatcher))
+#define GST_IS_PLAYER_SIGNAL_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER_SIGNAL_DISPATCHER))
+#define GST_PLAYER_SIGNAL_DISPATCHER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_PLAYER_SIGNAL_DISPATCHER, GstPlayerSignalDispatcherInterface))
+
+typedef void (*GstPlayerSignalDispatcherFunc) (gpointer data);
+
+struct _GstPlayerSignalDispatcherInterface {
+ GTypeInterface parent_iface;
+
+ void (*dispatch) (GstPlayerSignalDispatcher * self,
+ GstPlayer * player,
+ GstPlayerSignalDispatcherFunc emitter,
+ gpointer data,
+ GDestroyNotify destroy);
+};
+
+GST_PLAYER_API
+GType gst_player_signal_dispatcher_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_SIGNAL_DISPATCHER_H__ */
diff --git a/include/gst/player/gstplayer-types.h b/include/gst/player/gstplayer-types.h
new file mode 100644
index 0000000000..bed2dc34c1
--- /dev/null
+++ b/include/gst/player/gstplayer-types.h
@@ -0,0 +1,36 @@
+/* GStreamer
+ *
+ * Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_TYPES_H__
+#define __GST_PLAYER_TYPES_H__
+
+#include <gst/gst.h>
+#include <gst/player/player-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayer GstPlayer;
+typedef struct _GstPlayerClass GstPlayerClass;
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_TYPES_H__ */
+
+
diff --git a/include/gst/player/gstplayer-video-overlay-video-renderer.h b/include/gst/player/gstplayer-video-overlay-video-renderer.h
new file mode 100644
index 0000000000..7068705b59
--- /dev/null
+++ b/include/gst/player/gstplayer-video-overlay-video-renderer.h
@@ -0,0 +1,68 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_H__
+#define __GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_H__
+
+#include <gst/player/gstplayer-types.h>
+#include <gst/player/gstplayer-video-renderer.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayerVideoOverlayVideoRenderer
+ GstPlayerVideoOverlayVideoRenderer;
+typedef struct _GstPlayerVideoOverlayVideoRendererClass
+ GstPlayerVideoOverlayVideoRendererClass;
+
+#define GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER (gst_player_video_overlay_video_renderer_get_type ())
+#define GST_IS_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER))
+#define GST_IS_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER))
+#define GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayerVideoOverlayVideoRendererClass))
+#define GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayerVideoOverlayVideoRenderer))
+#define GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER, GstPlayerVideoOverlayVideoRendererClass))
+#define GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_CAST(obj) ((GstPlayerVideoOverlayVideoRenderer*)(obj))
+
+GST_PLAYER_API
+GType gst_player_video_overlay_video_renderer_get_type (void);
+
+GST_PLAYER_API
+GstPlayerVideoRenderer * gst_player_video_overlay_video_renderer_new (gpointer window_handle);
+
+GST_PLAYER_API
+GstPlayerVideoRenderer * gst_player_video_overlay_video_renderer_new_with_sink (gpointer window_handle, GstElement * video_sink);
+
+GST_PLAYER_API
+void gst_player_video_overlay_video_renderer_set_window_handle (GstPlayerVideoOverlayVideoRenderer * self, gpointer window_handle);
+
+GST_PLAYER_API
+gpointer gst_player_video_overlay_video_renderer_get_window_handle (GstPlayerVideoOverlayVideoRenderer * self);
+
+GST_PLAYER_API
+void gst_player_video_overlay_video_renderer_expose (GstPlayerVideoOverlayVideoRenderer * self);
+
+GST_PLAYER_API
+void gst_player_video_overlay_video_renderer_set_render_rectangle (GstPlayerVideoOverlayVideoRenderer * self, gint x, gint y, gint width, gint height);
+
+GST_PLAYER_API
+void gst_player_video_overlay_video_renderer_get_render_rectangle (GstPlayerVideoOverlayVideoRenderer * self, gint *x, gint *y, gint *width, gint *height);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER_H__ */
diff --git a/include/gst/player/gstplayer-video-renderer.h b/include/gst/player/gstplayer-video-renderer.h
new file mode 100644
index 0000000000..611670c141
--- /dev/null
+++ b/include/gst/player/gstplayer-video-renderer.h
@@ -0,0 +1,48 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_VIDEO_RENDERER_H__
+#define __GST_PLAYER_VIDEO_RENDERER_H__
+
+#include <gst/gst.h>
+#include <gst/player/gstplayer-types.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayerVideoRenderer GstPlayerVideoRenderer;
+typedef struct _GstPlayerVideoRendererInterface GstPlayerVideoRendererInterface;
+
+#define GST_TYPE_PLAYER_VIDEO_RENDERER (gst_player_video_renderer_get_type ())
+#define GST_PLAYER_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER_VIDEO_RENDERER, GstPlayerVideoRenderer))
+#define GST_IS_PLAYER_VIDEO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER_VIDEO_RENDERER))
+#define GST_PLAYER_VIDEO_RENDERER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_PLAYER_VIDEO_RENDERER, GstPlayerVideoRendererInterface))
+
+struct _GstPlayerVideoRendererInterface {
+ GTypeInterface parent_iface;
+
+ GstElement * (*create_video_sink) (GstPlayerVideoRenderer * self, GstPlayer * player);
+};
+
+GST_PLAYER_API
+GType gst_player_video_renderer_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_VIDEO_RENDERER_H__ */
diff --git a/include/gst/player/gstplayer-visualization.h b/include/gst/player/gstplayer-visualization.h
new file mode 100644
index 0000000000..c09a4f0c34
--- /dev/null
+++ b/include/gst/player/gstplayer-visualization.h
@@ -0,0 +1,60 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Brijesh Singh <brijesh.ksingh@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_VISUALIZATION_H__
+#define __GST_PLAYER_VISUALIZATION_H__
+
+#include <gst/gst.h>
+#include <gst/player/player-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstPlayerVisualization GstPlayerVisualization;
+/**
+ * GstPlayerVisualization:
+ * @name: name of the visualization.
+ * @description: description of the visualization.
+ *
+ * A #GstPlayerVisualization descriptor.
+ */
+struct _GstPlayerVisualization {
+ gchar *name;
+ gchar *description;
+};
+
+GST_PLAYER_API
+GType gst_player_visualization_get_type (void);
+
+GST_PLAYER_API
+GstPlayerVisualization * gst_player_visualization_copy (const GstPlayerVisualization *vis);
+
+GST_PLAYER_API
+void gst_player_visualization_free (GstPlayerVisualization *vis);
+
+GST_PLAYER_API
+GstPlayerVisualization ** gst_player_visualizations_get (void);
+
+GST_PLAYER_API
+void gst_player_visualizations_free (GstPlayerVisualization **viss);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_VISUALIZATION_H__ */
diff --git a/include/gst/player/gstplayer.h b/include/gst/player/gstplayer.h
new file mode 100644
index 0000000000..e853ed8750
--- /dev/null
+++ b/include/gst/player/gstplayer.h
@@ -0,0 +1,306 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_H__
+#define __GST_PLAYER_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/player/player-prelude.h>
+#include <gst/player/gstplayer-types.h>
+#include <gst/player/gstplayer-signal-dispatcher.h>
+#include <gst/player/gstplayer-video-renderer.h>
+#include <gst/player/gstplayer-media-info.h>
+
+G_BEGIN_DECLS
+
+GST_PLAYER_API
+GType gst_player_state_get_type (void);
+#define GST_TYPE_PLAYER_STATE (gst_player_state_get_type ())
+
+/**
+ * GstPlayerState:
+ * @GST_PLAYER_STATE_STOPPED: the player is stopped.
+ * @GST_PLAYER_STATE_BUFFERING: the player is buffering.
+ * @GST_PLAYER_STATE_PAUSED: the player is paused.
+ * @GST_PLAYER_STATE_PLAYING: the player is currently playing a
+ * stream.
+ */
+typedef enum
+{
+ GST_PLAYER_STATE_STOPPED,
+ GST_PLAYER_STATE_BUFFERING,
+ GST_PLAYER_STATE_PAUSED,
+ GST_PLAYER_STATE_PLAYING
+} GstPlayerState;
+
+GST_PLAYER_API
+const gchar *gst_player_state_get_name (GstPlayerState state);
+
+GST_PLAYER_API
+GQuark gst_player_error_quark (void);
+
+GST_PLAYER_API
+GType gst_player_error_get_type (void);
+#define GST_PLAYER_ERROR (gst_player_error_quark ())
+#define GST_TYPE_PLAYER_ERROR (gst_player_error_get_type ())
+
+/**
+ * GstPlayerError:
+ * @GST_PLAYER_ERROR_FAILED: generic error.
+ */
+typedef enum {
+ GST_PLAYER_ERROR_FAILED = 0
+} GstPlayerError;
+
+GST_PLAYER_API
+const gchar *gst_player_error_get_name (GstPlayerError error);
+
+GST_PLAYER_API
+GType gst_player_color_balance_type_get_type (void);
+#define GST_TYPE_PLAYER_COLOR_BALANCE_TYPE (gst_player_color_balance_type_get_type ())
+
+/**
+ * GstPlayerColorBalanceType:
+ * @GST_PLAYER_COLOR_BALANCE_BRIGHTNESS: brightness or black level.
+ * @GST_PLAYER_COLOR_BALANCE_CONTRAST: contrast or luma gain.
+ * @GST_PLAYER_COLOR_BALANCE_SATURATION: color saturation or chroma
+ * gain.
+ * @GST_PLAYER_COLOR_BALANCE_HUE: hue or color balance.
+ */
+typedef enum
+{
+ GST_PLAYER_COLOR_BALANCE_BRIGHTNESS,
+ GST_PLAYER_COLOR_BALANCE_CONTRAST,
+ GST_PLAYER_COLOR_BALANCE_SATURATION,
+ GST_PLAYER_COLOR_BALANCE_HUE,
+} GstPlayerColorBalanceType;
+
+GST_PLAYER_API
+const gchar *gst_player_color_balance_type_get_name (GstPlayerColorBalanceType type);
+
+#define GST_TYPE_PLAYER (gst_player_get_type ())
+#define GST_IS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER))
+#define GST_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAYER))
+#define GST_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAYER, GstPlayerClass))
+#define GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER, GstPlayer))
+#define GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAYER, GstPlayerClass))
+#define GST_PLAYER_CAST(obj) ((GstPlayer*)(obj))
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlayer, gst_object_unref)
+#endif
+
+GST_PLAYER_API
+GType gst_player_get_type (void);
+
+GST_PLAYER_API
+GstPlayer * gst_player_new (GstPlayerVideoRenderer * video_renderer, GstPlayerSignalDispatcher * signal_dispatcher);
+
+GST_PLAYER_API
+void gst_player_play (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_pause (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_stop (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_seek (GstPlayer * player,
+ GstClockTime position);
+
+GST_PLAYER_API
+void gst_player_set_rate (GstPlayer * player,
+ gdouble rate);
+
+GST_PLAYER_API
+gdouble gst_player_get_rate (GstPlayer * player);
+
+GST_PLAYER_API
+gchar * gst_player_get_uri (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_uri (GstPlayer * player,
+ const gchar * uri);
+
+GST_PLAYER_API
+gchar * gst_player_get_subtitle_uri (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_subtitle_uri (GstPlayer * player,
+ const gchar *uri);
+
+GST_PLAYER_API
+GstClockTime gst_player_get_position (GstPlayer * player);
+
+GST_PLAYER_API
+GstClockTime gst_player_get_duration (GstPlayer * player);
+
+GST_PLAYER_API
+gdouble gst_player_get_volume (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_volume (GstPlayer * player,
+ gdouble val);
+
+GST_PLAYER_API
+gboolean gst_player_get_mute (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_mute (GstPlayer * player,
+ gboolean val);
+
+GST_PLAYER_API
+GstElement * gst_player_get_pipeline (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_video_track_enabled (GstPlayer * player,
+ gboolean enabled);
+
+GST_PLAYER_API
+void gst_player_set_audio_track_enabled (GstPlayer * player,
+ gboolean enabled);
+
+GST_PLAYER_API
+void gst_player_set_subtitle_track_enabled (GstPlayer * player,
+ gboolean enabled);
+
+GST_PLAYER_API
+gboolean gst_player_set_audio_track (GstPlayer *player,
+ gint stream_index);
+
+GST_PLAYER_API
+gboolean gst_player_set_video_track (GstPlayer *player,
+ gint stream_index);
+
+GST_PLAYER_API
+gboolean gst_player_set_subtitle_track (GstPlayer *player,
+ gint stream_index);
+
+GST_PLAYER_API
+GstPlayerMediaInfo * gst_player_get_media_info (GstPlayer * player);
+
+GST_PLAYER_API
+GstPlayerAudioInfo * gst_player_get_current_audio_track (GstPlayer * player);
+
+GST_PLAYER_API
+GstPlayerVideoInfo * gst_player_get_current_video_track (GstPlayer * player);
+
+GST_PLAYER_API
+GstPlayerSubtitleInfo * gst_player_get_current_subtitle_track (GstPlayer * player);
+
+GST_PLAYER_API
+gboolean gst_player_set_visualization (GstPlayer * player,
+ const gchar *name);
+
+GST_PLAYER_API
+void gst_player_set_visualization_enabled (GstPlayer * player,
+ gboolean enabled);
+
+GST_PLAYER_API
+gchar * gst_player_get_current_visualization (GstPlayer * player);
+
+GST_PLAYER_API
+gboolean gst_player_has_color_balance (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_color_balance (GstPlayer * player,
+ GstPlayerColorBalanceType type,
+ gdouble value);
+
+GST_PLAYER_API
+gdouble gst_player_get_color_balance (GstPlayer * player,
+ GstPlayerColorBalanceType type);
+
+
+GST_PLAYER_API
+GstVideoMultiviewFramePacking gst_player_get_multiview_mode (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_multiview_mode (GstPlayer * player,
+ GstVideoMultiviewFramePacking mode);
+
+GST_PLAYER_API
+GstVideoMultiviewFlags gst_player_get_multiview_flags (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_multiview_flags (GstPlayer * player,
+ GstVideoMultiviewFlags flags);
+
+GST_PLAYER_API
+gint64 gst_player_get_audio_video_offset (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_audio_video_offset (GstPlayer * player,
+ gint64 offset);
+
+GST_PLAYER_API
+gint64 gst_player_get_subtitle_video_offset (GstPlayer * player);
+
+GST_PLAYER_API
+void gst_player_set_subtitle_video_offset (GstPlayer * player,
+ gint64 offset);
+
+GST_PLAYER_API
+gboolean gst_player_set_config (GstPlayer * player,
+ GstStructure * config);
+
+GST_PLAYER_API
+GstStructure * gst_player_get_config (GstPlayer * player);
+
+/* helpers for configuring the config structure */
+
+GST_PLAYER_API
+void gst_player_config_set_user_agent (GstStructure * config,
+ const gchar * agent);
+
+GST_PLAYER_API
+gchar * gst_player_config_get_user_agent (const GstStructure * config);
+
+GST_PLAYER_API
+void gst_player_config_set_position_update_interval (GstStructure * config,
+ guint interval);
+
+GST_PLAYER_API
+guint gst_player_config_get_position_update_interval (const GstStructure * config);
+
+GST_PLAYER_API
+void gst_player_config_set_seek_accurate (GstStructure * config, gboolean accurate);
+
+GST_PLAYER_API
+gboolean gst_player_config_get_seek_accurate (const GstStructure * config);
+
+typedef enum
+{
+ GST_PLAYER_THUMBNAIL_RAW_NATIVE = 0,
+ GST_PLAYER_THUMBNAIL_RAW_xRGB,
+ GST_PLAYER_THUMBNAIL_RAW_BGRx,
+ GST_PLAYER_THUMBNAIL_JPG,
+ GST_PLAYER_THUMBNAIL_PNG
+} GstPlayerSnapshotFormat;
+
+GST_PLAYER_API
+GstSample * gst_player_get_video_snapshot (GstPlayer * player,
+ GstPlayerSnapshotFormat format, const GstStructure * config);
+
+G_END_DECLS
+
+#endif /* __GST_PLAYER_H__ */
diff --git a/include/gst/player/player-prelude.h b/include/gst/player/player-prelude.h
new file mode 100644
index 0000000000..4b70469963
--- /dev/null
+++ b/include/gst/player/player-prelude.h
@@ -0,0 +1,43 @@
+/* GStreamer Player Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * player-prelude.h: prelude include header for gst-player library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_PLAYER_PRELUDE_H__
+#define __GST_PLAYER_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_PLAYER_API
+# ifdef BUILDING_GST_PLAYER
+# define GST_PLAYER_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_PLAYER_API GST_API_IMPORT
+# endif
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_PLAYER_DEPRECATED GST_PLAYER_API
+#define GST_PLAYER_DEPRECATED_FOR(f) GST_PLAYER_API
+#else
+#define GST_PLAYER_DEPRECATED G_DEPRECATED GST_PLAYER_API
+#define GST_PLAYER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_PLAYER_API
+#endif
+
+#endif /* __GST_PLAYER_PRELUDE_H__ */
diff --git a/include/gst/player/player.h b/include/gst/player/player.h
new file mode 100644
index 0000000000..40907c1f4b
--- /dev/null
+++ b/include/gst/player/player.h
@@ -0,0 +1,31 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __PLAYER_H__
+#define __PLAYER_H__
+
+#include <gst/player/player-prelude.h>
+#include <gst/player/gstplayer.h>
+#include <gst/player/gstplayer-media-info.h>
+#include <gst/player/gstplayer-g-main-context-signal-dispatcher.h>
+#include <gst/player/gstplayer-video-overlay-video-renderer.h>
+#include <gst/player/gstplayer-visualization.h>
+
+#endif /* __PLAYER_H__ */
diff --git a/include/gst/riff/riff-ids.h b/include/gst/riff/riff-ids.h
new file mode 100644
index 0000000000..dce937e6ad
--- /dev/null
+++ b/include/gst/riff/riff-ids.h
@@ -0,0 +1,536 @@
+/* GStreamer RIFF I/O
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * riff-ids.h: RIFF IDs and structs
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RIFF_IDS_H__
+#define __GST_RIFF_IDS_H__
+
+#include <gst/gst.h>
+#include "riff-prelude.h"
+
+G_BEGIN_DECLS
+
+/* RIFF types */
+#define GST_RIFF_RIFF_WAVE GST_MAKE_FOURCC ('W','A','V','E')
+#define GST_RIFF_RIFF_AVI GST_MAKE_FOURCC ('A','V','I',' ')
+#define GST_RIFF_RIFF_CDXA GST_MAKE_FOURCC ('C','D','X','A')
+
+/* tags */
+#define GST_RIFF_TAG_RIFF GST_MAKE_FOURCC ('R','I','F','F')
+#define GST_RIFF_TAG_AVF0 GST_MAKE_FOURCC ('A','V','F','0')
+#define GST_RIFF_TAG_RF64 GST_MAKE_FOURCC ('R','F','6','4')
+#define GST_RIFF_TAG_RIFX GST_MAKE_FOURCC ('R','I','F','X')
+#define GST_RIFF_TAG_LIST GST_MAKE_FOURCC ('L','I','S','T')
+#define GST_RIFF_TAG_avih GST_MAKE_FOURCC ('a','v','i','h')
+#define GST_RIFF_TAG_strd GST_MAKE_FOURCC ('s','t','r','d')
+#define GST_RIFF_TAG_strn GST_MAKE_FOURCC ('s','t','r','n')
+#define GST_RIFF_TAG_strh GST_MAKE_FOURCC ('s','t','r','h')
+#define GST_RIFF_TAG_strf GST_MAKE_FOURCC ('s','t','r','f')
+#define GST_RIFF_TAG_vedt GST_MAKE_FOURCC ('v','e','d','t')
+#define GST_RIFF_TAG_JUNK GST_MAKE_FOURCC ('J','U','N','K')
+#define GST_RIFF_TAG_JUNQ GST_MAKE_FOURCC ('J','U','N','Q')
+#define GST_RIFF_TAG_idx1 GST_MAKE_FOURCC ('i','d','x','1')
+#define GST_RIFF_TAG_dmlh GST_MAKE_FOURCC ('d','m','l','h')
+#define GST_RIFF_TAG_ID32 GST_MAKE_FOURCC ('I','D','3','2')
+#define GST_RIFF_TAG_id3 GST_MAKE_FOURCC ('i','d','3',' ')
+#define GST_RIFF_TAG_IDVX GST_MAKE_FOURCC ('I','D','V','X')
+/* WAV stuff */
+#define GST_RIFF_TAG_fmt GST_MAKE_FOURCC ('f','m','t',' ')
+#define GST_RIFF_TAG_data GST_MAKE_FOURCC ('d','a','t','a')
+#define GST_RIFF_TAG_plst GST_MAKE_FOURCC ('p','l','s','t')
+#define GST_RIFF_TAG_cue GST_MAKE_FOURCC ('c','u','e',' ')
+#define GST_RIFF_TAG_bext GST_MAKE_FOURCC ('b','e','x','t')
+#define GST_RIFF_TAG_BEXT GST_MAKE_FOURCC ('B','E','X','T')
+#define GST_RIFF_TAG_fact GST_MAKE_FOURCC ('f','a','c','t')
+#define GST_RIFF_TAG_acid GST_MAKE_FOURCC ('a','c','i','d')
+#define GST_RIFF_TAG_labl GST_MAKE_FOURCC ('l','a','b','l')
+#define GST_RIFF_TAG_note GST_MAKE_FOURCC ('n','o','t','e')
+#define GST_RIFF_TAG_smpl GST_MAKE_FOURCC ('s','m','p','l')
+#define GST_RIFF_TAG_inst GST_MAKE_FOURCC ('i','n','s','t')
+#define GST_RIFF_TAG_FLLR GST_MAKE_FOURCC ('F','L','L','R')
+
+/* LIST types */
+#define GST_RIFF_LIST_movi GST_MAKE_FOURCC ('m','o','v','i')
+#define GST_RIFF_LIST_hdrl GST_MAKE_FOURCC ('h','d','r','l')
+#define GST_RIFF_LIST_odml GST_MAKE_FOURCC ('o','d','m','l')
+#define GST_RIFF_LIST_strl GST_MAKE_FOURCC ('s','t','r','l')
+#define GST_RIFF_LIST_INFO GST_MAKE_FOURCC ('I','N','F','O')
+#define GST_RIFF_LIST_AVIX GST_MAKE_FOURCC ('A','V','I','X')
+#define GST_RIFF_LIST_adtl GST_MAKE_FOURCC ('a','d','t','l')
+#define GST_RIFF_LIST_ncdt GST_MAKE_FOURCC ('n','c','d','t')
+
+/* fcc types */
+#define GST_RIFF_FCC_vids GST_MAKE_FOURCC ('v','i','d','s')
+#define GST_RIFF_FCC_auds GST_MAKE_FOURCC ('a','u','d','s')
+#define GST_RIFF_FCC_pads GST_MAKE_FOURCC ('p','a','d','s')
+#define GST_RIFF_FCC_txts GST_MAKE_FOURCC ('t','x','t','s')
+#define GST_RIFF_FCC_vidc GST_MAKE_FOURCC ('v','i','d','c')
+#define GST_RIFF_FCC_iavs GST_MAKE_FOURCC ('i','a','v','s')
+/* fcc handlers */
+#define GST_RIFF_FCCH_RLE GST_MAKE_FOURCC ('R','L','E',' ')
+#define GST_RIFF_FCCH_msvc GST_MAKE_FOURCC ('m','s','v','c')
+#define GST_RIFF_FCCH_MSVC GST_MAKE_FOURCC ('M','S','V','C')
+
+/* INFO types - see http://www.saettler.com/RIFFMCI/riffmci.html */
+#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */
+#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */
+#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */
+#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */
+#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */
+#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */
+#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */
+#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */
+#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */
+#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */
+#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */
+#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */
+#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */
+#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */
+#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */
+#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */
+#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product (album) */
+#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */
+#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */
+#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */
+#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */
+#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */
+#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */
+
+#define GST_RIFF_INFO_IAAR GST_MAKE_FOURCC ('I','A','A','R') /* album artist */
+#define GST_RIFF_INFO_ITRK GST_MAKE_FOURCC ('I','T','R','K') /* track number */
+
+/* ncdt types - see http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCDT */
+#define GST_RIFF_LIST_nctg GST_MAKE_FOURCC ('n','c','t','g')
+
+/*********Chunk Names***************/
+#define GST_RIFF_FF00 GST_MAKE_FOURCC (0xFF,0xFF,0x00,0x00)
+#define GST_RIFF_00 GST_MAKE_FOURCC ('0', '0',0x00,0x00)
+#define GST_RIFF_01 GST_MAKE_FOURCC ('0', '1',0x00,0x00)
+#define GST_RIFF_02 GST_MAKE_FOURCC ('0', '2',0x00,0x00)
+#define GST_RIFF_03 GST_MAKE_FOURCC ('0', '3',0x00,0x00)
+#define GST_RIFF_04 GST_MAKE_FOURCC ('0', '4',0x00,0x00)
+#define GST_RIFF_05 GST_MAKE_FOURCC ('0', '5',0x00,0x00)
+#define GST_RIFF_06 GST_MAKE_FOURCC ('0', '6',0x00,0x00)
+#define GST_RIFF_07 GST_MAKE_FOURCC ('0', '7',0x00,0x00)
+#define GST_RIFF_00pc GST_MAKE_FOURCC ('0', '0', 'p', 'c')
+#define GST_RIFF_01pc GST_MAKE_FOURCC ('0', '1', 'p', 'c')
+#define GST_RIFF_00dc GST_MAKE_FOURCC ('0', '0', 'd', 'c')
+#define GST_RIFF_00dx GST_MAKE_FOURCC ('0', '0', 'd', 'x')
+#define GST_RIFF_00db GST_MAKE_FOURCC ('0', '0', 'd', 'b')
+#define GST_RIFF_00xx GST_MAKE_FOURCC ('0', '0', 'x', 'x')
+#define GST_RIFF_00id GST_MAKE_FOURCC ('0', '0', 'i', 'd')
+#define GST_RIFF_00rt GST_MAKE_FOURCC ('0', '0', 'r', 't')
+#define GST_RIFF_0021 GST_MAKE_FOURCC ('0', '0', '2', '1')
+#define GST_RIFF_00iv GST_MAKE_FOURCC ('0', '0', 'i', 'v')
+#define GST_RIFF_0031 GST_MAKE_FOURCC ('0', '0', '3', '1')
+#define GST_RIFF_0032 GST_MAKE_FOURCC ('0', '0', '3', '2')
+#define GST_RIFF_00vc GST_MAKE_FOURCC ('0', '0', 'v', 'c')
+#define GST_RIFF_00xm GST_MAKE_FOURCC ('0', '0', 'x', 'm')
+#define GST_RIFF_01wb GST_MAKE_FOURCC ('0', '1', 'w', 'b')
+#define GST_RIFF_01dc GST_MAKE_FOURCC ('0', '1', 'd', 'c')
+#define GST_RIFF_00__ GST_MAKE_FOURCC ('0', '0', '_', '_')
+
+/*********VIDEO CODECS**************/
+#define GST_RIFF_cram GST_MAKE_FOURCC ('c', 'r', 'a', 'm')
+#define GST_RIFF_CRAM GST_MAKE_FOURCC ('C', 'R', 'A', 'M')
+#define GST_RIFF_wham GST_MAKE_FOURCC ('w', 'h', 'a', 'm')
+#define GST_RIFF_WHAM GST_MAKE_FOURCC ('W', 'H', 'A', 'M')
+#define GST_RIFF_rgb GST_MAKE_FOURCC (0x00,0x00,0x00,0x00)
+#define GST_RIFF_RGB GST_MAKE_FOURCC ('R', 'G', 'B', ' ')
+#define GST_RIFF_RAW GST_MAKE_FOURCC ('R', 'A', 'W', ' ')
+#define GST_RIFF_DIB GST_MAKE_FOURCC ('D', 'I', 'B', ' ')
+#define GST_RIFF_rle8 GST_MAKE_FOURCC (0x01,0x00,0x00,0x00)
+#define GST_RIFF_RLE8 GST_MAKE_FOURCC ('R', 'L', 'E', '8')
+#define GST_RIFF_rle4 GST_MAKE_FOURCC (0x02,0x00,0x00,0x00)
+#define GST_RIFF_RLE4 GST_MAKE_FOURCC ('R', 'L', 'E', '4')
+#define GST_RIFF_none GST_MAKE_FOURCC (0x00,0x00,0xFF,0xFF)
+#define GST_RIFF_NONE GST_MAKE_FOURCC ('N', 'O', 'N', 'E')
+#define GST_RIFF_pack GST_MAKE_FOURCC (0x01,0x00,0xFF,0xFF)
+#define GST_RIFF_PACK GST_MAKE_FOURCC ('P', 'A', 'C', 'K')
+#define GST_RIFF_tran GST_MAKE_FOURCC (0x02,0x00,0xFF,0xFF)
+#define GST_RIFF_TRAN GST_MAKE_FOURCC ('T', 'R', 'A', 'N')
+#define GST_RIFF_ccc GST_MAKE_FOURCC (0x03,0x00,0xFF,0xFF)
+#define GST_RIFF_CCC GST_MAKE_FOURCC ('C', 'C', 'C', ' ')
+#define GST_RIFF_cyuv GST_MAKE_FOURCC ('c', 'y', 'u', 'v')
+#define GST_RIFF_CYUV GST_MAKE_FOURCC ('C', 'Y', 'U', 'V')
+#define GST_RIFF_jpeg GST_MAKE_FOURCC (0x04,0x00,0xFF,0xFF)
+#define GST_RIFF_JPEG GST_MAKE_FOURCC ('J', 'P', 'E', 'G')
+#define GST_RIFF_MJPG GST_MAKE_FOURCC ('M', 'J', 'P', 'G')
+#define GST_RIFF_mJPG GST_MAKE_FOURCC ('m', 'J', 'P', 'G')
+#define GST_RIFF_IJPG GST_MAKE_FOURCC ('I', 'J', 'P', 'G')
+#define GST_RIFF_rt21 GST_MAKE_FOURCC ('r', 't', '2', '1')
+#define GST_RIFF_RT21 GST_MAKE_FOURCC ('R', 'T', '2', '1')
+#define GST_RIFF_iv31 GST_MAKE_FOURCC ('i', 'v', '3', '1')
+#define GST_RIFF_IV31 GST_MAKE_FOURCC ('I', 'V', '3', '1')
+#define GST_RIFF_iv32 GST_MAKE_FOURCC ('i', 'v', '3', '2')
+#define GST_RIFF_IV32 GST_MAKE_FOURCC ('I', 'V', '3', '2')
+#define GST_RIFF_iv41 GST_MAKE_FOURCC ('i', 'v', '4', '1')
+#define GST_RIFF_IV41 GST_MAKE_FOURCC ('I', 'V', '4', '1')
+#define GST_RIFF_iv50 GST_MAKE_FOURCC ('i', 'v', '5', '0')
+#define GST_RIFF_IV50 GST_MAKE_FOURCC ('I', 'V', '5', '0')
+#define GST_RIFF_cvid GST_MAKE_FOURCC ('c', 'v', 'i', 'd')
+#define GST_RIFF_CVID GST_MAKE_FOURCC ('C', 'V', 'I', 'D')
+#define GST_RIFF_ULTI GST_MAKE_FOURCC ('U', 'L', 'T', 'I')
+#define GST_RIFF_ulti GST_MAKE_FOURCC ('u', 'l', 't', 'i')
+#define GST_RIFF_YUV9 GST_MAKE_FOURCC ('Y', 'U', 'V', '9')
+#define GST_RIFF_YVU9 GST_MAKE_FOURCC ('Y', 'V', 'U', '9')
+#define GST_RIFF_XMPG GST_MAKE_FOURCC ('X', 'M', 'P', 'G')
+#define GST_RIFF_xmpg GST_MAKE_FOURCC ('x', 'm', 'p', 'g')
+#define GST_RIFF_VDOW GST_MAKE_FOURCC ('V', 'D', 'O', 'W')
+#define GST_RIFF_MVI1 GST_MAKE_FOURCC ('M', 'V', 'I', '1')
+#define GST_RIFF_v422 GST_MAKE_FOURCC ('v', '4', '2', '2')
+#define GST_RIFF_V422 GST_MAKE_FOURCC ('V', '4', '2', '2')
+#define GST_RIFF_mvi1 GST_MAKE_FOURCC ('m', 'v', 'i', '1')
+#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */
+#define GST_RIFF_AURA GST_MAKE_FOURCC ('A', 'U', 'R', 'A')
+#define GST_RIFF_DMB1 GST_MAKE_FOURCC ('D', 'M', 'B', '1')
+#define GST_RIFF_dmb1 GST_MAKE_FOURCC ('d', 'm', 'b', '1')
+
+#define GST_RIFF_BW10 GST_MAKE_FOURCC ('B', 'W', '1', '0')
+#define GST_RIFF_bw10 GST_MAKE_FOURCC ('b', 'w', '1', '0')
+
+#define GST_RIFF_yuy2 GST_MAKE_FOURCC ('y', 'u', 'y', '2')
+#define GST_RIFF_YUY2 GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')
+#define GST_RIFF_YUV8 GST_MAKE_FOURCC ('Y', 'U', 'V', '8')
+#define GST_RIFF_WINX GST_MAKE_FOURCC ('W', 'I', 'N', 'X')
+#define GST_RIFF_WPY2 GST_MAKE_FOURCC ('W', 'P', 'Y', '2')
+#define GST_RIFF_m263 GST_MAKE_FOURCC ('m', '2', '6', '3')
+#define GST_RIFF_M263 GST_MAKE_FOURCC ('M', '2', '6', '3')
+#define GST_RIFF_H263 GST_MAKE_FOURCC ('H', '2', '6', '3')
+#define GST_RIFF_h263 GST_MAKE_FOURCC ('h', '2', '6', '3')
+#define GST_RIFF_i263 GST_MAKE_FOURCC ('i', '2', '6', '3')
+#define GST_RIFF_L263 GST_MAKE_FOURCC ('L', '2', '6', '3')
+#define GST_RIFF_x263 GST_MAKE_FOURCC ('x', '2', '6', '3')
+#define GST_RIFF_VSSH GST_MAKE_FOURCC ( 'V', 'S', 'S', 'H') /* H2.64 */
+
+#define GST_RIFF_Q1_0 GST_MAKE_FOURCC ('Q', '1',0x2e, '0')
+#define GST_RIFF_SFMC GST_MAKE_FOURCC ('S', 'F', 'M', 'C')
+
+#define GST_RIFF_y41p GST_MAKE_FOURCC ('y', '4', '1', 'p')
+#define GST_RIFF_Y41P GST_MAKE_FOURCC ('Y', '4', '1', 'P')
+#define GST_RIFF_yv12 GST_MAKE_FOURCC ('y', 'v', '1', '2')
+#define GST_RIFF_YV12 GST_MAKE_FOURCC ('Y', 'V', '1', '2')
+#define GST_RIFF_vixl GST_MAKE_FOURCC ('v', 'i', 'x', 'l')
+#define GST_RIFF_VIXL GST_MAKE_FOURCC ('V', 'I', 'X', 'L')
+#define GST_RIFF_iyuv GST_MAKE_FOURCC ('i', 'y', 'u', 'v')
+#define GST_RIFF_IYUV GST_MAKE_FOURCC ('I', 'Y', 'U', 'V')
+#define GST_RIFF_i420 GST_MAKE_FOURCC ('i', '4', '2', '0')
+#define GST_RIFF_I420 GST_MAKE_FOURCC ('I', '4', '2', '0')
+#define GST_RIFF_vyuy GST_MAKE_FOURCC ('v', 'y', 'u', 'y')
+#define GST_RIFF_VYUY GST_MAKE_FOURCC ('V', 'Y', 'U', 'Y')
+
+#define GST_RIFF_DIV3 GST_MAKE_FOURCC ('D', 'I', 'V', '3')
+
+#define GST_RIFF_rpza GST_MAKE_FOURCC ('r', 'p', 'z', 'a')
+/* And this here's the mistakes that need to be supported */
+#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */
+
+/*********** FND in MJPG **********/
+#define GST_RIFF_ISFT GST_MAKE_FOURCC ('I', 'S', 'F', 'T')
+#define GST_RIFF_IDIT GST_MAKE_FOURCC ('I', 'D', 'I', 'T')
+
+#define GST_RIFF_00AM GST_MAKE_FOURCC ('0', '0', 'A', 'M')
+#define GST_RIFF_DISP GST_MAKE_FOURCC ('D', 'I', 'S', 'P')
+#define GST_RIFF_ISBJ GST_MAKE_FOURCC ('I', 'S', 'B', 'J')
+
+#define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ')
+
+/* common data structures */
+typedef struct _gst_riff_strh {
+ guint32 type; /* stream type */
+ guint32 fcc_handler; /* fcc_handler */
+ guint32 flags;
+/* flags values */
+#define GST_RIFF_STRH_DISABLED 0x000000001
+#define GST_RIFF_STRH_VIDEOPALCHANGES 0x000010000
+ guint32 priority;
+ guint32 init_frames; /* initial frames (???) */
+ guint32 scale;
+ guint32 rate;
+ guint32 start;
+ guint32 length;
+ guint32 bufsize; /* suggested buffer size */
+ guint32 quality;
+ guint32 samplesize;
+ /* rcFrame, RECT structure(struct of 4 shorts)
+ gint32 left;
+ gint32 top;
+ gint32 right;
+ gint32 bottom;
+ */
+} gst_riff_strh;
+
+typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
+ guint32 size;
+ guint32 width;
+ guint32 height;
+ guint16 planes;
+ guint16 bit_cnt;
+ guint32 compression;
+ guint32 image_size;
+ guint32 xpels_meter;
+ guint32 ypels_meter;
+ guint32 num_colors; /* used colors */
+ guint32 imp_colors; /* important colors */
+ /* may be more for some codecs */
+} gst_riff_strf_vids;
+
+
+typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
+ guint16 format;
+/**** from public Microsoft RIFF docs ******/
+#define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000)
+#define GST_RIFF_WAVE_FORMAT_PCM (0x0001)
+#define GST_RIFF_WAVE_FORMAT_ADPCM (0x0002)
+#define GST_RIFF_WAVE_FORMAT_IEEE_FLOAT (0x0003)
+#define GST_RIFF_WAVE_FORMAT_VSELP (0x0004)
+#define GST_RIFF_WAVE_FORMAT_IBM_CVSD (0x0005)
+#define GST_RIFF_WAVE_FORMAT_ALAW (0x0006)
+#define GST_RIFF_WAVE_FORMAT_MULAW (0x0007)
+#define GST_RIFF_WAVE_FORMAT_WMS (0x000a) /* WMS Windows Media Audio Speech */
+#define GST_RIFF_WAVE_FORMAT_OKI_ADPCM (0x0010)
+#define GST_RIFF_WAVE_FORMAT_DVI_ADPCM (0x0011)
+#define GST_RIFF_WAVE_FORMAT_MEDIASPACE_ADPCM (0x0012)
+#define GST_RIFF_WAVE_FORMAT_SIERRA_ADPCM (0x0013)
+#define GST_RIFF_WAVE_FORMAT_G723_ADPCM (0x0014)
+#define GST_RIFF_WAVE_FORMAT_DIGISTD (0x0015)
+#define GST_RIFF_WAVE_FORMAT_DIGIFIX (0x0016)
+#define GST_RIFF_WAVE_FORMAT_DIALOGIC_OKI_ADPCM (0x0017)
+#define GST_RIFF_WAVE_FORMAT_MEDIAVISION_ADPCM (0x0018)
+#define GST_RIFF_WAVE_FORMAT_CU_CODEC (0x0019)
+#define GST_RIFF_WAVE_FORMAT_YAMAHA_ADPCM (0x0020)
+#define GST_RIFF_WAVE_FORMAT_SONARC (0x0021)
+#define GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH (0x0022)
+#define GST_RIFF_WAVE_FORMAT_ECHOSC1 (0x0023)
+#define GST_RIFF_WAVE_FORMAT_AUDIOFILE_AF36 (0x0024)
+#define GST_RIFF_WAVE_FORMAT_APTX (0x0025)
+#define GST_RIFF_WAVE_FORMAT_AUDIOFILE_AF10 (0x0026)
+#define GST_RIFF_WAVE_FORMAT_PROSODY_1612 (0x0027)
+#define GST_RIFF_WAVE_FORMAT_LRC (0x0028)
+#define GST_RIFF_WAVE_FORMAT_DOLBY_AC2 (0x0030)
+#define GST_RIFF_WAVE_FORMAT_GSM610 (0x0031)
+#define GST_RIFF_WAVE_FORMAT_MSN (0x0032)
+#define GST_RIFF_WAVE_FORMAT_ANTEX_ADPCME (0x0033)
+#define GST_RIFF_WAVE_FORMAT_CONTROL_RES_VQLPC (0x0034)
+#define GST_RIFF_WAVE_FORMAT_DIGIREAL (0x0035)
+#define GST_RIFF_WAVE_FORMAT_DIGIADPCM (0x0036)
+#define GST_RIFF_WAVE_FORMAT_CONTROL_RES_CR10 (0x0037)
+#define GST_RIFF_WAVE_FORMAT_NMS_VBXADPCM (0x0038)
+#define GST_RIFF_WAVE_FORMAT_CS_IMAADPCM (0x0039)
+#define GST_RIFF_WAVE_FORMAT_ECHOSC3 (0x003A)
+#define GST_RIFF_WAVE_FORMAT_ROCKWELL_ADPCM (0x003B)
+#define GST_RIFF_WAVE_FORMAT_ROCKWELL_DIGITALK (0x003C)
+#define GST_RIFF_WAVE_FORMAT_XEBEC (0x003D)
+#define GST_RIFF_WAVE_FORMAT_ITU_G721_ADPCM (0x0040)
+#define GST_RIFF_WAVE_FORMAT_G728_CELP (0x0041)
+#define GST_RIFF_WAVE_FORMAT_MSG723 (0x0042)
+#define GST_RIFF_WAVE_FORMAT_ITU_G726_ADPCM (0x0045)
+#define GST_RIFF_WAVE_FORMAT_MPEGL12 (0x0050)
+#define GST_RIFF_WAVE_FORMAT_RT24 (0x0052)
+#define GST_RIFF_WAVE_FORMAT_PAC (0x0053)
+#define GST_RIFF_WAVE_FORMAT_MPEGL3 (0x0055)
+#define GST_RIFF_WAVE_FORMAT_AMR_NB (0x0057)
+#define GST_RIFF_WAVE_FORMAT_AMR_WB (0x0058)
+#define GST_RIFF_WAVE_FORMAT_LUCENT_G723 (0x0059)
+#define GST_RIFF_WAVE_FORMAT_CIRRUS (0x0060)
+#define GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK4 (0x0061) /* not official */
+#define GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK3 (0x0062) /* not official */
+/* FIXME: where are these from? are they used at all? */
+#if 0
+#define GST_RIFF_WAVE_FORMAT_ESPCM (0x0061)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE (0x0062)
+#endif
+#define GST_RIFF_WAVE_FORMAT_CANOPUS_ATRAC (0x0063)
+#define GST_RIFF_WAVE_FORMAT_G726_ADPCM (0x0064)
+#define GST_RIFF_WAVE_FORMAT_G722_ADPCM (0x0065)
+#define GST_RIFF_WAVE_FORMAT_ADPCM_G722 (0x028F)
+#define GST_RIFF_WAVE_FORMAT_DSAT_DISPLAY (0x0067)
+#define GST_RIFF_WAVE_FORMAT_ADPCM_IMA_WAV (0x0069)
+/* FIXME: where are these from? are they used at all? */
+#if 0
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_BYTE_ALIGNED (0x0069)
+#endif
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_AC8 (0x0070)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_AC10 (0x0071)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_AC16 (0x0072)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_AC20 (0x0073)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_METAVOICE (0x0074)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_METASOUND (0x0075)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_RT29HW (0x0076)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_VR12 (0x0077)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_VR18 (0x0078)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_TQ40 (0x0079)
+#define GST_RIFF_WAVE_FORMAT_SOFTSOUND (0x0080)
+#define GST_RIFF_WAVE_FORMAT_VOXWARE_TQ60 (0x0081)
+#define GST_RIFF_WAVE_FORMAT_MSRT24 (0x0082)
+#define GST_RIFF_WAVE_FORMAT_G729A (0x0083)
+#define GST_RIFF_WAVE_FORMAT_MVI_MVI2 (0x0084)
+#define GST_RIFF_WAVE_FORMAT_DF_G726 (0x0085)
+#define GST_RIFF_WAVE_FORMAT_DF_GSM610 (0x0086)
+#define GST_RIFF_WAVE_FORMAT_ISIAUDIO (0x0088)
+#define GST_RIFF_WAVE_FORMAT_ONLIVE (0x0089)
+#define GST_RIFF_WAVE_FORMAT_SBC24 (0x0091)
+#define GST_RIFF_WAVE_FORMAT_DOLBY_AC3_SPDIF (0x0092)
+#define GST_RIFF_WAVE_FORMAT_MEDIASONIC_G723 (0x0093)
+#define GST_RIFF_WAVE_FORMAT_PROSODY_8KBPS (0x0094)
+#define GST_RIFF_WAVE_FORMAT_ZYXEL_ADPCM (0x0097)
+#define GST_RIFF_WAVE_FORMAT_PHILIPS_LPCBB (0x0098)
+#define GST_RIFF_WAVE_FORMAT_PACKED (0x0099)
+#define GST_RIFF_WAVE_FORMAT_MALDEN_PHONYTALK (0x00A0)
+#define GST_RIFF_WAVE_FORMAT_AAC (0x00ff)
+#define GST_RIFF_WAVE_FORMAT_RHETOREX_ADPCM (0x0100)
+#define GST_RIFF_IBM_FORMAT_MULAW (0x0101)
+#define GST_RIFF_IBM_FORMAT_ALAW (0x0102)
+#define GST_RIFF_IBM_FORMAT_ADPCM (0x0103)
+#define GST_RIFF_WAVE_FORMAT_VIVO_G723 (0x0111)
+#define GST_RIFF_WAVE_FORMAT_VIVO_SIREN (0x0112)
+#define GST_RIFF_WAVE_FORMAT_DIGITAL_G723 (0x0123)
+#define GST_RIFF_WAVE_FORMAT_SANYO_LD_ADPCM (0x0125)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_ACEPLNET (0x0130)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_ACELP4800 (0x0131)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_ACELP8V3 (0x0132)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_G729 (0x0133)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_G729A (0x0134)
+#define GST_RIFF_WAVE_FORMAT_SIPROLAB_KELVIN (0x0135)
+#define GST_RIFF_WAVE_FORMAT_G726ADPCM (0x0140)
+#define GST_RIFF_WAVE_FORMAT_QUALCOMM_PUREVOICE (0x0150)
+#define GST_RIFF_WAVE_FORMAT_QUALCOMM_HALFRATE (0x0151)
+#define GST_RIFF_WAVE_FORMAT_TUBGSM (0x0155)
+#define GST_RIFF_WAVE_FORMAT_WMAV1 (0x0160)
+#define GST_RIFF_WAVE_FORMAT_WMAV2 (0x0161)
+#define GST_RIFF_WAVE_FORMAT_WMAV3 (0x0162)
+#define GST_RIFF_WAVE_FORMAT_WMAV3_L (0x0163)
+#define GST_RIFF_WAVE_FORMAT_CREATIVE_ADPCM (0x0200)
+#define GST_RIFF_WAVE_FORMAT_CREATIVE_FASTSPEECH8 (0x0202)
+#define GST_RIFF_WAVE_FORMAT_CREATIVE_FASTSPEECH10 (0x0203)
+#define GST_RIFF_WAVE_FORMAT_UHER_ADPCM (0x0210)
+#define GST_RIFF_WAVE_FORMAT_QUARTERDECK (0x0220)
+#define GST_RIFF_WAVE_FORMAT_ILINK_VC (0x0230)
+#define GST_RIFF_WAVE_FORMAT_RAW_SPORT (0x0240)
+#define GST_RIFF_WAVE_FORMAT_IPI_HSX (0x0250)
+#define GST_RIFF_WAVE_FORMAT_IPI_RPELP (0x0251)
+#define GST_RIFF_WAVE_FORMAT_CS2 (0x0260)
+#define GST_RIFF_WAVE_FORMAT_SONY_ATRAC3 (0x0270)
+#define GST_RIFF_WAVE_FORMAT_SIREN (0x028E)
+#define GST_RIFF_WAVE_FORMAT_FM_TOWNS_SND (0x0300)
+#define GST_RIFF_WAVE_FORMAT_BTV_DIGITAL (0x0400)
+#define GST_RIFF_WAVE_FORMAT_IMC (0x0401)
+#define GST_RIFF_WAVE_FORMAT_QDESIGN_MUSIC (0x0450)
+#define GST_RIFF_WAVE_FORMAT_VME_VMPCM (0x0680)
+#define GST_RIFF_WAVE_FORMAT_TPC (0x0681)
+#define GST_RIFF_WAVE_FORMAT_OLIGSM (0x1000)
+#define GST_RIFF_WAVE_FORMAT_OLIADPCM (0x1001)
+#define GST_RIFF_WAVE_FORMAT_OLICELP (0x1002)
+#define GST_RIFF_WAVE_FORMAT_OLISBC (0x1003)
+#define GST_RIFF_WAVE_FORMAT_OLIOPR (0x1004)
+#define GST_RIFF_WAVE_FORMAT_LH_CODEC (0x1100)
+#define GST_RIFF_WAVE_FORMAT_NORRIS (0x1400)
+#define GST_RIFF_WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS (0x1500)
+#define GST_RIFF_WAVE_FORMAT_A52 (0x2000)
+#define GST_RIFF_WAVE_FORMAT_DTS (0x2001)
+#define GST_RIFF_WAVE_FORMAT_SONIC (0x2048)
+#define GST_RIFF_WAVE_FORMAT_SONIC_LS (0x2048)
+#define GST_RIFF_WAVE_FORMAT_AAC_AC (0x4143)
+#define GST_RIFF_WAVE_FORMAT_VORBIS1 (0x674f)
+#define GST_RIFF_WAVE_FORMAT_VORBIS2 (0x6750)
+#define GST_RIFF_WAVE_FORMAT_VORBIS3 (0x6751)
+#define GST_RIFF_WAVE_FORMAT_VORBIS1PLUS (0x676f)
+#define GST_RIFF_WAVE_FORMAT_VORBIS2PLUS (0x6770)
+#define GST_RIFF_WAVE_FORMAT_VORBIS3PLUS (0x6771)
+#define GST_RIFF_WAVE_FORMAT_AAC_pm (0x706d)
+#define GST_RIFF_WAVE_FORMAT_GSM_AMR_CBR (0x7A21)
+#define GST_RIFF_WAVE_FORMAT_GSM_AMR_VBR (0x7A22)
+#define GST_RIFF_WAVE_FORMAT_FLAC (0xF1AC)
+#define GST_RIFF_WAVE_FORMAT_EXTENSIBLE (0xFFFE)
+ guint16 channels;
+ guint32 rate;
+ guint32 av_bps;
+ guint16 blockalign;
+ guint16 bits_per_sample;
+#if 0
+ /* missing field */
+ guint16 extra_size;
+#endif
+} gst_riff_strf_auds;
+
+typedef struct _gst_riff_strf_iavs {
+ guint32 DVAAuxSrc;
+ guint32 DVAAuxCtl;
+ guint32 DVAAuxSrc1;
+ guint32 DVAAuxCtl1;
+ guint32 DVVAuxSrc;
+ guint32 DVVAuxCtl;
+ guint32 DVReserved1;
+ guint32 DVReserved2;
+} gst_riff_strf_iavs;
+
+typedef struct _gst_riff_index_entry {
+ guint32 id;
+ guint32 flags;
+#define GST_RIFF_IF_LIST (0x00000001L)
+#define GST_RIFF_IF_KEYFRAME (0x00000010L)
+#define GST_RIFF_IF_NO_TIME (0x00000100L)
+#define GST_RIFF_IF_COMPUSE (0x0FFF0000L)
+ guint32 offset;
+ guint32 size;
+} gst_riff_index_entry;
+
+typedef struct _gst_riff_dmlh {
+ guint32 totalframes;
+} gst_riff_dmlh;
+
+/* taken from libsndfile/wav.c (LGPL) */
+typedef struct _gst_riff_acid {
+ /* 4 bytes (int) type of file:
+ * this appears to be a bit mask,however some combinations
+ * are probably impossible and/or qualified as "errors"
+ *
+ * 0x01 On: One Shot Off: Loop
+ * 0x02 On: Root note is Set Off: No root
+ * 0x04 On: Stretch is On, Off: Stretch is OFF
+ * 0x08 On: Disk Based Off: Ram based
+ * 0x10 On: ?????????? Off: ????????? (Acidizer puts that ON)
+ */
+ guint32 loop_type;
+ /* 2 bytes (short) root note
+ * if type 0x10 is OFF : [C,C#,(...),B] -> [0x30 to 0x3B]
+ * if type 0x10 is ON : [C,C#,(...),B] -> [0x3C to 0x47]
+ * (both types fit on same MIDI pitch albeit different octaves, so who cares)
+ */
+ guint16 root_note;
+ /* 2 bytes (short) ??? always set to 0x8000
+ * 4 bytes (float) ??? seems to be always 0
+ */
+ guint16 unknown1;
+ gfloat unknown2;
+ /* 4 bytes (int) number of beats
+ * 2 bytes (short) meter denominator //always 4 in SF/ACID
+ * 2 bytes (short) meter numerator //always 4 in SF/ACID
+ * //are we sure about the order?? usually its num/denom
+ * 4 bytes (float) tempo
+ */
+ guint32 number_of_beats;
+ guint16 meter_d, meter_n;
+ gfloat tempo;
+} gst_riff_acid;
+
+G_END_DECLS
+
+#endif /* __GST_RIFF_IDS_H__ */
diff --git a/include/gst/riff/riff-media.h b/include/gst/riff/riff-media.h
new file mode 100644
index 0000000000..200bee10ce
--- /dev/null
+++ b/include/gst/riff/riff-media.h
@@ -0,0 +1,74 @@
+/* GStreamer RIFF I/O
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * riff-media.h: RIFF-id to/from caps routines
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RIFF_MEDIA_H__
+#define __GST_RIFF_MEDIA_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+#include "riff-ids.h"
+
+G_BEGIN_DECLS
+
+/*
+ * Create caos. strh/strf, strf/strd_data and codec_name can be NULL.
+ */
+
+GST_RIFF_API
+GstCaps * gst_riff_create_video_caps (guint32 codec_fcc,
+ gst_riff_strh * strh,
+ gst_riff_strf_vids * strf,
+ GstBuffer * strf_data,
+ GstBuffer * strd_data,
+ char ** codec_name);
+
+GST_RIFF_API
+GstCaps * gst_riff_create_audio_caps (guint16 codec_id,
+ gst_riff_strh * strh,
+ gst_riff_strf_auds * strf,
+ GstBuffer * strf_data,
+ GstBuffer * strd_data,
+ char ** codec_name,
+ gint channel_reorder_map[18]);
+
+GST_RIFF_API
+GstCaps * gst_riff_create_iavs_caps (guint32 codec_fcc,
+ gst_riff_strh * strh,
+ gst_riff_strf_iavs * strf,
+ GstBuffer * strf_data,
+ GstBuffer * strd_data,
+ char ** codec_name);
+/*
+ * Create template caps (includes all known types).
+ */
+
+GST_RIFF_API
+GstCaps * gst_riff_create_video_template_caps (void);
+
+GST_RIFF_API
+GstCaps * gst_riff_create_audio_template_caps (void);
+
+GST_RIFF_API
+GstCaps * gst_riff_create_iavs_template_caps (void);
+
+G_END_DECLS
+
+#endif /* __GST_RIFF_READ_H__ */
diff --git a/include/gst/riff/riff-prelude.h b/include/gst/riff/riff-prelude.h
new file mode 100644
index 0000000000..fdc932d6a5
--- /dev/null
+++ b/include/gst/riff/riff-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer RIFF Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * riff-prelude.h: prelude include header for gst-riff library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RIFF_PRELUDE_H__
+#define __GST_RIFF_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_RIFF
+#define GST_RIFF_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_RIFF_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_RIFF_PRELUDE_H__ */
diff --git a/include/gst/riff/riff-read.h b/include/gst/riff/riff-read.h
new file mode 100644
index 0000000000..77a768af96
--- /dev/null
+++ b/include/gst/riff/riff-read.h
@@ -0,0 +1,98 @@
+/* GStreamer RIFF I/O
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * riff-read.h: function declarations for parsing a RIFF file
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RIFF_READ_H__
+#define __GST_RIFF_READ_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include "riff-ids.h"
+
+G_BEGIN_DECLS
+
+/*
+ * Operate using pull_range().
+ */
+
+GST_RIFF_API
+GstFlowReturn gst_riff_read_chunk (GstElement * element,
+ GstPad * pad,
+ guint64 * offset,
+ guint32 * tag,
+ GstBuffer ** chunk_data);
+
+/*
+ * These functions operate on provided data (the caller is
+ * supposed to strip the chunk headers). The buffer is
+ * provided by the caller, the strf/strh/data are filled in
+ * by the function.
+ */
+
+GST_RIFF_API
+gboolean gst_riff_parse_chunk (GstElement * element,
+ GstBuffer * buf,
+ guint * offset,
+ guint32 * fourcc,
+ GstBuffer ** chunk_data);
+
+GST_RIFF_API
+gboolean gst_riff_parse_file_header (GstElement * element,
+ GstBuffer * buf,
+ guint32 * doctype);
+
+GST_RIFF_API
+gboolean gst_riff_parse_strh (GstElement * element,
+ GstBuffer * buf,
+ gst_riff_strh ** strh);
+
+GST_RIFF_API
+gboolean gst_riff_parse_strf_vids (GstElement * element,
+ GstBuffer * buf,
+ gst_riff_strf_vids ** strf,
+ GstBuffer ** data);
+
+GST_RIFF_API
+gboolean gst_riff_parse_strf_auds (GstElement * element,
+ GstBuffer * buf,
+ gst_riff_strf_auds ** strf,
+ GstBuffer ** data);
+
+GST_RIFF_API
+gboolean gst_riff_parse_strf_iavs (GstElement * element,
+ GstBuffer * buf,
+ gst_riff_strf_iavs ** strf,
+ GstBuffer ** data);
+
+GST_RIFF_API
+void gst_riff_parse_info (GstElement * element,
+ GstBuffer * buf,
+ GstTagList ** taglist);
+/*
+ * Init.
+ */
+
+GST_RIFF_API
+void gst_riff_init (void);
+
+G_END_DECLS
+
+#endif /* __GST_RIFF_READ_H__ */
diff --git a/include/gst/riff/riff.h b/include/gst/riff/riff.h
new file mode 100644
index 0000000000..e610305d76
--- /dev/null
+++ b/include/gst/riff/riff.h
@@ -0,0 +1,30 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstriff.h: single include header for gst-riff library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RIFF_H__
+#define __GST_RIFF_H__
+
+#include <gst/riff/riff-prelude.h>
+#include <gst/riff/riff-ids.h>
+#include <gst/riff/riff-media.h>
+#include <gst/riff/riff-read.h>
+
+#endif /* __GST_RIFF_H__ */
diff --git a/include/gst/rtp/gstrtcpbuffer.h b/include/gst/rtp/gstrtcpbuffer.h
new file mode 100644
index 0000000000..b6410a5a1f
--- /dev/null
+++ b/include/gst/rtp/gstrtcpbuffer.h
@@ -0,0 +1,671 @@
+/* GStreamer
+ * Copyright (C) <2007> Wim Taymans <wim@fluendo.com>
+ *
+ * gstrtcpbuffer.h: various helper functions to manipulate buffers
+ * with RTCP payload.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTCPBUFFER_H__
+#define __GST_RTCPBUFFER_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/rtp-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_RTCP_VERSION:
+ *
+ * The supported RTCP version 2.
+ */
+#define GST_RTCP_VERSION 2
+
+/**
+ * GstRTCPType:
+ * @GST_RTCP_TYPE_INVALID: Invalid type
+ * @GST_RTCP_TYPE_SR: Sender report
+ * @GST_RTCP_TYPE_RR: Receiver report
+ * @GST_RTCP_TYPE_SDES: Source description
+ * @GST_RTCP_TYPE_BYE: Goodbye
+ * @GST_RTCP_TYPE_APP: Application defined
+ * @GST_RTCP_TYPE_RTPFB: Transport layer feedback.
+ * @GST_RTCP_TYPE_PSFB: Payload-specific feedback.
+ * @GST_RTCP_TYPE_XR: Extended report.
+ *
+ * Different RTCP packet types.
+ */
+typedef enum
+{
+ GST_RTCP_TYPE_INVALID = 0,
+ GST_RTCP_TYPE_SR = 200,
+ GST_RTCP_TYPE_RR = 201,
+ GST_RTCP_TYPE_SDES = 202,
+ GST_RTCP_TYPE_BYE = 203,
+ GST_RTCP_TYPE_APP = 204,
+ GST_RTCP_TYPE_RTPFB = 205,
+ GST_RTCP_TYPE_PSFB = 206,
+ GST_RTCP_TYPE_XR = 207
+} GstRTCPType;
+
+/* FIXME 2.0: backwards compatibility define for enum typo */
+#define GST_RTCP_RTPFB_TYPE_RCTP_SR_REQ GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ
+
+/**
+ * GstRTCPFBType:
+ * @GST_RTCP_FB_TYPE_INVALID: Invalid type
+ * @GST_RTCP_RTPFB_TYPE_NACK: Generic NACK
+ * @GST_RTCP_RTPFB_TYPE_TMMBR: Temporary Maximum Media Stream Bit Rate Request
+ * @GST_RTCP_RTPFB_TYPE_TMMBN: Temporary Maximum Media Stream Bit Rate
+ * Notification
+ * @GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ: Request an SR packet for early
+ * synchronization
+ * @GST_RTCP_PSFB_TYPE_PLI: Picture Loss Indication
+ * @GST_RTCP_PSFB_TYPE_SLI: Slice Loss Indication
+ * @GST_RTCP_PSFB_TYPE_RPSI: Reference Picture Selection Indication
+ * @GST_RTCP_PSFB_TYPE_AFB: Application layer Feedback
+ * @GST_RTCP_PSFB_TYPE_FIR: Full Intra Request Command
+ * @GST_RTCP_PSFB_TYPE_TSTR: Temporal-Spatial Trade-off Request
+ * @GST_RTCP_PSFB_TYPE_TSTN: Temporal-Spatial Trade-off Notification
+ * @GST_RTCP_PSFB_TYPE_VBCN: Video Back Channel Message
+ *
+ * Different types of feedback messages.
+ */
+typedef enum
+{
+ /* generic */
+ GST_RTCP_FB_TYPE_INVALID = 0,
+ /* RTPFB types */
+ GST_RTCP_RTPFB_TYPE_NACK = 1,
+ /* RTPFB types assigned in RFC 5104 */
+ GST_RTCP_RTPFB_TYPE_TMMBR = 3,
+ GST_RTCP_RTPFB_TYPE_TMMBN = 4,
+ /* RTPFB types assigned in RFC 6051 */
+ GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ = 5,
+ /* draft-holmer-rmcat-transport-wide-cc-extensions-01 */
+ GST_RTCP_RTPFB_TYPE_TWCC = 15,
+
+ /* PSFB types */
+ GST_RTCP_PSFB_TYPE_PLI = 1,
+ GST_RTCP_PSFB_TYPE_SLI = 2,
+ GST_RTCP_PSFB_TYPE_RPSI = 3,
+ GST_RTCP_PSFB_TYPE_AFB = 15,
+ /* PSFB types assigned in RFC 5104 */
+ GST_RTCP_PSFB_TYPE_FIR = 4,
+ GST_RTCP_PSFB_TYPE_TSTR = 5,
+ GST_RTCP_PSFB_TYPE_TSTN = 6,
+ GST_RTCP_PSFB_TYPE_VBCN = 7,
+} GstRTCPFBType;
+
+/**
+ * GstRTCPSDESType:
+ * @GST_RTCP_SDES_INVALID: Invalid SDES entry
+ * @GST_RTCP_SDES_END: End of SDES list
+ * @GST_RTCP_SDES_CNAME: Canonical name
+ * @GST_RTCP_SDES_NAME: User name
+ * @GST_RTCP_SDES_EMAIL: User's electronic mail address
+ * @GST_RTCP_SDES_PHONE: User's phone number
+ * @GST_RTCP_SDES_LOC: Geographic user location
+ * @GST_RTCP_SDES_TOOL: Name of application or tool
+ * @GST_RTCP_SDES_NOTE: Notice about the source
+ * @GST_RTCP_SDES_PRIV: Private extensions
+ *
+ * Different types of SDES content.
+ */
+/**
+ * GST_RTCP_SDES_H323_CADDR:
+ *
+ * H.323 callable address
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_APSI:
+ *
+ * Application Specific Identifier (RFC6776)
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_RGRP:
+ *
+ * Reporting Group Identifier (RFC8861)
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_RTP_STREAM_ID:
+ *
+ * RtpStreamId SDES item (RFC8852).
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID:
+ *
+ * RepairedRtpStreamId SDES item (RFC8852).
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_CCID:
+ *
+ * CLUE CaptId (RFC8849)
+ *
+ * Since: 1.20:
+ */
+/**
+ * GST_RTCP_SDES_MID:
+ *
+ * MID SDES item (RFC8843).
+ *
+ * Since: 1.20:
+ */
+typedef enum
+{
+ GST_RTCP_SDES_INVALID = -1,
+ GST_RTCP_SDES_END = 0,
+ GST_RTCP_SDES_CNAME = 1,
+ GST_RTCP_SDES_NAME = 2,
+ GST_RTCP_SDES_EMAIL = 3,
+ GST_RTCP_SDES_PHONE = 4,
+ GST_RTCP_SDES_LOC = 5,
+ GST_RTCP_SDES_TOOL = 6,
+ GST_RTCP_SDES_NOTE = 7,
+ GST_RTCP_SDES_PRIV = 8,
+ GST_RTCP_SDES_H323_CADDR = 9,
+ GST_RTCP_SDES_APSI = 10,
+ GST_RTCP_SDES_RGRP = 11,
+ GST_RTCP_SDES_RTP_STREAM_ID = 12,
+ GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID = 13,
+ GST_RTCP_SDES_CCID = 14,
+ GST_RTCP_SDES_MID = 15,
+} GstRTCPSDESType;
+
+/**
+ * GstRTCPXRType:
+ * @GST_RTCP_XR_TYPE_INVALID: Invalid XR Report Block
+ * @GST_RTCP_XR_TYPE_LRLE: Loss RLE Report Block
+ * @GST_RTCP_XR_TYPE_DRLE: Duplicate RLE Report Block
+ * @GST_RTCP_XR_TYPE_PRT: Packet Receipt Times Report Block
+ * @GST_RTCP_XR_TYPE_RRT: Receiver Reference Time Report Block
+ * @GST_RTCP_XR_TYPE_DLRR: Delay since the last Receiver Report
+ * @GST_RTCP_XR_TYPE_SSUMM: Statistics Summary Report Block
+ * @GST_RTCP_XR_TYPE_VOIP_METRICS: VoIP Metrics Report Block
+ *
+ * Types of RTCP Extended Reports, those are defined in RFC 3611 and other RFCs
+ * according to the [IANA registry](https://www.iana.org/assignments/rtcp-xr-block-types/rtcp-xr-block-types.xhtml).
+ *
+ * Since: 1.16
+ */
+typedef enum
+{
+ GST_RTCP_XR_TYPE_INVALID = -1,
+ GST_RTCP_XR_TYPE_LRLE = 1,
+ GST_RTCP_XR_TYPE_DRLE = 2,
+ GST_RTCP_XR_TYPE_PRT = 3,
+ GST_RTCP_XR_TYPE_RRT = 4,
+ GST_RTCP_XR_TYPE_DLRR = 5,
+ GST_RTCP_XR_TYPE_SSUMM = 6,
+ GST_RTCP_XR_TYPE_VOIP_METRICS = 7
+} GstRTCPXRType;
+
+/**
+ * GST_RTCP_MAX_SDES:
+ *
+ * The maximum text length for an SDES item.
+ */
+#define GST_RTCP_MAX_SDES 255
+
+/**
+ * GST_RTCP_MAX_RB_COUNT:
+ *
+ * The maximum amount of Receiver report blocks in RR and SR messages.
+ */
+#define GST_RTCP_MAX_RB_COUNT 31
+
+/**
+ * GST_RTCP_MAX_SDES_ITEM_COUNT:
+ *
+ * The maximum amount of SDES items.
+ */
+#define GST_RTCP_MAX_SDES_ITEM_COUNT 31
+
+/**
+ * GST_RTCP_MAX_BYE_SSRC_COUNT:
+ *
+ * The maximum amount of SSRCs in a BYE packet.
+ */
+#define GST_RTCP_MAX_BYE_SSRC_COUNT 31
+
+/**
+ * GST_RTCP_VALID_MASK:
+ *
+ * Mask for version, padding bit and packet type pair
+ */
+#define GST_RTCP_VALID_MASK (0xc000 | 0x2000 | 0xfe)
+
+/**
+ * GST_RTCP_REDUCED_SIZE_VALID_MASK:
+ *
+ * Mask for version and packet type pair allowing reduced size
+ * packets, basically it accepts other types than RR and SR
+ */
+#define GST_RTCP_REDUCED_SIZE_VALID_MASK (0xc000 | 0xf8)
+
+/**
+ * GST_RTCP_VALID_VALUE:
+ *
+ * Valid value for the first two bytes of an RTCP packet after applying
+ * #GST_RTCP_VALID_MASK to them.
+ */
+#define GST_RTCP_VALID_VALUE ((GST_RTCP_VERSION << 14) | GST_RTCP_TYPE_SR)
+
+typedef struct _GstRTCPBuffer GstRTCPBuffer;
+typedef struct _GstRTCPPacket GstRTCPPacket;
+
+struct _GstRTCPBuffer
+{
+ GstBuffer *buffer;
+ GstMapInfo map;
+};
+
+#define GST_RTCP_BUFFER_INIT { NULL, GST_MAP_INFO_INIT }
+
+/**
+ * GstRTCPPacket:
+ * @rtcp: pointer to RTCP buffer
+ * @offset: offset of packet in buffer data
+ *
+ * Data structure that points to a packet at @offset in @buffer.
+ * The size of the structure is made public to allow stack allocations.
+ */
+struct _GstRTCPPacket
+{
+ /*< public >*/
+ GstRTCPBuffer *rtcp;
+ guint offset;
+
+ /*< private >*/
+ gboolean padding; /* padding field of current packet */
+ guint8 count; /* count field of current packet */
+ GstRTCPType type; /* type of current packet */
+ guint16 length; /* length of current packet in 32-bits words minus one, this is validated when doing _get_first_packet() and _move_to_next() */
+
+ guint item_offset; /* current item offset for navigating SDES */
+ guint item_count; /* current item count */
+ guint entry_offset; /* current entry offset for navigating SDES items */
+};
+
+/* creating buffers */
+
+GST_RTP_API
+GstBuffer* gst_rtcp_buffer_new_take_data (gpointer data, guint len);
+
+GST_RTP_API
+GstBuffer* gst_rtcp_buffer_new_copy_data (gconstpointer data, guint len);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_validate_data (guint8 *data, guint len);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_validate (GstBuffer *buffer);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_validate_data_reduced (guint8 *data, guint len);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_validate_reduced (GstBuffer *buffer);
+
+
+GST_RTP_API
+GstBuffer* gst_rtcp_buffer_new (guint mtu);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_map (GstBuffer *buffer, GstMapFlags flags, GstRTCPBuffer *rtcp);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_unmap (GstRTCPBuffer *rtcp);
+
+/* adding/retrieving packets */
+
+GST_RTP_API
+guint gst_rtcp_buffer_get_packet_count (GstRTCPBuffer *rtcp);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_get_first_packet (GstRTCPBuffer *rtcp, GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_move_to_next (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_buffer_add_packet (GstRTCPBuffer *rtcp, GstRTCPType type,
+ GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet);
+
+/* working with packets */
+
+GST_RTP_API
+gboolean gst_rtcp_packet_get_padding (GstRTCPPacket *packet);
+
+GST_RTP_API
+guint8 gst_rtcp_packet_get_count (GstRTCPPacket *packet);
+
+GST_RTP_API
+GstRTCPType gst_rtcp_packet_get_type (GstRTCPPacket *packet);
+
+GST_RTP_API
+guint16 gst_rtcp_packet_get_length (GstRTCPPacket *packet);
+
+
+/* sender reports */
+
+GST_RTP_API
+void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc,
+ guint64 *ntptime, guint32 *rtptime,
+ guint32 *packet_count, guint32 *octet_count);
+
+GST_RTP_API
+void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc,
+ guint64 ntptime, guint32 rtptime,
+ guint32 packet_count, guint32 octet_count);
+/* receiver reports */
+
+GST_RTP_API
+guint32 gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket *packet);
+
+GST_RTP_API
+void gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket *packet, guint32 ssrc);
+
+
+/* report blocks for SR and RR */
+
+GST_RTP_API
+guint gst_rtcp_packet_get_rb_count (GstRTCPPacket *packet);
+
+GST_RTP_API
+void gst_rtcp_packet_get_rb (GstRTCPPacket *packet, guint nth, guint32 *ssrc,
+ guint8 *fractionlost, gint32 *packetslost,
+ guint32 *exthighestseq, guint32 *jitter,
+ guint32 *lsr, guint32 *dlsr);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_add_rb (GstRTCPPacket *packet, guint32 ssrc,
+ guint8 fractionlost, gint32 packetslost,
+ guint32 exthighestseq, guint32 jitter,
+ guint32 lsr, guint32 dlsr);
+
+GST_RTP_API
+void gst_rtcp_packet_set_rb (GstRTCPPacket *packet, guint nth, guint32 ssrc,
+ guint8 fractionlost, gint32 packetslost,
+ guint32 exthighestseq, guint32 jitter,
+ guint32 lsr, guint32 dlsr);
+
+/* profile-specific extensions for SR and RR */
+
+GST_RTP_API
+gboolean gst_rtcp_packet_add_profile_specific_ext (GstRTCPPacket * packet,
+ const guint8 * data, guint len);
+
+GST_RTP_API
+guint16 gst_rtcp_packet_get_profile_specific_ext_length (GstRTCPPacket * packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_get_profile_specific_ext (GstRTCPPacket * packet,
+ guint8 ** data, guint * len);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_copy_profile_specific_ext (GstRTCPPacket * packet,
+ guint8 ** data, guint * len);
+
+/* source description packet */
+
+GST_RTP_API
+guint gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_first_item (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_next_item (GstRTCPPacket *packet);
+
+GST_RTP_API
+guint32 gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_first_entry (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_next_entry (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_get_entry (GstRTCPPacket *packet,
+ GstRTCPSDESType *type, guint8 *len,
+ guint8 **data);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet,
+ GstRTCPSDESType *type, guint8 *len,
+ guint8 **data);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_add_item (GstRTCPPacket *packet, guint32 ssrc);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_sdes_add_entry (GstRTCPPacket *packet, GstRTCPSDESType type,
+ guint8 len, const guint8 *data);
+
+/* bye packet */
+
+GST_RTP_API
+guint gst_rtcp_packet_bye_get_ssrc_count (GstRTCPPacket *packet);
+
+GST_RTP_API
+guint32 gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket *packet, guint nth);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_bye_add_ssrc (GstRTCPPacket *packet, guint32 ssrc);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_bye_add_ssrcs (GstRTCPPacket *packet, guint32 *ssrc, guint len);
+
+GST_RTP_API
+guint8 gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket *packet);
+
+GST_RTP_API
+gchar* gst_rtcp_packet_bye_get_reason (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_bye_set_reason (GstRTCPPacket *packet, const gchar *reason);
+
+/* app packets */
+
+GST_RTP_API
+void gst_rtcp_packet_app_set_subtype (GstRTCPPacket * packet, guint8 subtype);
+
+GST_RTP_API
+guint8 gst_rtcp_packet_app_get_subtype (GstRTCPPacket * packet);
+
+GST_RTP_API
+void gst_rtcp_packet_app_set_ssrc (GstRTCPPacket * packet, guint32 ssrc);
+
+GST_RTP_API
+guint32 gst_rtcp_packet_app_get_ssrc (GstRTCPPacket * packet);
+
+GST_RTP_API
+void gst_rtcp_packet_app_set_name (GstRTCPPacket * packet, const gchar *name);
+
+GST_RTP_API
+const gchar* gst_rtcp_packet_app_get_name (GstRTCPPacket * packet);
+
+GST_RTP_API
+guint16 gst_rtcp_packet_app_get_data_length (GstRTCPPacket * packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_app_set_data_length (GstRTCPPacket * packet, guint16 wordlen);
+
+GST_RTP_API
+guint8* gst_rtcp_packet_app_get_data (GstRTCPPacket * packet);
+
+/* feedback packets */
+
+GST_RTP_API
+guint32 gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket *packet);
+
+GST_RTP_API
+void gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket *packet, guint32 ssrc);
+
+GST_RTP_API
+guint32 gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket *packet);
+
+GST_RTP_API
+void gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket *packet, guint32 ssrc);
+
+GST_RTP_API
+GstRTCPFBType gst_rtcp_packet_fb_get_type (GstRTCPPacket *packet);
+
+GST_RTP_API
+void gst_rtcp_packet_fb_set_type (GstRTCPPacket *packet, GstRTCPFBType type);
+
+GST_RTP_API
+guint16 gst_rtcp_packet_fb_get_fci_length (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_fb_set_fci_length (GstRTCPPacket *packet, guint16 wordlen);
+
+GST_RTP_API
+guint8 * gst_rtcp_packet_fb_get_fci (GstRTCPPacket *packet);
+
+/* helper functions */
+
+GST_RTP_API
+guint64 gst_rtcp_ntp_to_unix (guint64 ntptime);
+
+GST_RTP_API
+guint64 gst_rtcp_unix_to_ntp (guint64 unixtime);
+
+GST_RTP_API
+const gchar * gst_rtcp_sdes_type_to_name (GstRTCPSDESType type);
+
+GST_RTP_API
+GstRTCPSDESType gst_rtcp_sdes_name_to_type (const gchar *name);
+
+/* extended report */
+
+GST_RTP_API
+guint32 gst_rtcp_packet_xr_get_ssrc (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_first_rb (GstRTCPPacket *packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_next_rb (GstRTCPPacket * packet);
+
+GST_RTP_API
+GstRTCPXRType gst_rtcp_packet_xr_get_block_type (GstRTCPPacket * packet);
+
+GST_RTP_API
+guint16 gst_rtcp_packet_xr_get_block_length (GstRTCPPacket * packet);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_rle_info (GstRTCPPacket * packet,
+ guint32 * ssrc, guint8 * thinning,
+ guint16 * begin_seq, guint16 * end_seq,
+ guint32 * chunk_count);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_rle_nth_chunk (GstRTCPPacket * packet, guint nth,
+ guint16 * chunk);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_prt_info (GstRTCPPacket * packet,
+ guint32 * ssrc, guint8 * thinning,
+ guint16 * begin_seq, guint16 * end_seq);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_prt_by_seq (GstRTCPPacket * packet, guint16 seq,
+ guint32 * receipt_time);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_rrt (GstRTCPPacket * packet, guint64 * timestamp);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_dlrr_block (GstRTCPPacket * packet,
+ guint nth, guint32 * ssrc,
+ guint32 * last_rr, guint32 * delay);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_summary_info (GstRTCPPacket * packet, guint32 * ssrc,
+ guint16 * begin_seq, guint16 * end_seq);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_summary_pkt (GstRTCPPacket * packet,
+ guint32 * lost_packets, guint32 * dup_packets);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_summary_jitter (GstRTCPPacket * packet,
+ guint32 * min_jitter, guint32 * max_jitter,
+ guint32 * mean_jitter, guint32 * dev_jitter);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_summary_ttl (GstRTCPPacket * packet, gboolean * is_ipv4,
+ guint8 * min_ttl, guint8 * max_ttl,
+ guint8 * mean_ttl, guint8 * dev_ttl);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_metrics_ssrc (GstRTCPPacket * packet, guint32 * ssrc);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_packet_metrics (GstRTCPPacket * packet,
+ guint8 * loss_rate, guint8 * discard_rate);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_burst_metrics (GstRTCPPacket * packet,
+ guint8 * burst_density, guint8 * gap_density,
+ guint16 * burst_duration, guint16 * gap_duration);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_delay_metrics (GstRTCPPacket * packet,
+ guint16 * roundtrip_delay,
+ guint16 * end_system_delay);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_signal_metrics (GstRTCPPacket * packet,
+ guint8 * signal_level, guint8 * noise_level,
+ guint8 * rerl, guint8 * gmin);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_quality_metrics (GstRTCPPacket * packet,
+ guint8 * r_factor, guint8 * ext_r_factor,
+ guint8 * mos_lq, guint8 * mos_cq);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_configuration_params (GstRTCPPacket * packet,
+ guint8 * gmin, guint8 * rx_config);
+
+GST_RTP_API
+gboolean gst_rtcp_packet_xr_get_voip_jitter_buffer_params (GstRTCPPacket * packet,
+ guint16 * jb_nominal,
+ guint16 * jb_maximum,
+ guint16 * jb_abs_max);
+
+G_END_DECLS
+
+#endif /* __GST_RTCPBUFFER_H__ */
+
diff --git a/include/gst/rtp/gstrtp-enumtypes.h b/include/gst/rtp/gstrtp-enumtypes.h
new file mode 100644
index 0000000000..1cb86d4825
--- /dev/null
+++ b/include/gst/rtp/gstrtp-enumtypes.h
@@ -0,0 +1,64 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/rtp/rtp-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gstrtcpbuffer.h" */
+
+GST_RTP_API
+GType gst_rtcp_type_get_type (void);
+#define GST_TYPE_RTCP_TYPE (gst_rtcp_type_get_type())
+
+GST_RTP_API
+GType gst_rtcpfb_type_get_type (void);
+#define GST_TYPE_RTCPFB_TYPE (gst_rtcpfb_type_get_type())
+
+GST_RTP_API
+GType gst_rtcpsdes_type_get_type (void);
+#define GST_TYPE_RTCPSDES_TYPE (gst_rtcpsdes_type_get_type())
+
+GST_RTP_API
+GType gst_rtcpxr_type_get_type (void);
+#define GST_TYPE_RTCPXR_TYPE (gst_rtcpxr_type_get_type())
+
+/* enumerations from "gstrtpbuffer.h" */
+
+GST_RTP_API
+GType gst_rtp_buffer_flags_get_type (void);
+#define GST_TYPE_RTP_BUFFER_FLAGS (gst_rtp_buffer_flags_get_type())
+
+GST_RTP_API
+GType gst_rtp_buffer_map_flags_get_type (void);
+#define GST_TYPE_RTP_BUFFER_MAP_FLAGS (gst_rtp_buffer_map_flags_get_type())
+
+/* enumerations from "gstrtpdefs.h" */
+
+GST_RTP_API
+GType gst_rtp_profile_get_type (void);
+#define GST_TYPE_RTP_PROFILE (gst_rtp_profile_get_type())
+
+/* enumerations from "gstrtphdrext.h" */
+
+GST_RTP_API
+GType gst_rtp_header_extension_flags_get_type (void);
+#define GST_TYPE_RTP_HEADER_EXTENSION_FLAGS (gst_rtp_header_extension_flags_get_type())
+
+GST_RTP_API
+GType gst_rtp_header_extension_direction_get_type (void);
+#define GST_TYPE_RTP_HEADER_EXTENSION_DIRECTION (gst_rtp_header_extension_direction_get_type())
+
+/* enumerations from "gstrtppayloads.h" */
+
+GST_RTP_API
+GType gst_rtp_payload_get_type (void);
+#define GST_TYPE_RTP_PAYLOAD (gst_rtp_payload_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/rtp/gstrtpbaseaudiopayload.h b/include/gst/rtp/gstrtpbaseaudiopayload.h
new file mode 100644
index 0000000000..773a49caba
--- /dev/null
+++ b/include/gst/rtp/gstrtpbaseaudiopayload.h
@@ -0,0 +1,124 @@
+/* GStreamer
+ * Copyright (C) <2006> Philippe Khalaf <philippe.kalaf@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_BASE_AUDIO_PAYLOAD_H__
+#define __GST_RTP_BASE_AUDIO_PAYLOAD_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/gstrtpbasepayload.h>
+#include <gst/base/gstadapter.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstRTPBaseAudioPayload GstRTPBaseAudioPayload;
+typedef struct _GstRTPBaseAudioPayloadClass GstRTPBaseAudioPayloadClass;
+
+typedef struct _GstRTPBaseAudioPayloadPrivate GstRTPBaseAudioPayloadPrivate;
+
+#define GST_TYPE_RTP_BASE_AUDIO_PAYLOAD \
+ (gst_rtp_base_audio_payload_get_type())
+#define GST_RTP_BASE_AUDIO_PAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GST_TYPE_RTP_BASE_AUDIO_PAYLOAD,GstRTPBaseAudioPayload))
+#define GST_RTP_BASE_AUDIO_PAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GST_TYPE_RTP_BASE_AUDIO_PAYLOAD,GstRTPBaseAudioPayloadClass))
+#define GST_IS_RTP_BASE_AUDIO_PAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_AUDIO_PAYLOAD))
+#define GST_IS_RTP_BASE_AUDIO_PAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_AUDIO_PAYLOAD))
+#define GST_RTP_BASE_AUDIO_PAYLOAD_CAST(obj) \
+ ((GstRTPBaseAudioPayload *) (obj))
+
+struct _GstRTPBaseAudioPayload
+{
+ GstRTPBasePayload payload;
+
+ GstRTPBaseAudioPayloadPrivate *priv;
+
+ GstClockTime base_ts;
+ gint frame_size;
+ gint frame_duration;
+
+ gint sample_size;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTPBaseAudioPayloadClass:
+ * @parent_class: the parent class
+ *
+ * Base class for audio RTP payloader.
+ */
+struct _GstRTPBaseAudioPayloadClass
+{
+ GstRTPBasePayloadClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTP_API
+GType gst_rtp_base_audio_payload_get_type (void);
+
+/* configure frame based */
+
+GST_RTP_API
+void gst_rtp_base_audio_payload_set_frame_based (GstRTPBaseAudioPayload *rtpbaseaudiopayload);
+
+GST_RTP_API
+void gst_rtp_base_audio_payload_set_frame_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload,
+ gint frame_duration, gint frame_size);
+
+/* configure sample based */
+
+GST_RTP_API
+void gst_rtp_base_audio_payload_set_sample_based (GstRTPBaseAudioPayload *rtpbaseaudiopayload);
+
+GST_RTP_API
+void gst_rtp_base_audio_payload_set_sample_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload,
+ gint sample_size);
+
+GST_RTP_API
+void gst_rtp_base_audio_payload_set_samplebits_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload,
+ gint sample_size);
+
+/* get the internal adapter */
+
+GST_RTP_API
+GstAdapter* gst_rtp_base_audio_payload_get_adapter (GstRTPBaseAudioPayload *rtpbaseaudiopayload);
+
+/* push and flushing data */
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_audio_payload_push (GstRTPBaseAudioPayload * baseaudiopayload,
+ const guint8 * data, guint payload_len,
+ GstClockTime timestamp);
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_audio_payload_flush (GstRTPBaseAudioPayload * baseaudiopayload,
+ guint payload_len, GstClockTime timestamp);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBaseAudioPayload, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_RTP_BASE_AUDIO_PAYLOAD_H__ */
diff --git a/include/gst/rtp/gstrtpbasedepayload.h b/include/gst/rtp/gstrtpbasedepayload.h
new file mode 100644
index 0000000000..341a61551c
--- /dev/null
+++ b/include/gst/rtp/gstrtpbasedepayload.h
@@ -0,0 +1,135 @@
+/* GStreamer
+ * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_BASE_DEPAYLOAD_H__
+#define __GST_RTP_BASE_DEPAYLOAD_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/gstrtpbuffer.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTP_BASE_DEPAYLOAD (gst_rtp_base_depayload_get_type())
+#define GST_RTP_BASE_DEPAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayload))
+#define GST_RTP_BASE_DEPAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayloadClass))
+#define GST_RTP_BASE_DEPAYLOAD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayloadClass))
+#define GST_IS_RTP_BASE_DEPAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_DEPAYLOAD))
+#define GST_IS_RTP_BASE_DEPAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_DEPAYLOAD))
+#define GST_RTP_BASE_DEPAYLOAD_CAST(obj) ((GstRTPBaseDepayload *)(obj))
+
+#define GST_RTP_BASE_DEPAYLOAD_SINKPAD(depayload) (GST_RTP_BASE_DEPAYLOAD_CAST (depayload)->sinkpad)
+#define GST_RTP_BASE_DEPAYLOAD_SRCPAD(depayload) (GST_RTP_BASE_DEPAYLOAD_CAST (depayload)->srcpad)
+
+typedef struct _GstRTPBaseDepayload GstRTPBaseDepayload;
+typedef struct _GstRTPBaseDepayloadClass GstRTPBaseDepayloadClass;
+typedef struct _GstRTPBaseDepayloadPrivate GstRTPBaseDepayloadPrivate;
+
+struct _GstRTPBaseDepayload
+{
+ GstElement parent;
+
+ GstPad *sinkpad, *srcpad;
+
+ /* this attribute must be set by the child */
+ guint clock_rate;
+
+ GstSegment segment;
+ gboolean need_newsegment;
+
+ /*< private >*/
+ GstRTPBaseDepayloadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTPBaseDepayloadClass:
+ * @parent_class: the parent class
+ * @set_caps: configure the depayloader
+ * @process: process incoming rtp packets. Subclass must implement either
+ * this method or @process_rtp_packet to process incoming rtp packets.
+ * If the child returns a buffer without a valid timestamp, the timestamp
+ * of the provided buffer will be applied to the result buffer and the
+ * buffer will be pushed. If this function returns %NULL, nothing is pushed.
+ * @packet_lost: signal the depayloader about packet loss
+ * @handle_event: custom event handling
+ * @process_rtp_packet: Same as the process virtual function, but slightly more
+ * efficient, since it is passed the rtp buffer structure that has already
+ * been mapped (with GST_MAP_READ) by the base class and thus does not have
+ * to be mapped again by the subclass. Can be used by the subclass to process
+ * incoming rtp packets. If the subclass returns a buffer without a valid
+ * timestamp, the timestamp of the input buffer will be applied to the result
+ * buffer and the output buffer will be pushed out. If this function returns
+ * %NULL, nothing is pushed out. Since: 1.6.
+ *
+ * Base class for RTP depayloaders.
+ */
+struct _GstRTPBaseDepayloadClass
+{
+ GstElementClass parent_class;
+
+ /*< public >*/
+ /* virtuals, inform the subclass of the caps. */
+ gboolean (*set_caps) (GstRTPBaseDepayload *filter, GstCaps *caps);
+
+ /* pure virtual function */
+ GstBuffer * (*process) (GstRTPBaseDepayload *base, GstBuffer *in);
+
+ /* non-pure function used to to signal the depayloader about packet loss. the
+ * timestamp and duration are the estimated values of the lost packet.
+ * The default implementation of this message pushes a segment update. */
+ gboolean (*packet_lost) (GstRTPBaseDepayload *filter, GstEvent *event);
+
+ /* the default implementation does the default actions for events but
+ * implementation can override. */
+ gboolean (*handle_event) (GstRTPBaseDepayload * filter, GstEvent * event);
+
+ GstBuffer * (*process_rtp_packet) (GstRTPBaseDepayload *base, GstRTPBuffer * rtp_buffer);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+};
+
+GST_RTP_API
+GType gst_rtp_base_depayload_get_type (void);
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_depayload_push (GstRTPBaseDepayload *filter, GstBuffer *out_buf);
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_depayload_push_list (GstRTPBaseDepayload *filter, GstBufferList *out_list);
+
+GST_RTP_API
+gboolean gst_rtp_base_depayload_is_source_info_enabled (GstRTPBaseDepayload * depayload);
+
+GST_RTP_API
+void gst_rtp_base_depayload_set_source_info_enabled (GstRTPBaseDepayload * depayload,
+ gboolean enable);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBaseDepayload, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_RTP_BASE_DEPAYLOAD_H__ */
diff --git a/include/gst/rtp/gstrtpbasepayload.h b/include/gst/rtp/gstrtpbasepayload.h
new file mode 100644
index 0000000000..00bf99e196
--- /dev/null
+++ b/include/gst/rtp/gstrtpbasepayload.h
@@ -0,0 +1,199 @@
+/* GStreamer
+ * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_BASE_PAYLOAD_H__
+#define __GST_RTP_BASE_PAYLOAD_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/rtp-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTP_BASE_PAYLOAD \
+ (gst_rtp_base_payload_get_type())
+#define GST_RTP_BASE_PAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_BASE_PAYLOAD,GstRTPBasePayload))
+#define GST_RTP_BASE_PAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_BASE_PAYLOAD,GstRTPBasePayloadClass))
+#define GST_RTP_BASE_PAYLOAD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_BASE_PAYLOAD, GstRTPBasePayloadClass))
+#define GST_IS_RTP_BASE_PAYLOAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_PAYLOAD))
+#define GST_IS_RTP_BASE_PAYLOAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_PAYLOAD))
+#define GST_RTP_BASE_PAYLOAD_CAST(obj) \
+ ((GstRTPBasePayload*)(obj))
+
+typedef struct _GstRTPBasePayload GstRTPBasePayload;
+typedef struct _GstRTPBasePayloadPrivate GstRTPBasePayloadPrivate;
+typedef struct _GstRTPBasePayloadClass GstRTPBasePayloadClass;
+
+/**
+ * GST_RTP_BASE_PAYLOAD_SINKPAD:
+ * @payload: a #GstRTPBasePayload
+ *
+ * Get access to the sinkpad of @payload.
+ */
+#define GST_RTP_BASE_PAYLOAD_SINKPAD(payload) (GST_RTP_BASE_PAYLOAD (payload)->sinkpad)
+/**
+ * GST_RTP_BASE_PAYLOAD_SRCPAD:
+ * @payload: a #GstRTPBasePayload
+ *
+ * Get access to the srcpad of @payload.
+ */
+#define GST_RTP_BASE_PAYLOAD_SRCPAD(payload) (GST_RTP_BASE_PAYLOAD (payload)->srcpad)
+
+/**
+ * GST_RTP_BASE_PAYLOAD_PT:
+ * @payload: a #GstRTPBasePayload
+ *
+ * Get access to the configured payload type of @payload.
+ */
+#define GST_RTP_BASE_PAYLOAD_PT(payload) (GST_RTP_BASE_PAYLOAD (payload)->pt)
+/**
+ * GST_RTP_BASE_PAYLOAD_MTU:
+ * @payload: a #GstRTPBasePayload
+ *
+ * Get access to the configured MTU of @payload.
+ */
+#define GST_RTP_BASE_PAYLOAD_MTU(payload) (GST_RTP_BASE_PAYLOAD (payload)->mtu)
+
+struct _GstRTPBasePayload
+{
+ GstElement element;
+
+ /*< private >*/
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ guint32 ts_base;
+ guint16 seqnum_base;
+
+ gchar *media;
+ gchar *encoding_name;
+ gboolean dynamic;
+ guint32 clock_rate;
+
+ gint32 ts_offset;
+ guint32 timestamp;
+ gint16 seqnum_offset;
+ guint16 seqnum;
+ gint64 max_ptime;
+ guint pt;
+ guint ssrc;
+ guint current_ssrc;
+ guint mtu;
+
+ GstSegment segment;
+
+ guint64 min_ptime;
+ guint64 ptime; /* in ns */
+ guint64 ptime_multiple; /* in ns */
+
+ /*< private >*/
+ GstRTPBasePayloadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTPBasePayloadClass:
+ * @parent_class: the parent class
+ * @get_caps: get desired caps
+ * @set_caps: configure the payloader
+ * @handle_buffer: process data
+ * @sink_event: custom event handling on the sinkpad
+ * @src_event: custom event handling on the srcpad
+ * @query: custom query handling
+ *
+ * Base class for audio RTP payloader.
+ */
+struct _GstRTPBasePayloadClass
+{
+ GstElementClass parent_class;
+
+ /* query accepted caps */
+ GstCaps * (*get_caps) (GstRTPBasePayload *payload, GstPad * pad, GstCaps * filter);
+ /* receive caps on the sink pad, configure the payloader. */
+ gboolean (*set_caps) (GstRTPBasePayload *payload, GstCaps *caps);
+
+ /* handle a buffer, perform 0 or more gst_rtp_base_payload_push() on
+ * the RTP buffers. This function takes ownership of the buffer. */
+ GstFlowReturn (*handle_buffer) (GstRTPBasePayload *payload,
+ GstBuffer *buffer);
+ /* handle events and queries */
+ gboolean (*sink_event) (GstRTPBasePayload *payload, GstEvent * event);
+ gboolean (*src_event) (GstRTPBasePayload *payload, GstEvent * event);
+ gboolean (*query) (GstRTPBasePayload *payload, GstPad *pad, GstQuery * query);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTP_API
+GType gst_rtp_base_payload_get_type (void);
+
+GST_RTP_API
+void gst_rtp_base_payload_set_options (GstRTPBasePayload *payload,
+ const gchar *media,
+ gboolean dynamic,
+ const gchar *encoding_name,
+ guint32 clock_rate);
+
+GST_RTP_API
+gboolean gst_rtp_base_payload_set_outcaps (GstRTPBasePayload *payload,
+ const gchar *fieldname, ...);
+
+GST_RTP_API
+gboolean gst_rtp_base_payload_set_outcaps_structure (GstRTPBasePayload *payload,
+ GstStructure *s);
+
+GST_RTP_API
+gboolean gst_rtp_base_payload_is_filled (GstRTPBasePayload *payload,
+ guint size, GstClockTime duration);
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_payload_push (GstRTPBasePayload *payload,
+ GstBuffer *buffer);
+
+GST_RTP_API
+GstFlowReturn gst_rtp_base_payload_push_list (GstRTPBasePayload *payload,
+ GstBufferList *list);
+
+GST_RTP_API
+GstBuffer * gst_rtp_base_payload_allocate_output_buffer (GstRTPBasePayload * payload,
+ guint payload_len, guint8 pad_len,
+ guint8 csrc_count);
+
+GST_RTP_API
+void gst_rtp_base_payload_set_source_info_enabled (GstRTPBasePayload * payload,
+ gboolean enable);
+
+GST_RTP_API
+gboolean gst_rtp_base_payload_is_source_info_enabled (GstRTPBasePayload * payload);
+
+GST_RTP_API
+guint gst_rtp_base_payload_get_source_count (GstRTPBasePayload * payload,
+ GstBuffer * buffer);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBasePayload, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_RTP_BASE_PAYLOAD_H__ */
diff --git a/include/gst/rtp/gstrtpbuffer.h b/include/gst/rtp/gstrtpbuffer.h
new file mode 100644
index 0000000000..cac8998c2b
--- /dev/null
+++ b/include/gst/rtp/gstrtpbuffer.h
@@ -0,0 +1,286 @@
+/* GStreamer
+ * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
+ * <2005> Wim Taymans <wim@fluendo.com>
+ *
+ * gstrtpbuffer.h: various helper functions to manipulate buffers
+ * with RTP payload.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTPBUFFER_H__
+#define __GST_RTPBUFFER_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/gstrtppayloads.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_RTP_VERSION:
+ *
+ * The supported RTP version 2.
+ */
+#define GST_RTP_VERSION 2
+
+
+typedef struct _GstRTPBuffer GstRTPBuffer;
+
+/**
+ * GstRTPBuffer:
+ * @buffer: pointer to RTP buffer
+ * @state: internal state
+ * @data: array of data
+ * @size: array of size
+ * @map: array of #GstMapInfo
+ *
+ * Data structure that points to an RTP packet.
+ * The size of the structure is made public to allow stack allocations.
+ */
+struct _GstRTPBuffer
+{
+ GstBuffer *buffer;
+ guint state;
+ gpointer data[4];
+ gsize size[4];
+ GstMapInfo map[4];
+};
+
+#define GST_RTP_BUFFER_INIT { NULL, 0, { NULL, NULL, NULL, NULL}, { 0, 0, 0, 0 }, \
+ { GST_MAP_INFO_INIT, GST_MAP_INFO_INIT, GST_MAP_INFO_INIT, GST_MAP_INFO_INIT} }
+
+/* creating buffers */
+
+GST_RTP_API
+void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len,
+ guint8 pad_len, guint8 csrc_count);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, gsize len);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_new_copy_data (gconstpointer data, gsize len);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
+
+GST_RTP_API
+guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
+
+GST_RTP_API
+guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
+
+GST_RTP_API
+guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_map (GstBuffer *buffer, GstMapFlags flags, GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_unmap (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_packet_len (GstRTPBuffer *rtp, guint len);
+
+GST_RTP_API
+guint gst_rtp_buffer_get_packet_len (GstRTPBuffer *rtp);
+
+GST_RTP_API
+guint gst_rtp_buffer_get_header_len (GstRTPBuffer *rtp);
+
+GST_RTP_API
+guint8 gst_rtp_buffer_get_version (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_version (GstRTPBuffer *rtp, guint8 version);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_padding (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_padding (GstRTPBuffer *rtp, gboolean padding);
+
+GST_RTP_API
+void gst_rtp_buffer_pad_to (GstRTPBuffer *rtp, guint len);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_extension (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_extension (GstRTPBuffer *rtp, gboolean extension);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_extension_data (GstRTPBuffer *rtp, guint16 *bits,
+ gpointer *data, guint *wordlen);
+
+GST_RTP_API
+GBytes* gst_rtp_buffer_get_extension_bytes (GstRTPBuffer *rtp, guint16 *bits);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_set_extension_data (GstRTPBuffer *rtp, guint16 bits, guint16 length);
+
+GST_RTP_API
+void gst_rtp_buffer_remove_extension_data (GstRTPBuffer *rtp);
+
+GST_RTP_API
+guint32 gst_rtp_buffer_get_ssrc (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_ssrc (GstRTPBuffer *rtp, guint32 ssrc);
+
+GST_RTP_API
+guint8 gst_rtp_buffer_get_csrc_count (GstRTPBuffer *rtp);
+
+GST_RTP_API
+guint32 gst_rtp_buffer_get_csrc (GstRTPBuffer *rtp, guint8 idx);
+
+GST_RTP_API
+void gst_rtp_buffer_set_csrc (GstRTPBuffer *rtp, guint8 idx, guint32 csrc);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_marker (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_marker (GstRTPBuffer *rtp, gboolean marker);
+
+GST_RTP_API
+guint8 gst_rtp_buffer_get_payload_type (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_payload_type (GstRTPBuffer *rtp, guint8 payload_type);
+
+GST_RTP_API
+guint16 gst_rtp_buffer_get_seq (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_seq (GstRTPBuffer *rtp, guint16 seq);
+
+GST_RTP_API
+guint32 gst_rtp_buffer_get_timestamp (GstRTPBuffer *rtp);
+
+GST_RTP_API
+void gst_rtp_buffer_set_timestamp (GstRTPBuffer *rtp, guint32 timestamp);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_get_payload_buffer (GstRTPBuffer *rtp);
+
+GST_RTP_API
+GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, guint offset, guint len);
+
+GST_RTP_API
+guint gst_rtp_buffer_get_payload_len (GstRTPBuffer *rtp);
+
+GST_RTP_API
+gpointer gst_rtp_buffer_get_payload (GstRTPBuffer *rtp);
+
+GST_RTP_API
+GBytes* gst_rtp_buffer_get_payload_bytes (GstRTPBuffer *rtp);
+
+/* some helpers */
+
+GST_RTP_API
+guint32 gst_rtp_buffer_default_clock_rate (guint8 payload_type);
+
+GST_RTP_API
+gint gst_rtp_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2);
+
+GST_RTP_API
+guint64 gst_rtp_buffer_ext_timestamp (guint64 *exttimestamp, guint32 timestamp);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_extension_onebyte_header (GstRTPBuffer *rtp,
+ guint8 id,
+ guint nth,
+ gpointer * data,
+ guint * size);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_extension_twobytes_header (GstRTPBuffer *rtp,
+ guint8 * appbits,
+ guint8 id,
+ guint nth,
+ gpointer * data,
+ guint * size);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_add_extension_onebyte_header (GstRTPBuffer *rtp,
+ guint8 id,
+ gconstpointer data,
+ guint size);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_add_extension_twobytes_header (GstRTPBuffer *rtp,
+ guint8 appbits,
+ guint8 id,
+ gconstpointer data,
+ guint size);
+
+GST_RTP_API
+gboolean gst_rtp_buffer_get_extension_onebyte_header_from_bytes (GBytes * bytes,
+ guint16 bit_pattern,
+ guint8 id,
+ guint nth,
+ gpointer * data,
+ guint * size);
+
+/**
+ * GstRTPBufferFlags:
+ * @GST_RTP_BUFFER_FLAG_RETRANSMISSION: The #GstBuffer was once wrapped
+ * in a retransmitted packet as specified by RFC 4588.
+ * @GST_RTP_BUFFER_FLAG_REDUNDANT: The packet represents redundant RTP packet.
+ * The flag is used in gstrtpstorage to be able to hold the packetback
+ * and use it only for recovery from packet loss.
+ * Since: 1.14
+ * @GST_RTP_BUFFER_FLAG_LAST: Offset to define more flags.
+ *
+ * Additional RTP buffer flags. These flags can potentially be used on any
+ * buffers carrying RTP packets.
+ *
+ * Note that these are only valid for #GstCaps of type: application/x-rtp (x-rtcp).
+ * They can conflict with other extended buffer flags.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_RTP_BUFFER_FLAG_RETRANSMISSION = (GST_BUFFER_FLAG_LAST << 0),
+ GST_RTP_BUFFER_FLAG_REDUNDANT = (GST_BUFFER_FLAG_LAST << 1),
+ GST_RTP_BUFFER_FLAG_LAST = (GST_BUFFER_FLAG_LAST << 8)
+} GstRTPBufferFlags;
+
+/**
+ * GstRTPBufferMapFlags:
+ * @GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING: Skip mapping and validation of RTP
+ * padding and RTP pad count when present. Useful for buffers where
+ * the padding may be encrypted.
+ * @GST_RTP_BUFFER_MAP_FLAG_LAST: Offset to define more flags
+ *
+ * Additional mapping flags for gst_rtp_buffer_map().
+ *
+ * Since: 1.6.1
+ */
+typedef enum {
+ GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING = (GST_MAP_FLAG_LAST << 0),
+ GST_RTP_BUFFER_MAP_FLAG_LAST = (GST_MAP_FLAG_LAST << 8)
+ /* 8 more flags possible afterwards */
+} GstRTPBufferMapFlags;
+
+G_END_DECLS
+
+#endif /* __GST_RTPBUFFER_H__ */
+
diff --git a/include/gst/rtp/gstrtpdefs.h b/include/gst/rtp/gstrtpdefs.h
new file mode 100644
index 0000000000..14aff5613a
--- /dev/null
+++ b/include/gst/rtp/gstrtpdefs.h
@@ -0,0 +1,58 @@
+/* GStreamer
+ * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
+ * <2005> Wim Taymans <wim@fluendo.com>
+ *
+ * gstrtpbuffer.h: various helper functions to manipulate buffers
+ * with RTP payload.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTPDEFS_H__
+#define __GST_RTPDEFS_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/rtp-prelude.h>
+
+/**
+ * SECTION:gstrtpdefs
+ * @title: GstRTPdefs
+ * @short_description: common RTP defines
+ *
+ * Provides common defines for the RTP library.
+ */
+
+/**
+ * GstRTPProfile:
+ * @GST_RTP_PROFILE_UNKNOWN: invalid profile
+ * @GST_RTP_PROFILE_AVP: the Audio/Visual profile (RFC 3551)
+ * @GST_RTP_PROFILE_SAVP: the secure Audio/Visual profile (RFC 3711)
+ * @GST_RTP_PROFILE_AVPF: the Audio/Visual profile with feedback (RFC 4585)
+ * @GST_RTP_PROFILE_SAVPF: the secure Audio/Visual profile with feedback (RFC 5124)
+ *
+ * The transfer profile to use.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_RTP_PROFILE_UNKNOWN = 0,
+ GST_RTP_PROFILE_AVP,
+ GST_RTP_PROFILE_SAVP,
+ GST_RTP_PROFILE_AVPF,
+ GST_RTP_PROFILE_SAVPF
+} GstRTPProfile;
+
+#endif /* __GST_RTPDEFS_H__ */
diff --git a/include/gst/rtp/gstrtphdrext.h b/include/gst/rtp/gstrtphdrext.h
new file mode 100644
index 0000000000..442c27af60
--- /dev/null
+++ b/include/gst/rtp/gstrtphdrext.h
@@ -0,0 +1,294 @@
+/* GStreamer
+ * Copyright (C) <2012> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2020> Matthew Waters <matthew@centricular.com>
+ *
+ * gstrtphdrext.h: RTP header extensions
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_RTPHDREXT_H__
+#define __GST_RTPHDREXT_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/gstrtpbuffer.h>
+
+G_BEGIN_DECLS
+
+#define GST_RTP_HDREXT_BASE "urn:ietf:params:rtp-hdrext:"
+
+/* RFC 6051 */
+#define GST_RTP_HDREXT_NTP_64 "ntp-64"
+
+#define GST_RTP_HDREXT_NTP_64_SIZE 8
+
+GST_RTP_API
+gboolean gst_rtp_hdrext_set_ntp_64 (gpointer data, guint size, guint64 ntptime);
+
+GST_RTP_API
+gboolean gst_rtp_hdrext_get_ntp_64 (gpointer data, guint size, guint64 *ntptime);
+
+#define GST_RTP_HDREXT_NTP_56 "ntp-56"
+
+#define GST_RTP_HDREXT_NTP_56_SIZE 7
+
+GST_RTP_API
+gboolean gst_rtp_hdrext_set_ntp_56 (gpointer data, guint size, guint64 ntptime);
+
+GST_RTP_API
+gboolean gst_rtp_hdrext_get_ntp_56 (gpointer data, guint size, guint64 *ntptime);
+
+/**
+ * GST_RTP_HDREXT_ELEMENT_CLASS:
+ *
+ * Constant string used in element classification to signal that this element
+ * is a RTP header extension.
+ *
+ * Since: 1.20
+ */
+#define GST_RTP_HDREXT_ELEMENT_CLASS "Network/Extension/RTPHeader"
+
+GST_RTP_API
+GType gst_rtp_header_extension_get_type (void);
+#define GST_TYPE_RTP_HEADER_EXTENSION (gst_rtp_header_extension_get_type())
+#define GST_RTP_HEADER_EXTENSION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_HEADER_EXTENSION,GstRTPHeaderExtension))
+#define GST_RTP_HEADER_EXTENSION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_HEADER_EXTENSION,GstRTPHeaderExtensionClass))
+#define GST_RTP_HEADER_EXTENSION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_RTP_HEADER_EXTENSION,GstRTPHeaderExtensionClass))
+#define GST_IS_RTP_HEADER_EXTENSION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_HEADER_EXTENSION))
+#define GST_IS_RTP_HEADER_EXTENSION_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_HEADER_EXTENSION))
+/**
+ * GST_RTP_HEADER_EXTENSION_CAST:
+ *
+ * Since: 1.20
+ */
+#define GST_RTP_HEADER_EXTENSION_CAST(obj) ((GstRTPHeaderExtension *)(obj))
+
+typedef struct _GstRTPHeaderExtension GstRTPHeaderExtension;
+typedef struct _GstRTPHeaderExtensionClass GstRTPHeaderExtensionClass;
+
+/**
+ * GstRTPHeaderExtensionFlags:
+ * @GST_RTP_HEADER_EXTENSION_ONE_BYTE: The one byte rtp extension header.
+ * 1-16 data bytes per extension with a maximum of
+ * 14 extension ids in total.
+ * @GST_RTP_HEADER_EXTENSION_TWO_BYTE: The two byte rtp extension header.
+ * 256 data bytes per extension with a maximum of 255 (or 256
+ * including appbits) extensions in total.
+ *
+ * Flags that apply to a RTP Audio/Video header extension.
+ *
+ * Since: 1.20
+ */
+typedef enum /*< underscore_name=gst_rtp_header_extension_flags >*/
+{
+ GST_RTP_HEADER_EXTENSION_ONE_BYTE = (1 << 0),
+ GST_RTP_HEADER_EXTENSION_TWO_BYTE = (1 << 1),
+} GstRTPHeaderExtensionFlags;
+
+/**
+ * GstRTPHeaderExtensionDirection:
+ * @GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE: Neither send nor
+ * receive RTP Header Extensions
+ * @GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY: Only send RTP Header
+ * Extensions @GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY: Only
+ * receive RTP Header Extensions
+ * @GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV: Send and receive RTP
+ * Header Extensions ext
+ * @GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED: RTP header extension
+ * direction is inherited from the stream
+ *
+ * Direction to which to apply the RTP Header Extension
+ *
+ * Since: 1.20
+ */
+typedef enum /*< underscore_name=gst_rtp_header_extension_direction >*/
+{
+ GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE = 0,
+ GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY = (1 << 0),
+ GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY = (1 << 1),
+ GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV = (
+ GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY |
+ GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY),
+ GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED = (1 << 2)
+} GstRTPHeaderExtensionDirection;
+
+/**
+ * GstRTPHeaderExtension:
+ * @parent: the parent #GObject
+ * @ext_id: the configured extension id
+ *
+ * Instance struct for a RTP Audio/Video header extension.
+ *
+ * Since: 1.20
+ */
+struct _GstRTPHeaderExtension
+{
+ GstElement parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTPHeaderExtensionClass:
+ * @parent_class: the parent class
+ * @get_uri: retrieve the RTP extension uri
+ * @get_supported_flags: retrieve the supported flags
+ * @get_max_size: retrieve the maximum size for this extension based on the
+ * information available from input_meta. Implementations should attempt
+ * to provide as accurate information as possible as the returned value
+ * will be used to control the amount of possible data in the payload.
+ * Implementations must return the maximum as the allocated size for
+ * writing the extension will be at least the size of the returned value.
+ * Return the amount of data read or <0 on failure.
+ * @write: write into @data the information for this extension. Various
+ * information is provided to help writing extensions in particular cases.
+ * @read: read from a rtp payloaded buffer and extract the extension
+ * information, optionally adding some meta onto the output buffer.
+ * @set_non_rtp_sink_caps: read any information from sink caps that the header
+ * extension needs for its function.
+ * @update_non_rtp_src_caps: update depayloader non-RTP (depayloaded) caps with
+ * the information parsed from RTP header.
+ * @set_attributes: set the necessary attributes that may be signaled e.g. with
+ * an SDP.
+ * @set_caps_from_attributes: write the necessary caps field/s for the configured
+ * attributes e.g. as signalled with SDP.
+ *
+ * Base class for RTP Header extensions.
+ *
+ * Since: 1.20
+ */
+
+struct _GstRTPHeaderExtensionClass
+{
+ GstElementClass parent_class;
+
+ /*< public >*/
+ GstRTPHeaderExtensionFlags (*get_supported_flags) (GstRTPHeaderExtension * ext);
+
+ gsize (*get_max_size) (GstRTPHeaderExtension * ext,
+ const GstBuffer * input_meta);
+
+ gssize (*write) (GstRTPHeaderExtension * ext,
+ const GstBuffer * input_meta,
+ GstRTPHeaderExtensionFlags write_flags,
+ GstBuffer * output,
+ guint8 * data,
+ gsize size);
+
+ gboolean (*read) (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionFlags read_flags,
+ const guint8 * data,
+ gsize size,
+ GstBuffer * buffer);
+ gboolean (*set_non_rtp_sink_caps) (GstRTPHeaderExtension * ext,
+ const GstCaps * caps);
+ gboolean (*update_non_rtp_src_caps) (GstRTPHeaderExtension * ext,
+ GstCaps * caps);
+ gboolean (*set_attributes) (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction,
+ const gchar * attributes);
+ gboolean (*set_caps_from_attributes) (GstRTPHeaderExtension * ext,
+ GstCaps * caps);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPHeaderExtension, gst_object_unref)
+
+/**
+ * GST_RTP_HEADER_EXTENSION_URI_METADATA_KEY:
+ *
+ * Since: 1.20
+ */
+#define GST_RTP_HEADER_EXTENSION_URI_METADATA_KEY "RTP-Header-Extension-URI"
+
+GST_RTP_API
+void gst_rtp_header_extension_class_set_uri (GstRTPHeaderExtensionClass *klass,
+ const gchar * uri);
+
+GST_RTP_API
+const gchar * gst_rtp_header_extension_get_uri (GstRTPHeaderExtension * ext);
+GST_RTP_API
+gsize gst_rtp_header_extension_get_max_size (GstRTPHeaderExtension * ext,
+ const GstBuffer * input_meta);
+GST_RTP_API
+GstRTPHeaderExtensionFlags gst_rtp_header_extension_get_supported_flags (GstRTPHeaderExtension * ext);
+GST_RTP_API
+guint gst_rtp_header_extension_get_id (GstRTPHeaderExtension * ext);
+GST_RTP_API
+void gst_rtp_header_extension_set_id (GstRTPHeaderExtension * ext,
+ guint ext_id);
+GST_RTP_API
+gssize gst_rtp_header_extension_write (GstRTPHeaderExtension * ext,
+ const GstBuffer * input_meta,
+ GstRTPHeaderExtensionFlags write_flags,
+ GstBuffer * output,
+ guint8 * data,
+ gsize size);
+GST_RTP_API
+gboolean gst_rtp_header_extension_read (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionFlags read_flags,
+ const guint8 * data,
+ gsize size,
+ GstBuffer * buffer);
+GST_RTP_API
+gboolean gst_rtp_header_extension_set_non_rtp_sink_caps (GstRTPHeaderExtension * ext,
+ const GstCaps * caps);
+GST_RTP_API
+gboolean gst_rtp_header_extension_wants_update_non_rtp_src_caps (GstRTPHeaderExtension * ext);
+GST_RTP_API
+void gst_rtp_header_extension_set_wants_update_non_rtp_src_caps (GstRTPHeaderExtension * ext,
+ gboolean state);
+GST_RTP_API
+gboolean gst_rtp_header_extension_update_non_rtp_src_caps (GstRTPHeaderExtension * ext,
+ GstCaps * caps);
+GST_RTP_API
+gboolean gst_rtp_header_extension_set_caps_from_attributes (GstRTPHeaderExtension * ext,
+ GstCaps * caps);
+GST_RTP_API
+gboolean gst_rtp_header_extension_set_attributes_from_caps (GstRTPHeaderExtension * ext,
+ const GstCaps * caps);
+
+GST_RTP_API
+GList * gst_rtp_get_header_extension_list (void);
+GST_RTP_API
+GstRTPHeaderExtension * gst_rtp_header_extension_create_from_uri (const gchar * uri);
+
+GST_RTP_API
+gchar * gst_rtp_header_extension_get_sdp_caps_field_name (GstRTPHeaderExtension * ext);
+
+GST_RTP_API
+void gst_rtp_header_extension_set_direction (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction);
+GST_RTP_API
+GstRTPHeaderExtensionDirection gst_rtp_header_extension_get_direction (GstRTPHeaderExtension * ext);
+
+GST_RTP_API
+gboolean gst_rtp_header_extension_set_caps_from_attributes_helper (GstRTPHeaderExtension * ext,
+ GstCaps * caps,
+ const gchar * attributes);
+
+G_END_DECLS
+
+#endif /* __GST_RTPHDREXT_H__ */
+
diff --git a/include/gst/rtp/gstrtpmeta.h b/include/gst/rtp/gstrtpmeta.h
new file mode 100644
index 0000000000..f0611d36e3
--- /dev/null
+++ b/include/gst/rtp/gstrtpmeta.h
@@ -0,0 +1,79 @@
+/* GStreamer
+ * Copyright (C) <2016> Stian Selnes <stian@pexip.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_META_H__
+#define __GST_RTP_META_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/rtp-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_RTP_SOURCE_META_API_TYPE (gst_rtp_source_meta_api_get_type())
+#define GST_RTP_SOURCE_META_INFO (gst_rtp_source_meta_get_info())
+typedef struct _GstRTPSourceMeta GstRTPSourceMeta;
+
+#define GST_RTP_SOURCE_META_MAX_CSRC_COUNT 15
+
+/**
+ * GstRTPSourceMeta:
+ * @meta: parent #GstMeta
+ * @ssrc: the SSRC
+ * @ssrc_valid: whether @ssrc is set and valid
+ * @csrc: (allow-none): pointer to the CSRCs
+ * @csrc_count: number of elements in @csrc
+ *
+ * Meta describing the source(s) of the buffer.
+ *
+ * Since: 1.16
+ */
+struct _GstRTPSourceMeta
+{
+ GstMeta meta;
+
+ guint32 ssrc;
+ gboolean ssrc_valid;
+ guint32 csrc[GST_RTP_SOURCE_META_MAX_CSRC_COUNT];
+ guint csrc_count;
+};
+
+GST_RTP_API
+GType gst_rtp_source_meta_api_get_type (void);
+
+GST_RTP_API
+GstRTPSourceMeta * gst_buffer_add_rtp_source_meta (GstBuffer * buffer, const guint32 * ssrc,
+ const guint32 * csrc, guint csrc_count);
+GST_RTP_API
+GstRTPSourceMeta * gst_buffer_get_rtp_source_meta (GstBuffer * buffer);
+
+GST_RTP_API
+guint gst_rtp_source_meta_get_source_count (const GstRTPSourceMeta * meta);
+
+GST_RTP_API
+gboolean gst_rtp_source_meta_set_ssrc (GstRTPSourceMeta * meta, guint32 * ssrc);
+
+GST_RTP_API
+gboolean gst_rtp_source_meta_append_csrc (GstRTPSourceMeta * meta,
+ const guint32 * csrc, guint csrc_count);
+GST_RTP_API
+const GstMetaInfo * gst_rtp_source_meta_get_info (void);
+
+G_END_DECLS
+
+#endif /* __GST_RTP_META_H__ */
diff --git a/include/gst/rtp/gstrtppayloads.h b/include/gst/rtp/gstrtppayloads.h
new file mode 100644
index 0000000000..84f6c3cc3c
--- /dev/null
+++ b/include/gst/rtp/gstrtppayloads.h
@@ -0,0 +1,199 @@
+/* GStreamer
+ * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstrtppayloads.h: various helper functions to deal with RTP payload
+ * types.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTPPAYLOADS_H__
+#define __GST_RTPPAYLOADS_H__
+
+#include <gst/gst.h>
+#include <gst/rtp/rtp-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstRTPPayload:
+ * @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551)
+ * @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved
+ * @GST_RTP_PAYLOAD_G721: RFC 3551 says reserved
+ * @GST_RTP_PAYLOAD_GSM: GSM audio
+ * @GST_RTP_PAYLOAD_G723: ITU G.723.1 audio
+ * @GST_RTP_PAYLOAD_DVI4_8000: IMA ADPCM wave type (RFC 3551)
+ * @GST_RTP_PAYLOAD_DVI4_16000: IMA ADPCM wave type (RFC 3551)
+ * @GST_RTP_PAYLOAD_LPC: experimental linear predictive encoding
+ * @GST_RTP_PAYLOAD_PCMA: ITU-T G.711 A-law audio (RFC 3551)
+ * @GST_RTP_PAYLOAD_G722: ITU-T G.722 (RFC 3551)
+ * @GST_RTP_PAYLOAD_L16_STEREO: stereo PCM
+ * @GST_RTP_PAYLOAD_L16_MONO: mono PCM
+ * @GST_RTP_PAYLOAD_QCELP: EIA & TIA standard IS-733
+ * @GST_RTP_PAYLOAD_CN: Comfort Noise (RFC 3389)
+ * @GST_RTP_PAYLOAD_MPA: Audio MPEG 1-3.
+ * @GST_RTP_PAYLOAD_G728: ITU-T G.728 Speech coder (RFC 3551)
+ * @GST_RTP_PAYLOAD_DVI4_11025: IMA ADPCM wave type (RFC 3551)
+ * @GST_RTP_PAYLOAD_DVI4_22050: IMA ADPCM wave type (RFC 3551)
+ * @GST_RTP_PAYLOAD_G729: ITU-T G.729 Speech coder (RFC 3551)
+ * @GST_RTP_PAYLOAD_CELLB: See RFC 2029
+ * @GST_RTP_PAYLOAD_JPEG: ISO Standards 10918-1 and 10918-2 (RFC 2435)
+ * @GST_RTP_PAYLOAD_NV: nv encoding by Ron Frederick
+ * @GST_RTP_PAYLOAD_H261: ITU-T Recommendation H.261 (RFC 2032)
+ * @GST_RTP_PAYLOAD_MPV: Video MPEG 1 & 2 (RFC 2250)
+ * @GST_RTP_PAYLOAD_MP2T: MPEG-2 transport stream (RFC 2250)
+ * @GST_RTP_PAYLOAD_H263: Video H263 (RFC 2190)
+ *
+ * Standard predefined fixed payload types.
+ *
+ * The official list is at:
+ * http://www.iana.org/assignments/rtp-parameters
+ *
+ * Audio:
+ * reserved: 19
+ * unassigned: 20-23,
+ *
+ * Video:
+ * unassigned: 24, 27, 29, 30, 35-71, 77-95
+ * Reserved for RTCP conflict avoidance: 72-76
+ */
+typedef enum
+{
+ /* Audio: */
+ GST_RTP_PAYLOAD_PCMU = 0,
+ GST_RTP_PAYLOAD_1016 = 1, /* RFC 3551 says reserved */
+ GST_RTP_PAYLOAD_G721 = 2, /* RFC 3551 says reserved */
+ GST_RTP_PAYLOAD_GSM = 3,
+ GST_RTP_PAYLOAD_G723 = 4,
+ GST_RTP_PAYLOAD_DVI4_8000 = 5,
+ GST_RTP_PAYLOAD_DVI4_16000 = 6,
+ GST_RTP_PAYLOAD_LPC = 7,
+ GST_RTP_PAYLOAD_PCMA = 8,
+ GST_RTP_PAYLOAD_G722 = 9,
+ GST_RTP_PAYLOAD_L16_STEREO = 10,
+ GST_RTP_PAYLOAD_L16_MONO = 11,
+ GST_RTP_PAYLOAD_QCELP = 12,
+ GST_RTP_PAYLOAD_CN = 13,
+ GST_RTP_PAYLOAD_MPA = 14,
+ GST_RTP_PAYLOAD_G728 = 15,
+ GST_RTP_PAYLOAD_DVI4_11025 = 16,
+ GST_RTP_PAYLOAD_DVI4_22050 = 17,
+ GST_RTP_PAYLOAD_G729 = 18,
+
+ /* Video: */
+
+ GST_RTP_PAYLOAD_CELLB = 25,
+ GST_RTP_PAYLOAD_JPEG = 26,
+ GST_RTP_PAYLOAD_NV = 28,
+ GST_RTP_PAYLOAD_H261 = 31,
+ GST_RTP_PAYLOAD_MPV = 32,
+ GST_RTP_PAYLOAD_MP2T = 33,
+ GST_RTP_PAYLOAD_H263 = 34,
+
+ /* BOTH */
+} GstRTPPayload;
+
+/* backward compatibility */
+#define GST_RTP_PAYLOAD_G723_63 16
+#define GST_RTP_PAYLOAD_G723_53 17
+#define GST_RTP_PAYLOAD_TS48 18
+#define GST_RTP_PAYLOAD_TS41 19
+
+#define GST_RTP_PAYLOAD_G723_63_STRING "16"
+#define GST_RTP_PAYLOAD_G723_53_STRING "17"
+#define GST_RTP_PAYLOAD_TS48_STRING "18"
+#define GST_RTP_PAYLOAD_TS41_STRING "19"
+
+/* Defining the above as strings, to make the declaration of pad_templates
+ * easier. So if please keep these synchronized with the above.
+ */
+#define GST_RTP_PAYLOAD_PCMU_STRING "0"
+#define GST_RTP_PAYLOAD_1016_STRING "1"
+#define GST_RTP_PAYLOAD_G721_STRING "2"
+#define GST_RTP_PAYLOAD_GSM_STRING "3"
+#define GST_RTP_PAYLOAD_G723_STRING "4"
+#define GST_RTP_PAYLOAD_DVI4_8000_STRING "5"
+#define GST_RTP_PAYLOAD_DVI4_16000_STRING "6"
+#define GST_RTP_PAYLOAD_LPC_STRING "7"
+#define GST_RTP_PAYLOAD_PCMA_STRING "8"
+#define GST_RTP_PAYLOAD_G722_STRING "9"
+#define GST_RTP_PAYLOAD_L16_STEREO_STRING "10"
+#define GST_RTP_PAYLOAD_L16_MONO_STRING "11"
+#define GST_RTP_PAYLOAD_QCELP_STRING "12"
+#define GST_RTP_PAYLOAD_CN_STRING "13"
+#define GST_RTP_PAYLOAD_MPA_STRING "14"
+#define GST_RTP_PAYLOAD_G728_STRING "15"
+#define GST_RTP_PAYLOAD_DVI4_11025_STRING "16"
+#define GST_RTP_PAYLOAD_DVI4_22050_STRING "17"
+#define GST_RTP_PAYLOAD_G729_STRING "18"
+
+#define GST_RTP_PAYLOAD_CELLB_STRING "25"
+#define GST_RTP_PAYLOAD_JPEG_STRING "26"
+#define GST_RTP_PAYLOAD_NV_STRING "28"
+
+#define GST_RTP_PAYLOAD_H261_STRING "31"
+#define GST_RTP_PAYLOAD_MPV_STRING "32"
+#define GST_RTP_PAYLOAD_MP2T_STRING "33"
+#define GST_RTP_PAYLOAD_H263_STRING "34"
+
+#define GST_RTP_PAYLOAD_DYNAMIC_STRING "[96, 127]"
+
+/**
+ * GST_RTP_PAYLOAD_IS_DYNAMIC:
+ * @pt: a payload type
+ *
+ * Check if @pt is a dynamic payload type.
+ */
+#define GST_RTP_PAYLOAD_IS_DYNAMIC(pt) ((pt) >= 96 && (pt) <= 127)
+
+typedef struct _GstRTPPayloadInfo GstRTPPayloadInfo;
+
+/**
+ * GstRTPPayloadInfo:
+ * @payload_type: payload type, -1 means dynamic
+ * @media: the media type(s), usually "audio", "video", "application", "text",
+ * "message".
+ * @encoding_name: the encoding name of @pt
+ * @clock_rate: default clock rate, 0 = unknown/variable
+ * @encoding_parameters: encoding parameters. For audio this is the number of
+ * channels. NULL = not applicable.
+ * @bitrate: the bitrate of the media. 0 = unknown/variable.
+ *
+ * Structure holding default payload type information.
+ */
+struct _GstRTPPayloadInfo
+{
+ guint8 payload_type;
+ const gchar *media;
+ const gchar *encoding_name;
+ guint clock_rate;
+ const gchar *encoding_parameters;
+ guint bitrate;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTP_API
+const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type);
+
+GST_RTP_API
+const GstRTPPayloadInfo * gst_rtp_payload_info_for_name (const gchar *media, const gchar *encoding_name);
+
+G_END_DECLS
+
+#endif /* __GST_RTPPAYLOADS_H__ */
+
diff --git a/include/gst/rtp/rtp-prelude.h b/include/gst/rtp/rtp-prelude.h
new file mode 100644
index 0000000000..e130b8a476
--- /dev/null
+++ b/include/gst/rtp/rtp-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer RTP Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * rtp-prelude.h: prelude include header for gst-rtp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_PRELUDE_H__
+#define __GST_RTP_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_RTP
+#define GST_RTP_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_RTP_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_RTP_PRELUDE_H__ */
diff --git a/include/gst/rtp/rtp.h b/include/gst/rtp/rtp.h
new file mode 100644
index 0000000000..0e6633bd81
--- /dev/null
+++ b/include/gst/rtp/rtp.h
@@ -0,0 +1,36 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstrtp.h: single include header for gst-rtp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_H__
+#define __GST_RTP_H__
+
+#include <gst/rtp/gstrtpdefs.h>
+#include <gst/rtp/gstrtpbuffer.h>
+#include <gst/rtp/gstrtcpbuffer.h>
+#include <gst/rtp/gstrtppayloads.h>
+#include <gst/rtp/gstrtphdrext.h>
+#include <gst/rtp/gstrtpbaseaudiopayload.h>
+#include <gst/rtp/gstrtpbasepayload.h>
+#include <gst/rtp/gstrtpbasedepayload.h>
+#include <gst/rtp/gstrtpmeta.h>
+#include <gst/rtp/gstrtp-enumtypes.h>
+
+#endif /* __GST_RTP_H__ */
diff --git a/include/gst/rtsp-server/rtsp-address-pool.h b/include/gst/rtsp-server/rtsp-address-pool.h
new file mode 100644
index 0000000000..997cfd1d77
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-address-pool.h
@@ -0,0 +1,205 @@
+/* GStreamer
+ * Copyright (C) 2012 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_ADDRESS_POOL_H__
+#define __GST_RTSP_ADDRESS_POOL_H__
+
+#include <gst/gst.h>
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_ADDRESS_POOL (gst_rtsp_address_pool_get_type ())
+#define GST_IS_RTSP_ADDRESS_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ADDRESS_POOL))
+#define GST_IS_RTSP_ADDRESS_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ADDRESS_POOL))
+#define GST_RTSP_ADDRESS_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
+#define GST_RTSP_ADDRESS_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPool))
+#define GST_RTSP_ADDRESS_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
+#define GST_RTSP_ADDRESS_POOL_CAST(obj) ((GstRTSPAddressPool*)(obj))
+#define GST_RTSP_ADDRESS_POOL_CLASS_CAST(klass) ((GstRTSPAddressPoolClass*)(klass))
+
+/**
+ * GstRTSPAddressPoolResult:
+ * @GST_RTSP_ADDRESS_POOL_OK: no error
+ * @GST_RTSP_ADDRESS_POOL_EINVAL:invalid arguments were provided to a function
+ * @GST_RTSP_ADDRESS_POOL_ERESERVED: the addres has already been reserved
+ * @GST_RTSP_ADDRESS_POOL_ERANGE: the address is not in the pool
+ * @GST_RTSP_ADDRESS_POOL_ELAST: last error
+ *
+ * Result codes from RTSP address pool functions.
+ */
+typedef enum {
+ GST_RTSP_ADDRESS_POOL_OK = 0,
+ /* errors */
+ GST_RTSP_ADDRESS_POOL_EINVAL = -1,
+ GST_RTSP_ADDRESS_POOL_ERESERVED = -2,
+ GST_RTSP_ADDRESS_POOL_ERANGE = -3,
+
+ GST_RTSP_ADDRESS_POOL_ELAST = -4,
+} GstRTSPAddressPoolResult;
+
+
+typedef struct _GstRTSPAddress GstRTSPAddress;
+
+typedef struct _GstRTSPAddressPool GstRTSPAddressPool;
+typedef struct _GstRTSPAddressPoolClass GstRTSPAddressPoolClass;
+typedef struct _GstRTSPAddressPoolPrivate GstRTSPAddressPoolPrivate;
+
+/**
+ * GstRTSPAddress:
+ * @pool: the #GstRTSPAddressPool owner of this address
+ * @address: the address
+ * @port: the port number
+ * @n_ports: number of ports
+ * @ttl: TTL or 0 for unicast addresses
+ *
+ * An address
+ */
+struct _GstRTSPAddress {
+ GstRTSPAddressPool *pool;
+
+ gchar *address;
+ guint16 port;
+ gint n_ports;
+ guint8 ttl;
+
+ /*<private >*/
+ gpointer priv;
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_address_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPAddress * gst_rtsp_address_copy (GstRTSPAddress *addr);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_address_free (GstRTSPAddress *addr);
+
+/**
+ * GstRTSPAddressFlags:
+ * @GST_RTSP_ADDRESS_FLAG_NONE: no flags
+ * @GST_RTSP_ADDRESS_FLAG_IPV4: an IPv4 address
+ * @GST_RTSP_ADDRESS_FLAG_IPV6: and IPv6 address
+ * @GST_RTSP_ADDRESS_FLAG_EVEN_PORT: address with an even port
+ * @GST_RTSP_ADDRESS_FLAG_MULTICAST: a multicast address
+ * @GST_RTSP_ADDRESS_FLAG_UNICAST: a unicast address
+ *
+ * Flags used to control allocation of addresses
+ */
+typedef enum {
+ GST_RTSP_ADDRESS_FLAG_NONE = 0,
+ GST_RTSP_ADDRESS_FLAG_IPV4 = (1 << 0),
+ GST_RTSP_ADDRESS_FLAG_IPV6 = (1 << 1),
+ GST_RTSP_ADDRESS_FLAG_EVEN_PORT = (1 << 2),
+ GST_RTSP_ADDRESS_FLAG_MULTICAST = (1 << 3),
+ GST_RTSP_ADDRESS_FLAG_UNICAST = (1 << 4),
+} GstRTSPAddressFlags;
+
+/**
+ * GST_RTSP_ADDRESS_POOL_ANY_IPV4:
+ *
+ * Used with gst_rtsp_address_pool_add_range() to bind to all
+ * IPv4 addresses
+ */
+#define GST_RTSP_ADDRESS_POOL_ANY_IPV4 "0.0.0.0"
+
+/**
+ * GST_RTSP_ADDRESS_POOL_ANY_IPV6:
+ *
+ * Used with gst_rtsp_address_pool_add_range() to bind to all
+ * IPv6 addresses
+ */
+#define GST_RTSP_ADDRESS_POOL_ANY_IPV6 "::"
+
+/**
+ * GstRTSPAddressPool:
+ * @parent: the parent GObject
+ *
+ * An address pool, all member are private
+ */
+struct _GstRTSPAddressPool {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPAddressPoolPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPAddressPoolClass:
+ *
+ * Opaque Address pool class.
+ */
+struct _GstRTSPAddressPoolClass {
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_address_pool_get_type (void);
+
+/* create a new address pool */
+
+GST_RTSP_SERVER_API
+GstRTSPAddressPool * gst_rtsp_address_pool_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_address_pool_dump (GstRTSPAddressPool * pool);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_address_pool_add_range (GstRTSPAddressPool * pool,
+ const gchar *min_address,
+ const gchar *max_address,
+ guint16 min_port,
+ guint16 max_port,
+ guint8 ttl);
+
+GST_RTSP_SERVER_API
+GstRTSPAddress * gst_rtsp_address_pool_acquire_address (GstRTSPAddressPool * pool,
+ GstRTSPAddressFlags flags,
+ gint n_ports);
+
+GST_RTSP_SERVER_API
+GstRTSPAddressPoolResult gst_rtsp_address_pool_reserve_address (GstRTSPAddressPool * pool,
+ const gchar *ip_address,
+ guint port,
+ guint n_ports,
+ guint ttl,
+ GstRTSPAddress ** address);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_address_pool_has_unicast_addresses (GstRTSPAddressPool * pool);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPAddress, gst_rtsp_address_free)
+#endif
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPAddressPool, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_ADDRESS_POOL_H__ */
diff --git a/include/gst/rtsp-server/rtsp-auth.h b/include/gst/rtsp-server/rtsp-auth.h
new file mode 100644
index 0000000000..05a3e5a455
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-auth.h
@@ -0,0 +1,230 @@
+/* GStreamer
+ * Copyright (C) 2010 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_RTSP_AUTH_H__
+#define __GST_RTSP_AUTH_H__
+
+typedef struct _GstRTSPAuth GstRTSPAuth;
+typedef struct _GstRTSPAuthClass GstRTSPAuthClass;
+typedef struct _GstRTSPAuthPrivate GstRTSPAuthPrivate;
+
+#include "rtsp-server-prelude.h"
+#include "rtsp-client.h"
+#include "rtsp-token.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_AUTH (gst_rtsp_auth_get_type ())
+#define GST_IS_RTSP_AUTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_AUTH))
+#define GST_IS_RTSP_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_AUTH))
+#define GST_RTSP_AUTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_AUTH, GstRTSPAuthClass))
+#define GST_RTSP_AUTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_AUTH, GstRTSPAuth))
+#define GST_RTSP_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_AUTH, GstRTSPAuthClass))
+#define GST_RTSP_AUTH_CAST(obj) ((GstRTSPAuth*)(obj))
+#define GST_RTSP_AUTH_CLASS_CAST(klass) ((GstRTSPAuthClass*)(klass))
+
+/**
+ * GstRTSPAuth:
+ *
+ * The authentication structure.
+ */
+struct _GstRTSPAuth {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPAuthPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPAuthClass:
+ * @authenticate: check the authentication of a client. The default implementation
+ * checks if the authentication in the header matches one of the basic
+ * authentication tokens. This function should set the authgroup field
+ * in the context.
+ * @check: check if a resource can be accessed. this function should
+ * call authenticate to authenticate the client when needed. The method
+ * should also construct and send an appropriate response message on
+ * error.
+ *
+ * The authentication class.
+ */
+struct _GstRTSPAuthClass {
+ GObjectClass parent_class;
+
+ gboolean (*authenticate) (GstRTSPAuth *auth, GstRTSPContext *ctx);
+ gboolean (*check) (GstRTSPAuth *auth, GstRTSPContext *ctx,
+ const gchar *check);
+ void (*generate_authenticate_header) (GstRTSPAuth *auth, GstRTSPContext *ctx);
+ gboolean (*accept_certificate) (GstRTSPAuth *auth,
+ GTlsConnection *connection,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors);
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_auth_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPAuth * gst_rtsp_auth_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_tls_certificate (GstRTSPAuth *auth, GTlsCertificate *cert);
+
+GST_RTSP_SERVER_API
+GTlsCertificate * gst_rtsp_auth_get_tls_certificate (GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_tls_database (GstRTSPAuth *auth, GTlsDatabase *database);
+
+GST_RTSP_SERVER_API
+GTlsDatabase * gst_rtsp_auth_get_tls_database (GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_tls_authentication_mode (GstRTSPAuth *auth, GTlsAuthenticationMode mode);
+
+GST_RTSP_SERVER_API
+GTlsAuthenticationMode gst_rtsp_auth_get_tls_authentication_mode (GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_default_token (GstRTSPAuth *auth, GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+GstRTSPToken * gst_rtsp_auth_get_default_token (GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_add_basic (GstRTSPAuth *auth, const gchar * basic,
+ GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_remove_basic (GstRTSPAuth *auth, const gchar * basic);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_add_digest (GstRTSPAuth *auth, const gchar *user,
+ const gchar *pass, GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_remove_digest (GstRTSPAuth *auth, const gchar *user);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_supported_methods (GstRTSPAuth *auth, GstRTSPAuthMethod methods);
+
+GST_RTSP_SERVER_API
+GstRTSPAuthMethod gst_rtsp_auth_get_supported_methods (GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_auth_check (const gchar *check);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_auth_parse_htdigest (GstRTSPAuth *auth, const gchar *path, GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_auth_set_realm (GstRTSPAuth *auth, const gchar *realm);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_auth_get_realm (GstRTSPAuth *auth);
+
+/* helpers */
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_auth_make_basic (const gchar * user, const gchar * pass);
+
+/* checks */
+/**
+ * GST_RTSP_AUTH_CHECK_CONNECT:
+ *
+ * Check a new connection
+ */
+#define GST_RTSP_AUTH_CHECK_CONNECT "auth.check.connect"
+/**
+ * GST_RTSP_AUTH_CHECK_URL:
+ *
+ * Check the URL and methods
+ */
+#define GST_RTSP_AUTH_CHECK_URL "auth.check.url"
+/**
+ * GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS:
+ *
+ * Check if access is allowed to a factory.
+ * When access is not allowed an 404 Not Found is sent in the response.
+ */
+#define GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS "auth.check.media.factory.access"
+/**
+ * GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT:
+ *
+ * Check if media can be constructed from a media factory
+ * A response should be sent on error.
+ */
+#define GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT "auth.check.media.factory.construct"
+/**
+ * GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS:
+ *
+ * Check if the client can specify TTL, destination and
+ * port pair in multicast. No response is sent when the check returns
+ * %FALSE.
+ */
+#define GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS "auth.check.transport.client-settings"
+
+
+/* tokens */
+/**
+ * GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE:
+ *
+ * G_TYPE_STRING, the role to use when dealing with media factories
+ *
+ * The default #GstRTSPAuth object uses this string in the token to find the
+ * role of the media factory. It will then retrieve the #GstRTSPPermissions of
+ * the media factory and retrieve the role with the same name.
+ */
+#define GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE "media.factory.role"
+/**
+ * GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS:
+ *
+ * G_TYPE_BOOLEAN, %TRUE if the client can specify TTL, destination and
+ * port pair in multicast.
+ */
+#define GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS "transport.client-settings"
+
+/* permissions */
+/**
+ * GST_RTSP_PERM_MEDIA_FACTORY_ACCESS:
+ *
+ * G_TYPE_BOOLEAN, %TRUE if the media can be accessed, %FALSE will
+ * return a 404 Not Found error when trying to access the media.
+ */
+#define GST_RTSP_PERM_MEDIA_FACTORY_ACCESS "media.factory.access"
+/**
+ * GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT:
+ *
+ * G_TYPE_BOOLEAN, %TRUE if the media can be constructed, %FALSE will
+ * return a 404 Not Found error when trying to access the media.
+ */
+#define GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT "media.factory.construct"
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPAuth, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_AUTH_H__ */
diff --git a/include/gst/rtsp-server/rtsp-client.h b/include/gst/rtsp-server/rtsp-client.h
new file mode 100644
index 0000000000..604a042399
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-client.h
@@ -0,0 +1,294 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/rtsp/gstrtspconnection.h>
+
+#ifndef __GST_RTSP_CLIENT_H__
+#define __GST_RTSP_CLIENT_H__
+
+G_BEGIN_DECLS
+
+typedef struct _GstRTSPClient GstRTSPClient;
+typedef struct _GstRTSPClientClass GstRTSPClientClass;
+typedef struct _GstRTSPClientPrivate GstRTSPClientPrivate;
+
+#include "rtsp-server-prelude.h"
+#include "rtsp-context.h"
+#include "rtsp-mount-points.h"
+#include "rtsp-sdp.h"
+#include "rtsp-auth.h"
+
+#define GST_TYPE_RTSP_CLIENT (gst_rtsp_client_get_type ())
+#define GST_IS_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
+#define GST_IS_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
+#define GST_RTSP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
+#define GST_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
+#define GST_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
+#define GST_RTSP_CLIENT_CAST(obj) ((GstRTSPClient*)(obj))
+#define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
+
+/**
+ * GstRTSPClientSendFunc:
+ * @client: a #GstRTSPClient
+ * @message: a #GstRTSPMessage
+ * @close: close the connection
+ * @user_data: user data when registering the callback
+ *
+ * This callback is called when @client wants to send @message. When @close is
+ * %TRUE, the connection should be closed when the message has been sent.
+ *
+ * Returns: %TRUE on success.
+ */
+typedef gboolean (*GstRTSPClientSendFunc) (GstRTSPClient *client,
+ GstRTSPMessage *message,
+ gboolean close,
+ gpointer user_data);
+
+/**
+ * GstRTSPClientSendMessagesFunc:
+ * @client: a #GstRTSPClient
+ * @messages: #GstRTSPMessage
+ * @n_messages: number of messages
+ * @close: close the connection
+ * @user_data: user data when registering the callback
+ *
+ * This callback is called when @client wants to send @messages. When @close is
+ * %TRUE, the connection should be closed when the message has been sent.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 1.16
+ */
+typedef gboolean (*GstRTSPClientSendMessagesFunc) (GstRTSPClient *client,
+ GstRTSPMessage *messages,
+ guint n_messages,
+ gboolean close,
+ gpointer user_data);
+
+/**
+ * GstRTSPClient:
+ *
+ * The client object represents the connection and its state with a client.
+ */
+struct _GstRTSPClient {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPClientPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPClientClass:
+ * @create_sdp: called when the SDP needs to be created for media.
+ * @configure_client_media: called when the stream in media needs to be configured.
+ * The default implementation will configure the blocksize on the payloader when
+ * spcified in the request headers.
+ * @configure_client_transport: called when the client transport needs to be
+ * configured.
+ * @params_set: set parameters. This function should also initialize the
+ * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
+ * @params_get: get parameters. This function should also initialize the
+ * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
+ * @make_path_from_uri: called to create path from uri.
+ * @adjust_play_mode: called to give the application the possibility to adjust
+ * the range, seek flags, rate and rate-control. Since 1.18
+ * @adjust_play_response: called to give the implementation the possibility to
+ * adjust the response to a play request, for example if extra headers were
+ * parsed when #GstRTSPClientClass.adjust_play_mode was called. Since 1.18
+ * @tunnel_http_response: called when a response to the GET request is about to
+ * be sent for a tunneled connection. The response can be modified. Since: 1.4
+ *
+ * The client class structure.
+ */
+struct _GstRTSPClientClass {
+ GObjectClass parent_class;
+
+ GstSDPMessage * (*create_sdp) (GstRTSPClient *client, GstRTSPMedia *media);
+ gboolean (*configure_client_media) (GstRTSPClient * client,
+ GstRTSPMedia * media, GstRTSPStream * stream,
+ GstRTSPContext * ctx);
+ gboolean (*configure_client_transport) (GstRTSPClient * client,
+ GstRTSPContext * ctx,
+ GstRTSPTransport * ct);
+ GstRTSPResult (*params_set) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPResult (*params_get) (GstRTSPClient *client, GstRTSPContext *ctx);
+ gchar * (*make_path_from_uri) (GstRTSPClient *client, const GstRTSPUrl *uri);
+ GstRTSPStatusCode (*adjust_play_mode) (GstRTSPClient * client,
+ GstRTSPContext * context,
+ GstRTSPTimeRange ** range,
+ GstSeekFlags * flags,
+ gdouble * rate,
+ GstClockTime * trickmode_interval,
+ gboolean * enable_rate_control);
+ GstRTSPStatusCode (*adjust_play_response) (GstRTSPClient * client,
+ GstRTSPContext * context);
+
+ /* signals */
+ void (*closed) (GstRTSPClient *client);
+ void (*new_session) (GstRTSPClient *client, GstRTSPSession *session);
+ void (*options_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*describe_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*setup_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*play_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*pause_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*teardown_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*set_parameter_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*get_parameter_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*handle_response) (GstRTSPClient *client, GstRTSPContext *ctx);
+
+ void (*tunnel_http_response) (GstRTSPClient * client, GstRTSPMessage * request,
+ GstRTSPMessage * response);
+ void (*send_message) (GstRTSPClient * client, GstRTSPContext *ctx,
+ GstRTSPMessage * response);
+
+ gboolean (*handle_sdp) (GstRTSPClient *client, GstRTSPContext *ctx, GstRTSPMedia *media, GstSDPMessage *sdp);
+
+ void (*announce_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ void (*record_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ gchar* (*check_requirements) (GstRTSPClient *client, GstRTSPContext *ctx, gchar ** arr);
+
+ GstRTSPStatusCode (*pre_options_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_describe_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_setup_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_play_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_pause_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_teardown_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_set_parameter_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_get_parameter_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_announce_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+ GstRTSPStatusCode (*pre_record_request) (GstRTSPClient *client, GstRTSPContext *ctx);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-18];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_client_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPClient * gst_rtsp_client_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
+ GstRTSPSessionPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_mount_points (GstRTSPClient *client,
+ GstRTSPMountPoints *mounts);
+
+GST_RTSP_SERVER_API
+GstRTSPMountPoints * gst_rtsp_client_get_mount_points (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_content_length_limit (GstRTSPClient *client, guint limit);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_client_get_content_length_limit (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_auth (GstRTSPClient *client, GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+GstRTSPAuth * gst_rtsp_client_get_auth (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_thread_pool (GstRTSPClient *client, GstRTSPThreadPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPThreadPool * gst_rtsp_client_get_thread_pool (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_client_set_connection (GstRTSPClient *client, GstRTSPConnection *conn);
+
+GST_RTSP_SERVER_API
+GstRTSPConnection * gst_rtsp_client_get_connection (GstRTSPClient *client);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_client_attach (GstRTSPClient *client,
+ GMainContext *context);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_close (GstRTSPClient * client);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_send_func (GstRTSPClient *client,
+ GstRTSPClientSendFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_client_set_send_messages_func (GstRTSPClient *client,
+ GstRTSPClientSendMessagesFunc func,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+GstRTSPResult gst_rtsp_client_handle_message (GstRTSPClient *client,
+ GstRTSPMessage *message);
+
+GST_RTSP_SERVER_API
+GstRTSPResult gst_rtsp_client_send_message (GstRTSPClient * client,
+ GstRTSPSession *session,
+ GstRTSPMessage *message);
+/**
+ * GstRTSPClientSessionFilterFunc:
+ * @client: a #GstRTSPClient object
+ * @sess: a #GstRTSPSession in @client
+ * @user_data: user data that has been given to gst_rtsp_client_session_filter()
+ *
+ * This function will be called by the gst_rtsp_client_session_filter(). An
+ * implementation should return a value of #GstRTSPFilterResult.
+ *
+ * When this function returns #GST_RTSP_FILTER_REMOVE, @sess will be removed
+ * from @client.
+ *
+ * A return value of #GST_RTSP_FILTER_KEEP will leave @sess untouched in
+ * @client.
+ *
+ * A value of #GST_RTSP_FILTER_REF will add @sess to the result #GList of
+ * gst_rtsp_client_session_filter().
+ *
+ * Returns: a #GstRTSPFilterResult.
+ */
+typedef GstRTSPFilterResult (*GstRTSPClientSessionFilterFunc) (GstRTSPClient *client,
+ GstRTSPSession *sess,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+GList * gst_rtsp_client_session_filter (GstRTSPClient *client,
+ GstRTSPClientSessionFilterFunc func,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+GstRTSPStreamTransport * gst_rtsp_client_get_stream_transport (GstRTSPClient *client,
+ guint8 channel);
+
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPClient, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_CLIENT_H__ */
diff --git a/include/gst/rtsp-server/rtsp-context.h b/include/gst/rtsp-server/rtsp-context.h
new file mode 100644
index 0000000000..c4567f9b09
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-context.h
@@ -0,0 +1,97 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/rtsp/gstrtspconnection.h>
+
+#ifndef __GST_RTSP_CONTEXT_H__
+#define __GST_RTSP_CONTEXT_H__
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_CONTEXT (gst_rtsp_context_get_type ())
+
+typedef struct _GstRTSPContext GstRTSPContext;
+
+#include "rtsp-server-prelude.h"
+#include "rtsp-server-object.h"
+#include "rtsp-media.h"
+#include "rtsp-media-factory.h"
+#include "rtsp-session-media.h"
+#include "rtsp-auth.h"
+#include "rtsp-thread-pool.h"
+#include "rtsp-token.h"
+
+/**
+ * GstRTSPContext:
+ * @server: the server
+ * @conn: the connection
+ * @client: the client
+ * @request: the complete request
+ * @uri: the complete url parsed from @request
+ * @method: the parsed method of @uri
+ * @auth: the current auth object or %NULL
+ * @token: authorisation token
+ * @session: the session, can be %NULL
+ * @sessmedia: the session media for the url can be %NULL
+ * @factory: the media factory for the url, can be %NULL
+ * @media: the media for the url can be %NULL
+ * @stream: the stream for the url can be %NULL
+ * @response: the response
+ * @trans: the stream transport, can be %NULL
+ *
+ * Information passed around containing the context of a request.
+ */
+struct _GstRTSPContext {
+ GstRTSPServer *server;
+ GstRTSPConnection *conn;
+ GstRTSPClient *client;
+ GstRTSPMessage *request;
+ GstRTSPUrl *uri;
+ GstRTSPMethod method;
+ GstRTSPAuth *auth;
+ GstRTSPToken *token;
+ GstRTSPSession *session;
+ GstRTSPSessionMedia *sessmedia;
+ GstRTSPMediaFactory *factory;
+ GstRTSPMedia *media;
+ GstRTSPStream *stream;
+ GstRTSPMessage *response;
+ GstRTSPStreamTransport *trans;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_context_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPContext * gst_rtsp_context_get_current (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_context_push_current (GstRTSPContext * ctx);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_context_pop_current (GstRTSPContext * ctx);
+
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_CONTEXT_H__ */
diff --git a/include/gst/rtsp-server/rtsp-media-factory-uri.h b/include/gst/rtsp-server/rtsp-media-factory-uri.h
new file mode 100644
index 0000000000..2980670cd5
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-media-factory-uri.h
@@ -0,0 +1,91 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include "rtsp-media-factory.h"
+
+#ifndef __GST_RTSP_MEDIA_FACTORY_URI_H__
+#define __GST_RTSP_MEDIA_FACTORY_URI_H__
+
+G_BEGIN_DECLS
+
+/* types for the media factory */
+#define GST_TYPE_RTSP_MEDIA_FACTORY_URI (gst_rtsp_media_factory_uri_get_type ())
+#define GST_IS_RTSP_MEDIA_FACTORY_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA_FACTORY_URI))
+#define GST_IS_RTSP_MEDIA_FACTORY_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA_FACTORY_URI))
+#define GST_RTSP_MEDIA_FACTORY_URI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA_FACTORY_URI, GstRTSPMediaFactoryURIClass))
+#define GST_RTSP_MEDIA_FACTORY_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA_FACTORY_URI, GstRTSPMediaFactoryURI))
+#define GST_RTSP_MEDIA_FACTORY_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA_FACTORY_URI, GstRTSPMediaFactoryURIClass))
+#define GST_RTSP_MEDIA_FACTORY_URI_CAST(obj) ((GstRTSPMediaFactoryURI*)(obj))
+#define GST_RTSP_MEDIA_FACTORY_URI_CLASS_CAST(klass) ((GstRTSPMediaFactoryURIClass*)(klass))
+
+typedef struct _GstRTSPMediaFactoryURI GstRTSPMediaFactoryURI;
+typedef struct _GstRTSPMediaFactoryURIClass GstRTSPMediaFactoryURIClass;
+typedef struct _GstRTSPMediaFactoryURIPrivate GstRTSPMediaFactoryURIPrivate;
+
+/**
+ * GstRTSPMediaFactoryURI:
+ *
+ * A media factory that creates a pipeline to play any uri.
+ */
+struct _GstRTSPMediaFactoryURI {
+ GstRTSPMediaFactory parent;
+
+ /*< private >*/
+ GstRTSPMediaFactoryURIPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPMediaFactoryURIClass:
+ *
+ * The #GstRTSPMediaFactoryURI class structure.
+ */
+struct _GstRTSPMediaFactoryURIClass {
+ GstRTSPMediaFactoryClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_media_factory_uri_get_type (void);
+
+/* creating the factory */
+
+GST_RTSP_SERVER_API
+GstRTSPMediaFactoryURI * gst_rtsp_media_factory_uri_new (void);
+
+/* configuring the factory */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_uri_set_uri (GstRTSPMediaFactoryURI *factory,
+ const gchar *uri);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_media_factory_uri_get_uri (GstRTSPMediaFactoryURI *factory);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPMediaFactoryURI, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_MEDIA_FACTORY_URI_H__ */
diff --git a/include/gst/rtsp-server/rtsp-media-factory.h b/include/gst/rtsp-server/rtsp-media-factory.h
new file mode 100644
index 0000000000..8e847fda33
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-media-factory.h
@@ -0,0 +1,284 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/rtsp/gstrtspurl.h>
+
+#include "rtsp-media.h"
+#include "rtsp-permissions.h"
+#include "rtsp-address-pool.h"
+
+#ifndef __GST_RTSP_MEDIA_FACTORY_H__
+#define __GST_RTSP_MEDIA_FACTORY_H__
+
+G_BEGIN_DECLS
+
+/* types for the media factory */
+#define GST_TYPE_RTSP_MEDIA_FACTORY (gst_rtsp_media_factory_get_type ())
+#define GST_IS_RTSP_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA_FACTORY))
+#define GST_IS_RTSP_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA_FACTORY))
+#define GST_RTSP_MEDIA_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactoryClass))
+#define GST_RTSP_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactory))
+#define GST_RTSP_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactoryClass))
+#define GST_RTSP_MEDIA_FACTORY_CAST(obj) ((GstRTSPMediaFactory*)(obj))
+#define GST_RTSP_MEDIA_FACTORY_CLASS_CAST(klass) ((GstRTSPMediaFactoryClass*)(klass))
+
+typedef struct _GstRTSPMediaFactory GstRTSPMediaFactory;
+typedef struct _GstRTSPMediaFactoryClass GstRTSPMediaFactoryClass;
+typedef struct _GstRTSPMediaFactoryPrivate GstRTSPMediaFactoryPrivate;
+
+/**
+ * GstRTSPMediaFactory:
+ *
+ * The definition and logic for constructing the pipeline for a media. The media
+ * can contain multiple streams like audio and video.
+ */
+struct _GstRTSPMediaFactory {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPMediaFactoryPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPMediaFactoryClass:
+ * @gen_key: convert @url to a key for caching shared #GstRTSPMedia objects.
+ * The default implementation of this function will use the complete URL
+ * including the query parameters to return a key.
+ * @create_element: Construct and return a #GstElement that is a #GstBin containing
+ * the elements to use for streaming the media. The bin should contain
+ * payloaders pay\%d for each stream. The default implementation of this
+ * function returns the bin created from the launch parameter.
+ * @construct: the vmethod that will be called when the factory has to create the
+ * #GstRTSPMedia for @url. The default implementation of this
+ * function calls create_element to retrieve an element and then looks for
+ * pay\%d to create the streams.
+ * @create_pipeline: create a new pipeline or re-use an existing one and
+ * add the #GstRTSPMedia's element created by @construct to the pipeline.
+ * @configure: configure the media created with @construct. The default
+ * implementation will configure the 'shared' property of the media.
+ * @media_constructed: signal emitted when a media was constructed
+ * @media_configure: signal emitted when a media should be configured
+ *
+ * The #GstRTSPMediaFactory class structure.
+ */
+struct _GstRTSPMediaFactoryClass {
+ GObjectClass parent_class;
+
+ gchar * (*gen_key) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
+
+ GstElement * (*create_element) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
+ GstRTSPMedia * (*construct) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
+ GstElement * (*create_pipeline) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+ void (*configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+
+ /* signals */
+ void (*media_constructed) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+ void (*media_configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_media_factory_get_type (void);
+
+/* creating the factory */
+
+GST_RTSP_SERVER_API
+GstRTSPMediaFactory * gst_rtsp_media_factory_new (void);
+
+/* configuring the factory */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
+ const gchar *launch);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_permissions (GstRTSPMediaFactory *factory,
+ GstRTSPPermissions *permissions);
+
+GST_RTSP_SERVER_API
+GstRTSPPermissions * gst_rtsp_media_factory_get_permissions (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_add_role (GstRTSPMediaFactory *factory,
+ const gchar *role,
+ const gchar *fieldname, ...);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_add_role_from_structure (GstRTSPMediaFactory * factory,
+ GstStructure *structure);
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_shared (GstRTSPMediaFactory *factory,
+ gboolean shared);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_is_shared (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_stop_on_disconnect (GstRTSPMediaFactory *factory,
+ gboolean stop_on_disconnect);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_is_stop_on_disonnect (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_suspend_mode (GstRTSPMediaFactory *factory,
+ GstRTSPSuspendMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPSuspendMode gst_rtsp_media_factory_get_suspend_mode (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFactory *factory,
+ gboolean eos_shutdown);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_profiles (GstRTSPMediaFactory *factory,
+ GstRTSPProfile profiles);
+
+GST_RTSP_SERVER_API
+GstRTSPProfile gst_rtsp_media_factory_get_profiles (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory,
+ GstRTSPLowerTrans protocols);
+
+GST_RTSP_SERVER_API
+GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_address_pool (GstRTSPMediaFactory * factory,
+ GstRTSPAddressPool * pool);
+
+GST_RTSP_SERVER_API
+GstRTSPAddressPool * gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_multicast_iface (GstRTSPMediaFactory *factory, const gchar *multicast_iface);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_media_factory_get_multicast_iface (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_buffer_size (GstRTSPMediaFactory * factory,
+ guint size);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_factory_get_buffer_size (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_retransmission_time (GstRTSPMediaFactory * factory,
+ GstClockTime time);
+
+GST_RTSP_SERVER_API
+GstClockTime gst_rtsp_media_factory_get_retransmission_time (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_do_retransmission (GstRTSPMediaFactory * factory,
+ gboolean do_retransmission);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_get_do_retransmission (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_latency (GstRTSPMediaFactory * factory,
+ guint latency);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_factory_get_latency (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_transport_mode (GstRTSPMediaFactory *factory,
+ GstRTSPTransportMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPTransportMode gst_rtsp_media_factory_get_transport_mode (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_media_gtype (GstRTSPMediaFactory * factory,
+ GType media_gtype);
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_media_factory_get_media_gtype (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_clock (GstRTSPMediaFactory *factory,
+ GstClock * clock);
+
+GST_RTSP_SERVER_API
+GstClock * gst_rtsp_media_factory_get_clock (GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_publish_clock_mode (GstRTSPMediaFactory * factory, GstRTSPPublishClockMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPPublishClockMode gst_rtsp_media_factory_get_publish_clock_mode (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_set_max_mcast_ttl (GstRTSPMediaFactory * factory,
+ guint ttl);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_factory_get_max_mcast_ttl (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_bind_mcast_address (GstRTSPMediaFactory * factory,
+ gboolean bind_mcast_addr);
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_is_bind_mcast_address (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_dscp_qos (GstRTSPMediaFactory * factory,
+ gint dscp_qos);
+GST_RTSP_SERVER_API
+gint gst_rtsp_media_factory_get_dscp_qos (GstRTSPMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_factory_set_enable_rtcp (GstRTSPMediaFactory * factory,
+ gboolean enable);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_factory_is_enable_rtcp (GstRTSPMediaFactory * factory);
+
+/* creating the media from the factory and a url */
+
+GST_RTSP_SERVER_API
+GstRTSPMedia * gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory,
+ const GstRTSPUrl *url);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_media_factory_create_element (GstRTSPMediaFactory *factory,
+ const GstRTSPUrl *url);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPMediaFactory, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_MEDIA_FACTORY_H__ */
diff --git a/include/gst/rtsp-server/rtsp-media.h b/include/gst/rtsp-server/rtsp-media.h
new file mode 100644
index 0000000000..9c2494a64e
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-media.h
@@ -0,0 +1,449 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/rtsp/rtsp.h>
+#include <gst/net/gstnet.h>
+
+#ifndef __GST_RTSP_MEDIA_H__
+#define __GST_RTSP_MEDIA_H__
+
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+/* types for the media */
+#define GST_TYPE_RTSP_MEDIA (gst_rtsp_media_get_type ())
+#define GST_IS_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA))
+#define GST_IS_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA))
+#define GST_RTSP_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
+#define GST_RTSP_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMedia))
+#define GST_RTSP_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
+#define GST_RTSP_MEDIA_CAST(obj) ((GstRTSPMedia*)(obj))
+#define GST_RTSP_MEDIA_CLASS_CAST(klass) ((GstRTSPMediaClass*)(klass))
+
+typedef struct _GstRTSPMedia GstRTSPMedia;
+typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
+typedef struct _GstRTSPMediaPrivate GstRTSPMediaPrivate;
+
+/**
+ * GstRTSPMediaStatus:
+ * @GST_RTSP_MEDIA_STATUS_UNPREPARED: media pipeline not prerolled
+ * @GST_RTSP_MEDIA_STATUS_UNPREPARING: media pipeline is busy doing a clean
+ * shutdown.
+ * @GST_RTSP_MEDIA_STATUS_PREPARING: media pipeline is prerolling
+ * @GST_RTSP_MEDIA_STATUS_PREPARED: media pipeline is prerolled
+ * @GST_RTSP_MEDIA_STATUS_SUSPENDED: media is suspended
+ * @GST_RTSP_MEDIA_STATUS_ERROR: media pipeline is in error
+ *
+ * The state of the media pipeline.
+ */
+typedef enum {
+ GST_RTSP_MEDIA_STATUS_UNPREPARED = 0,
+ GST_RTSP_MEDIA_STATUS_UNPREPARING = 1,
+ GST_RTSP_MEDIA_STATUS_PREPARING = 2,
+ GST_RTSP_MEDIA_STATUS_PREPARED = 3,
+ GST_RTSP_MEDIA_STATUS_SUSPENDED = 4,
+ GST_RTSP_MEDIA_STATUS_ERROR = 5
+} GstRTSPMediaStatus;
+
+/**
+ * GstRTSPSuspendMode:
+ * @GST_RTSP_SUSPEND_MODE_NONE: Media is not suspended
+ * @GST_RTSP_SUSPEND_MODE_PAUSE: Media is PAUSED in suspend
+ * @GST_RTSP_SUSPEND_MODE_RESET: The media is set to NULL when suspended
+ *
+ * The suspend mode of the media pipeline. A media pipeline is suspended right
+ * after creating the SDP and when the client performs a PAUSED request.
+ */
+typedef enum {
+ GST_RTSP_SUSPEND_MODE_NONE = 0,
+ GST_RTSP_SUSPEND_MODE_PAUSE = 1,
+ GST_RTSP_SUSPEND_MODE_RESET = 2
+} GstRTSPSuspendMode;
+
+/**
+ * GstRTSPTransportMode:
+ * @GST_RTSP_TRANSPORT_MODE_PLAY: Transport supports PLAY mode
+ * @GST_RTSP_TRANSPORT_MODE_RECORD: Transport supports RECORD mode
+ *
+ * The supported modes of the media.
+ */
+typedef enum {
+ GST_RTSP_TRANSPORT_MODE_PLAY = 1,
+ GST_RTSP_TRANSPORT_MODE_RECORD = 2,
+} GstRTSPTransportMode;
+
+/**
+ * GstRTSPPublishClockMode:
+ * @GST_RTSP_PUBLISH_CLOCK_MODE_NONE: Publish nothing
+ * @GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK: Publish the clock but not the offset
+ * @GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET: Publish the clock and offset
+ *
+ * Whether the clock and possibly RTP/clock offset should be published according to RFC7273.
+ */
+typedef enum {
+ GST_RTSP_PUBLISH_CLOCK_MODE_NONE,
+ GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK,
+ GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET
+} GstRTSPPublishClockMode;
+
+#define GST_TYPE_RTSP_TRANSPORT_MODE (gst_rtsp_transport_mode_get_type())
+GST_RTSP_SERVER_API
+GType gst_rtsp_transport_mode_get_type (void);
+
+#define GST_TYPE_RTSP_SUSPEND_MODE (gst_rtsp_suspend_mode_get_type())
+GST_RTSP_SERVER_API
+GType gst_rtsp_suspend_mode_get_type (void);
+
+#define GST_TYPE_RTSP_PUBLISH_CLOCK_MODE (gst_rtsp_publish_clock_mode_get_type())
+GST_RTSP_SERVER_API
+GType gst_rtsp_publish_clock_mode_get_type (void);
+
+#include "rtsp-stream.h"
+#include "rtsp-thread-pool.h"
+#include "rtsp-permissions.h"
+#include "rtsp-address-pool.h"
+#include "rtsp-sdp.h"
+
+/**
+ * GstRTSPMedia:
+ *
+ * A class that contains the GStreamer element along with a list of
+ * #GstRTSPStream objects that can produce data.
+ *
+ * This object is usually created from a #GstRTSPMediaFactory.
+ */
+struct _GstRTSPMedia {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPMediaPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPMediaClass:
+ * @handle_message: handle a message
+ * @prepare: the default implementation adds all elements and sets the
+ * pipeline's state to GST_STATE_PAUSED (or GST_STATE_PLAYING
+ * in case of NO_PREROLL elements).
+ * @unprepare: the default implementation sets the pipeline's state
+ * to GST_STATE_NULL and removes all elements.
+ * @suspend: the default implementation sets the pipeline's state to
+ * GST_STATE_NULL GST_STATE_PAUSED depending on the selected
+ * suspend mode.
+ * @unsuspend: the default implementation reverts the suspend operation.
+ * The pipeline will be prerolled again if it's state was
+ * set to GST_STATE_NULL in suspend.
+ * @convert_range: convert a range to the given unit
+ * @query_position: query the current position in the pipeline
+ * @query_stop: query when playback will stop
+ *
+ * The RTSP media class
+ */
+struct _GstRTSPMediaClass {
+ GObjectClass parent_class;
+
+ /* vmethods */
+ gboolean (*handle_message) (GstRTSPMedia *media, GstMessage *message);
+ gboolean (*prepare) (GstRTSPMedia *media, GstRTSPThread *thread);
+ gboolean (*unprepare) (GstRTSPMedia *media);
+ gboolean (*suspend) (GstRTSPMedia *media);
+ gboolean (*unsuspend) (GstRTSPMedia *media);
+ gboolean (*convert_range) (GstRTSPMedia *media, GstRTSPTimeRange *range,
+ GstRTSPRangeUnit unit);
+ gboolean (*query_position) (GstRTSPMedia *media, gint64 *position);
+ gboolean (*query_stop) (GstRTSPMedia *media, gint64 *stop);
+ GstElement * (*create_rtpbin) (GstRTSPMedia *media);
+ gboolean (*setup_rtpbin) (GstRTSPMedia *media, GstElement *rtpbin);
+ gboolean (*setup_sdp) (GstRTSPMedia *media, GstSDPMessage *sdp, GstSDPInfo *info);
+
+ /* signals */
+ void (*new_stream) (GstRTSPMedia *media, GstRTSPStream * stream);
+ void (*removed_stream) (GstRTSPMedia *media, GstRTSPStream * stream);
+
+ void (*prepared) (GstRTSPMedia *media);
+ void (*unprepared) (GstRTSPMedia *media);
+
+ void (*target_state) (GstRTSPMedia *media, GstState state);
+ void (*new_state) (GstRTSPMedia *media, GstState state);
+
+ gboolean (*handle_sdp) (GstRTSPMedia *media, GstSDPMessage *sdp);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-1];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_media_get_type (void);
+
+/* creating the media */
+
+GST_RTSP_SERVER_API
+GstRTSPMedia * gst_rtsp_media_new (GstElement *element);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_media_get_element (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_take_pipeline (GstRTSPMedia *media, GstPipeline *pipeline);
+
+GST_RTSP_SERVER_API
+GstRTSPMediaStatus gst_rtsp_media_get_status (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_permissions (GstRTSPMedia *media,
+ GstRTSPPermissions *permissions);
+
+GST_RTSP_SERVER_API
+GstRTSPPermissions * gst_rtsp_media_get_permissions (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_stop_on_disconnect (GstRTSPMedia *media, gboolean stop_on_disconnect);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_stop_on_disconnect (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_transport_mode (GstRTSPMedia *media, GstRTSPTransportMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPTransportMode gst_rtsp_media_get_transport_mode (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_reusable (GstRTSPMedia *media, gboolean reusable);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_reusable (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_profiles (GstRTSPMedia *media, GstRTSPProfile profiles);
+
+GST_RTSP_SERVER_API
+GstRTSPProfile gst_rtsp_media_get_profiles (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_protocols (GstRTSPMedia *media, GstRTSPLowerTrans protocols);
+
+GST_RTSP_SERVER_API
+GstRTSPLowerTrans gst_rtsp_media_get_protocols (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_eos_shutdown (GstRTSPMedia *media, gboolean eos_shutdown);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_eos_shutdown (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_address_pool (GstRTSPMedia *media, GstRTSPAddressPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPAddressPool * gst_rtsp_media_get_address_pool (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_multicast_iface (GstRTSPMedia *media, const gchar *multicast_iface);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_media_get_multicast_iface (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_buffer_size (GstRTSPMedia *media, guint size);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_get_buffer_size (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_retransmission_time (GstRTSPMedia *media, GstClockTime time);
+
+GST_RTSP_SERVER_API
+GstClockTime gst_rtsp_media_get_retransmission_time (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_do_retransmission (GstRTSPMedia * media,
+ gboolean do_retransmission);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_get_do_retransmission (GstRTSPMedia * media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_latency (GstRTSPMedia *media, guint latency);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_get_latency (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_use_time_provider (GstRTSPMedia *media, gboolean time_provider);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_time_provider (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+GstNetTimeProvider * gst_rtsp_media_get_time_provider (GstRTSPMedia *media,
+ const gchar *address, guint16 port);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_clock (GstRTSPMedia *media, GstClock * clock);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_publish_clock_mode (GstRTSPMedia * media, GstRTSPPublishClockMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPPublishClockMode gst_rtsp_media_get_publish_clock_mode (GstRTSPMedia * media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_set_max_mcast_ttl (GstRTSPMedia *media, guint ttl);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_get_max_mcast_ttl (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_bind_mcast_address (GstRTSPMedia *media, gboolean bind_mcast_addr);
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_bind_mcast_address (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_dscp_qos (GstRTSPMedia * media, gint dscp_qos);
+GST_RTSP_SERVER_API
+gint gst_rtsp_media_get_dscp_qos (GstRTSPMedia * media);
+
+/* prepare the media for playback */
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_prepare (GstRTSPMedia *media, GstRTSPThread *thread);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_unprepare (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_suspend_mode (GstRTSPMedia *media, GstRTSPSuspendMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPSuspendMode gst_rtsp_media_get_suspend_mode (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_suspend (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_unsuspend (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp,
+ GstSDPInfo * info);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_handle_sdp (GstRTSPMedia * media, GstSDPMessage * sdp);
+
+/* creating streams */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_collect_streams (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+GstRTSPStream * gst_rtsp_media_create_stream (GstRTSPMedia *media,
+ GstElement *payloader,
+ GstPad *pad);
+
+/* dealing with the media */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_lock (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_unlock (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+GstClock * gst_rtsp_media_get_clock (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+GstClockTime gst_rtsp_media_get_base_time (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_media_n_streams (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+GstRTSPStream * gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx);
+
+GST_RTSP_SERVER_API
+GstRTSPStream * gst_rtsp_media_find_stream (GstRTSPMedia *media, const gchar * control);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_seek (GstRTSPMedia *media, GstRTSPTimeRange *range);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_seek_full (GstRTSPMedia *media,
+ GstRTSPTimeRange *range,
+ GstSeekFlags flags);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_seek_trickmode (GstRTSPMedia *media,
+ GstRTSPTimeRange *range,
+ GstSeekFlags flags,
+ gdouble rate,
+ GstClockTime trickmode_interval);
+
+GST_RTSP_SERVER_API
+GstClockTimeDiff gst_rtsp_media_seekable (GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_media_get_range_string (GstRTSPMedia *media,
+ gboolean play,
+ GstRTSPRangeUnit unit);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_get_rates (GstRTSPMedia * media,
+ gdouble * rate,
+ gdouble * applied_rate);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_set_state (GstRTSPMedia *media, GstState state,
+ GPtrArray *transports);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_pipeline_state (GstRTSPMedia * media,
+ GstState state);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_complete_pipeline (GstRTSPMedia * media, GPtrArray * transports);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_is_receive_only (GstRTSPMedia * media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_has_completed_sender (GstRTSPMedia * media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_media_set_rate_control (GstRTSPMedia * media, gboolean enabled);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_media_get_rate_control (GstRTSPMedia * media);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPMedia, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_MEDIA_H__ */
diff --git a/include/gst/rtsp-server/rtsp-mount-points.h b/include/gst/rtsp-server/rtsp-mount-points.h
new file mode 100644
index 0000000000..200620dcdd
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-mount-points.h
@@ -0,0 +1,105 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include "rtsp-media-factory.h"
+
+#ifndef __GST_RTSP_MOUNT_POINTS_H__
+#define __GST_RTSP_MOUNT_POINTS_H__
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_MOUNT_POINTS (gst_rtsp_mount_points_get_type ())
+#define GST_IS_RTSP_MOUNT_POINTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MOUNT_POINTS))
+#define GST_IS_RTSP_MOUNT_POINTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MOUNT_POINTS))
+#define GST_RTSP_MOUNT_POINTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPointsClass))
+#define GST_RTSP_MOUNT_POINTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPoints))
+#define GST_RTSP_MOUNT_POINTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPointsClass))
+#define GST_RTSP_MOUNT_POINTS_CAST(obj) ((GstRTSPMountPoints*)(obj))
+#define GST_RTSP_MOUNT_POINTS_CLASS_CAST(klass) ((GstRTSPMountPointsClass*)(klass))
+
+typedef struct _GstRTSPMountPoints GstRTSPMountPoints;
+typedef struct _GstRTSPMountPointsClass GstRTSPMountPointsClass;
+typedef struct _GstRTSPMountPointsPrivate GstRTSPMountPointsPrivate;
+
+/**
+ * GstRTSPMountPoints:
+ *
+ * Creates a #GstRTSPMediaFactory object for a given url.
+ */
+struct _GstRTSPMountPoints {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPMountPointsPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPMountPointsClass:
+ * @make_path: make a path from the given url.
+ *
+ * The class for the media mounts object.
+ */
+struct _GstRTSPMountPointsClass {
+ GObjectClass parent_class;
+
+ gchar * (*make_path) (GstRTSPMountPoints *mounts,
+ const GstRTSPUrl *url);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_mount_points_get_type (void);
+
+/* creating a mount points */
+
+GST_RTSP_SERVER_API
+GstRTSPMountPoints * gst_rtsp_mount_points_new (void);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_mount_points_make_path (GstRTSPMountPoints *mounts,
+ const GstRTSPUrl * url);
+/* finding a media factory */
+
+GST_RTSP_SERVER_API
+GstRTSPMediaFactory * gst_rtsp_mount_points_match (GstRTSPMountPoints *mounts,
+ const gchar *path,
+ gint * matched);
+/* managing media to a mount point */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_mount_points_add_factory (GstRTSPMountPoints *mounts,
+ const gchar *path,
+ GstRTSPMediaFactory *factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_mount_points_remove_factory (GstRTSPMountPoints *mounts,
+ const gchar *path);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPMountPoints, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_MOUNT_POINTS_H__ */
diff --git a/include/gst/rtsp-server/rtsp-onvif-client.h b/include/gst/rtsp-server/rtsp-onvif-client.h
new file mode 100644
index 0000000000..8230f23c59
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-onvif-client.h
@@ -0,0 +1,65 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_ONVIF_CLIENT_H__
+#define __GST_RTSP_ONVIF_CLIENT_H__
+
+#include <gst/gst.h>
+#include "rtsp-client.h"
+
+#define GST_TYPE_RTSP_ONVIF_CLIENT (gst_rtsp_onvif_client_get_type ())
+#define GST_IS_RTSP_ONVIF_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ONVIF_CLIENT))
+#define GST_IS_RTSP_ONVIF_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ONVIF_CLIENT))
+#define GST_RTSP_ONVIF_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ONVIF_CLIENT, GstRTSPOnvifClientClass))
+#define GST_RTSP_ONVIF_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ONVIF_CLIENT, GstRTSPOnvifClient))
+#define GST_RTSP_ONVIF_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ONVIF_CLIENT, GstRTSPOnvifClientClass))
+#define GST_RTSP_ONVIF_CLIENT_CAST(obj) ((GstRTSPOnvifClient*)(obj))
+#define GST_RTSP_ONVIF_CLIENT_CLASS_CAST(klass) ((GstRTSPOnvifClientClass*)(klass))
+
+typedef struct GstRTSPOnvifClientClass GstRTSPOnvifClientClass;
+typedef struct GstRTSPOnvifClient GstRTSPOnvifClient;
+
+/**
+ * GstRTSPOnvifClient:
+ *
+ * Since: 1.14
+ */
+struct GstRTSPOnvifClientClass
+{
+ GstRTSPClientClass parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+struct GstRTSPOnvifClient
+{
+ GstRTSPClient parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_onvif_client_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPClient * gst_rtsp_onvif_client_new (void);
+
+#endif /* __GST_RTSP_ONVIF_CLIENT_H__ */
diff --git a/include/gst/rtsp-server/rtsp-onvif-media-factory.h b/include/gst/rtsp-server/rtsp-onvif-media-factory.h
new file mode 100644
index 0000000000..7ff9dc3469
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-onvif-media-factory.h
@@ -0,0 +1,95 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_ONVIF_MEDIA_FACTORY_H__
+#define __GST_RTSP_ONVIF_MEDIA_FACTORY_H__
+
+#include <gst/gst.h>
+#include "rtsp-media-factory.h"
+
+#define GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY (gst_rtsp_onvif_media_factory_get_type ())
+#define GST_IS_RTSP_ONVIF_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY))
+#define GST_IS_RTSP_ONVIF_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY))
+#define GST_RTSP_ONVIF_MEDIA_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY, GstRTSPOnvifMediaFactoryClass))
+#define GST_RTSP_ONVIF_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY, GstRTSPOnvifMediaFactory))
+#define GST_RTSP_ONVIF_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ONVIF_MEDIA_FACTORY, GstRTSPOnvifMediaFactoryClass))
+#define GST_RTSP_ONVIF_MEDIA_FACTORY_CAST(obj) ((GstRTSPOnvifMediaFactory*)(obj))
+#define GST_RTSP_ONVIF_MEDIA_FACTORY_CLASS_CAST(klass) ((GstRTSPOnvifMediaFactoryClass*)(klass))
+
+typedef struct GstRTSPOnvifMediaFactoryClass GstRTSPOnvifMediaFactoryClass;
+typedef struct GstRTSPOnvifMediaFactory GstRTSPOnvifMediaFactory;
+typedef struct GstRTSPOnvifMediaFactoryPrivate GstRTSPOnvifMediaFactoryPrivate;
+
+/**
+ * GstRTSPOnvifMediaFactory:
+ *
+ * Since: 1.14
+ */
+struct GstRTSPOnvifMediaFactoryClass
+{
+ GstRTSPMediaFactoryClass parent;
+ gboolean (*has_backchannel_support) (GstRTSPOnvifMediaFactory * factory);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+struct GstRTSPOnvifMediaFactory
+{
+ GstRTSPMediaFactory parent;
+ GstRTSPOnvifMediaFactoryPrivate *priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_onvif_media_factory_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPMediaFactory *gst_rtsp_onvif_media_factory_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_onvif_media_factory_set_backchannel_launch (GstRTSPOnvifMediaFactory *
+ factory, const gchar * launch);
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_onvif_media_factory_get_backchannel_launch (GstRTSPOnvifMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_onvif_media_factory_has_backchannel_support (GstRTSPOnvifMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_onvif_media_factory_has_replay_support (GstRTSPOnvifMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_onvif_media_factory_set_replay_support (GstRTSPOnvifMediaFactory * factory, gboolean has_replay_support);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_onvif_media_factory_set_backchannel_bandwidth (GstRTSPOnvifMediaFactory * factory, guint bandwidth);
+GST_RTSP_SERVER_API
+guint gst_rtsp_onvif_media_factory_get_backchannel_bandwidth (GstRTSPOnvifMediaFactory * factory);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_onvif_media_factory_requires_backchannel (GstRTSPMediaFactory * factory, GstRTSPContext * ctx);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPOnvifMediaFactory, gst_object_unref)
+#endif
+
+#endif /* __GST_RTSP_ONVIF_MEDIA_FACTORY_H__ */
diff --git a/include/gst/rtsp-server/rtsp-onvif-media.h b/include/gst/rtsp-server/rtsp-onvif-media.h
new file mode 100644
index 0000000000..95418c073a
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-onvif-media.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_ONVIF_MEDIA_H__
+#define __GST_RTSP_ONVIF_MEDIA_H__
+
+#include <gst/gst.h>
+#include "rtsp-media.h"
+
+#define GST_TYPE_RTSP_ONVIF_MEDIA (gst_rtsp_onvif_media_get_type ())
+#define GST_IS_RTSP_ONVIF_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ONVIF_MEDIA))
+#define GST_IS_RTSP_ONVIF_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ONVIF_MEDIA))
+#define GST_RTSP_ONVIF_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ONVIF_MEDIA, GstRTSPOnvifMediaClass))
+#define GST_RTSP_ONVIF_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ONVIF_MEDIA, GstRTSPOnvifMedia))
+#define GST_RTSP_ONVIF_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ONVIF_MEDIA, GstRTSPOnvifMediaClass))
+#define GST_RTSP_ONVIF_MEDIA_CAST(obj) ((GstRTSPOnvifMedia*)(obj))
+#define GST_RTSP_ONVIF_MEDIA_CLASS_CAST(klass) ((GstRTSPOnvifMediaClass*)(klass))
+
+typedef struct GstRTSPOnvifMediaClass GstRTSPOnvifMediaClass;
+typedef struct GstRTSPOnvifMedia GstRTSPOnvifMedia;
+typedef struct GstRTSPOnvifMediaPrivate GstRTSPOnvifMediaPrivate;
+
+/**
+ * GstRTSPOnvifMedia:
+ *
+ * Since: 1.14
+ */
+struct GstRTSPOnvifMediaClass
+{
+ GstRTSPMediaClass parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+struct GstRTSPOnvifMedia
+{
+ GstRTSPMedia parent;
+ GstRTSPOnvifMediaPrivate *priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_onvif_media_get_type (void);
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_onvif_media_collect_backchannel (GstRTSPOnvifMedia * media);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_onvif_media_set_backchannel_bandwidth (GstRTSPOnvifMedia * media, guint bandwidth);
+GST_RTSP_SERVER_API
+guint gst_rtsp_onvif_media_get_backchannel_bandwidth (GstRTSPOnvifMedia * media);
+
+#endif /* __GST_RTSP_ONVIF_MEDIA_H__ */
diff --git a/include/gst/rtsp-server/rtsp-onvif-server.h b/include/gst/rtsp-server/rtsp-onvif-server.h
new file mode 100644
index 0000000000..b04c9b4d5c
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-onvif-server.h
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_ONVIF_SERVER_H__
+#define __GST_RTSP_ONVIF_SERVER_H__
+
+#include <gst/gst.h>
+#include "rtsp-server-object.h"
+
+#define GST_TYPE_RTSP_ONVIF_SERVER (gst_rtsp_onvif_server_get_type ())
+#define GST_IS_RTSP_ONVIF_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ONVIF_SERVER))
+#define GST_IS_RTSP_ONVIF_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ONVIF_SERVER))
+#define GST_RTSP_ONVIF_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ONVIF_SERVER, GstRTSPOnvifServerClass))
+#define GST_RTSP_ONVIF_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ONVIF_SERVER, GstRTSPOnvifServer))
+#define GST_RTSP_ONVIF_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ONVIF_SERVER, GstRTSPOnvifServerClass))
+#define GST_RTSP_ONVIF_SERVER_CAST(obj) ((GstRTSPOnvifServer*)(obj))
+#define GST_RTSP_ONVIF_SERVER_CLASS_CAST(klass) ((GstRTSPOnvifServerClass*)(klass))
+
+typedef struct GstRTSPOnvifServerClass GstRTSPOnvifServerClass;
+typedef struct GstRTSPOnvifServer GstRTSPOnvifServer;
+
+/**
+ * GstRTSPOnvifServer:
+ *
+ * Since: 1.14
+ */
+struct GstRTSPOnvifServerClass
+{
+ GstRTSPServerClass parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+struct GstRTSPOnvifServer
+{
+ GstRTSPServer parent;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_onvif_server_get_type (void);
+GST_RTSP_SERVER_API
+GstRTSPServer *gst_rtsp_onvif_server_new (void);
+
+#define GST_RTSP_ONVIF_BACKCHANNEL_REQUIREMENT "www.onvif.org/ver20/backchannel"
+#define GST_RTSP_ONVIF_REPLAY_REQUIREMENT "onvif-replay"
+
+#include "rtsp-onvif-client.h"
+#include "rtsp-onvif-media-factory.h"
+#include "rtsp-onvif-media.h"
+
+#endif /* __GST_RTSP_ONVIF_SERVER_H__ */
diff --git a/include/gst/rtsp-server/rtsp-params.h b/include/gst/rtsp-server/rtsp-params.h
new file mode 100644
index 0000000000..f2863169d4
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-params.h
@@ -0,0 +1,41 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include <gst/rtsp/gstrtspurl.h>
+#include <gst/rtsp/gstrtspmessage.h>
+
+#ifndef __GST_RTSP_PARAMS_H__
+#define __GST_RTSP_PARAMS_H__
+
+#include "rtsp-client.h"
+#include "rtsp-session.h"
+
+G_BEGIN_DECLS
+
+GST_RTSP_SERVER_API
+GstRTSPResult gst_rtsp_params_set (GstRTSPClient * client, GstRTSPContext * ctx);
+
+GST_RTSP_SERVER_API
+GstRTSPResult gst_rtsp_params_get (GstRTSPClient * client, GstRTSPContext * ctx);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_PARAMS_H__ */
diff --git a/include/gst/rtsp-server/rtsp-permissions.h b/include/gst/rtsp-server/rtsp-permissions.h
new file mode 100644
index 0000000000..fac55e400d
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-permissions.h
@@ -0,0 +1,122 @@
+/* GStreamer
+ * Copyright (C) 2010 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_RTSP_PERMISSIONS_H__
+#define __GST_RTSP_PERMISSIONS_H__
+
+#include "rtsp-server-prelude.h"
+
+typedef struct _GstRTSPPermissions GstRTSPPermissions;
+
+G_BEGIN_DECLS
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_permissions_get_type (void);
+
+#define GST_TYPE_RTSP_PERMISSIONS (gst_rtsp_permissions_get_type ())
+#define GST_IS_RTSP_PERMISSIONS(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_PERMISSIONS))
+#define GST_RTSP_PERMISSIONS_CAST(obj) ((GstRTSPPermissions*)(obj))
+#define GST_RTSP_PERMISSIONS(obj) (GST_RTSP_PERMISSIONS_CAST(obj))
+
+/**
+ * GstRTSPPermissions:
+ *
+ * The opaque permissions structure. It is used to define the permissions
+ * of objects in different roles.
+ */
+struct _GstRTSPPermissions {
+ GstMiniObject mini_object;
+};
+
+/* refcounting */
+/**
+ * gst_rtsp_permissions_ref:
+ * @permissions: The permissions to refcount
+ *
+ * Increase the refcount of this permissions.
+ *
+ * Returns: (transfer full): @permissions (for convenience when doing assignments)
+ */
+static inline GstRTSPPermissions *
+gst_rtsp_permissions_ref (GstRTSPPermissions * permissions)
+{
+ return (GstRTSPPermissions *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (permissions));
+}
+
+/**
+ * gst_rtsp_permissions_unref:
+ * @permissions: (transfer full): the permissions to refcount
+ *
+ * Decrease the refcount of an permissions, freeing it if the refcount reaches 0.
+ */
+static inline void
+gst_rtsp_permissions_unref (GstRTSPPermissions * permissions)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (permissions));
+}
+
+
+GST_RTSP_SERVER_API
+GstRTSPPermissions * gst_rtsp_permissions_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_add_role (GstRTSPPermissions *permissions,
+ const gchar *role,
+ const gchar *fieldname, ...);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_add_role_valist (GstRTSPPermissions *permissions,
+ const gchar *role,
+ const gchar *fieldname,
+ va_list var_args);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_add_role_empty (GstRTSPPermissions * permissions,
+ const gchar * role);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_add_role_from_structure (GstRTSPPermissions * permissions,
+ GstStructure *structure);
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_add_permission_for_role (GstRTSPPermissions * permissions,
+ const gchar * role,
+ const gchar * permission,
+ gboolean allowed);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_permissions_remove_role (GstRTSPPermissions *permissions,
+ const gchar *role);
+
+GST_RTSP_SERVER_API
+const GstStructure * gst_rtsp_permissions_get_role (GstRTSPPermissions *permissions,
+ const gchar *role);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_permissions_is_allowed (GstRTSPPermissions *permissions,
+ const gchar *role, const gchar *permission);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPPermissions, gst_rtsp_permissions_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_PERMISSIONS_H__ */
diff --git a/include/gst/rtsp-server/rtsp-sdp.h b/include/gst/rtsp-server/rtsp-sdp.h
new file mode 100644
index 0000000000..20d2ac8c6b
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-sdp.h
@@ -0,0 +1,49 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/sdp/gstsdpmessage.h>
+
+#include "rtsp-media.h"
+
+#ifndef __GST_RTSP_SDP_H__
+#define __GST_RTSP_SDP_H__
+
+G_BEGIN_DECLS
+
+typedef struct {
+ gboolean is_ipv6;
+ const gchar *server_ip;
+} GstSDPInfo;
+
+/* creating SDP */
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_sdp_from_media (GstSDPMessage *sdp, GstSDPInfo *info, GstRTSPMedia * media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_sdp_from_stream (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+gboolean
+gst_rtsp_sdp_make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPStream * stream, GstCaps * caps, GstRTSPProfile profile);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SDP_H__ */
diff --git a/include/gst/rtsp-server/rtsp-server-object.h b/include/gst/rtsp-server/rtsp-server-object.h
new file mode 100644
index 0000000000..4f44f3a500
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-server-object.h
@@ -0,0 +1,211 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_SERVER_OBJECT_H__
+#define __GST_RTSP_SERVER_OBJECT_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstRTSPServer GstRTSPServer;
+typedef struct _GstRTSPServerClass GstRTSPServerClass;
+typedef struct _GstRTSPServerPrivate GstRTSPServerPrivate;
+
+#include "rtsp-server-prelude.h"
+#include "rtsp-session-pool.h"
+#include "rtsp-session.h"
+#include "rtsp-media.h"
+#include "rtsp-stream.h"
+#include "rtsp-stream-transport.h"
+#include "rtsp-address-pool.h"
+#include "rtsp-thread-pool.h"
+#include "rtsp-client.h"
+#include "rtsp-context.h"
+#include "rtsp-mount-points.h"
+#include "rtsp-media-factory.h"
+#include "rtsp-permissions.h"
+#include "rtsp-auth.h"
+#include "rtsp-token.h"
+#include "rtsp-session-media.h"
+#include "rtsp-sdp.h"
+#include "rtsp-media-factory-uri.h"
+#include "rtsp-params.h"
+
+#define GST_TYPE_RTSP_SERVER (gst_rtsp_server_get_type ())
+#define GST_IS_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
+#define GST_IS_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
+#define GST_RTSP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
+#define GST_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
+#define GST_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
+#define GST_RTSP_SERVER_CAST(obj) ((GstRTSPServer*)(obj))
+#define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
+
+/**
+ * GstRTSPServer:
+ *
+ * This object listens on a port, creates and manages the clients connected to
+ * it.
+ */
+struct _GstRTSPServer {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPServerPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPServerClass:
+ * @create_client: Create, configure a new GstRTSPClient
+ * object that handles the new connection on @socket. The default
+ * implementation will create a GstRTSPClient and will configure the
+ * mount-points, auth, session-pool and thread-pool on the client.
+ * @client_connected: emitted when a new client connected.
+ *
+ * The RTSP server class structure
+ */
+struct _GstRTSPServerClass {
+ GObjectClass parent_class;
+
+ GstRTSPClient * (*create_client) (GstRTSPServer *server);
+
+ /* signals */
+ void (*client_connected) (GstRTSPServer *server, GstRTSPClient *client);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_server_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPServer * gst_rtsp_server_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_address (GstRTSPServer *server, const gchar *address);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_server_get_address (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_service (GstRTSPServer *server, const gchar *service);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_server_get_service (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_backlog (GstRTSPServer *server, gint backlog);
+
+GST_RTSP_SERVER_API
+gint gst_rtsp_server_get_backlog (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+int gst_rtsp_server_get_bound_port (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_mount_points (GstRTSPServer *server, GstRTSPMountPoints *mounts);
+
+GST_RTSP_SERVER_API
+GstRTSPMountPoints * gst_rtsp_server_get_mount_points (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_content_length_limit (GstRTSPServer * server, guint limit);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_server_get_content_length_limit (GstRTSPServer * server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
+
+GST_RTSP_SERVER_API
+GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_server_set_thread_pool (GstRTSPServer *server, GstRTSPThreadPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPThreadPool * gst_rtsp_server_get_thread_pool (GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_server_transfer_connection (GstRTSPServer * server, GSocket *socket,
+ const gchar * ip, gint port,
+ const gchar *initial_buffer);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_server_io_func (GSocket *socket, GIOCondition condition,
+ GstRTSPServer *server);
+
+GST_RTSP_SERVER_API
+GSocket * gst_rtsp_server_create_socket (GstRTSPServer *server,
+ GCancellable *cancellable,
+ GError **error);
+
+GST_RTSP_SERVER_API
+GSource * gst_rtsp_server_create_source (GstRTSPServer *server,
+ GCancellable * cancellable,
+ GError **error);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_server_attach (GstRTSPServer *server,
+ GMainContext *context);
+
+/**
+ * GstRTSPServerClientFilterFunc:
+ * @server: a #GstRTSPServer object
+ * @client: a #GstRTSPClient in @server
+ * @user_data: user data that has been given to gst_rtsp_server_client_filter()
+ *
+ * This function will be called by the gst_rtsp_server_client_filter(). An
+ * implementation should return a value of #GstRTSPFilterResult.
+ *
+ * When this function returns #GST_RTSP_FILTER_REMOVE, @client will be removed
+ * from @server.
+ *
+ * A return value of #GST_RTSP_FILTER_KEEP will leave @client untouched in
+ * @server.
+ *
+ * A value of #GST_RTSP_FILTER_REF will add @client to the result #GList of
+ * gst_rtsp_server_client_filter().
+ *
+ * Returns: a #GstRTSPFilterResult.
+ */
+typedef GstRTSPFilterResult (*GstRTSPServerClientFilterFunc) (GstRTSPServer *server,
+ GstRTSPClient *client,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+GList * gst_rtsp_server_client_filter (GstRTSPServer *server,
+ GstRTSPServerClientFilterFunc func,
+ gpointer user_data);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPServer, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SERVER_OBJECT_H__ */
diff --git a/include/gst/rtsp-server/rtsp-server-prelude.h b/include/gst/rtsp-server/rtsp-server-prelude.h
new file mode 100644
index 0000000000..8aff8c4934
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-server-prelude.h
@@ -0,0 +1,44 @@
+/* GStreamer RtspServer Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * rtspserver-prelude.h: prelude include header for gst-rtspserver library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_SERVER_PRELUDE_H__
+#define __GST_RTSP_SERVER_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_RTSP_SERVER_API
+# ifdef BUILDING_GST_RTSP_SERVER
+# define GST_RTSP_SERVER_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_RTSP_SERVER_API GST_API_IMPORT
+# endif
+#endif
+
+/* Do *not* use these defines outside of rtsp-server. Use G_DEPRECATED instead. */
+#ifdef GST_DISABLE_DEPRECATED
+#define GST_RTSP_SERVER_DEPRECATED GST_RTSP_SERVER_API
+#define GST_RTSP_SERVER_DEPRECATED_FOR(f) GST_RTSP_SERVER_API
+#else
+#define GST_RTSP_SERVER_DEPRECATED G_DEPRECATED GST_RTSP_SERVER_API
+#define GST_RTSP_SERVER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_RTSP_SERVER_API
+#endif
+
+#endif /* __GST_RTSP_SERVER_PRELUDE_H__ */
diff --git a/include/gst/rtsp-server/rtsp-server.h b/include/gst/rtsp-server/rtsp-server.h
new file mode 100644
index 0000000000..1dd1a23242
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-server.h
@@ -0,0 +1,56 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_SERVER_H__
+#define __GST_RTSP_SERVER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#include "rtsp-server-prelude.h"
+#include "rtsp-server-object.h"
+#include "rtsp-session-pool.h"
+#include "rtsp-session.h"
+#include "rtsp-media.h"
+#include "rtsp-stream.h"
+#include "rtsp-stream-transport.h"
+#include "rtsp-address-pool.h"
+#include "rtsp-thread-pool.h"
+#include "rtsp-client.h"
+#include "rtsp-context.h"
+#include "rtsp-server.h"
+#include "rtsp-mount-points.h"
+#include "rtsp-media-factory.h"
+#include "rtsp-permissions.h"
+#include "rtsp-auth.h"
+#include "rtsp-token.h"
+#include "rtsp-session-media.h"
+#include "rtsp-sdp.h"
+#include "rtsp-media-factory-uri.h"
+#include "rtsp-params.h"
+
+#include "rtsp-onvif-client.h"
+#include "rtsp-onvif-media-factory.h"
+#include "rtsp-onvif-media.h"
+#include "rtsp-onvif-server.h"
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SERVER_H__ */
diff --git a/include/gst/rtsp-server/rtsp-session-media.h b/include/gst/rtsp-server/rtsp-session-media.h
new file mode 100644
index 0000000000..a20946606d
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-session-media.h
@@ -0,0 +1,123 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include <gst/rtsp/gstrtsptransport.h>
+
+#ifndef __GST_RTSP_SESSION_MEDIA_H__
+#define __GST_RTSP_SESSION_MEDIA_H__
+
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_SESSION_MEDIA (gst_rtsp_session_media_get_type ())
+#define GST_IS_RTSP_SESSION_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION_MEDIA))
+#define GST_IS_RTSP_SESSION_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION_MEDIA))
+#define GST_RTSP_SESSION_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION_MEDIA, GstRTSPSessionMediaClass))
+#define GST_RTSP_SESSION_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION_MEDIA, GstRTSPSessionMedia))
+#define GST_RTSP_SESSION_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION_MEDIA, GstRTSPSessionMediaClass))
+#define GST_RTSP_SESSION_MEDIA_CAST(obj) ((GstRTSPSessionMedia*)(obj))
+#define GST_RTSP_SESSION_MEDIA_CLASS_CAST(klass) ((GstRTSPSessionMediaClass*)(klass))
+
+typedef struct _GstRTSPSessionMedia GstRTSPSessionMedia;
+typedef struct _GstRTSPSessionMediaClass GstRTSPSessionMediaClass;
+typedef struct _GstRTSPSessionMediaPrivate GstRTSPSessionMediaPrivate;
+
+/**
+ * GstRTSPSessionMedia:
+ *
+ * State of a client session regarding a specific media identified by path.
+ */
+struct _GstRTSPSessionMedia
+{
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPSessionMediaPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstRTSPSessionMediaClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_session_media_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPSessionMedia * gst_rtsp_session_media_new (const gchar *path,
+ GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_media_matches (GstRTSPSessionMedia *media,
+ const gchar *path,
+ gint * matched);
+
+GST_RTSP_SERVER_API
+GstRTSPMedia * gst_rtsp_session_media_get_media (GstRTSPSessionMedia *media);
+
+GST_RTSP_SERVER_API
+GstClockTime gst_rtsp_session_media_get_base_time (GstRTSPSessionMedia *media);
+/* control media */
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_media_set_state (GstRTSPSessionMedia *media,
+ GstState state);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_media_set_rtsp_state (GstRTSPSessionMedia *media,
+ GstRTSPState state);
+
+GST_RTSP_SERVER_API
+GstRTSPState gst_rtsp_session_media_get_rtsp_state (GstRTSPSessionMedia *media);
+
+/* get stream transport config */
+
+GST_RTSP_SERVER_API
+GstRTSPStreamTransport * gst_rtsp_session_media_set_transport (GstRTSPSessionMedia *media,
+ GstRTSPStream *stream,
+ GstRTSPTransport *tr);
+
+GST_RTSP_SERVER_API
+GstRTSPStreamTransport * gst_rtsp_session_media_get_transport (GstRTSPSessionMedia *media,
+ guint idx);
+
+GST_RTSP_SERVER_API
+GPtrArray * gst_rtsp_session_media_get_transports (GstRTSPSessionMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_media_alloc_channels (GstRTSPSessionMedia *media,
+ GstRTSPRange *range);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_session_media_get_rtpinfo (GstRTSPSessionMedia * media);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPSessionMedia, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SESSION_MEDIA_H__ */
diff --git a/include/gst/rtsp-server/rtsp-session-pool.h b/include/gst/rtsp-server/rtsp-session-pool.h
new file mode 100644
index 0000000000..aeb375c3cb
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-session-pool.h
@@ -0,0 +1,169 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_RTSP_SESSION_POOL_H__
+#define __GST_RTSP_SESSION_POOL_H__
+
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GstRTSPSessionPool GstRTSPSessionPool;
+typedef struct _GstRTSPSessionPoolClass GstRTSPSessionPoolClass;
+typedef struct _GstRTSPSessionPoolPrivate GstRTSPSessionPoolPrivate;
+
+#include "rtsp-session.h"
+
+#define GST_TYPE_RTSP_SESSION_POOL (gst_rtsp_session_pool_get_type ())
+#define GST_IS_RTSP_SESSION_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION_POOL))
+#define GST_IS_RTSP_SESSION_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION_POOL))
+#define GST_RTSP_SESSION_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION_POOL, GstRTSPSessionPoolClass))
+#define GST_RTSP_SESSION_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION_POOL, GstRTSPSessionPool))
+#define GST_RTSP_SESSION_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION_POOL, GstRTSPSessionPoolClass))
+#define GST_RTSP_SESSION_POOL_CAST(obj) ((GstRTSPSessionPool*)(obj))
+#define GST_RTSP_SESSION_POOL_CLASS_CAST(klass) ((GstRTSPSessionPoolClass*)(klass))
+
+/**
+ * GstRTSPSessionPool:
+ *
+ * An object that keeps track of the active sessions. This object is usually
+ * attached to a #GstRTSPServer object to manage the sessions in that server.
+ */
+struct _GstRTSPSessionPool {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPSessionPoolPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPSessionPoolClass:
+ * @create_session_id: create a new random session id. Subclasses can create
+ * custom session ids and should not check if the session exists.
+ * @create_session: make a new session object.
+ * @session_removed: a session was removed from the pool
+ */
+struct _GstRTSPSessionPoolClass {
+ GObjectClass parent_class;
+
+ gchar * (*create_session_id) (GstRTSPSessionPool *pool);
+ GstRTSPSession * (*create_session) (GstRTSPSessionPool *pool, const gchar *id);
+
+ /* signals */
+ void (*session_removed) (GstRTSPSessionPool *pool,
+ GstRTSPSession *session);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE - 1];
+};
+
+/**
+ * GstRTSPSessionPoolFunc:
+ * @pool: a #GstRTSPSessionPool object
+ * @user_data: user data that has been given when registering the handler
+ *
+ * The function that will be called from the GSource watch on the session pool.
+ *
+ * The function will be called when the pool must be cleaned up because one or
+ * more sessions timed out.
+ *
+ * Returns: %FALSE if the source should be removed.
+ */
+typedef gboolean (*GstRTSPSessionPoolFunc) (GstRTSPSessionPool *pool, gpointer user_data);
+
+/**
+ * GstRTSPSessionPoolFilterFunc:
+ * @pool: a #GstRTSPSessionPool object
+ * @session: a #GstRTSPSession in @pool
+ * @user_data: user data that has been given to gst_rtsp_session_pool_filter()
+ *
+ * This function will be called by the gst_rtsp_session_pool_filter(). An
+ * implementation should return a value of #GstRTSPFilterResult.
+ *
+ * When this function returns #GST_RTSP_FILTER_REMOVE, @session will be removed
+ * from @pool.
+ *
+ * A return value of #GST_RTSP_FILTER_KEEP will leave @session untouched in
+ * @pool.
+ *
+ * A value of GST_RTSP_FILTER_REF will add @session to the result #GList of
+ * gst_rtsp_session_pool_filter().
+ *
+ * Returns: a #GstRTSPFilterResult.
+ */
+typedef GstRTSPFilterResult (*GstRTSPSessionPoolFilterFunc) (GstRTSPSessionPool *pool,
+ GstRTSPSession *session,
+ gpointer user_data);
+
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_session_pool_get_type (void);
+
+/* creating a session pool */
+
+GST_RTSP_SERVER_API
+GstRTSPSessionPool * gst_rtsp_session_pool_new (void);
+
+/* counting sessions */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_pool_set_max_sessions (GstRTSPSessionPool *pool, guint max);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_session_pool_get_max_sessions (GstRTSPSessionPool *pool);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_session_pool_get_n_sessions (GstRTSPSessionPool *pool);
+
+/* managing sessions */
+
+GST_RTSP_SERVER_API
+GstRTSPSession * gst_rtsp_session_pool_create (GstRTSPSessionPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPSession * gst_rtsp_session_pool_find (GstRTSPSessionPool *pool,
+ const gchar *sessionid);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_pool_remove (GstRTSPSessionPool *pool,
+ GstRTSPSession *sess);
+
+/* perform session maintenance */
+
+GST_RTSP_SERVER_API
+GList * gst_rtsp_session_pool_filter (GstRTSPSessionPool *pool,
+ GstRTSPSessionPoolFilterFunc func,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_session_pool_cleanup (GstRTSPSessionPool *pool);
+
+GST_RTSP_SERVER_API
+GSource * gst_rtsp_session_pool_create_watch (GstRTSPSessionPool *pool);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPSessionPool, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SESSION_POOL_H__ */
diff --git a/include/gst/rtsp-server/rtsp-session.h b/include/gst/rtsp-server/rtsp-session.h
new file mode 100644
index 0000000000..f0ee128088
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-session.h
@@ -0,0 +1,186 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include <gst/rtsp/gstrtsptransport.h>
+#include "rtsp-server-prelude.h" /* for GST_RTSP_SERVER_DEPRECATED_FOR */
+
+#ifndef __GST_RTSP_SESSION_H__
+#define __GST_RTSP_SESSION_H__
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_SESSION (gst_rtsp_session_get_type ())
+#define GST_IS_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SESSION))
+#define GST_IS_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SESSION))
+#define GST_RTSP_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
+#define GST_RTSP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SESSION, GstRTSPSession))
+#define GST_RTSP_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SESSION, GstRTSPSessionClass))
+#define GST_RTSP_SESSION_CAST(obj) ((GstRTSPSession*)(obj))
+#define GST_RTSP_SESSION_CLASS_CAST(klass) ((GstRTSPSessionClass*)(klass))
+
+typedef struct _GstRTSPSession GstRTSPSession;
+typedef struct _GstRTSPSessionClass GstRTSPSessionClass;
+typedef struct _GstRTSPSessionPrivate GstRTSPSessionPrivate;
+
+/**
+ * GstRTSPFilterResult:
+ * @GST_RTSP_FILTER_REMOVE: Remove session
+ * @GST_RTSP_FILTER_KEEP: Keep session in the pool
+ * @GST_RTSP_FILTER_REF: Ref session in the result list
+ *
+ * Possible return values for gst_rtsp_session_pool_filter().
+ */
+typedef enum
+{
+ GST_RTSP_FILTER_REMOVE,
+ GST_RTSP_FILTER_KEEP,
+ GST_RTSP_FILTER_REF,
+} GstRTSPFilterResult;
+
+#include "rtsp-media.h"
+#include "rtsp-session-media.h"
+
+/**
+ * GstRTSPSession:
+ *
+ * Session information kept by the server for a specific client.
+ * One client session, identified with a session id, can handle multiple medias
+ * identified with the url of a media.
+ */
+struct _GstRTSPSession {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPSessionPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstRTSPSessionClass {
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_session_get_type (void);
+
+/* create a new session */
+
+GST_RTSP_SERVER_API
+GstRTSPSession * gst_rtsp_session_new (const gchar *sessionid);
+
+GST_RTSP_SERVER_API
+const gchar * gst_rtsp_session_get_sessionid (GstRTSPSession *session);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_session_get_header (GstRTSPSession *session);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_set_timeout (GstRTSPSession *session, guint timeout);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_session_get_timeout (GstRTSPSession *session);
+
+/* session timeout stuff */
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_touch (GstRTSPSession *session);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_prevent_expire (GstRTSPSession *session);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_session_allow_expire (GstRTSPSession *session);
+
+GST_RTSP_SERVER_API
+gint gst_rtsp_session_next_timeout_usec (GstRTSPSession *session, gint64 now);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_is_expired_usec (GstRTSPSession *session, gint64 now);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GST_RTSP_SERVER_DEPRECATED_FOR(gst_rtsp_session_next_timeout_usec)
+gint gst_rtsp_session_next_timeout (GstRTSPSession *session, GTimeVal *now);
+
+GST_RTSP_SERVER_DEPRECATED_FOR(gst_rtsp_session_is_expired_usec)
+gboolean gst_rtsp_session_is_expired (GstRTSPSession *session, GTimeVal *now);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+/* handle media in a session */
+
+GST_RTSP_SERVER_API
+GstRTSPSessionMedia * gst_rtsp_session_manage_media (GstRTSPSession *sess,
+ const gchar *path,
+ GstRTSPMedia *media);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_session_release_media (GstRTSPSession *sess,
+ GstRTSPSessionMedia *media);
+/* get media in a session */
+
+GST_RTSP_SERVER_API
+GstRTSPSessionMedia * gst_rtsp_session_get_media (GstRTSPSession *sess,
+ const gchar *path,
+ gint * matched);
+/* get media in a session, increasing its reference count */
+
+GST_RTSP_SERVER_API
+GstRTSPSessionMedia * gst_rtsp_session_dup_media (GstRTSPSession *sess,
+ const gchar *path,
+ gint * matched);
+/**
+ * GstRTSPSessionFilterFunc:
+ * @sess: a #GstRTSPSession object
+ * @media: a #GstRTSPSessionMedia in @sess
+ * @user_data: user data that has been given to gst_rtsp_session_filter()
+ *
+ * This function will be called by the gst_rtsp_session_filter(). An
+ * implementation should return a value of #GstRTSPFilterResult.
+ *
+ * When this function returns #GST_RTSP_FILTER_REMOVE, @media will be removed
+ * from @sess.
+ *
+ * A return value of #GST_RTSP_FILTER_KEEP will leave @media untouched in
+ * @sess.
+ *
+ * A value of GST_RTSP_FILTER_REF will add @media to the result #GList of
+ * gst_rtsp_session_filter().
+ *
+ * Returns: a #GstRTSPFilterResult.
+ */
+typedef GstRTSPFilterResult (*GstRTSPSessionFilterFunc) (GstRTSPSession *sess,
+ GstRTSPSessionMedia *media,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+GList * gst_rtsp_session_filter (GstRTSPSession *sess,
+ GstRTSPSessionFilterFunc func,
+ gpointer user_data);
+
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPSession, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_SESSION_H__ */
diff --git a/include/gst/rtsp-server/rtsp-stream-transport.h b/include/gst/rtsp-server/rtsp-stream-transport.h
new file mode 100644
index 0000000000..d8516c027e
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-stream-transport.h
@@ -0,0 +1,229 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+#include <gst/rtsp/gstrtsprange.h>
+#include <gst/rtsp/gstrtspurl.h>
+
+#ifndef __GST_RTSP_STREAM_TRANSPORT_H__
+#define __GST_RTSP_STREAM_TRANSPORT_H__
+
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+/* types for the media */
+#define GST_TYPE_RTSP_STREAM_TRANSPORT (gst_rtsp_stream_transport_get_type ())
+#define GST_IS_RTSP_STREAM_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT))
+#define GST_IS_RTSP_STREAM_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM_TRANSPORT))
+#define GST_RTSP_STREAM_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransportClass))
+#define GST_RTSP_STREAM_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransport))
+#define GST_RTSP_STREAM_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransportClass))
+#define GST_RTSP_STREAM_TRANSPORT_CAST(obj) ((GstRTSPStreamTransport*)(obj))
+#define GST_RTSP_STREAM_TRANSPORT_CLASS_CAST(klass) ((GstRTSPStreamTransportClass*)(klass))
+
+typedef struct _GstRTSPStreamTransport GstRTSPStreamTransport;
+typedef struct _GstRTSPStreamTransportClass GstRTSPStreamTransportClass;
+typedef struct _GstRTSPStreamTransportPrivate GstRTSPStreamTransportPrivate;
+
+#include "rtsp-stream.h"
+
+/**
+ * GstRTSPSendFunc:
+ * @buffer: a #GstBuffer
+ * @channel: a channel
+ * @user_data: user data
+ *
+ * Function registered with gst_rtsp_stream_transport_set_callbacks() and
+ * called when @buffer must be sent on @channel.
+ *
+ * Returns: %TRUE on success
+ */
+typedef gboolean (*GstRTSPSendFunc) (GstBuffer *buffer, guint8 channel, gpointer user_data);
+
+/**
+ * GstRTSPSendListFunc:
+ * @buffer_list: a #GstBufferList
+ * @channel: a channel
+ * @user_data: user data
+ *
+ * Function registered with gst_rtsp_stream_transport_set_callbacks() and
+ * called when @buffer_list must be sent on @channel.
+ *
+ * Returns: %TRUE on success
+ *
+ * Since: 1.16
+ */
+typedef gboolean (*GstRTSPSendListFunc) (GstBufferList *buffer_list, guint8 channel, gpointer user_data);
+
+/**
+ * GstRTSPKeepAliveFunc:
+ * @user_data: user data
+ *
+ * Function registered with gst_rtsp_stream_transport_set_keepalive() and called
+ * when the stream is active.
+ */
+typedef void (*GstRTSPKeepAliveFunc) (gpointer user_data);
+
+/**
+ * GstRTSPMessageSentFunc:
+ * @user_data: user data
+ *
+ * Function registered with gst_rtsp_stream_transport_set_message_sent()
+ * and called when a message has been sent on the transport.
+ */
+typedef void (*GstRTSPMessageSentFunc) (gpointer user_data);
+
+/**
+ * GstRTSPMessageSentFuncFull:
+ * @user_data: user data
+ *
+ * Function registered with gst_rtsp_stream_transport_set_message_sent_full()
+ * and called when a message has been sent on the transport.
+ *
+ * Since: 1.18
+ */
+typedef void (*GstRTSPMessageSentFuncFull) (GstRTSPStreamTransport *trans, gpointer user_data);
+
+/**
+ * GstRTSPStreamTransport:
+ * @parent: parent instance
+ *
+ * A Transport description for a stream
+ */
+struct _GstRTSPStreamTransport {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPStreamTransportPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstRTSPStreamTransportClass {
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_stream_transport_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPStreamTransport * gst_rtsp_stream_transport_new (GstRTSPStream *stream,
+ GstRTSPTransport *tr);
+
+GST_RTSP_SERVER_API
+GstRTSPStream * gst_rtsp_stream_transport_get_stream (GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_transport (GstRTSPStreamTransport *trans,
+ GstRTSPTransport * tr);
+
+GST_RTSP_SERVER_API
+const GstRTSPTransport * gst_rtsp_stream_transport_get_transport (GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_url (GstRTSPStreamTransport *trans,
+ const GstRTSPUrl * url);
+
+GST_RTSP_SERVER_API
+const GstRTSPUrl * gst_rtsp_stream_transport_get_url (GstRTSPStreamTransport *trans);
+
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_stream_transport_get_rtpinfo (GstRTSPStreamTransport *trans,
+ GstClockTime start_time);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_callbacks (GstRTSPStreamTransport *trans,
+ GstRTSPSendFunc send_rtp,
+ GstRTSPSendFunc send_rtcp,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_list_callbacks (GstRTSPStreamTransport *trans,
+ GstRTSPSendListFunc send_rtp_list,
+ GstRTSPSendListFunc send_rtcp_list,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_keepalive (GstRTSPStreamTransport *trans,
+ GstRTSPKeepAliveFunc keep_alive,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_message_sent (GstRTSPStreamTransport *trans,
+ GstRTSPMessageSentFunc message_sent,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_message_sent_full (GstRTSPStreamTransport *trans,
+ GstRTSPMessageSentFuncFull message_sent,
+ gpointer user_data,
+ GDestroyNotify notify);
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_keep_alive (GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_message_sent (GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_set_active (GstRTSPStreamTransport *trans,
+ gboolean active);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_transport_set_timed_out (GstRTSPStreamTransport *trans,
+ gboolean timedout);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_is_timed_out (GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_send_rtp (GstRTSPStreamTransport *trans,
+ GstBuffer *buffer);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_send_rtcp (GstRTSPStreamTransport *trans,
+ GstBuffer *buffer);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_send_rtp_list (GstRTSPStreamTransport *trans,
+ GstBufferList *buffer_list);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_transport_send_rtcp_list(GstRTSPStreamTransport *trans,
+ GstBufferList *buffer_list);
+
+GST_RTSP_SERVER_API
+GstFlowReturn gst_rtsp_stream_transport_recv_data (GstRTSPStreamTransport *trans,
+ guint channel, GstBuffer *buffer);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPStreamTransport, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_STREAM_TRANSPORT_H__ */
diff --git a/include/gst/rtsp-server/rtsp-stream.h b/include/gst/rtsp-server/rtsp-stream.h
new file mode 100644
index 0000000000..5e6ff2151a
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-stream.h
@@ -0,0 +1,406 @@
+/* GStreamer
+ * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+#include <gst/rtsp/rtsp.h>
+#include <gio/gio.h>
+
+#ifndef __GST_RTSP_STREAM_H__
+#define __GST_RTSP_STREAM_H__
+
+#include "rtsp-server-prelude.h"
+
+G_BEGIN_DECLS
+
+/* types for the media stream */
+#define GST_TYPE_RTSP_STREAM (gst_rtsp_stream_get_type ())
+#define GST_IS_RTSP_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM))
+#define GST_IS_RTSP_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM))
+#define GST_RTSP_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
+#define GST_RTSP_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStream))
+#define GST_RTSP_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
+#define GST_RTSP_STREAM_CAST(obj) ((GstRTSPStream*)(obj))
+#define GST_RTSP_STREAM_CLASS_CAST(klass) ((GstRTSPStreamClass*)(klass))
+
+typedef struct _GstRTSPStream GstRTSPStream;
+typedef struct _GstRTSPStreamClass GstRTSPStreamClass;
+typedef struct _GstRTSPStreamPrivate GstRTSPStreamPrivate;
+
+#include "rtsp-stream-transport.h"
+#include "rtsp-address-pool.h"
+#include "rtsp-session.h"
+#include "rtsp-media.h"
+
+/**
+ * GstRTSPStream:
+ *
+ * The definition of a media stream.
+ */
+struct _GstRTSPStream {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPStreamPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstRTSPStreamClass {
+ GObjectClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_stream_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPStream * gst_rtsp_stream_new (guint idx, GstElement *payloader,
+ GstPad *pad);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_index (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_pt (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstPad * gst_rtsp_stream_get_srcpad (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstPad * gst_rtsp_stream_get_sinkpad (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_control (GstRTSPStream *stream, const gchar *control);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_stream_get_control (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_has_control (GstRTSPStream *stream, const gchar *control);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_mtu (GstRTSPStream *stream, guint mtu);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_mtu (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_dscp_qos (GstRTSPStream *stream, gint dscp_qos);
+
+GST_RTSP_SERVER_API
+gint gst_rtsp_stream_get_dscp_qos (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_transport_supported (GstRTSPStream *stream,
+ GstRTSPTransport *transport);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_profiles (GstRTSPStream *stream, GstRTSPProfile profiles);
+
+GST_RTSP_SERVER_API
+GstRTSPProfile gst_rtsp_stream_get_profiles (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_protocols (GstRTSPStream *stream, GstRTSPLowerTrans protocols);
+
+GST_RTSP_SERVER_API
+GstRTSPLowerTrans gst_rtsp_stream_get_protocols (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_address_pool (GstRTSPStream *stream, GstRTSPAddressPool *pool);
+
+GST_RTSP_SERVER_API
+GstRTSPAddressPool *
+ gst_rtsp_stream_get_address_pool (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_multicast_iface (GstRTSPStream *stream, const gchar * multicast_iface);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_stream_get_multicast_iface (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstRTSPAddress * gst_rtsp_stream_reserve_address (GstRTSPStream *stream,
+ const gchar * address,
+ guint port,
+ guint n_ports,
+ guint ttl);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_join_bin (GstRTSPStream *stream,
+ GstBin *bin, GstElement *rtpbin,
+ GstState state);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_leave_bin (GstRTSPStream *stream,
+ GstBin *bin, GstElement *rtpbin);
+
+GST_RTSP_SERVER_API
+GstBin * gst_rtsp_stream_get_joined_bin (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_set_blocked (GstRTSPStream * stream,
+ gboolean blocked);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_blocking (GstRTSPStream * stream);
+
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_unblock_linked (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_client_side (GstRTSPStream *stream, gboolean client_side);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_client_side (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_get_server_port (GstRTSPStream *stream,
+ GstRTSPRange *server_port,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+GstRTSPAddress * gst_rtsp_stream_get_multicast_address (GstRTSPStream *stream,
+ GSocketFamily family);
+
+
+GST_RTSP_SERVER_API
+GObject * gst_rtsp_stream_get_rtpsession (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_stream_get_srtp_encoder (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_get_ssrc (GstRTSPStream *stream,
+ guint *ssrc);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_get_rtpinfo (GstRTSPStream *stream,
+ guint *rtptime, guint *seq,
+ guint *clock_rate,
+ GstClockTime *running_time);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_get_rates (GstRTSPStream * stream,
+ gdouble * rate,
+ gdouble * applied_rate);
+
+GST_RTSP_SERVER_API
+GstCaps * gst_rtsp_stream_get_caps (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstFlowReturn gst_rtsp_stream_recv_rtp (GstRTSPStream *stream,
+ GstBuffer *buffer);
+
+GST_RTSP_SERVER_API
+GstFlowReturn gst_rtsp_stream_recv_rtcp (GstRTSPStream *stream,
+ GstBuffer *buffer);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_add_transport (GstRTSPStream *stream,
+ GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_remove_transport (GstRTSPStream *stream,
+ GstRTSPStreamTransport *trans);
+
+GST_RTSP_SERVER_API
+GSocket * gst_rtsp_stream_get_rtp_socket (GstRTSPStream *stream,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+GSocket * gst_rtsp_stream_get_rtcp_socket (GstRTSPStream *stream,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+GSocket * gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream *stream,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+GSocket * gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream *stream,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_add_multicast_client_address (GstRTSPStream * stream,
+ const gchar * destination,
+ guint rtp_port,
+ guint rtcp_port,
+ GSocketFamily family);
+
+GST_RTSP_SERVER_API
+gchar * gst_rtsp_stream_get_multicast_client_addresses (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_update_crypto (GstRTSPStream * stream,
+ guint ssrc, GstCaps * crypto);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_query_position (GstRTSPStream * stream,
+ gint64 * position);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_query_stop (GstRTSPStream * stream,
+ gint64 * stop);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_seekable (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_seqnum_offset (GstRTSPStream *stream, guint16 seqnum);
+
+GST_RTSP_SERVER_API
+guint16 gst_rtsp_stream_get_current_seqnum (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_retransmission_time (GstRTSPStream *stream, GstClockTime time);
+
+GST_RTSP_SERVER_API
+GstClockTime gst_rtsp_stream_get_retransmission_time (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_retransmission_pt (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_retransmission_pt (GstRTSPStream * stream,
+ guint rtx_pt);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_buffer_size (GstRTSPStream *stream, guint size);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_buffer_size (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_pt_map (GstRTSPStream * stream, guint pt, GstCaps * caps);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_stream_request_aux_sender (GstRTSPStream * stream, guint sessid);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_stream_request_aux_receiver (GstRTSPStream * stream, guint sessid);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_allocate_udp_sockets (GstRTSPStream * stream, GSocketFamily family,
+ GstRTSPTransport *transport, gboolean use_client_settings);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_publish_clock_mode (GstRTSPStream * stream, GstRTSPPublishClockMode mode);
+
+GST_RTSP_SERVER_API
+GstRTSPPublishClockMode gst_rtsp_stream_get_publish_clock_mode (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_set_max_mcast_ttl (GstRTSPStream *stream, guint ttl);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_max_mcast_ttl (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_verify_mcast_ttl (GstRTSPStream *stream, guint ttl);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_bind_mcast_address (GstRTSPStream * stream, gboolean bind_mcast_addr);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_bind_mcast_address (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_complete_stream (GstRTSPStream * stream, const GstRTSPTransport * transport);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_complete (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_sender (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_is_receiver (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_handle_keymgmt (GstRTSPStream *stream, const gchar *keymgmt);
+
+/* ULP Forward Error Correction (RFC 5109) */
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_get_ulpfec_enabled (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_ulpfec_pt (GstRTSPStream *stream, guint pt);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_ulpfec_pt (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_stream_request_ulpfec_decoder (GstRTSPStream *stream, GstElement *rtpbin, guint sessid);
+
+GST_RTSP_SERVER_API
+GstElement * gst_rtsp_stream_request_ulpfec_encoder (GstRTSPStream *stream, guint sessid);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_ulpfec_percentage (GstRTSPStream *stream, guint percentage);
+
+GST_RTSP_SERVER_API
+guint gst_rtsp_stream_get_ulpfec_percentage (GstRTSPStream *stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_set_rate_control (GstRTSPStream * stream, gboolean enabled);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_stream_get_rate_control (GstRTSPStream * stream);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_stream_unblock_rtcp (GstRTSPStream * stream);
+
+/**
+ * GstRTSPStreamTransportFilterFunc:
+ * @stream: a #GstRTSPStream object
+ * @trans: a #GstRTSPStreamTransport in @stream
+ * @user_data: user data that has been given to gst_rtsp_stream_transport_filter()
+ *
+ * This function will be called by the gst_rtsp_stream_transport_filter(). An
+ * implementation should return a value of #GstRTSPFilterResult.
+ *
+ * When this function returns #GST_RTSP_FILTER_REMOVE, @trans will be removed
+ * from @stream.
+ *
+ * A return value of #GST_RTSP_FILTER_KEEP will leave @trans untouched in
+ * @stream.
+ *
+ * A value of #GST_RTSP_FILTER_REF will add @trans to the result #GList of
+ * gst_rtsp_stream_transport_filter().
+ *
+ * Returns: a #GstRTSPFilterResult.
+ */
+typedef GstRTSPFilterResult (*GstRTSPStreamTransportFilterFunc) (GstRTSPStream *stream,
+ GstRTSPStreamTransport *trans,
+ gpointer user_data);
+
+GST_RTSP_SERVER_API
+GList * gst_rtsp_stream_transport_filter (GstRTSPStream *stream,
+ GstRTSPStreamTransportFilterFunc func,
+ gpointer user_data);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPStream, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_STREAM_H__ */
diff --git a/include/gst/rtsp-server/rtsp-thread-pool.h b/include/gst/rtsp-server/rtsp-thread-pool.h
new file mode 100644
index 0000000000..01ca3ac711
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-thread-pool.h
@@ -0,0 +1,191 @@
+/* GStreamer
+ * Copyright (C) 2010 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_RTSP_THREAD_POOL_H__
+#define __GST_RTSP_THREAD_POOL_H__
+
+typedef struct _GstRTSPThread GstRTSPThread;
+typedef struct _GstRTSPThreadPool GstRTSPThreadPool;
+typedef struct _GstRTSPThreadPoolClass GstRTSPThreadPoolClass;
+typedef struct _GstRTSPThreadPoolPrivate GstRTSPThreadPoolPrivate;
+
+#include "rtsp-client.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_THREAD_POOL (gst_rtsp_thread_pool_get_type ())
+#define GST_IS_RTSP_THREAD_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_THREAD_POOL))
+#define GST_IS_RTSP_THREAD_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_THREAD_POOL))
+#define GST_RTSP_THREAD_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_THREAD_POOL, GstRTSPThreadPoolClass))
+#define GST_RTSP_THREAD_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_THREAD_POOL, GstRTSPThreadPool))
+#define GST_RTSP_THREAD_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_THREAD_POOL, GstRTSPThreadPoolClass))
+#define GST_RTSP_THREAD_POOL_CAST(obj) ((GstRTSPThreadPool*)(obj))
+#define GST_RTSP_THREAD_POOL_CLASS_CAST(klass) ((GstRTSPThreadPoolClass*)(klass))
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_thread_get_type (void);
+
+#define GST_TYPE_RTSP_THREAD (gst_rtsp_thread_get_type ())
+#define GST_IS_RTSP_THREAD(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_THREAD))
+#define GST_RTSP_THREAD_CAST(obj) ((GstRTSPThread*)(obj))
+#define GST_RTSP_THREAD(obj) (GST_RTSP_THREAD_CAST(obj))
+
+/**
+ * GstRTSPThreadType:
+ * @GST_RTSP_THREAD_TYPE_CLIENT: a thread to handle the client communication
+ * @GST_RTSP_THREAD_TYPE_MEDIA: a thread to handle media
+ *
+ * Different thread types
+ */
+typedef enum
+{
+ GST_RTSP_THREAD_TYPE_CLIENT,
+ GST_RTSP_THREAD_TYPE_MEDIA
+} GstRTSPThreadType;
+
+/**
+ * GstRTSPThread:
+ * @mini_object: parent #GstMiniObject
+ * @type: the thread type
+ * @context: a #GMainContext
+ * @loop: a #GMainLoop
+ *
+ * Structure holding info about a mainloop running in a thread
+ */
+struct _GstRTSPThread {
+ GstMiniObject mini_object;
+
+ GstRTSPThreadType type;
+ GMainContext *context;
+ GMainLoop *loop;
+};
+
+GST_RTSP_SERVER_API
+GstRTSPThread * gst_rtsp_thread_new (GstRTSPThreadType type);
+
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_thread_reuse (GstRTSPThread * thread);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_thread_stop (GstRTSPThread * thread);
+
+/**
+ * gst_rtsp_thread_ref:
+ * @thread: The thread to refcount
+ *
+ * Increase the refcount of this thread.
+ *
+ * Returns: (transfer full): @thread (for convenience when doing assignments)
+ */
+static inline GstRTSPThread *
+gst_rtsp_thread_ref (GstRTSPThread * thread)
+{
+ return (GstRTSPThread *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (thread));
+}
+
+/**
+ * gst_rtsp_thread_unref:
+ * @thread: (transfer full): the thread to refcount
+ *
+ * Decrease the refcount of an thread, freeing it if the refcount reaches 0.
+ */
+static inline void
+gst_rtsp_thread_unref (GstRTSPThread * thread)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (thread));
+}
+
+/**
+ * GstRTSPThreadPool:
+ *
+ * The thread pool structure.
+ */
+struct _GstRTSPThreadPool {
+ GObject parent;
+
+ /*< private >*/
+ GstRTSPThreadPoolPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstRTSPThreadPoolClass:
+ * @pool: a #GThreadPool used internally
+ * @get_thread: this function should make or reuse an existing thread that runs
+ * a mainloop.
+ * @configure_thread: configure a thread object. this vmethod is called when
+ * a new thread has been created and should be configured.
+ * @thread_enter: called from the thread when it is entered
+ * @thread_leave: called from the thread when it is left
+ *
+ * Class for managing threads.
+ */
+struct _GstRTSPThreadPoolClass {
+ GObjectClass parent_class;
+
+ GThreadPool *pool;
+
+ GstRTSPThread * (*get_thread) (GstRTSPThreadPool *pool,
+ GstRTSPThreadType type,
+ GstRTSPContext *ctx);
+ void (*configure_thread) (GstRTSPThreadPool *pool,
+ GstRTSPThread * thread,
+ GstRTSPContext *ctx);
+
+ void (*thread_enter) (GstRTSPThreadPool *pool,
+ GstRTSPThread *thread);
+ void (*thread_leave) (GstRTSPThreadPool *pool,
+ GstRTSPThread *thread);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_thread_pool_get_type (void);
+
+GST_RTSP_SERVER_API
+GstRTSPThreadPool * gst_rtsp_thread_pool_new (void);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_thread_pool_set_max_threads (GstRTSPThreadPool * pool, gint max_threads);
+
+GST_RTSP_SERVER_API
+gint gst_rtsp_thread_pool_get_max_threads (GstRTSPThreadPool * pool);
+
+GST_RTSP_SERVER_API
+GstRTSPThread * gst_rtsp_thread_pool_get_thread (GstRTSPThreadPool *pool,
+ GstRTSPThreadType type,
+ GstRTSPContext *ctx);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_thread_pool_cleanup (void);
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPThread, gst_rtsp_thread_unref)
+#endif
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPThreadPool, gst_object_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_THREAD_POOL_H__ */
diff --git a/include/gst/rtsp-server/rtsp-token.h b/include/gst/rtsp-server/rtsp-token.h
new file mode 100644
index 0000000000..27e18fbc48
--- /dev/null
+++ b/include/gst/rtsp-server/rtsp-token.h
@@ -0,0 +1,113 @@
+/* GStreamer
+ * Copyright (C) 2010 Wim Taymans <wim.taymans at gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __GST_RTSP_TOKEN_H__
+#define __GST_RTSP_TOKEN_H__
+
+typedef struct _GstRTSPToken GstRTSPToken;
+
+#include "rtsp-auth.h"
+
+G_BEGIN_DECLS
+
+GST_RTSP_SERVER_API
+GType gst_rtsp_token_get_type(void);
+
+#define GST_TYPE_RTSP_TOKEN (gst_rtsp_token_get_type())
+#define GST_IS_RTSP_TOKEN(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_TOKEN))
+#define GST_RTSP_TOKEN_CAST(obj) ((GstRTSPToken*)(obj))
+#define GST_RTSP_TOKEN(obj) (GST_RTSP_TOKEN_CAST(obj))
+
+/**
+ * GstRTSPToken:
+ *
+ * An opaque object used for checking authorisations.
+ * It is generated after successful authentication.
+ */
+struct _GstRTSPToken {
+ GstMiniObject mini_object;
+};
+
+/* refcounting */
+/**
+ * gst_rtsp_token_ref:
+ * @token: The token to refcount
+ *
+ * Increase the refcount of this token.
+ *
+ * Returns: (transfer full): @token (for convenience when doing assignments)
+ */
+static inline GstRTSPToken *
+gst_rtsp_token_ref (GstRTSPToken * token)
+{
+ return (GstRTSPToken *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (token));
+}
+
+/**
+ * gst_rtsp_token_unref:
+ * @token: (transfer full): the token to refcount
+ *
+ * Decrease the refcount of an token, freeing it if the refcount reaches 0.
+ */
+static inline void
+gst_rtsp_token_unref (GstRTSPToken * token)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (token));
+}
+
+
+GST_RTSP_SERVER_API
+GstRTSPToken * gst_rtsp_token_new_empty (void);
+
+GST_RTSP_SERVER_API
+GstRTSPToken * gst_rtsp_token_new (const gchar * firstfield, ...);
+
+GST_RTSP_SERVER_API
+GstRTSPToken * gst_rtsp_token_new_valist (const gchar * firstfield, va_list var_args);
+
+GST_RTSP_SERVER_API
+const GstStructure * gst_rtsp_token_get_structure (GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+GstStructure * gst_rtsp_token_writable_structure (GstRTSPToken *token);
+
+GST_RTSP_SERVER_API
+void gst_rtsp_token_set_string (GstRTSPToken * token,
+ const gchar * field,
+ const gchar * string_value);
+GST_RTSP_SERVER_API
+const gchar * gst_rtsp_token_get_string (GstRTSPToken *token,
+ const gchar *field);
+GST_RTSP_SERVER_API
+void gst_rtsp_token_set_bool (GstRTSPToken * token,
+ const gchar * field,
+ gboolean bool_value);
+GST_RTSP_SERVER_API
+gboolean gst_rtsp_token_is_allowed (GstRTSPToken *token,
+ const gchar *field);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPToken, gst_rtsp_token_unref)
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_TOKEN_H__ */
diff --git a/include/gst/rtsp/gstrtsp-enumtypes.h b/include/gst/rtsp/gstrtsp-enumtypes.h
new file mode 100644
index 0000000000..47c84d5226
--- /dev/null
+++ b/include/gst/rtsp/gstrtsp-enumtypes.h
@@ -0,0 +1,82 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/rtsp/rtsp-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gstrtspdefs.h" */
+
+GST_RTSP_API
+GType gst_rtsp_result_get_type (void);
+#define GST_TYPE_RTSP_RESULT (gst_rtsp_result_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_event_get_type (void);
+#define GST_TYPE_RTSP_EVENT (gst_rtsp_event_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_family_get_type (void);
+#define GST_TYPE_RTSP_FAMILY (gst_rtsp_family_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_state_get_type (void);
+#define GST_TYPE_RTSP_STATE (gst_rtsp_state_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_version_get_type (void);
+#define GST_TYPE_RTSP_VERSION (gst_rtsp_version_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_method_get_type (void);
+#define GST_TYPE_RTSP_METHOD (gst_rtsp_method_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_auth_method_get_type (void);
+#define GST_TYPE_RTSP_AUTH_METHOD (gst_rtsp_auth_method_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_header_field_get_type (void);
+#define GST_TYPE_RTSP_HEADER_FIELD (gst_rtsp_header_field_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_status_code_get_type (void);
+#define GST_TYPE_RTSP_STATUS_CODE (gst_rtsp_status_code_get_type())
+
+/* enumerations from "gstrtspmessage.h" */
+
+GST_RTSP_API
+GType gst_rtsp_msg_type_get_type (void);
+#define GST_TYPE_RTSP_MSG_TYPE (gst_rtsp_msg_type_get_type())
+
+/* enumerations from "gstrtsprange.h" */
+
+GST_RTSP_API
+GType gst_rtsp_range_unit_get_type (void);
+#define GST_TYPE_RTSP_RANGE_UNIT (gst_rtsp_range_unit_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_time_type_get_type (void);
+#define GST_TYPE_RTSP_TIME_TYPE (gst_rtsp_time_type_get_type())
+
+/* enumerations from "gstrtsptransport.h" */
+
+GST_RTSP_API
+GType gst_rtsp_trans_mode_get_type (void);
+#define GST_TYPE_RTSP_TRANS_MODE (gst_rtsp_trans_mode_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_profile_get_type (void);
+#define GST_TYPE_RTSP_PROFILE (gst_rtsp_profile_get_type())
+
+GST_RTSP_API
+GType gst_rtsp_lower_trans_get_type (void);
+#define GST_TYPE_RTSP_LOWER_TRANS (gst_rtsp_lower_trans_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/rtsp/gstrtsp.h b/include/gst/rtsp/gstrtsp.h
new file mode 100644
index 0000000000..eb1370e759
--- /dev/null
+++ b/include/gst/rtsp/gstrtsp.h
@@ -0,0 +1,33 @@
+/* GStreamer RTSP extension
+ * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * rtsp.h: Generic include to pull in defs
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __GST_RTSP_H__
+#define __GST_RTSP_H__
+
+#include <gst/rtsp/gstrtspconnection.h>
+#include <gst/rtsp/gstrtspdefs.h>
+#include <gst/rtsp/gstrtsp-enumtypes.h>
+#include <gst/rtsp/gstrtspextension.h>
+#include <gst/rtsp/gstrtspmessage.h>
+#include <gst/rtsp/gstrtsprange.h>
+#include <gst/rtsp/gstrtsptransport.h>
+#include <gst/rtsp/gstrtspurl.h>
+
+#endif /* __GST_RTSP_H__ */
diff --git a/include/gst/rtsp/gstrtspconnection.h b/include/gst/rtsp/gstrtspconnection.h
new file mode 100644
index 0000000000..2eeb462bda
--- /dev/null
+++ b/include/gst/rtsp/gstrtspconnection.h
@@ -0,0 +1,395 @@
+/* GStreamer
+ * Copyright (C) <2005,2009> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_CONNECTION_H__
+#define __GST_RTSP_CONNECTION_H__
+
+#include <glib.h>
+
+#include <gst/gstconfig.h>
+#include <gst/rtsp/gstrtspdefs.h>
+#include <gst/rtsp/gstrtspurl.h>
+#include <gst/rtsp/gstrtspmessage.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstRTSPConnection:
+ *
+ * Opaque RTSP connection object.
+ */
+typedef struct _GstRTSPConnection GstRTSPConnection;
+
+/* opening/closing a connection */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_create_from_socket (GSocket * socket,
+ const gchar * ip,
+ guint16 port,
+ const gchar * initial_buffer,
+ GstRTSPConnection ** conn);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_accept (GSocket * socket, GstRTSPConnection ** conn, GCancellable * cancellable);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_connect_usec (GstRTSPConnection * conn, gint64 timeout);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_connect_with_response_usec (GstRTSPConnection * conn, gint64 timeout, GstRTSPMessage * response);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
+
+/* TLS connections */
+
+GST_RTSP_API
+GTlsConnection * gst_rtsp_connection_get_tls (GstRTSPConnection * conn, GError ** error);
+
+GST_RTSP_API
+gboolean gst_rtsp_connection_set_tls_validation_flags (GstRTSPConnection * conn, GTlsCertificateFlags flags);
+
+GST_RTSP_API
+GTlsCertificateFlags gst_rtsp_connection_get_tls_validation_flags (GstRTSPConnection * conn);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_tls_database (GstRTSPConnection * conn, GTlsDatabase * database);
+
+GST_RTSP_API
+GTlsDatabase * gst_rtsp_connection_get_tls_database (GstRTSPConnection * conn);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_tls_interaction (GstRTSPConnection * conn, GTlsInteraction * interaction);
+
+GST_RTSP_API
+GTlsInteraction * gst_rtsp_connection_get_tls_interaction (GstRTSPConnection * conn);
+
+typedef gboolean (*GstRTSPConnectionAcceptCertificateFunc) (GTlsConnection *conn,
+ GTlsCertificate *peer_cert,
+ GTlsCertificateFlags errors,
+ gpointer user_data);
+GST_RTSP_API
+void gst_rtsp_connection_set_accept_certificate_func (GstRTSPConnection * conn,
+ GstRTSPConnectionAcceptCertificateFunc func,
+ gpointer user_data,
+ GDestroyNotify destroy_notify);
+
+/* sending/receiving raw bytes */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_read_usec (GstRTSPConnection * conn, guint8 * data,
+ guint size, gint64 timeout);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_write_usec (GstRTSPConnection * conn, const guint8 * data,
+ guint size, gint64 timeout);
+
+/* sending/receiving messages */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_send_usec (GstRTSPConnection *conn, GstRTSPMessage *message,
+ gint64 timeout);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_send_messages_usec (GstRTSPConnection *conn, GstRTSPMessage *messages, guint n_messages,
+ gint64 timeout);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_receive_usec (GstRTSPConnection *conn, GstRTSPMessage *message,
+ gint64 timeout);
+
+/* status management */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_poll_usec (GstRTSPConnection *conn, GstRTSPEvent events,
+ GstRTSPEvent *revents, gint64 timeout);
+
+/* reset the timeout */
+
+GST_RTSP_API
+gint64 gst_rtsp_connection_next_timeout_usec (GstRTSPConnection *conn);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
+
+/* flushing state */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
+
+/* HTTP proxy support */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_set_proxy (GstRTSPConnection *conn,
+ const gchar *host, guint port);
+
+/* configure authentication data */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
+ const gchar *user, const gchar *pass);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_auth_param (GstRTSPConnection *conn,
+ const gchar * param,
+ const gchar *value);
+
+GST_RTSP_API
+void gst_rtsp_connection_clear_auth_params (GstRTSPConnection *conn);
+
+/* configure DSCP */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn,
+ guint qos_dscp);
+
+/* Content-Length limit */
+GST_RTSP_API
+void gst_rtsp_connection_set_content_length_limit (GstRTSPConnection *conn,
+ guint limit);
+
+/* accessors */
+
+GST_RTSP_API
+GstRTSPUrl * gst_rtsp_connection_get_url (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip);
+
+GST_RTSP_API
+GSocket * gst_rtsp_connection_get_read_socket (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+GSocket * gst_rtsp_connection_get_write_socket (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn,
+ gboolean enable);
+
+/* tunneling */
+
+GST_RTSP_API
+void gst_rtsp_connection_set_tunneled (GstRTSPConnection *conn, gboolean tunneled);
+
+GST_RTSP_API
+gboolean gst_rtsp_connection_is_tunneled (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_remember_session_id (GstRTSPConnection *conn, gboolean remember);
+
+GST_RTSP_API
+gboolean gst_rtsp_connection_get_remember_session_id (GstRTSPConnection *conn);
+
+GST_RTSP_API
+void gst_rtsp_connection_set_ignore_x_server_reply (GstRTSPConnection *conn, gboolean ignore);
+
+GST_RTSP_API
+gboolean gst_rtsp_connection_get_ignore_x_server_reply (const GstRTSPConnection *conn);
+
+/* async IO */
+
+/**
+ * GstRTSPWatch:
+ *
+ * Opaque RTSP watch object that can be used for asynchronous RTSP
+ * operations.
+ */
+typedef struct _GstRTSPWatch GstRTSPWatch;
+
+/**
+ * GstRTSPWatchFuncs:
+ * @message_received: callback when a message was received
+ * @message_sent: callback when a message was sent
+ * @closed: callback when the connection is closed
+ * @error: callback when an error occurred
+ * @tunnel_start: a client started a tunneled connection. The tunnelid of the
+ * connection must be saved.
+ * @tunnel_complete: a client finished a tunneled connection. In this callback
+ * you usually pair the tunnelid of this connection with the saved one using
+ * gst_rtsp_connection_do_tunnel().
+ * @error_full: callback when an error occurred with more information than
+ * the @error callback.
+ * @tunnel_lost: callback when the post connection of a tunnel is closed.
+ * @tunnel_http_response: callback when an HTTP response to the GET request
+ * is about to be sent for a tunneled connection. The response can be
+ * modified in the callback. Since: 1.4.
+ *
+ * Callback functions from a #GstRTSPWatch.
+ */
+typedef struct {
+ GstRTSPResult (*message_received) (GstRTSPWatch *watch, GstRTSPMessage *message,
+ gpointer user_data);
+ GstRTSPResult (*message_sent) (GstRTSPWatch *watch, guint id,
+ gpointer user_data);
+ GstRTSPResult (*closed) (GstRTSPWatch *watch, gpointer user_data);
+ GstRTSPResult (*error) (GstRTSPWatch *watch, GstRTSPResult result,
+ gpointer user_data);
+ GstRTSPStatusCode (*tunnel_start) (GstRTSPWatch *watch, gpointer user_data);
+ GstRTSPResult (*tunnel_complete) (GstRTSPWatch *watch, gpointer user_data);
+ GstRTSPResult (*error_full) (GstRTSPWatch *watch, GstRTSPResult result,
+ GstRTSPMessage *message, guint id,
+ gpointer user_data);
+ GstRTSPResult (*tunnel_lost) (GstRTSPWatch *watch, gpointer user_data);
+ GstRTSPResult (*tunnel_http_response) (GstRTSPWatch *watch,
+ GstRTSPMessage *request,
+ GstRTSPMessage *response,
+ gpointer user_data);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING-1];
+} GstRTSPWatchFuncs;
+
+GST_RTSP_API
+GstRTSPWatch * gst_rtsp_watch_new (GstRTSPConnection *conn,
+ GstRTSPWatchFuncs *funcs,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_RTSP_API
+void gst_rtsp_watch_reset (GstRTSPWatch *watch);
+
+GST_RTSP_API
+void gst_rtsp_watch_unref (GstRTSPWatch *watch);
+
+GST_RTSP_API
+guint gst_rtsp_watch_attach (GstRTSPWatch *watch,
+ GMainContext *context);
+
+GST_RTSP_API
+void gst_rtsp_watch_set_send_backlog (GstRTSPWatch *watch,
+ gsize bytes, guint messages);
+
+GST_RTSP_API
+void gst_rtsp_watch_get_send_backlog (GstRTSPWatch *watch,
+ gsize *bytes, guint *messages);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_watch_write_data (GstRTSPWatch *watch,
+ const guint8 *data,
+ guint size, guint *id);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_watch_send_message (GstRTSPWatch *watch,
+ GstRTSPMessage *message,
+ guint *id);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_watch_send_messages (GstRTSPWatch *watch,
+ GstRTSPMessage *messages,
+ guint n_messages,
+ guint *id);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_watch_wait_backlog_usec (GstRTSPWatch * watch,
+ gint64 timeout);
+
+GST_RTSP_API
+void gst_rtsp_watch_set_flushing (GstRTSPWatch * watch,
+ gboolean flushing);
+
+#ifndef GST_DISABLE_DEPRECATED
+
+/* Deprecated */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_connect_usec)
+GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_connect_with_response_usec)
+GstRTSPResult gst_rtsp_connection_connect_with_response (GstRTSPConnection * conn, GTimeVal * timeout, GstRTSPMessage * response);
+
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_read_usec)
+GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
+ guint size, GTimeVal * timeout);
+
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_write_usec)
+GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
+ guint size, GTimeVal * timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_send_usec)
+GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message,
+ GTimeVal *timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_send_messages_usec)
+GstRTSPResult gst_rtsp_connection_send_messages (GstRTSPConnection *conn, GstRTSPMessage *messages, guint n_messages,
+ GTimeVal *timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_receive_usec)
+GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message,
+ GTimeVal *timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_poll_usec)
+GstRTSPResult gst_rtsp_connection_poll (GstRTSPConnection *conn, GstRTSPEvent events,
+ GstRTSPEvent *revents, GTimeVal *timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_next_timeout_usec)
+GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
+
+GST_RTSP_DEPRECATED_FOR (gst_rtsp_watch_wait_backlog_usec)
+GstRTSPResult gst_rtsp_watch_wait_backlog (GstRTSPWatch * watch,
+ GTimeVal *timeout);
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+#endif /* GST_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_CONNECTION_H__ */
diff --git a/include/gst/rtsp/gstrtspdefs.h b/include/gst/rtsp/gstrtspdefs.h
new file mode 100644
index 0000000000..8a028c381b
--- /dev/null
+++ b/include/gst/rtsp/gstrtspdefs.h
@@ -0,0 +1,453 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_DEFS_H__
+#define __GST_RTSP_DEFS_H__
+
+#include <gst/gst.h>
+#include <gst/rtsp/rtsp-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_RTSP_CHECK:
+ * @stmt: a statement
+ * @label: a label
+ *
+ * Macro that checks the return value of @stmt and jumps to @label when it does
+ * not equal #GST_RTSP_OK.
+ */
+#define GST_RTSP_CHECK(stmt, label) \
+G_STMT_START { \
+ if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \
+ goto label; \
+} G_STMT_END
+
+/**
+ * GstRTSPResult:
+ * @GST_RTSP_OK: no error
+ * @GST_RTSP_ERROR: some unspecified error occurred
+ * @GST_RTSP_EINVAL: invalid arguments were provided to a function
+ * @GST_RTSP_EINTR: an operation was canceled
+ * @GST_RTSP_ENOMEM: no memory was available for the operation
+ * @GST_RTSP_ERESOLV: a host resolve error occurred
+ * @GST_RTSP_ENOTIMPL: function not implemented
+ * @GST_RTSP_ESYS: a system error occurred, errno contains more details
+ * @GST_RTSP_EPARSE: a parsing error occurred
+ * @GST_RTSP_EWSASTART: windows networking could not start
+ * @GST_RTSP_EWSAVERSION: windows networking stack has wrong version
+ * @GST_RTSP_EEOF: end-of-file was reached
+ * @GST_RTSP_ENET: a network problem occurred, h_errno contains more details
+ * @GST_RTSP_ENOTIP: the host is not an IP host
+ * @GST_RTSP_ETIMEOUT: a timeout occurred
+ * @GST_RTSP_ETGET: the tunnel GET request has been performed
+ * @GST_RTSP_ETPOST: the tunnel POST request has been performed
+ * @GST_RTSP_ELAST: last error
+ *
+ * Result codes from the RTSP functions.
+ */
+typedef enum {
+ GST_RTSP_OK = 0,
+ /* errors */
+ GST_RTSP_ERROR = -1,
+ GST_RTSP_EINVAL = -2,
+ GST_RTSP_EINTR = -3,
+ GST_RTSP_ENOMEM = -4,
+ GST_RTSP_ERESOLV = -5,
+ GST_RTSP_ENOTIMPL = -6,
+ GST_RTSP_ESYS = -7,
+ GST_RTSP_EPARSE = -8,
+ GST_RTSP_EWSASTART = -9,
+ GST_RTSP_EWSAVERSION = -10,
+ GST_RTSP_EEOF = -11,
+ GST_RTSP_ENET = -12,
+ GST_RTSP_ENOTIP = -13,
+ GST_RTSP_ETIMEOUT = -14,
+ GST_RTSP_ETGET = -15,
+ GST_RTSP_ETPOST = -16,
+
+ GST_RTSP_ELAST = -17
+} GstRTSPResult;
+
+/**
+ * GstRTSPEvent:
+ * @GST_RTSP_EV_READ: connection is readable
+ * @GST_RTSP_EV_WRITE: connection is writable
+ *
+ * The possible events for the connection.
+ */
+typedef enum {
+ GST_RTSP_EV_READ = (1 << 0),
+ GST_RTSP_EV_WRITE = (1 << 1)
+} GstRTSPEvent;
+
+/**
+ * GstRTSPFamily:
+ * @GST_RTSP_FAM_NONE: unknown network family
+ * @GST_RTSP_FAM_INET: internet
+ * @GST_RTSP_FAM_INET6: internet V6
+ *
+ * The possible network families.
+ */
+typedef enum {
+ GST_RTSP_FAM_NONE,
+ GST_RTSP_FAM_INET,
+ GST_RTSP_FAM_INET6
+} GstRTSPFamily;
+
+/**
+ * GstRTSPState:
+ * @GST_RTSP_STATE_INVALID: invalid state
+ * @GST_RTSP_STATE_INIT: initializing
+ * @GST_RTSP_STATE_READY: ready for operation
+ * @GST_RTSP_STATE_SEEKING: seeking in progress
+ * @GST_RTSP_STATE_PLAYING: playing
+ * @GST_RTSP_STATE_RECORDING: recording
+ *
+ * The different RTSP states.
+ */
+typedef enum {
+ GST_RTSP_STATE_INVALID,
+ GST_RTSP_STATE_INIT,
+ GST_RTSP_STATE_READY,
+ GST_RTSP_STATE_SEEKING,
+ GST_RTSP_STATE_PLAYING,
+ GST_RTSP_STATE_RECORDING
+} GstRTSPState;
+
+/**
+ * GstRTSPVersion:
+ * @GST_RTSP_VERSION_INVALID: unknown/invalid version
+ * @GST_RTSP_VERSION_1_0: version 1.0
+ * @GST_RTSP_VERSION_1_1: version 1.1.
+ * @GST_RTSP_VERSION_2_0: version 2.0.
+ *
+ * The supported RTSP versions.
+ */
+typedef enum {
+ GST_RTSP_VERSION_INVALID = 0x00,
+ GST_RTSP_VERSION_1_0 = 0x10,
+ GST_RTSP_VERSION_1_1 = 0x11,
+ GST_RTSP_VERSION_2_0 = 0x20
+} GstRTSPVersion;
+
+/**
+ * GstRTSPMethod:
+ * @GST_RTSP_INVALID: invalid method
+ * @GST_RTSP_DESCRIBE: the DESCRIBE method
+ * @GST_RTSP_ANNOUNCE: the ANNOUNCE method
+ * @GST_RTSP_GET_PARAMETER: the GET_PARAMETER method
+ * @GST_RTSP_OPTIONS: the OPTIONS method
+ * @GST_RTSP_PAUSE: the PAUSE method
+ * @GST_RTSP_PLAY: the PLAY method
+ * @GST_RTSP_RECORD: the RECORD method
+ * @GST_RTSP_REDIRECT: the REDIRECT method
+ * @GST_RTSP_SETUP: the SETUP method
+ * @GST_RTSP_SET_PARAMETER: the SET_PARAMETER method
+ * @GST_RTSP_TEARDOWN: the TEARDOWN method
+ * @GST_RTSP_GET: the GET method (HTTP).
+ * @GST_RTSP_POST: the POST method (HTTP).
+ *
+ * The different supported RTSP methods.
+ */
+typedef enum {
+ GST_RTSP_INVALID = 0,
+ GST_RTSP_DESCRIBE = (1 << 0),
+ GST_RTSP_ANNOUNCE = (1 << 1),
+ GST_RTSP_GET_PARAMETER = (1 << 2),
+ GST_RTSP_OPTIONS = (1 << 3),
+ GST_RTSP_PAUSE = (1 << 4),
+ GST_RTSP_PLAY = (1 << 5),
+ GST_RTSP_RECORD = (1 << 6),
+ GST_RTSP_REDIRECT = (1 << 7),
+ GST_RTSP_SETUP = (1 << 8),
+ GST_RTSP_SET_PARAMETER = (1 << 9),
+ GST_RTSP_TEARDOWN = (1 << 10),
+ GST_RTSP_GET = (1 << 11),
+ GST_RTSP_POST = (1 << 12)
+} GstRTSPMethod;
+
+/**
+ * GstRTSPAuthMethod:
+ * @GST_RTSP_AUTH_NONE: no authentication
+ * @GST_RTSP_AUTH_BASIC: basic authentication
+ * @GST_RTSP_AUTH_DIGEST: digest authentication
+ *
+ * Authentication methods, ordered by strength
+ */
+typedef enum {
+ GST_RTSP_AUTH_NONE = 0x00,
+ GST_RTSP_AUTH_BASIC = 0x01,
+ GST_RTSP_AUTH_DIGEST = 0x02
+} GstRTSPAuthMethod;
+
+/**
+ * GST_RTSP_AUTH_MAX:
+ *
+ * Strongest available authentication method
+ */
+#define GST_RTSP_AUTH_MAX GST_RTSP_AUTH_DIGEST
+
+/**
+ * GstRTSPHeaderField:
+ *
+ * Enumeration of rtsp header fields
+ */
+typedef enum {
+ GST_RTSP_HDR_INVALID,
+
+ /*
+ * R = Request
+ * r = response
+ * g = general
+ * e = entity
+ */
+ GST_RTSP_HDR_ACCEPT, /* Accept R opt. entity */
+ GST_RTSP_HDR_ACCEPT_ENCODING, /* Accept-Encoding R opt. entity */
+ GST_RTSP_HDR_ACCEPT_LANGUAGE, /* Accept-Language R opt. all */
+ GST_RTSP_HDR_ALLOW, /* Allow r opt. all */
+ GST_RTSP_HDR_AUTHORIZATION, /* Authorization R opt. all */
+ GST_RTSP_HDR_BANDWIDTH, /* Bandwidth R opt. all */
+ GST_RTSP_HDR_BLOCKSIZE, /* Blocksize R opt. all but OPTIONS, TEARDOWN */
+ GST_RTSP_HDR_CACHE_CONTROL, /* Cache-Control g opt. SETUP */
+ GST_RTSP_HDR_CONFERENCE, /* Conference R opt. SETUP */
+ GST_RTSP_HDR_CONNECTION, /* Connection g req. all */
+ GST_RTSP_HDR_CONTENT_BASE, /* Content-Base e opt. entity */
+ GST_RTSP_HDR_CONTENT_ENCODING, /* Content-Encoding e req. SET_PARAMETER, DESCRIBE, ANNOUNCE */
+ GST_RTSP_HDR_CONTENT_LANGUAGE, /* Content-Language e req. DESCRIBE, ANNOUNCE */
+ GST_RTSP_HDR_CONTENT_LENGTH, /* Content-Length e req. SET_PARAMETER, ANNOUNCE, entity */
+ GST_RTSP_HDR_CONTENT_LOCATION, /* Content-Location e opt. entity */
+ GST_RTSP_HDR_CONTENT_TYPE, /* Content-Type e req. SET_PARAMETER, ANNOUNCE, entity */
+ GST_RTSP_HDR_CSEQ, /* CSeq g req. all */
+ GST_RTSP_HDR_DATE, /* Date g opt. all */
+ GST_RTSP_HDR_EXPIRES, /* Expires e opt. DESCRIBE, ANNOUNCE */
+ GST_RTSP_HDR_FROM, /* From R opt. all */
+ GST_RTSP_HDR_IF_MODIFIED_SINCE, /* If-Modified-Since R opt. DESCRIBE, SETUP */
+ GST_RTSP_HDR_LAST_MODIFIED, /* Last-Modified e opt. entity */
+ GST_RTSP_HDR_PROXY_AUTHENTICATE, /* Proxy-Authenticate */
+ GST_RTSP_HDR_PROXY_REQUIRE, /* Proxy-Require R req. all */
+ GST_RTSP_HDR_PUBLIC, /* Public r opt. all */
+ GST_RTSP_HDR_RANGE, /* Range Rr opt. PLAY, PAUSE, RECORD */
+ GST_RTSP_HDR_REFERER, /* Referrer R opt. all */
+ GST_RTSP_HDR_REQUIRE, /* Require R req. all */
+ GST_RTSP_HDR_RETRY_AFTER, /* Retry-After r opt. all */
+ GST_RTSP_HDR_RTP_INFO, /* RTP-Info r req. PLAY */
+ GST_RTSP_HDR_SCALE, /* Scale Rr opt. PLAY, RECORD */
+ GST_RTSP_HDR_SESSION, /* Session Rr req. all but SETUP, OPTIONS */
+ GST_RTSP_HDR_SERVER, /* Server r opt. all */
+ GST_RTSP_HDR_SPEED, /* Speed Rr opt. PLAY */
+ GST_RTSP_HDR_TRANSPORT, /* Transport Rr req. SETUP */
+ GST_RTSP_HDR_UNSUPPORTED, /* Unsupported r req. all */
+ GST_RTSP_HDR_USER_AGENT, /* User-Agent R opt. all */
+ GST_RTSP_HDR_VIA, /* Via g opt. all */
+ GST_RTSP_HDR_WWW_AUTHENTICATE, /* WWW-Authenticate r opt. all */
+
+ /* Real extensions */
+ GST_RTSP_HDR_CLIENT_CHALLENGE, /* ClientChallenge */
+ GST_RTSP_HDR_REAL_CHALLENGE1, /* RealChallenge1 */
+ GST_RTSP_HDR_REAL_CHALLENGE2, /* RealChallenge2 */
+ GST_RTSP_HDR_REAL_CHALLENGE3, /* RealChallenge3 */
+ GST_RTSP_HDR_SUBSCRIBE, /* Subscribe */
+ GST_RTSP_HDR_ALERT, /* Alert */
+ GST_RTSP_HDR_CLIENT_ID, /* ClientID */
+ GST_RTSP_HDR_COMPANY_ID, /* CompanyID */
+ GST_RTSP_HDR_GUID, /* GUID */
+ GST_RTSP_HDR_REGION_DATA, /* RegionData */
+ GST_RTSP_HDR_MAX_ASM_WIDTH, /* SupportsMaximumASMBandwidth */
+ GST_RTSP_HDR_LANGUAGE, /* Language */
+ GST_RTSP_HDR_PLAYER_START_TIME, /* PlayerStarttime */
+
+ GST_RTSP_HDR_LOCATION, /* Location */
+
+ GST_RTSP_HDR_ETAG, /* ETag */
+ GST_RTSP_HDR_IF_MATCH, /* If-Match */
+
+ /* WM extensions [MS-RTSP] */
+ GST_RTSP_HDR_ACCEPT_CHARSET, /* Accept-Charset */
+ GST_RTSP_HDR_SUPPORTED, /* Supported */
+ GST_RTSP_HDR_VARY, /* Vary */
+ GST_RTSP_HDR_X_ACCELERATE_STREAMING, /* X-Accelerate-Streaming */
+ GST_RTSP_HDR_X_ACCEPT_AUTHENT, /* X-Accept-Authentication */
+ GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT, /* X-Accept-Proxy-Authentication */
+ GST_RTSP_HDR_X_BROADCAST_ID, /* X-Broadcast-Id */
+ GST_RTSP_HDR_X_BURST_STREAMING, /* X-Burst-Streaming */
+ GST_RTSP_HDR_X_NOTICE, /* X-Notice */
+ GST_RTSP_HDR_X_PLAYER_LAG_TIME, /* X-Player-Lag-Time */
+ GST_RTSP_HDR_X_PLAYLIST, /* X-Playlist */
+ GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE, /* X-Playlist-Change-Notice */
+ GST_RTSP_HDR_X_PLAYLIST_GEN_ID, /* X-Playlist-Gen-Id */
+ GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, /* X-Playlist-Seek-Id */
+ GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, /* X-Proxy-Client-Agent */
+ GST_RTSP_HDR_X_PROXY_CLIENT_VERB, /* X-Proxy-Client-Verb */
+ GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, /* X-Receding-PlaylistChange */
+ GST_RTSP_HDR_X_RTP_INFO, /* X-RTP-Info */
+ GST_RTSP_HDR_X_STARTUPPROFILE, /* X-StartupProfile */
+
+ GST_RTSP_HDR_TIMESTAMP, /* Timestamp */
+
+ GST_RTSP_HDR_AUTHENTICATION_INFO, /* Authentication-Info */
+ GST_RTSP_HDR_HOST, /* Host */
+ GST_RTSP_HDR_PRAGMA, /* Pragma */
+ GST_RTSP_HDR_X_SERVER_IP_ADDRESS, /* X-Server-IP-Address */
+ GST_RTSP_HDR_X_SESSIONCOOKIE, /* x-sessioncookie */
+
+ GST_RTSP_HDR_RTCP_INTERVAL, /* RTCP-Interval */
+
+ /* Since: 1.4 */
+ GST_RTSP_HDR_KEYMGMT, /* KeyMgmt */
+
+ /* Since: 1.14 */
+ GST_RTSP_HDR_PIPELINED_REQUESTS, /* Pipelined-Requests Rr opt. SETUP */
+ GST_RTSP_HDR_MEDIA_PROPERTIES, /* Media-Properties Rr opt. SETUP */
+ GST_RTSP_HDR_SEEK_STYLE, /* Seek-Type Rr opt. PLAY */
+ GST_RTSP_HDR_ACCEPT_RANGES, /* Accept-Ranges Rr opt. SETUP, GET_PARAMETER */
+
+ /* Onvif extensions */
+ GST_RTSP_HDR_FRAMES, /* Frames Rr opt. PLAY */
+ GST_RTSP_HDR_RATE_CONTROL, /* Rate-control Rr opt. PLAY */
+
+ GST_RTSP_HDR_LAST
+} GstRTSPHeaderField;
+
+/**
+ * GstRTSPStatusCode:
+ *
+ * Enumeration of rtsp status codes
+ */
+typedef enum {
+ GST_RTSP_STS_INVALID = 0,
+ GST_RTSP_STS_CONTINUE = 100,
+ GST_RTSP_STS_OK = 200,
+ GST_RTSP_STS_CREATED = 201,
+ GST_RTSP_STS_LOW_ON_STORAGE = 250,
+ GST_RTSP_STS_MULTIPLE_CHOICES = 300,
+ GST_RTSP_STS_MOVED_PERMANENTLY = 301,
+ GST_RTSP_STS_MOVE_TEMPORARILY = 302,
+ GST_RTSP_STS_SEE_OTHER = 303,
+ GST_RTSP_STS_NOT_MODIFIED = 304,
+ GST_RTSP_STS_USE_PROXY = 305,
+ GST_RTSP_STS_BAD_REQUEST = 400,
+ GST_RTSP_STS_UNAUTHORIZED = 401,
+ GST_RTSP_STS_PAYMENT_REQUIRED = 402,
+ GST_RTSP_STS_FORBIDDEN = 403,
+ GST_RTSP_STS_NOT_FOUND = 404,
+ GST_RTSP_STS_METHOD_NOT_ALLOWED = 405,
+ GST_RTSP_STS_NOT_ACCEPTABLE = 406,
+ GST_RTSP_STS_PROXY_AUTH_REQUIRED = 407,
+ GST_RTSP_STS_REQUEST_TIMEOUT = 408,
+ GST_RTSP_STS_GONE = 410,
+ GST_RTSP_STS_LENGTH_REQUIRED = 411,
+ GST_RTSP_STS_PRECONDITION_FAILED = 412,
+ GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE = 413,
+ GST_RTSP_STS_REQUEST_URI_TOO_LARGE = 414,
+ GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE = 415,
+ GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD = 451,
+ GST_RTSP_STS_CONFERENCE_NOT_FOUND = 452,
+ GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH = 453,
+ GST_RTSP_STS_SESSION_NOT_FOUND = 454,
+ GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE = 455,
+ GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE = 456,
+ GST_RTSP_STS_INVALID_RANGE = 457,
+ GST_RTSP_STS_PARAMETER_IS_READONLY = 458,
+ GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED = 459,
+ GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED = 460,
+ GST_RTSP_STS_UNSUPPORTED_TRANSPORT = 461,
+ GST_RTSP_STS_DESTINATION_UNREACHABLE = 462,
+ GST_RTSP_STS_KEY_MANAGEMENT_FAILURE = 463, /* since 1.4 */
+ GST_RTSP_STS_INTERNAL_SERVER_ERROR = 500,
+ GST_RTSP_STS_NOT_IMPLEMENTED = 501,
+ GST_RTSP_STS_BAD_GATEWAY = 502,
+ GST_RTSP_STS_SERVICE_UNAVAILABLE = 503,
+ GST_RTSP_STS_GATEWAY_TIMEOUT = 504,
+ GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED = 505,
+ GST_RTSP_STS_OPTION_NOT_SUPPORTED = 551
+} GstRTSPStatusCode;
+
+GST_RTSP_API
+gchar* gst_rtsp_strresult (GstRTSPResult result);
+
+GST_RTSP_API
+const gchar* gst_rtsp_method_as_text (GstRTSPMethod method);
+
+GST_RTSP_API
+const gchar* gst_rtsp_version_as_text (GstRTSPVersion version);
+
+GST_RTSP_API
+const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field);
+
+GST_RTSP_API
+const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code);
+
+GST_RTSP_API
+gchar* gst_rtsp_options_as_text (GstRTSPMethod options);
+
+GST_RTSP_API
+GstRTSPMethod gst_rtsp_options_from_text (const gchar *options);
+
+GST_RTSP_API
+GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header);
+
+GST_RTSP_API
+GstRTSPMethod gst_rtsp_find_method (const gchar *method);
+
+GST_RTSP_API
+gboolean gst_rtsp_header_allow_multiple (GstRTSPHeaderField field);
+
+GST_RTSP_API
+gchar * gst_rtsp_generate_digest_auth_response (const gchar *algorithm,
+ const gchar *method,
+ const gchar *realm,
+ const gchar *username,
+ const gchar *password,
+ const gchar *uri,
+ const gchar *nonce);
+
+GST_RTSP_API
+gchar * gst_rtsp_generate_digest_auth_response_from_md5 (const gchar *algorithm,
+ const gchar * method,
+ const gchar * md5,
+ const gchar * uri,
+ const gchar * nonce);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_DEFS_H__ */
diff --git a/include/gst/rtsp/gstrtspextension.h b/include/gst/rtsp/gstrtspextension.h
new file mode 100644
index 0000000000..60b129b46a
--- /dev/null
+++ b/include/gst/rtsp/gstrtspextension.h
@@ -0,0 +1,122 @@
+/* GStreamer RTSP Extension
+ * Copyright (C) 2007 Wim Taymans <wim@fluendo.com>
+ *
+ * gstrtspextension.h: RTSP Extension interface.
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_EXTENSION_H__
+#define __GST_RTSP_EXTENSION_H__
+
+#include <gst/gst.h>
+
+#include <gst/sdp/gstsdpmessage.h>
+#include <gst/rtsp/gstrtsptransport.h>
+#include <gst/rtsp/gstrtspmessage.h>
+#include <gst/rtsp/gstrtspurl.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_EXTENSION \
+ (gst_rtsp_extension_get_type ())
+#define GST_RTSP_EXTENSION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_EXTENSION, GstRTSPExtension))
+#define GST_IS_RTSP_EXTENSION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_EXTENSION))
+#define GST_RTSP_EXTENSION_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_RTSP_EXTENSION, GstRTSPExtensionInterface))
+
+/**
+ * GstRTSPExtensionInterface:
+ *
+ * An interface representing RTSP extensions.
+ */
+typedef struct _GstRTSPExtension GstRTSPExtension;
+typedef struct _GstRTSPExtensionInterface GstRTSPExtensionInterface;
+
+struct _GstRTSPExtensionInterface {
+ GTypeInterface parent;
+
+ /* vfunctions */
+ gboolean (*detect_server) (GstRTSPExtension *ext, GstRTSPMessage *resp);
+
+ GstRTSPResult (*before_send) (GstRTSPExtension *ext, GstRTSPMessage *req);
+ GstRTSPResult (*after_send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp);
+
+ GstRTSPResult (*parse_sdp) (GstRTSPExtension *ext, GstSDPMessage *sdp, GstStructure *s);
+ GstRTSPResult (*setup_media) (GstRTSPExtension *ext, GstSDPMedia *media);
+
+ gboolean (*configure_stream) (GstRTSPExtension *ext, GstCaps *caps);
+
+ GstRTSPResult (*get_transports) (GstRTSPExtension *ext, GstRTSPLowerTrans protocols, gchar **transport);
+
+ GstRTSPResult (*stream_select) (GstRTSPExtension *ext, GstRTSPUrl *url);
+
+ /* signals */
+ GstRTSPResult (*send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp);
+
+ /* ABI: more vfunctions added later */
+ GstRTSPResult (*receive_request) (GstRTSPExtension *ext, GstRTSPMessage *req);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_API
+GType gst_rtsp_extension_get_type (void);
+
+/* invoke vfunction on interface */
+
+GST_RTSP_API
+gboolean gst_rtsp_extension_detect_server (GstRTSPExtension *ext, GstRTSPMessage *resp);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_before_send (GstRTSPExtension *ext, GstRTSPMessage *req);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_after_send (GstRTSPExtension *ext, GstRTSPMessage *req,
+ GstRTSPMessage *resp);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_parse_sdp (GstRTSPExtension *ext, GstSDPMessage *sdp,
+ GstStructure *s);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_setup_media (GstRTSPExtension *ext, GstSDPMedia *media);
+
+GST_RTSP_API
+gboolean gst_rtsp_extension_configure_stream (GstRTSPExtension *ext, GstCaps *caps);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_get_transports (GstRTSPExtension *ext, GstRTSPLowerTrans protocols,
+ gchar **transport);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_stream_select (GstRTSPExtension *ext, GstRTSPUrl *url);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_receive_request (GstRTSPExtension *ext, GstRTSPMessage *req);
+
+/* signal emission */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_extension_send (GstRTSPExtension *ext, GstRTSPMessage *req,
+ GstRTSPMessage *resp);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_EXTENSION_H__ */
diff --git a/include/gst/rtsp/gstrtspmessage.h b/include/gst/rtsp/gstrtspmessage.h
new file mode 100644
index 0000000000..ed6a284c91
--- /dev/null
+++ b/include/gst/rtsp/gstrtspmessage.h
@@ -0,0 +1,347 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_MESSAGE_H__
+#define __GST_RTSP_MESSAGE_H__
+
+#include <gst/gst.h>
+#include <gst/rtsp/gstrtspdefs.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstRTSPMsgType:
+ * @GST_RTSP_MESSAGE_INVALID: invalid message type
+ * @GST_RTSP_MESSAGE_REQUEST: RTSP request message
+ * @GST_RTSP_MESSAGE_RESPONSE: RTSP response message
+ * @GST_RTSP_MESSAGE_HTTP_REQUEST: HTTP request message.
+ * @GST_RTSP_MESSAGE_HTTP_RESPONSE: HTTP response message.
+ * @GST_RTSP_MESSAGE_DATA: data message
+ *
+ * The type of a message.
+ */
+typedef enum
+{
+ GST_RTSP_MESSAGE_INVALID,
+ GST_RTSP_MESSAGE_REQUEST,
+ GST_RTSP_MESSAGE_RESPONSE,
+ GST_RTSP_MESSAGE_HTTP_REQUEST,
+ GST_RTSP_MESSAGE_HTTP_RESPONSE,
+ GST_RTSP_MESSAGE_DATA
+} GstRTSPMsgType;
+
+typedef struct _GstRTSPMessage GstRTSPMessage;
+
+/**
+ * GstRTSPMessage:
+ * @type: the message type
+ *
+ * An RTSP message containing request, response or data messages. Depending on
+ * the @type, the appropriate structure may be accessed.
+ */
+struct _GstRTSPMessage
+{
+ GstRTSPMsgType type;
+
+ union {
+ struct {
+ GstRTSPMethod method;
+ gchar *uri;
+ GstRTSPVersion version;
+ } request;
+ struct {
+ GstRTSPStatusCode code;
+ gchar *reason;
+ GstRTSPVersion version;
+ } response;
+ struct {
+ guint8 channel;
+ } data;
+ } type_data;
+
+ /*< private >*/
+ GArray *hdr_fields;
+
+ guint8 *body;
+ guint body_size;
+
+ GstBuffer *body_buffer;
+ gpointer _gst_reserved[GST_PADDING-1];
+};
+
+GST_RTSP_API
+GType gst_rtsp_msg_get_type (void);
+
+#define GST_TYPE_RTSP_MESSAGE (gst_rtsp_msg_get_type())
+#define GST_RTSP_MESSAGE_CAST(object) ((GstRTSPMessage *)(object))
+#define GST_RTSP_MESSAGE(object) (GST_RTSP_MESSAGE_CAST(object))
+
+/* memory management */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg);
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_copy (const GstRTSPMessage *msg,
+ GstRTSPMessage **copy);
+
+GST_RTSP_API
+GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg);
+
+/* request */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg,
+ GstRTSPMethod method,
+ const gchar *uri);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg,
+ GstRTSPMethod method,
+ const gchar *uri);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg,
+ GstRTSPMethod *method,
+ const gchar **uri,
+ GstRTSPVersion *version);
+
+/* response */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg,
+ GstRTSPStatusCode code,
+ const gchar *reason,
+ const GstRTSPMessage *request);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg,
+ GstRTSPStatusCode code,
+ const gchar *reason,
+ const GstRTSPMessage *request);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg,
+ GstRTSPStatusCode *code,
+ const gchar **reason,
+ GstRTSPVersion *version);
+
+/* data */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg,
+ guint8 channel);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg,
+ guint8 channel);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg,
+ guint8 *channel);
+
+/* headers */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg,
+ GstRTSPHeaderField field,
+ const gchar *value);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg,
+ GstRTSPHeaderField field,
+ gchar *value);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg,
+ GstRTSPHeaderField field,
+ gint indx);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg,
+ GstRTSPHeaderField field,
+ gchar **value,
+ gint indx);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_add_header_by_name (GstRTSPMessage * msg,
+ const gchar * header,
+ const gchar * value);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_take_header_by_name (GstRTSPMessage * msg,
+ const gchar * header,
+ gchar * value);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_remove_header_by_name (GstRTSPMessage * msg,
+ const gchar * header,
+ gint index);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_get_header_by_name (GstRTSPMessage * msg,
+ const gchar * header,
+ gchar ** value,
+ gint index);
+
+/* header serialization */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg,
+ GString *str);
+
+/* handling the body */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg,
+ const guint8 *data,
+ guint size);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg,
+ guint8 *data,
+ guint size);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg,
+ guint8 **data,
+ guint *size);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg,
+ guint8 **data,
+ guint *size);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_set_body_buffer (GstRTSPMessage *msg,
+ GstBuffer * buffer);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_take_body_buffer(GstRTSPMessage *msg,
+ GstBuffer * buffer);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_get_body_buffer (const GstRTSPMessage *msg,
+ GstBuffer ** buffer);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_steal_body_buffer(GstRTSPMessage *msg,
+ GstBuffer ** buffer);
+
+GST_RTSP_API
+gboolean gst_rtsp_message_has_body_buffer(const GstRTSPMessage *msg);
+
+typedef struct _GstRTSPAuthCredential GstRTSPAuthCredential;
+typedef struct _GstRTSPAuthParam GstRTSPAuthParam;
+
+/**
+ * GstRTSPAuthCredential:
+ * @scheme: a #GstRTSPAuthMethod
+ * @params: A NULL-terminated array of #GstRTSPAuthParam
+ * @authorization: The authorization for the basic schem
+ *
+ * RTSP Authentication credentials
+ *
+ * Since: 1.12
+ */
+struct _GstRTSPAuthCredential {
+ GstRTSPAuthMethod scheme;
+
+ /* For Basic/Digest WWW-Authenticate and Digest
+ * Authorization */
+ GstRTSPAuthParam **params; /* NULL terminated */
+
+ /* For Basic Authorization */
+ gchar *authorization;
+};
+
+/**
+ * GstRTSPAuthParam:
+ * @name: The name of the parameter
+ * @value: The value of the parameter
+ *
+ * RTSP Authentication parameter
+ *
+ * Since: 1.12
+ */
+struct _GstRTSPAuthParam {
+ gchar *name;
+ gchar *value;
+};
+
+GST_RTSP_API
+GstRTSPAuthParam * gst_rtsp_auth_param_copy (GstRTSPAuthParam * param);
+GST_RTSP_API
+void gst_rtsp_auth_param_free (GstRTSPAuthParam * param);
+
+GST_RTSP_API
+GstRTSPAuthCredential ** gst_rtsp_message_parse_auth_credentials (GstRTSPMessage * msg, GstRTSPHeaderField field);
+
+GST_RTSP_API
+void gst_rtsp_auth_credentials_free (GstRTSPAuthCredential ** credentials);
+
+#define GST_TYPE_RTSP_AUTH_CREDENTIAL gst_rtsp_auth_credential_get_type()
+
+GST_RTSP_API
+GType gst_rtsp_auth_credential_get_type (void);
+
+#define GST_TYPE_RTSP_AUTH_PARAM gst_rtsp_auth_param_get_type()
+
+GST_RTSP_API
+GType gst_rtsp_auth_param_get_type (void);
+
+/* debug */
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_MESSAGE_H__ */
diff --git a/include/gst/rtsp/gstrtsprange.h b/include/gst/rtsp/gstrtsprange.h
new file mode 100644
index 0000000000..c14bf0f103
--- /dev/null
+++ b/include/gst/rtsp/gstrtsprange.h
@@ -0,0 +1,164 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_RANGE_H__
+#define __GST_RTSP_RANGE_H__
+
+#include <glib.h>
+#include <gst/gst.h>
+
+#include <gst/rtsp/gstrtspdefs.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstRTSPRangeUnit:
+ * @GST_RTSP_RANGE_SMPTE: SMPTE timecode
+ * @GST_RTSP_RANGE_SMPTE_30_DROP: 29.97 frames per second
+ * @GST_RTSP_RANGE_SMPTE_25: 25 frames per second
+ * @GST_RTSP_RANGE_NPT: Normal play time
+ * @GST_RTSP_RANGE_CLOCK: Absolute time expressed as ISO 8601 timestamps
+ *
+ * Different possible time range units.
+ */
+typedef enum
+{
+ GST_RTSP_RANGE_SMPTE,
+ GST_RTSP_RANGE_SMPTE_30_DROP,
+ GST_RTSP_RANGE_SMPTE_25,
+ GST_RTSP_RANGE_NPT,
+ GST_RTSP_RANGE_CLOCK
+} GstRTSPRangeUnit;
+
+typedef struct _GstRTSPTimeRange GstRTSPTimeRange;
+typedef struct _GstRTSPTime GstRTSPTime;
+typedef struct _GstRTSPTime2 GstRTSPTime2;
+
+/**
+ * GstRTSPTimeType:
+ * @GST_RTSP_TIME_SECONDS: seconds
+ * @GST_RTSP_TIME_NOW: now
+ * @GST_RTSP_TIME_END: end
+ * @GST_RTSP_TIME_FRAMES: frames and subframes
+ * @GST_RTSP_TIME_UTC: UTC time
+ *
+ * Possible time types.
+ */
+typedef enum {
+ GST_RTSP_TIME_SECONDS,
+ GST_RTSP_TIME_NOW,
+ GST_RTSP_TIME_END,
+ GST_RTSP_TIME_FRAMES,
+ GST_RTSP_TIME_UTC
+} GstRTSPTimeType;
+
+/**
+ * GstRTSPTime:
+ * @type: the time of the time
+ * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS,
+ * GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES
+ *
+ * A time indication.
+ */
+struct _GstRTSPTime {
+ GstRTSPTimeType type;
+ gdouble seconds;
+};
+
+/**
+ * GstRTSPTime2:
+ * @frames: frames and subframes when type in GstRTSPTime is
+ * GST_RTSP_TIME_FRAMES
+ * @year: year when type is GST_RTSP_TIME_UTC
+ * @month: month when type is GST_RTSP_TIME_UTC
+ * @day: day when type is GST_RTSP_TIME_UTC
+ *
+ * Extra fields for a time indication.
+ *
+ * Since: 1.2
+ */
+struct _GstRTSPTime2 {
+ gdouble frames;
+ guint year;
+ guint month;
+ guint day;
+};
+
+/**
+ * GstRTSPTimeRange:
+ * @unit: the time units used
+ * @min: the minimum interval
+ * @max: the maximum interval
+ * @min2: extra fields in the minimum interval (Since: 1.2)
+ * @max2: extra fields in the maximum interval (Since: 1.2)
+ *
+ * A time range.
+ */
+struct _GstRTSPTimeRange {
+ GstRTSPRangeUnit unit;
+
+ GstRTSPTime min;
+ GstRTSPTime max;
+ GstRTSPTime2 min2;
+ GstRTSPTime2 max2;
+};
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range);
+
+GST_RTSP_API
+gchar * gst_rtsp_range_to_string (const GstRTSPTimeRange *range);
+
+GST_RTSP_API
+void gst_rtsp_range_free (GstRTSPTimeRange *range);
+
+GST_RTSP_API
+gboolean gst_rtsp_range_get_times (const GstRTSPTimeRange *range,
+ GstClockTime *min, GstClockTime *max);
+
+GST_RTSP_API
+gboolean gst_rtsp_range_convert_units (GstRTSPTimeRange * range,
+ GstRTSPRangeUnit unit);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_RANGE_H__ */
diff --git a/include/gst/rtsp/gstrtsptransport.h b/include/gst/rtsp/gstrtsptransport.h
new file mode 100644
index 0000000000..909edecd7a
--- /dev/null
+++ b/include/gst/rtsp/gstrtsptransport.h
@@ -0,0 +1,201 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_TRANSPORT_H__
+#define __GST_RTSP_TRANSPORT_H__
+
+#include <gst/gstconfig.h>
+#include <gst/rtsp/gstrtspdefs.h>
+#include <gst/rtsp/gstrtsp-enumtypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstRTSPTransMode:
+ * @GST_RTSP_TRANS_UNKNOWN: invalid tansport mode
+ * @GST_RTSP_TRANS_RTP: transfer RTP data
+ * @GST_RTSP_TRANS_RDT: transfer RDT (RealMedia) data
+ *
+ * The transfer mode to use.
+ */
+typedef enum {
+ GST_RTSP_TRANS_UNKNOWN = 0,
+ GST_RTSP_TRANS_RTP = (1 << 0),
+ GST_RTSP_TRANS_RDT = (1 << 1)
+} GstRTSPTransMode;
+
+/**
+ * GstRTSPProfile:
+ * @GST_RTSP_PROFILE_UNKNOWN: invalid profile
+ * @GST_RTSP_PROFILE_AVP: the Audio/Visual profile (RFC 3551)
+ * @GST_RTSP_PROFILE_SAVP: the secure Audio/Visual profile (RFC 3711)
+ * @GST_RTSP_PROFILE_AVPF: the Audio/Visual profile with feedback (RFC 4585)
+ * @GST_RTSP_PROFILE_SAVPF: the secure Audio/Visual profile with feedback (RFC 5124)
+ *
+ * The transfer profile to use.
+ */
+/* FIXME 2.0: This should probably be an enum, not flags and maybe be replaced
+ * by GstRTPTransport */
+typedef enum {
+ GST_RTSP_PROFILE_UNKNOWN = 0,
+ GST_RTSP_PROFILE_AVP = (1 << 0),
+ GST_RTSP_PROFILE_SAVP = (1 << 1),
+ GST_RTSP_PROFILE_AVPF = (1 << 2),
+ GST_RTSP_PROFILE_SAVPF = (1 << 3),
+} GstRTSPProfile;
+
+/**
+ * GstRTSPLowerTrans:
+ * @GST_RTSP_LOWER_TRANS_UNKNOWN: invalid transport flag
+ * @GST_RTSP_LOWER_TRANS_UDP: stream data over UDP
+ * @GST_RTSP_LOWER_TRANS_UDP_MCAST: stream data over UDP multicast
+ * @GST_RTSP_LOWER_TRANS_TCP: stream data over TCP
+ * @GST_RTSP_LOWER_TRANS_HTTP: stream data tunneled over HTTP.
+ * @GST_RTSP_LOWER_TRANS_TLS: encrypt TCP and HTTP with TLS
+ *
+ * The different transport methods.
+ */
+typedef enum {
+ GST_RTSP_LOWER_TRANS_UNKNOWN = 0,
+ GST_RTSP_LOWER_TRANS_UDP = (1 << 0),
+ GST_RTSP_LOWER_TRANS_UDP_MCAST = (1 << 1),
+ GST_RTSP_LOWER_TRANS_TCP = (1 << 2),
+ GST_RTSP_LOWER_TRANS_HTTP = (1 << 4),
+ GST_RTSP_LOWER_TRANS_TLS = (1 << 5)
+} GstRTSPLowerTrans;
+
+typedef struct _GstRTSPRange GstRTSPRange;
+typedef struct _GstRTSPTransport GstRTSPTransport;
+
+/**
+ * GstRTSPRange:
+ * @min: minimum value of the range
+ * @max: maximum value of the range
+ *
+ * A type to specify a range.
+ */
+
+struct _GstRTSPRange {
+ gint min;
+ gint max;
+};
+
+/**
+ * GstRTSPTransport:
+ * @trans: the transport mode
+ * @profile: the tansport profile
+ * @lower_transport: the lower transport
+ * @destination: the destination ip/hostname
+ * @source: the source ip/hostname
+ * @layers: the number of layers
+ * @mode_play: if play mode was selected
+ * @mode_record: if record mode was selected
+ * @append: is append mode was selected
+ * @interleaved: the interleave range
+ * @ttl: the time to live for multicast UDP
+ * @port: the port pair for multicast sessions
+ * @client_port: the client port pair for receiving data. For TCP
+ * based transports, applications can use this field to store the
+ * sender and receiver ports of the client.
+ * @server_port: the server port pair for receiving data. For TCP
+ * based transports, applications can use this field to store the
+ * sender and receiver ports of the server.
+ * @ssrc: the ssrc that the sender/receiver will use
+ *
+ * A structure holding the RTSP transport values.
+ */
+
+struct _GstRTSPTransport {
+ GstRTSPTransMode trans;
+ GstRTSPProfile profile;
+ GstRTSPLowerTrans lower_transport;
+
+ gchar *destination;
+ gchar *source;
+ guint layers;
+ gboolean mode_play;
+ gboolean mode_record;
+ gboolean append;
+ GstRTSPRange interleaved;
+
+ /* multicast specific */
+ guint ttl;
+ GstRTSPRange port;
+
+ /* UDP/TCP specific */
+ GstRTSPRange client_port;
+ GstRTSPRange server_port;
+ /* RTP specific */
+ guint ssrc;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_new (GstRTSPTransport **transport);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_init (GstRTSPTransport *transport);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_parse (const gchar *str, GstRTSPTransport *transport);
+
+GST_RTSP_API
+gchar* gst_rtsp_transport_as_text (GstRTSPTransport *transport);
+
+GST_RTSP_DEPRECATED_FOR(gst_rtsp_transport_get_media_type)
+GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_get_media_type (GstRTSPTransport *transport,
+ const gchar **media_type);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_TRANSPORT_H__ */
diff --git a/include/gst/rtsp/gstrtspurl.h b/include/gst/rtsp/gstrtspurl.h
new file mode 100644
index 0000000000..8e95a1567f
--- /dev/null
+++ b/include/gst/rtsp/gstrtspurl.h
@@ -0,0 +1,121 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_RTSP_URL_H__
+#define __GST_RTSP_URL_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gst/rtsp/gstrtspdefs.h>
+#include <gst/rtsp/gstrtsptransport.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_RTSP_DEFAULT_PORT:
+ *
+ * The default RTSP port to connect to.
+ */
+#define GST_RTSP_DEFAULT_PORT 554
+
+#define GST_TYPE_RTSP_URL (gst_rtsp_url_get_type())
+
+typedef struct _GstRTSPUrl GstRTSPUrl;
+
+/**
+ * GstRTSPUrl:
+ * @transports: the transports allowed
+ * @family: the family
+ * @user: the user
+ * @passwd: the password
+ * @host: the host
+ * @port: the port
+ * @abspath: the absolute path
+ * @query: additional query parameters
+ *
+ * This structure contains the result of a parsed RTSP URL
+ */
+struct _GstRTSPUrl {
+ GstRTSPLowerTrans transports;
+ GstRTSPFamily family;
+ gchar *user;
+ gchar *passwd;
+ gchar *host;
+ guint16 port;
+ gchar *abspath;
+ gchar *query;
+};
+
+GST_RTSP_API
+GType gst_rtsp_url_get_type (void);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_url_parse (const gchar *urlstr, GstRTSPUrl **url);
+
+GST_RTSP_API
+GstRTSPUrl* gst_rtsp_url_copy (const GstRTSPUrl *url);
+
+GST_RTSP_API
+void gst_rtsp_url_free (GstRTSPUrl *url);
+
+GST_RTSP_API
+gchar* gst_rtsp_url_get_request_uri (const GstRTSPUrl *url);
+
+GST_RTSP_API
+gchar * gst_rtsp_url_get_request_uri_with_control (const GstRTSPUrl * url,
+ const gchar * control_path);
+
+GST_RTSP_API
+gchar** gst_rtsp_url_decode_path_components
+ (const GstRTSPUrl *url);
+GST_RTSP_API
+GstRTSPResult gst_rtsp_url_set_port (GstRTSPUrl *url, guint16 port);
+
+GST_RTSP_API
+GstRTSPResult gst_rtsp_url_get_port (const GstRTSPUrl *url, guint16 *port);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPUrl, gst_rtsp_url_free)
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_URL_H__ */
diff --git a/include/gst/rtsp/rtsp-prelude.h b/include/gst/rtsp/rtsp-prelude.h
new file mode 100644
index 0000000000..1086091179
--- /dev/null
+++ b/include/gst/rtsp/rtsp-prelude.h
@@ -0,0 +1,41 @@
+/* GStreamer Rtsp Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * rtsp-prelude.h: prelude include header for gst-rtsp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP_PRELUDE_H__
+#define __GST_RTSP_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_RTSP
+#define GST_RTSP_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_RTSP_API GST_API_IMPORT
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_RTSP_DEPRECATED GST_RTSP_API
+#define GST_RTSP_DEPRECATED_FOR(f) GST_RTSP_API
+#else
+#define GST_RTSP_DEPRECATED G_DEPRECATED GST_RTSP_API
+#define GST_RTSP_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_RTSP_API
+#endif
+
+#endif /* __GST_RTSP_PRELUDE_H__ */
diff --git a/include/gst/rtsp/rtsp.h b/include/gst/rtsp/rtsp.h
new file mode 100644
index 0000000000..a44b650b09
--- /dev/null
+++ b/include/gst/rtsp/rtsp.h
@@ -0,0 +1,37 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstrtsp.h: single include header for gst-rtsp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTSP__H__
+#define __GST_RTSP__H__
+
+#include <gst/rtsp/rtsp-prelude.h>
+
+#include <gst/rtsp/gstrtsp.h>
+#include <gst/rtsp/gstrtspconnection.h>
+#include <gst/rtsp/gstrtspdefs.h>
+#include <gst/rtsp/gstrtsp-enumtypes.h>
+#include <gst/rtsp/gstrtspextension.h>
+#include <gst/rtsp/gstrtspmessage.h>
+#include <gst/rtsp/gstrtsprange.h>
+#include <gst/rtsp/gstrtsptransport.h>
+#include <gst/rtsp/gstrtspurl.h>
+
+#endif /* __GST_RTSP__H__ */
diff --git a/include/gst/sctp/sctp-prelude.h b/include/gst/sctp/sctp-prelude.h
new file mode 100644
index 0000000000..ac16e9d7fe
--- /dev/null
+++ b/include/gst/sctp/sctp-prelude.h
@@ -0,0 +1,35 @@
+/* GStreamer SCTP Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * sctp-prelude.h: prelude include header for gst-audiobad library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_SCTP_PRELUDE_H__
+#define __GST_SCTP_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_SCTP_API
+# ifdef BUILDING_GST_SCTP
+# define GST_SCTP_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_SCTP_API GST_API_IMPORT
+# endif
+#endif
+
+#endif /* __GST_SCTP_PRELUDE_H__ */
diff --git a/include/gst/sctp/sctpreceivemeta.h b/include/gst/sctp/sctpreceivemeta.h
new file mode 100644
index 0000000000..5a508370c2
--- /dev/null
+++ b/include/gst/sctp/sctpreceivemeta.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, Collabora Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef __GST_SCTP_RECEIVE_META_H__
+#define __GST_SCTP_RECEIVE_META_H__
+
+#include <gst/gst.h>
+#include <gst/sctp/sctp-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_SCTP_RECEIVE_META_API_TYPE (gst_sctp_receive_meta_api_get_type())
+#define GST_SCTP_RECEIVE_META_INFO (gst_sctp_receive_meta_get_info())
+typedef struct _GstSctpReceiveMeta GstSctpReceiveMeta;
+
+struct _GstSctpReceiveMeta
+{
+ GstMeta meta;
+
+ guint32 ppid;
+};
+
+GST_SCTP_API
+GType gst_sctp_receive_meta_api_get_type (void);
+GST_SCTP_API
+const GstMetaInfo *gst_sctp_receive_meta_get_info (void);
+GST_SCTP_API
+GstSctpReceiveMeta *gst_sctp_buffer_add_receive_meta (GstBuffer * buffer,
+ guint32 ppid);
+
+#define gst_sctp_buffer_get_receive_meta(b) ((GstSctpReceiveMeta *)gst_buffer_get_meta((b), GST_SCTP_RECEIVE_META_API_TYPE))
+
+G_END_DECLS
+
+#endif /* __GST_SCTP_RECEIVE_META_H__ */
diff --git a/include/gst/sctp/sctpsendmeta.h b/include/gst/sctp/sctpsendmeta.h
new file mode 100644
index 0000000000..b1860e52f2
--- /dev/null
+++ b/include/gst/sctp/sctpsendmeta.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Collabora Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef __GST_SCTP_SEND_META_H__
+#define __GST_SCTP_SEND_META_H__
+
+#include <gst/gst.h>
+#include <gst/sctp/sctp-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ GST_SCTP_SEND_META_PARTIAL_RELIABILITY_NONE,
+ GST_SCTP_SEND_META_PARTIAL_RELIABILITY_TTL,
+ GST_SCTP_SEND_META_PARTIAL_RELIABILITY_BUF,
+ GST_SCTP_SEND_META_PARTIAL_RELIABILITY_RTX
+} GstSctpSendMetaPartiallyReliability;
+
+#define GST_SCTP_SEND_META_API_TYPE (gst_sctp_send_meta_api_get_type())
+#define GST_SCTP_SEND_META_INFO (gst_sctp_send_meta_get_info())
+typedef struct _GstSctpSendMeta GstSctpSendMeta;
+
+struct _GstSctpSendMeta
+{
+ GstMeta meta;
+
+ guint32 ppid;
+ gboolean ordered;
+ GstSctpSendMetaPartiallyReliability pr;
+ guint32 pr_param;
+};
+
+GST_SCTP_API
+GType gst_sctp_send_meta_api_get_type (void);
+GST_SCTP_API
+const GstMetaInfo *gst_sctp_send_meta_get_info (void);
+GST_SCTP_API
+GstSctpSendMeta *gst_sctp_buffer_add_send_meta (GstBuffer * buffer,
+ guint32 ppid, gboolean ordered, GstSctpSendMetaPartiallyReliability pr,
+ guint32 pr_param);
+
+#define gst_sctp_buffer_get_send_meta(b) ((GstSctpSendMeta *)gst_buffer_get_meta((b), GST_SCTP_SEND_META_API_TYPE))
+
+G_END_DECLS
+
+#endif /* __GST_SCTP_SEND_META_H__ */
diff --git a/include/gst/sdp/gstmikey.h b/include/gst/sdp/gstmikey.h
new file mode 100644
index 0000000000..900bbbf2f8
--- /dev/null
+++ b/include/gst/sdp/gstmikey.h
@@ -0,0 +1,749 @@
+/* GStreamer
+ * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * gstmikey.h: various helper functions to manipulate mikey messages
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_MIKEY_H__
+#define __GST_MIKEY_H__
+
+#include <gst/gst.h>
+#include <gst/sdp/sdp-prelude.h>
+
+G_BEGIN_DECLS
+
+GST_SDP_API
+GType gst_mikey_message_get_type(void);
+#define GST_TYPE_MIKEY_MESSAGE (gst_mikey_message_get_type())
+
+typedef struct _GstMIKEYMessage GstMIKEYMessage;
+typedef struct _GstMIKEYEncryptInfo GstMIKEYEncryptInfo;
+typedef struct _GstMIKEYDecryptInfo GstMIKEYDecryptInfo;
+
+/**
+ * GST_MIKEY_VERSION:
+ *
+ * The supported MIKEY version 1.
+ */
+#define GST_MIKEY_VERSION 1
+
+/**
+ * GstMIKEYType:
+ * @GST_MIKEY_TYPE_INVALID: Invalid type
+ * @GST_MIKEY_TYPE_PSK_INIT: Initiator's pre-shared key message
+ * @GST_MIKEY_TYPE_PSK_VERIFY: Verification message of a Pre-shared key message
+ * @GST_MIKEY_TYPE_PK_INIT: Initiator's public-key transport message
+ * @GST_MIKEY_TYPE_PK_VERIFY: Verification message of a public-key message
+ * @GST_MIKEY_TYPE_DH_INIT: Initiator's DH exchange message
+ * @GST_MIKEY_TYPE_DH_RESP: Responder's DH exchange message
+ * @GST_MIKEY_TYPE_ERROR: Error message
+ *
+ * Different MIKEY data types.
+ */
+typedef enum
+{
+ GST_MIKEY_TYPE_INVALID = -1,
+ GST_MIKEY_TYPE_PSK_INIT = 0,
+ GST_MIKEY_TYPE_PSK_VERIFY = 1,
+ GST_MIKEY_TYPE_PK_INIT = 2,
+ GST_MIKEY_TYPE_PK_VERIFY = 3,
+ GST_MIKEY_TYPE_DH_INIT = 4,
+ GST_MIKEY_TYPE_DH_RESP = 5,
+ GST_MIKEY_TYPE_ERROR = 6
+} GstMIKEYType;
+
+/**
+ * GstMIKEYPayloadType:
+ * @GST_MIKEY_PT_LAST: Last payload
+ * @GST_MIKEY_PT_KEMAC: Key data transport payload
+ * @GST_MIKEY_PT_PKE: Envelope data payload
+ * @GST_MIKEY_PT_DH: DH data payload
+ * @GST_MIKEY_PT_SIGN: Signature payload
+ * @GST_MIKEY_PT_T: Timestamp payload
+ * @GST_MIKEY_PT_ID: ID payload
+ * @GST_MIKEY_PT_CERT: Certificate Payload
+ * @GST_MIKEY_PT_CHASH: Cert hash payload
+ * @GST_MIKEY_PT_V: Verification message payload
+ * @GST_MIKEY_PT_SP: Security Policy payload
+ * @GST_MIKEY_PT_RAND: RAND payload
+ * @GST_MIKEY_PT_ERR: Error payload
+ * @GST_MIKEY_PT_KEY_DATA: Key data sub-payload
+ * @GST_MIKEY_PT_GEN_EXT: General Extension Payload
+
+ * Different MIKEY Payload types.
+ */
+typedef enum
+{
+ GST_MIKEY_PT_LAST = 0,
+ GST_MIKEY_PT_KEMAC = 1,
+ GST_MIKEY_PT_PKE = 2,
+ GST_MIKEY_PT_DH = 3,
+ GST_MIKEY_PT_SIGN = 4,
+ GST_MIKEY_PT_T = 5,
+ GST_MIKEY_PT_ID = 6,
+ GST_MIKEY_PT_CERT = 7,
+ GST_MIKEY_PT_CHASH = 8,
+ GST_MIKEY_PT_V = 9,
+ GST_MIKEY_PT_SP = 10,
+ GST_MIKEY_PT_RAND = 11,
+ GST_MIKEY_PT_ERR = 12,
+ GST_MIKEY_PT_KEY_DATA = 20,
+ GST_MIKEY_PT_GEN_EXT = 21
+} GstMIKEYPayloadType;
+
+/**
+ * GstMIKEYPRFFunc:
+ * @GST_MIKEY_PRF_MIKEY_1: MIKEY-1 PRF function
+ *
+ * The PRF function that has been/will be used for key derivation
+ */
+typedef enum
+{
+ GST_MIKEY_PRF_MIKEY_1 = 0
+} GstMIKEYPRFFunc;
+
+/**
+ * GstMIKEYMapType:
+ * @GST_MIKEY_MAP_TYPE_SRTP: SRTP
+ *
+ * Specifies the method of uniquely mapping Crypto Sessions to the security
+ * protocol sessions.
+ */
+typedef enum
+{
+ GST_MIKEY_MAP_TYPE_SRTP = 0
+} GstMIKEYMapType;
+
+/**
+ * GstMIKEYMapSRTP:
+ * @policy: The security policy applied for the stream with @ssrc
+ * @ssrc: the SSRC that must be used for the stream
+ * @roc: current rollover counter
+ *
+ * The Security policy Map item for SRTP
+ */
+typedef struct {
+ guint8 policy;
+ guint32 ssrc;
+ guint32 roc;
+} GstMIKEYMapSRTP;
+
+typedef struct _GstMIKEYPayload GstMIKEYPayload;
+
+GST_SDP_API
+GType gst_mikey_payload_get_type(void);
+#define GST_TYPE_MIKEY_PAYLOAD (gst_mikey_payload_get_type())
+
+/**
+ * GstMIKEYPayload:
+ * @type: the payload type
+ * @len: length of the payload
+ *
+ * Hold the common fields for all payloads
+ */
+struct _GstMIKEYPayload {
+ /* < private > */
+ GstMiniObject mini_object;
+
+ /* < public > */
+ GstMIKEYPayloadType type;
+ guint len;
+};
+
+GST_SDP_API
+GstMIKEYPayload * gst_mikey_payload_new (GstMIKEYPayloadType type);
+
+/**
+ * gst_mikey_payload_ref:
+ * @payload: The payload to refcount
+ *
+ * Increase the refcount of this payload.
+ *
+ * Returns: (transfer full): @payload (for convenience when doing assignments)
+ *
+ * Since: 1.4
+ */
+static inline GstMIKEYPayload *
+gst_mikey_payload_ref (GstMIKEYPayload * payload)
+{
+ return (GstMIKEYPayload *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (payload));
+}
+
+/**
+ * gst_mikey_payload_unref:
+ * @payload: (transfer full): the payload to refcount
+ *
+ * Decrease the refcount of an payload, freeing it if the refcount reaches 0.
+ *
+ * Since: 1.4
+ */
+static inline void
+gst_mikey_payload_unref (GstMIKEYPayload * payload)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (payload));
+}
+
+/**
+ * gst_mikey_payload_copy:
+ * @payload: a #GstMIKEYPayload.
+ *
+ * Create a copy of the given payload.
+ *
+ * Returns: (transfer full): a new copy of @payload.
+ *
+ * Since: 1.4
+ */
+static inline GstMIKEYPayload *
+gst_mikey_payload_copy (const GstMIKEYPayload * payload)
+{
+ return (GstMIKEYPayload *) gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (payload));
+}
+
+/**
+ * GstMIKEYEncAlg:
+ * @GST_MIKEY_ENC_NULL: no encryption
+ * @GST_MIKEY_ENC_AES_CM_128: AES-CM using a 128-bit key
+ * @GST_MIKEY_ENC_AES_KW_128: AES Key Wrap using a 128-bit key
+ * @GST_MIKEY_ENC_AES_GCM_128: AES-GCM using a 128-bit key (Since: 1.16)
+ *
+ * The encryption algorithm used to encrypt the Encr data field
+ */
+typedef enum
+{
+ GST_MIKEY_ENC_NULL = 0,
+ GST_MIKEY_ENC_AES_CM_128 = 1,
+ GST_MIKEY_ENC_AES_KW_128 = 2,
+ GST_MIKEY_ENC_AES_GCM_128 = 6
+} GstMIKEYEncAlg;
+
+/**
+ * GstMIKEYMacAlg:
+ * @GST_MIKEY_MAC_NULL: no authentication
+ * @GST_MIKEY_MAC_HMAC_SHA_1_160: HMAC-SHA-1-160
+ *
+ * Specifies the authentication algorithm used
+ */
+typedef enum
+{
+ GST_MIKEY_MAC_NULL = 0,
+ GST_MIKEY_MAC_HMAC_SHA_1_160 = 1
+} GstMIKEYMacAlg;
+
+/**
+ * GstMIKEYPayloadKEMAC:
+ * @pt: the common #GstMIKEYPayload
+ * @enc_alg: the #GstMIKEYEncAlg
+ * @mac_alg: the #GstMIKEYMacAlg
+ * @subpayloads: the subpayloads
+ *
+ * A structure holding the KEMAC payload
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ GstMIKEYEncAlg enc_alg;
+ GstMIKEYMacAlg mac_alg;
+ GArray *subpayloads;
+} GstMIKEYPayloadKEMAC;
+
+GST_SDP_API
+gboolean gst_mikey_payload_kemac_set (GstMIKEYPayload *payload,
+ GstMIKEYEncAlg enc_alg,
+ GstMIKEYMacAlg mac_alg);
+
+GST_SDP_API
+guint gst_mikey_payload_kemac_get_n_sub (const GstMIKEYPayload *payload);
+
+GST_SDP_API
+const GstMIKEYPayload * gst_mikey_payload_kemac_get_sub (const GstMIKEYPayload *payload, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_payload_kemac_remove_sub (GstMIKEYPayload *payload, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_payload_kemac_add_sub (GstMIKEYPayload *payload,
+ GstMIKEYPayload *newpay);
+
+/**
+ * GstMIKEYCacheType:
+ * @GST_MIKEY_CACHE_NONE: The envelope key MUST NOT be cached
+ * @GST_MIKEY_CACHE_ALWAYS: The envelope key MUST be cached
+ * @GST_MIKEY_CACHE_FOR_CSB: The envelope key MUST be cached, but only
+ * to be used for the specific CSB.
+ *
+ * The different cache types
+ */
+typedef enum
+{
+ GST_MIKEY_CACHE_NONE = 0,
+ GST_MIKEY_CACHE_ALWAYS = 1,
+ GST_MIKEY_CACHE_FOR_CSB = 2
+} GstMIKEYCacheType;
+
+/**
+ * GstMIKEYPayloadPKE:
+ * @pt: the common #GstMIKEYPayload
+ * @C: envelope key cache indicator
+ * @data_len: length of @data
+ * @data: the encrypted envelope key
+ *
+ * The Envelope data payload contains the encrypted envelope key that is
+ * used in the public-key transport to protect the data in the Key data
+ * transport payload. The encryption algorithm used is implicit from
+ * the certificate/public key used.
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ GstMIKEYCacheType C;
+ guint16 data_len;
+ guint8 *data;
+} GstMIKEYPayloadPKE;
+
+GST_SDP_API
+gboolean gst_mikey_payload_pke_set (GstMIKEYPayload *payload,
+ GstMIKEYCacheType C,
+ guint16 data_len, const guint8 *data);
+
+
+/**
+ * GstMIKEYTSType:
+ * @GST_MIKEY_TS_TYPE_NTP_UTC: an NTP time in UTC timezone
+ * @GST_MIKEY_TS_TYPE_NTP: an NTP time
+ * @GST_MIKEY_TS_TYPE_COUNTER: a counter
+ *
+ * Specifies the timestamp type.
+ */
+typedef enum
+{
+ GST_MIKEY_TS_TYPE_NTP_UTC = 0,
+ GST_MIKEY_TS_TYPE_NTP = 1,
+ GST_MIKEY_TS_TYPE_COUNTER = 2
+} GstMIKEYTSType;
+
+/**
+ * GstMIKEYPayloadT:
+ * @pt: the payload header
+ * @type: a #GstMIKEYTSType
+ * @ts_value: the timestamp value
+ *
+ * The timestamp payload carries the timestamp information
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ GstMIKEYTSType type;
+ guint8 *ts_value;
+} GstMIKEYPayloadT;
+
+GST_SDP_API
+gboolean gst_mikey_payload_t_set (GstMIKEYPayload *payload,
+ GstMIKEYTSType type, const guint8 *ts_value);
+
+/**
+ * GstMIKEYPayloadSPParam:
+ * @type: specifies the type of the parameter
+ * @len: specifies the length of @val
+ * @val: specifies the value of the parameter
+ *
+ * A Type/Length/Value field for security parameters
+ */
+typedef struct {
+ guint8 type;
+ guint8 len;
+ guint8 *val;
+} GstMIKEYPayloadSPParam;
+
+/**
+ * GstMIKEYSecProto:
+ * @GST_MIKEY_SEC_PROTO_SRTP: SRTP
+ *
+ * Specifies the security protocol
+ */
+typedef enum
+{
+ GST_MIKEY_SEC_PROTO_SRTP = 0
+} GstMIKEYSecProto;
+
+/**
+ * GstMIKEYSecSRTP:
+ * @GST_MIKEY_SP_SRTP_ENC_ALG: Encryption algorithm
+ * @GST_MIKEY_SP_SRTP_ENC_KEY_LEN: Session Encr. key length
+ * @GST_MIKEY_SP_SRTP_AUTH_ALG: Authentication algorithm
+ * @GST_MIKEY_SP_SRTP_AUTH_KEY_LEN: Session Auth. key length
+ * @GST_MIKEY_SP_SRTP_SALT_KEY_LEN: Session Salt key length
+ * @GST_MIKEY_SP_SRTP_PRF: SRTP Pseudo Random Function
+ * @GST_MIKEY_SP_SRTP_KEY_DERIV_RATE: Key derivation rate
+ * @GST_MIKEY_SP_SRTP_SRTP_ENC: SRTP encryption off/on, 0 if off, 1 if on
+ * @GST_MIKEY_SP_SRTP_SRTCP_ENC: SRTCP encryption off/on, 0 if off, 1 if on
+ * @GST_MIKEY_SP_SRTP_FEC_ORDER: sender's FEC order
+ * @GST_MIKEY_SP_SRTP_SRTP_AUTH: SRTP authentication off/on, 0 if off, 1 if on
+ * @GST_MIKEY_SP_SRTP_AUTH_TAG_LEN: Authentication tag length
+ * @GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN: SRTP prefix length
+ * @GST_MIKEY_SP_SRTP_AEAD_AUTH_TAG_LEN: AEAD authentication tag length (Since: 1.16)
+ *
+ * This policy specifies the parameters for SRTP and SRTCP
+ */
+typedef enum
+{
+ GST_MIKEY_SP_SRTP_ENC_ALG = 0,
+ GST_MIKEY_SP_SRTP_ENC_KEY_LEN = 1,
+ GST_MIKEY_SP_SRTP_AUTH_ALG = 2,
+ GST_MIKEY_SP_SRTP_AUTH_KEY_LEN = 3,
+ GST_MIKEY_SP_SRTP_SALT_KEY_LEN = 4,
+ GST_MIKEY_SP_SRTP_PRF = 5,
+ GST_MIKEY_SP_SRTP_KEY_DERIV_RATE = 6,
+ GST_MIKEY_SP_SRTP_SRTP_ENC = 7,
+ GST_MIKEY_SP_SRTP_SRTCP_ENC = 8,
+ GST_MIKEY_SP_SRTP_FEC_ORDER = 9,
+ GST_MIKEY_SP_SRTP_SRTP_AUTH = 10,
+ GST_MIKEY_SP_SRTP_AUTH_TAG_LEN = 11,
+ GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN = 12,
+ GST_MIKEY_SP_SRTP_AEAD_AUTH_TAG_LEN = 20
+} GstMIKEYSecSRTP;
+
+/**
+ * GstMIKEYPayloadSP:
+ * @pt: the payload header
+ * @policy: the policy number
+ * @proto: the security protocol
+ * @params: array of #GstMIKEYPayloadSPParam
+ *
+ * The Security Policy payload defines a set of policies that apply to a
+ * specific security protocol
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ guint policy;
+ GstMIKEYSecProto proto;
+ GArray *params;
+} GstMIKEYPayloadSP;
+
+GST_SDP_API
+gboolean gst_mikey_payload_sp_set (GstMIKEYPayload *payload,
+ guint policy, GstMIKEYSecProto proto);
+GST_SDP_API
+guint gst_mikey_payload_sp_get_n_params (const GstMIKEYPayload *payload);
+
+GST_SDP_API
+const GstMIKEYPayloadSPParam *
+ gst_mikey_payload_sp_get_param (const GstMIKEYPayload *payload, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_payload_sp_remove_param (GstMIKEYPayload *payload, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_payload_sp_add_param (GstMIKEYPayload *payload,
+ guint8 type, guint8 len, const guint8 *val);
+
+/**
+ * GstMIKEYPayloadRAND:
+ * @pt: the payload header
+ * @len: the length of @rand
+ * @rand: random values
+ *
+ * The RAND payload consists of a (pseudo-)random bit-string
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ guint8 len;
+ guint8 *rand;
+} GstMIKEYPayloadRAND;
+
+GST_SDP_API
+gboolean gst_mikey_payload_rand_set (GstMIKEYPayload *payload,
+ guint8 len, const guint8 *rand);
+
+/**
+ * GstMIKEYKeyDataType:
+ * @GST_MIKEY_KD_TGK: a TEK Generation Key
+ * @GST_MIKEY_KD_TEK: Traffic-Encrypting Key
+ *
+ * The type of key.
+ */
+typedef enum
+{
+ GST_MIKEY_KD_TGK = 0,
+ GST_MIKEY_KD_TEK = 2,
+} GstMIKEYKeyDataType;
+
+/**
+ * GstMIKEYKVType:
+ * @GST_MIKEY_KV_NULL: No specific usage rule
+ * @GST_MIKEY_KV_SPI: The key is associated with the SPI/MKI
+ * @GST_MIKEY_KV_INTERVAL: The key has a start and expiration time
+ *
+ * The key validity type
+ */
+typedef enum
+{
+ GST_MIKEY_KV_NULL = 0,
+ GST_MIKEY_KV_SPI = 1,
+ GST_MIKEY_KV_INTERVAL = 2,
+} GstMIKEYKVType;
+
+/**
+ * GstMIKEYPayloadKeyData:
+ * @pt: the payload header
+ * @key_type: the #GstMIKEYKeyDataType of @key_data
+ * @key_len: length of @key_data
+ * @key_data: the key data
+ * @salt_len: the length of @salt_data, can be 0
+ * @salt_data: salt data
+ * @kv_type: the Key Validity type
+ * @kv_len: length of @kv_data
+ * @kv_data: key validity data
+ *
+ * The Key data payload contains key material. It should be added as sub
+ * payload to the KEMAC.
+ */
+typedef struct {
+ GstMIKEYPayload pt;
+
+ GstMIKEYKeyDataType key_type;
+ guint16 key_len;
+ guint8 *key_data;
+ guint16 salt_len;
+ guint8 *salt_data;
+ GstMIKEYKVType kv_type;
+ guint8 kv_len[2];
+ guint8 *kv_data[2];
+} GstMIKEYPayloadKeyData;
+
+GST_SDP_API
+gboolean gst_mikey_payload_key_data_set_key (GstMIKEYPayload *payload,
+ GstMIKEYKeyDataType key_type,
+ guint16 key_len, const guint8 *key_data);
+
+GST_SDP_API
+gboolean gst_mikey_payload_key_data_set_salt (GstMIKEYPayload *payload,
+ guint16 salt_len, const guint8 *salt_data);
+
+GST_SDP_API
+gboolean gst_mikey_payload_key_data_set_spi (GstMIKEYPayload *payload,
+ guint8 spi_len, const guint8 *spi_data);
+
+GST_SDP_API
+gboolean gst_mikey_payload_key_data_set_interval (GstMIKEYPayload *payload,
+ guint8 vf_len, const guint8 *vf_data,
+ guint8 vt_len, const guint8 *vt_data);
+
+/**
+ * GstMIKEYMessage:
+ * @version: the version
+ * @type: the #GstMIKEYType message type
+ * @V: verify flag
+ * @prf_func: a #GstMIKEYPRFFunc
+ * @CSB_id: Identifies the Crypto Session Bundle
+ * @map_type: a #GstMIKEYMapType
+ * @map_info: map info array of type depending on @map_type
+ * @payloads: the payload array of #GstMIKEYPayload
+ *
+ * Structure holding the information of the MIKEY message
+ */
+struct _GstMIKEYMessage
+{
+ /* < private > */
+ GstMiniObject mini_object;
+
+ /* < public > */
+ guint8 version;
+ GstMIKEYType type;
+ gboolean V;
+ GstMIKEYPRFFunc prf_func;
+ guint32 CSB_id;
+ GstMIKEYMapType map_type;
+ GArray *map_info;
+ GArray *payloads;
+};
+
+
+GST_SDP_API
+GstMIKEYMessage * gst_mikey_message_new (void);
+
+GST_SDP_API
+GstMIKEYMessage * gst_mikey_message_new_from_data (gconstpointer data, gsize size,
+ GstMIKEYDecryptInfo *info, GError **error);
+
+GST_SDP_API
+GstMIKEYMessage * gst_mikey_message_new_from_bytes (GBytes *bytes, GstMIKEYDecryptInfo *info,
+ GError **error);
+
+GST_SDP_API
+GBytes * gst_mikey_message_to_bytes (GstMIKEYMessage *msg, GstMIKEYEncryptInfo *info,
+ GError **error);
+
+GST_SDP_API
+GstMIKEYMessage * gst_mikey_message_new_from_caps (GstCaps *caps);
+
+GST_SDP_API
+gboolean gst_mikey_message_to_caps (const GstMIKEYMessage *msg, GstCaps *caps);
+
+GST_SDP_API
+gchar * gst_mikey_message_base64_encode (GstMIKEYMessage* msg);
+
+/**
+ * gst_mikey_message_ref:
+ * @message: The message to refcount
+ *
+ * Increase the refcount of this message.
+ *
+ * Returns: (transfer full): @message (for convenience when doing assignments)
+ *
+ * Since: 1.4
+ */
+static inline GstMIKEYMessage *
+gst_mikey_message_ref (GstMIKEYMessage * message)
+{
+ return (GstMIKEYMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (message));
+}
+
+/**
+ * gst_mikey_message_unref:
+ * @message: (transfer full): the message to refcount
+ *
+ * Decrease the refcount of an message, freeing it if the refcount reaches 0.
+ *
+ * Since: 1.4
+ */
+static inline void
+gst_mikey_message_unref (GstMIKEYMessage * message)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (message));
+}
+
+/**
+ * gst_mikey_message_copy:
+ * @message: a #GstMIKEYMessage.
+ *
+ * Create a copy of the given message.
+ *
+ * Returns: (transfer full): a new copy of @message.
+ *
+ * Since: 1.4
+ */
+static inline GstMIKEYMessage *
+gst_mikey_message_copy (const GstMIKEYMessage * message)
+{
+ return (GstMIKEYMessage *) gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (message));
+}
+
+
+GST_SDP_API
+gboolean gst_mikey_message_set_info (GstMIKEYMessage *msg,
+ guint8 version, GstMIKEYType type, gboolean V,
+ GstMIKEYPRFFunc prf_func, guint32 CSB_id,
+ GstMIKEYMapType map_type);
+
+GST_SDP_API
+guint gst_mikey_message_get_n_cs (const GstMIKEYMessage *msg);
+
+/* SRTP crypto sessions */
+
+GST_SDP_API
+const GstMIKEYMapSRTP * gst_mikey_message_get_cs_srtp (const GstMIKEYMessage *msg, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_message_insert_cs_srtp (GstMIKEYMessage *msg, gint idx,
+ const GstMIKEYMapSRTP *map);
+
+GST_SDP_API
+gboolean gst_mikey_message_replace_cs_srtp (GstMIKEYMessage *msg, gint idx,
+ const GstMIKEYMapSRTP *map);
+
+GST_SDP_API
+gboolean gst_mikey_message_remove_cs_srtp (GstMIKEYMessage *msg, gint idx);
+
+GST_SDP_API
+gboolean gst_mikey_message_add_cs_srtp (GstMIKEYMessage *msg,
+ guint8 policy, guint32 ssrc, guint32 roc);
+
+/* adding/retrieving payloads */
+
+GST_SDP_API
+guint gst_mikey_message_get_n_payloads (const GstMIKEYMessage *msg);
+
+GST_SDP_API
+const GstMIKEYPayload * gst_mikey_message_get_payload (const GstMIKEYMessage *msg, guint idx);
+
+GST_SDP_API
+const GstMIKEYPayload * gst_mikey_message_find_payload (const GstMIKEYMessage *msg,
+ GstMIKEYPayloadType type, guint nth);
+
+GST_SDP_API
+gboolean gst_mikey_message_remove_payload (GstMIKEYMessage *msg, guint idx);
+
+GST_SDP_API
+gboolean gst_mikey_message_insert_payload (GstMIKEYMessage *msg, guint idx,
+ GstMIKEYPayload *payload);
+
+GST_SDP_API
+gboolean gst_mikey_message_add_payload (GstMIKEYMessage *msg,
+ GstMIKEYPayload *payload);
+
+GST_SDP_API
+gboolean gst_mikey_message_replace_payload (GstMIKEYMessage *msg, guint idx,
+ GstMIKEYPayload *payload);
+
+
+/* Key data transport payload (KEMAC) */
+/* Envelope data payload (PKE) */
+
+GST_SDP_API
+gboolean gst_mikey_message_add_pke (GstMIKEYMessage *msg,
+ GstMIKEYCacheType C,
+ guint16 data_len, const guint8 *data);
+/* DH data payload (DH) */
+/* Signature payload (SIGN) */
+
+/* Timestamp payload (T) */
+
+GST_SDP_API
+gboolean gst_mikey_message_add_t (GstMIKEYMessage *msg,
+ GstMIKEYTSType type, const guint8 *ts_value);
+
+GST_SDP_API
+gboolean gst_mikey_message_add_t_now_ntp_utc (GstMIKEYMessage *msg);
+/* ID payload (ID) */
+/* Certificate Payload (CERT) */
+/* Cert hash payload (CHASH)*/
+/* Ver msg payload (V) */
+/* Security Policy payload (SP)*/
+/* RAND payload (RAND) */
+
+GST_SDP_API
+gboolean gst_mikey_message_add_rand (GstMIKEYMessage *msg,
+ guint8 len, const guint8 *rand);
+
+GST_SDP_API
+gboolean gst_mikey_message_add_rand_len (GstMIKEYMessage *msg, guint8 len);
+
+/* Error payload (ERR) */
+/* Key data sub-payload */
+/* General Extension Payload */
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMIKEYMessage, gst_mikey_message_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMIKEYPayload, gst_mikey_payload_unref)
+
+G_END_DECLS
+
+#endif /* __GST_MIKEY_H__ */
diff --git a/include/gst/sdp/gstsdp.h b/include/gst/sdp/gstsdp.h
new file mode 100644
index 0000000000..1eb54836d7
--- /dev/null
+++ b/include/gst/sdp/gstsdp.h
@@ -0,0 +1,58 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_SDP_H__
+#define __GST_SDP_H__
+
+/**
+ * GstSDPResult:
+ * @GST_SDP_OK: A successful return value
+ * @GST_SDP_EINVAL: a function was given invalid parameters
+ *
+ * Return values for the SDP functions.
+ */
+typedef enum {
+ GST_SDP_OK = 0,
+ GST_SDP_EINVAL = -1
+} GstSDPResult;
+
+#endif /* __GST_SDP_H__ */
diff --git a/include/gst/sdp/gstsdpmessage.h b/include/gst/sdp/gstsdpmessage.h
new file mode 100644
index 0000000000..378f14938b
--- /dev/null
+++ b/include/gst/sdp/gstsdpmessage.h
@@ -0,0 +1,762 @@
+/* GStreamer
+ * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/*
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __GST_SDP_MESSAGE_H__
+#define __GST_SDP_MESSAGE_H__
+
+#include "gstmikey.h"
+
+#include <glib.h>
+#include <gst/gst.h>
+#include <gst/sdp/sdp.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstSDPOrigin:
+ * @username: the user's login on the originating host, or it is "-"
+ * if the originating host does not support the concept of user ids.
+ * @sess_id: is a numeric string such that the tuple of @username, @sess_id,
+ * @nettype, @addrtype and @addr form a globally unique identifier for the
+ * session.
+ * @sess_version: a version number for this announcement
+ * @nettype: the type of network. "IN" is defined to have the meaning
+ * "Internet".
+ * @addrtype: the type of @addr.
+ * @addr: the globally unique address of the machine from which the session was
+ * created.
+ *
+ * The contents of the SDP "o=" field which gives the originator of the session
+ * (their username and the address of the user's host) plus a session id and
+ * session version number.
+ */
+typedef struct {
+ gchar *username;
+ gchar *sess_id;
+ gchar *sess_version;
+ gchar *nettype;
+ gchar *addrtype;
+ gchar *addr;
+} GstSDPOrigin;
+
+/**
+ * GstSDPConnection:
+ * @nettype: the type of network. "IN" is defined to have the meaning
+ * "Internet".
+ * @addrtype: the type of @address.
+ * @address: the address
+ * @ttl: the time to live of the address
+ * @addr_number: the number of layers
+ *
+ * The contents of the SDP "c=" field which contains connection data.
+ */
+typedef struct {
+ gchar *nettype;
+ gchar *addrtype;
+ gchar *address;
+ guint ttl;
+ guint addr_number;
+} GstSDPConnection;
+
+GST_SDP_API
+GstSDPResult gst_sdp_connection_set (GstSDPConnection *conn,
+ const gchar *nettype,
+ const gchar *addrtype,
+ const gchar *address,
+ guint ttl, guint addr_number);
+
+GST_SDP_API
+GstSDPResult gst_sdp_connection_clear (GstSDPConnection *conn);
+
+
+/**
+ * GST_SDP_BWTYPE_CT:
+ *
+ * The Conference Total bandwidth modifier.
+ */
+#define GST_SDP_BWTYPE_CT "CT"
+/**
+ * GST_SDP_BWTYPE_AS:
+ *
+ * The Application-Specific Maximum bandwidth modifier.
+ */
+#define GST_SDP_BWTYPE_AS "AS"
+/**
+ * GST_SDP_BWTYPE_EXT_PREFIX:
+ *
+ * The extension prefix bandwidth modifier.
+ */
+#define GST_SDP_BWTYPE_EXT_PREFIX "X-"
+
+/**
+ * GST_SDP_BWTYPE_RS:
+ *
+ * RTCP bandwidth allocated to active data senders (RFC 3556).
+ */
+#define GST_SDP_BWTYPE_RS "RS"
+/**
+ * GST_SDP_BWTYPE_RR:
+ *
+ * RTCP bandwidth allocated to data receivers (RFC 3556).
+ */
+#define GST_SDP_BWTYPE_RR "RR"
+/**
+ * GST_SDP_BWTYPE_TIAS:
+ *
+ * Transport Independent Application Specific Maximum bandwidth (RFC 3890).
+ */
+#define GST_SDP_BWTYPE_TIAS "TIAS"
+
+
+/**
+ * GstSDPBandwidth:
+ * @bwtype: the bandwidth modifier type
+ * @bandwidth: the bandwidth in kilobits per second
+ *
+ * The contents of the SDP "b=" field which specifies the proposed bandwidth to
+ * be used by the session or media.
+ */
+typedef struct {
+ gchar *bwtype;
+ guint bandwidth;
+} GstSDPBandwidth;
+
+GST_SDP_API
+GstSDPResult gst_sdp_bandwidth_set (GstSDPBandwidth *bw, const gchar *bwtype,
+ guint bandwidth);
+
+GST_SDP_API
+GstSDPResult gst_sdp_bandwidth_clear (GstSDPBandwidth *bw);
+
+/**
+ * GstSDPTime:
+ * @start: start time for the conference. The value is the decimal
+ * representation of Network Time Protocol (NTP) time values in seconds
+ * @stop: stop time for the conference. The value is the decimal
+ * representation of Network Time Protocol (NTP) time values in seconds
+ * @repeat: repeat times for a session
+ *
+ * The contents of the SDP "t=" field which specify the start and stop times for
+ * a conference session.
+ */
+typedef struct {
+ gchar *start;
+ gchar *stop;
+ GArray *repeat;
+} GstSDPTime;
+
+GST_SDP_API
+GstSDPResult gst_sdp_time_set (GstSDPTime *t, const gchar *start,
+ const gchar *stop, const gchar **repeat);
+
+GST_SDP_API
+GstSDPResult gst_sdp_time_clear (GstSDPTime *t);
+
+/**
+ * GstSDPZone:
+ * @time: the NTP time that a time zone adjustment happens
+ * @typed_time: the offset from the time when the session was first scheduled
+ *
+ * The contents of the SDP "z=" field which allows the sender to
+ * specify a list of time zone adjustments and offsets from the base
+ * time.
+ */
+typedef struct {
+ gchar *time;
+ gchar *typed_time;
+} GstSDPZone;
+
+GST_SDP_API
+GstSDPResult gst_sdp_zone_set (GstSDPZone *zone, const gchar *adj_time,
+ const gchar *typed_time);
+
+GST_SDP_API
+GstSDPResult gst_sdp_zone_clear (GstSDPZone *zone);
+
+
+/**
+ * GstSDPKey:
+ * @type: the encryption type
+ * @data: the encryption data
+ *
+ * The contents of the SDP "k=" field which is used to convey encryption
+ * keys.
+ */
+typedef struct {
+ gchar *type;
+ gchar *data;
+} GstSDPKey;
+
+/**
+ * GstSDPAttribute:
+ * @key: the attribute key
+ * @value: the attribute value or NULL when it was a property attribute
+ *
+ * The contents of the SDP "a=" field which contains a key/value pair.
+ */
+typedef struct {
+ gchar *key;
+ gchar *value;
+} GstSDPAttribute;
+
+GST_SDP_API
+GstSDPResult gst_sdp_attribute_set (GstSDPAttribute *attr, const gchar *key,
+ const gchar *value);
+
+GST_SDP_API
+GstSDPResult gst_sdp_attribute_clear (GstSDPAttribute *attr);
+
+/**
+ * GstSDPMedia:
+ * @media: the media type
+ * @port: the transport port to which the media stream will be sent
+ * @num_ports: the number of ports or -1 if only one port was specified
+ * @proto: the transport protocol
+ * @fmts: an array of #gchar formats
+ * @information: the media title
+ * @connections: array of #GstSDPConnection with media connection information
+ * @bandwidths: array of #GstSDPBandwidth with media bandwidth information
+ * @key: the encryption key
+ * @attributes: array of #GstSDPAttribute with the additional media attributes
+ *
+ * The contents of the SDP "m=" field with all related fields.
+ */
+typedef struct {
+ gchar *media;
+ guint port;
+ guint num_ports;
+ gchar *proto;
+ GArray *fmts;
+ gchar *information;
+ GArray *connections;
+ GArray *bandwidths;
+ GstSDPKey key;
+ GArray *attributes;
+} GstSDPMedia;
+
+/**
+ * GstSDPMessage:
+ * @version: the protocol version
+ * @origin: owner/creator and session identifier
+ * @session_name: session name
+ * @information: session information
+ * @uri: URI of description
+ * @emails: array of #gchar with email addresses
+ * @phones: array of #gchar with phone numbers
+ * @connection: connection information for the session
+ * @bandwidths: array of #GstSDPBandwidth with bandwidth information
+ * @times: array of #GstSDPTime with time descriptions
+ * @zones: array of #GstSDPZone with time zone adjustments
+ * @key: encryption key
+ * @attributes: array of #GstSDPAttribute with session attributes
+ * @medias: array of #GstSDPMedia with media descriptions
+ *
+ * The contents of the SDP message.
+ */
+typedef struct {
+ gchar *version;
+ GstSDPOrigin origin;
+ gchar *session_name;
+ gchar *information;
+ gchar *uri;
+ GArray *emails;
+ GArray *phones;
+ GstSDPConnection connection;
+ GArray *bandwidths;
+ GArray *times;
+ GArray *zones;
+ GstSDPKey key;
+ GArray *attributes;
+ GArray *medias;
+} GstSDPMessage;
+
+
+GST_SDP_API
+GType gst_sdp_message_get_type (void);
+
+#define GST_TYPE_SDP_MESSAGE (gst_sdp_message_get_type())
+#define GST_SDP_MESSAGE_CAST(object) ((GstSDPMessage *)(object))
+#define GST_SDP_MESSAGE(object) (GST_SDP_MESSAGE_CAST(object))
+
+/* Session descriptions */
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_new (GstSDPMessage **msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_init (GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_uninit (GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_free (GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_copy (const GstSDPMessage *msg, GstSDPMessage **copy);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_parse_buffer (const guint8 *data, guint size, GstSDPMessage *msg);
+
+GST_SDP_API
+gchar* gst_sdp_message_as_text (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_new_from_text (const gchar *text, GstSDPMessage ** msg);
+
+/* convert from/to uri */
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_parse_uri (const gchar *uri, GstSDPMessage *msg);
+
+GST_SDP_API
+gchar* gst_sdp_message_as_uri (const gchar *scheme, const GstSDPMessage *msg);
+
+/* utils */
+
+GST_SDP_API
+gboolean gst_sdp_address_is_multicast (const gchar *nettype, const gchar *addrtype,
+ const gchar *addr);
+/* v=.. */
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_version (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_version (GstSDPMessage *msg, const gchar *version);
+
+/* o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address> */
+
+GST_SDP_API
+const GstSDPOrigin* gst_sdp_message_get_origin (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_origin (GstSDPMessage *msg, const gchar *username,
+ const gchar *sess_id, const gchar *sess_version,
+ const gchar *nettype, const gchar *addrtype,
+ const gchar *addr);
+
+/* s=<session name> */
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_session_name (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_session_name (GstSDPMessage *msg, const gchar *session_name);
+
+/* i=<session description> */
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_information (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_information (GstSDPMessage *msg, const gchar *information);
+
+/* u=<uri> */
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_uri (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_uri (GstSDPMessage *msg, const gchar *uri);
+
+/* e=<email-address> */
+
+GST_SDP_API
+guint gst_sdp_message_emails_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_email (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_email (GstSDPMessage *msg, gint idx,
+ const gchar *email);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_email (GstSDPMessage *msg, guint idx,
+ const gchar *email);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_email (GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_email (GstSDPMessage *msg, const gchar *email);
+
+/* p=<phone-number> */
+
+GST_SDP_API
+guint gst_sdp_message_phones_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_phone (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_phone (GstSDPMessage *msg, gint idx,
+ const gchar *phone);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_phone (GstSDPMessage *msg, guint idx,
+ const gchar *phone);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_phone (GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_phone (GstSDPMessage *msg, const gchar *phone);
+
+/* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
+
+GST_SDP_API
+const GstSDPConnection* gst_sdp_message_get_connection (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_connection (GstSDPMessage *msg, const gchar *nettype,
+ const gchar *addrtype, const gchar *address,
+ guint ttl, guint addr_number);
+/* b=<bwtype>:<bandwidth> */
+
+GST_SDP_API
+guint gst_sdp_message_bandwidths_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const GstSDPBandwidth* gst_sdp_message_get_bandwidth (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_bandwidth (GstSDPMessage * msg, gint idx,
+ GstSDPBandwidth * bw);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_bandwidth (GstSDPMessage * msg, guint idx,
+ GstSDPBandwidth * bw);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_bandwidth (GstSDPMessage * msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_bandwidth (GstSDPMessage *msg, const gchar *bwtype,
+ guint bandwidth);
+
+/* t=<start-time> <stop-time> and
+ * r=<repeat interval> <active duration> <offsets from start-time> */
+
+GST_SDP_API
+guint gst_sdp_message_times_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const GstSDPTime* gst_sdp_message_get_time (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_time (GstSDPMessage *msg, gint idx,
+ GstSDPTime *t);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_time (GstSDPMessage *msg, guint idx,
+ GstSDPTime *t);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_time (GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_time (GstSDPMessage *msg, const gchar *start,
+ const gchar *stop, const gchar **repeat);
+
+/* z=<adjustment time> <offset> <adjustment time> <offset> .... */
+
+GST_SDP_API
+guint gst_sdp_message_zones_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const GstSDPZone* gst_sdp_message_get_zone (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_zone (GstSDPMessage *msg, gint idx,
+ GstSDPZone *zone);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_zone (GstSDPMessage *msg, guint idx,
+ GstSDPZone *zone);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_zone (GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_zone (GstSDPMessage *msg, const gchar *adj_time,
+ const gchar *typed_time);
+
+/* k=<method>[:<encryption key>] */
+
+GST_SDP_API
+const GstSDPKey* gst_sdp_message_get_key (const GstSDPMessage *msg);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_set_key (GstSDPMessage *msg, const gchar *type,
+ const gchar *data);
+/* a=... */
+
+GST_SDP_API
+guint gst_sdp_message_attributes_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const GstSDPAttribute* gst_sdp_message_get_attribute (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_attribute_val (const GstSDPMessage *msg,
+ const gchar *key);
+
+GST_SDP_API
+const gchar* gst_sdp_message_get_attribute_val_n (const GstSDPMessage *msg,
+ const gchar *key, guint nth);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_insert_attribute (GstSDPMessage *msg, gint idx,
+ GstSDPAttribute *attr);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_replace_attribute (GstSDPMessage *msg, guint idx,
+ GstSDPAttribute *attr);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_remove_attribute (GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_attribute (GstSDPMessage *msg, const gchar *key,
+ const gchar *value);
+
+/* m=.. sections */
+
+GST_SDP_API
+guint gst_sdp_message_medias_len (const GstSDPMessage *msg);
+
+GST_SDP_API
+const GstSDPMedia* gst_sdp_message_get_media (const GstSDPMessage *msg, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_add_media (GstSDPMessage *msg, GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_dump (const GstSDPMessage *msg);
+
+/* Media descriptions */
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_new (GstSDPMedia **media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_init (GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_uninit (GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_free (GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_copy (const GstSDPMedia *media, GstSDPMedia **copy);
+
+GST_SDP_API
+gchar* gst_sdp_media_as_text (const GstSDPMedia *media);
+
+/* m=<media> <port>/<number of ports> <proto> <fmt> ... */
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_media (const GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_media (GstSDPMedia *media, const gchar *med);
+
+GST_SDP_API
+guint gst_sdp_media_get_port (const GstSDPMedia *media);
+
+GST_SDP_API
+guint gst_sdp_media_get_num_ports (const GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_port_info (GstSDPMedia *media, guint port,
+ guint num_ports);
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_proto (const GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_proto (GstSDPMedia *media, const gchar *proto);
+
+GST_SDP_API
+guint gst_sdp_media_formats_len (const GstSDPMedia *media);
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_format (const GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_insert_format (GstSDPMedia *media, gint idx,
+ const gchar *format);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_replace_format (GstSDPMedia *media, guint idx,
+ const gchar *format);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_remove_format (GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_add_format (GstSDPMedia *media, const gchar *format);
+
+/* i=<session description> */
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_information (const GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_information (GstSDPMedia *media, const gchar *information);
+
+/* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
+
+GST_SDP_API
+guint gst_sdp_media_connections_len (const GstSDPMedia *media);
+
+GST_SDP_API
+const GstSDPConnection* gst_sdp_media_get_connection (const GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_insert_connection (GstSDPMedia *media, gint idx,
+ GstSDPConnection *conn);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_replace_connection (GstSDPMedia *media, guint idx,
+ GstSDPConnection *conn);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_remove_connection (GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_add_connection (GstSDPMedia *media,
+ const gchar *nettype,
+ const gchar *addrtype,
+ const gchar *address,
+ guint ttl, guint addr_number);
+
+/* b=<bwtype>:<bandwidth> */
+
+GST_SDP_API
+guint gst_sdp_media_bandwidths_len (const GstSDPMedia *media);
+
+GST_SDP_API
+const GstSDPBandwidth* gst_sdp_media_get_bandwidth (const GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_insert_bandwidth (GstSDPMedia *media, gint idx,
+ GstSDPBandwidth *bw);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_replace_bandwidth (GstSDPMedia *media, guint idx,
+ GstSDPBandwidth *bw);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_remove_bandwidth (GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_add_bandwidth (GstSDPMedia *media, const gchar *bwtype,
+ guint bandwidth);
+
+/* k=<method>:<encryption key> */
+
+GST_SDP_API
+const GstSDPKey* gst_sdp_media_get_key (const GstSDPMedia *media);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_key (GstSDPMedia *media, const gchar *type,
+ const gchar *data);
+/* a=... */
+
+GST_SDP_API
+guint gst_sdp_media_attributes_len (const GstSDPMedia *media);
+
+GST_SDP_API
+const GstSDPAttribute * gst_sdp_media_get_attribute (const GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_attribute_val (const GstSDPMedia *media, const gchar *key);
+
+GST_SDP_API
+const gchar* gst_sdp_media_get_attribute_val_n (const GstSDPMedia *media, const gchar *key,
+ guint nth);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_insert_attribute (GstSDPMedia *media, gint idx,
+ GstSDPAttribute *attr);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_replace_attribute (GstSDPMedia *media, guint idx,
+ GstSDPAttribute *attr);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_remove_attribute (GstSDPMedia *media, guint idx);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_add_attribute (GstSDPMedia *media, const gchar *key,
+ const gchar *value);
+
+GST_SDP_API
+GstCaps* gst_sdp_media_get_caps_from_media (const GstSDPMedia *media, gint pt);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_set_media_from_caps (const GstCaps* caps, GstSDPMedia *media);
+
+GST_SDP_API
+gchar * gst_sdp_make_keymgmt (const gchar *uri, const gchar *base64);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_parse_keymgmt (const GstSDPMessage *msg, GstMIKEYMessage **mikey);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_parse_keymgmt (const GstSDPMedia *media, GstMIKEYMessage **mikey);
+
+GST_SDP_API
+GstSDPResult gst_sdp_message_attributes_to_caps (const GstSDPMessage *msg, GstCaps *caps);
+
+GST_SDP_API
+GstSDPResult gst_sdp_media_attributes_to_caps (const GstSDPMedia *media, GstCaps *caps);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstSDPMessage, gst_sdp_message_free)
+
+G_END_DECLS
+
+#endif /* __GST_SDP_MESSAGE_H__ */
diff --git a/include/gst/sdp/sdp-prelude.h b/include/gst/sdp/sdp-prelude.h
new file mode 100644
index 0000000000..cecdfd0d31
--- /dev/null
+++ b/include/gst/sdp/sdp-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer SDP Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * sdp-prelude.h: prelude include header for gst-sdp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_SDP_PRELUDE_H__
+#define __GST_SDP_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_SDP
+#define GST_SDP_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_SDP_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_SDP_PRELUDE_H__ */
diff --git a/include/gst/sdp/sdp.h b/include/gst/sdp/sdp.h
new file mode 100644
index 0000000000..f7dd52740a
--- /dev/null
+++ b/include/gst/sdp/sdp.h
@@ -0,0 +1,31 @@
+/* GStreamer
+ * Copyright (C) 2012 GStreamer developers
+ *
+ * gstsdp.h: single include header for gst-sdp library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_SDP__H__
+#define __GST_SDP__H__
+
+#include <gst/sdp/sdp-prelude.h>
+
+#include <gst/sdp/gstsdp.h>
+#include <gst/sdp/gstsdpmessage.h>
+#include <gst/sdp/gstmikey.h>
+
+#endif /* __GST_SDP__H__ */
diff --git a/include/gst/tag/gsttagdemux.h b/include/gst/tag/gsttagdemux.h
new file mode 100644
index 0000000000..495d6a7a14
--- /dev/null
+++ b/include/gst/tag/gsttagdemux.h
@@ -0,0 +1,139 @@
+/* GStreamer Base Class for Tag Demuxing
+ * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TAG_DEMUX_H__
+#define __GST_TAG_DEMUX_H__
+
+#include <gst/gst.h>
+#include <gst/tag/tag-enumtypes.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TAG_DEMUX (gst_tag_demux_get_type())
+#define GST_TAG_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TAG_DEMUX,GstTagDemux))
+#define GST_TAG_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TAG_DEMUX,GstTagDemuxClass))
+#define GST_IS_TAG_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TAG_DEMUX))
+#define GST_IS_TAG_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TAG_DEMUX))
+
+typedef struct _GstTagDemux GstTagDemux;
+typedef struct _GstTagDemuxClass GstTagDemuxClass;
+typedef struct _GstTagDemuxPrivate GstTagDemuxPrivate;
+
+/**
+ * GstTagDemuxResult:
+ * @GST_TAG_DEMUX_RESULT_BROKEN_TAG: cannot parse tag, just skip it
+ * @GST_TAG_DEMUX_RESULT_AGAIN : call again with less or more data
+ * @GST_TAG_DEMUX_RESULT_OK : parsed tag successfully
+ *
+ * Result values from the parse_tag virtual function.
+ */
+typedef enum {
+ GST_TAG_DEMUX_RESULT_BROKEN_TAG,
+ GST_TAG_DEMUX_RESULT_AGAIN,
+ GST_TAG_DEMUX_RESULT_OK
+} GstTagDemuxResult;
+
+/**
+ * GstTagDemux:
+ * @element: parent element
+ *
+ * Opaque #GstTagDemux structure.
+ */
+struct _GstTagDemux
+{
+ GstElement element;
+
+ /*< private >*/
+ GstTagDemuxPrivate *priv;
+
+ gpointer reserved[GST_PADDING];
+};
+
+/**
+ * GstTagDemuxClass:
+ * @parent_class: the parent class.
+ * @min_start_size: minimum size required to identify a tag at the start and
+ * determine its total size. Set to 0 if not interested in start tags.
+ * Subclasses should set this in their class_init function.
+ * @min_end_size: minimum size required to identify a tag at the end and
+ * determine its total size. Set to 0 if not interested in end tags.
+ * Subclasses should set this in their class_init function.
+ * @identify_tag: identify tag and determine the size required to parse the
+ * tag. Buffer may be larger than the specified minimum size.
+ * Subclassed MUST override this vfunc in their class_init function.
+ * @parse_tag: parse the tag. Buffer will be exactly of the size determined by
+ * the identify_tag vfunc before. The parse_tag vfunc may change the size
+ * stored in *tag_size and return GST_TAG_DEMUX_RESULT_AGAIN to request a
+ * larger or smaller buffer. It is also permitted to adjust the tag_size to a
+ * smaller value and then return GST_TAG_DEMUX_RESULT_OK in one go.
+ * Subclassed MUST override the parse_tag vfunc in their class_init function.
+ * @merge_tags: merge start and end tags. Subclasses may want to override this
+ * vfunc to allow prioritising of start or end tag according to user
+ * preference. Note that both start_tags and end_tags may be NULL. By default
+ * start tags are preferred over end tags.
+ *
+ * The #GstTagDemuxClass structure. See documentation at beginning of section
+ * for details about what subclasses need to override and do.
+ */
+struct _GstTagDemuxClass
+{
+ GstElementClass parent_class;
+
+ /* minimum size required to identify a tag at the start and determine
+ * its total size */
+ guint min_start_size;
+
+ /* minimum size required to identify a tag at the end and determine
+ * its total size */
+ guint min_end_size;
+
+ /* vtable */
+
+ /* identify tag and determine the size required to parse the tag */
+ gboolean (*identify_tag) (GstTagDemux * demux,
+ GstBuffer * buffer,
+ gboolean start_tag,
+ guint * tag_size);
+
+ /* parse the tag once it is identified and its size is known */
+ GstTagDemuxResult (*parse_tag) (GstTagDemux * demux,
+ GstBuffer * buffer,
+ gboolean start_tag,
+ guint * tag_size,
+ GstTagList ** tags);
+
+ /* merge start and end tags (optional) */
+ GstTagList * (*merge_tags) (GstTagDemux * demux,
+ const GstTagList * start_tags,
+ const GstTagList * end_tags);
+
+ /*< private >*/
+ gpointer reserved[GST_PADDING];
+};
+
+GST_TAG_API
+GType gst_tag_demux_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTagDemux, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_TAG_DEMUX_H__ */
+
diff --git a/include/gst/tag/gsttagmux.h b/include/gst/tag/gsttagmux.h
new file mode 100644
index 0000000000..e78097f2fd
--- /dev/null
+++ b/include/gst/tag/gsttagmux.h
@@ -0,0 +1,89 @@
+/* GStreamer tag muxer base class
+ * Copyright (C) 2006 Christophe Fergeau <teuf@gnome.org>
+ * Copyright (C) 2006,2011 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Pioneers of the Inevitable <songbird@songbirdnest.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_TAG_MUX_H
+#define GST_TAG_MUX_H
+
+#include <gst/gst.h>
+#include <gst/tag/tag-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TAG_MUX \
+ (gst_tag_mux_get_type())
+#define GST_TAG_MUX(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TAG_MUX,GstTagMux))
+#define GST_TAG_MUX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TAG_MUX,GstTagMuxClass))
+#define GST_IS_TAG_MUX(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TAG_MUX))
+#define GST_IS_TAG_MUX_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TAG_MUX))
+
+typedef struct _GstTagMux GstTagMux;
+typedef struct _GstTagMuxClass GstTagMuxClass;
+typedef struct _GstTagMuxPrivate GstTagMuxPrivate;
+
+/**
+ * GstTagMux:
+ * @element: parent element
+ *
+ * Opaque #GstTagMux structure.
+ */
+struct _GstTagMux {
+ GstElement element;
+
+ /*< private >*/
+ GstTagMuxPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstTagMuxClass:
+ * @parent_class: the parent class.
+ * @render_start_tag: create a tag buffer to add to the beginning of the
+ * input stream given a tag list, or NULL
+ * @render_end_tag: create a tag buffer to add to the end of the
+ * input stream given a tag list, or NULL
+ *
+ * The #GstTagMuxClass structure. Subclasses need to override at least one
+ * of the two render vfuncs.
+ */
+struct _GstTagMuxClass {
+ GstElementClass parent_class;
+
+ /* vfuncs */
+ GstBuffer * (*render_start_tag) (GstTagMux * mux, const GstTagList * tag_list);
+ GstBuffer * (*render_end_tag) (GstTagMux * mux, const GstTagList * tag_list);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_TAG_API
+GType gst_tag_mux_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTagMux, gst_object_unref)
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/tag/tag-enumtypes.h b/include/gst/tag/tag-enumtypes.h
new file mode 100644
index 0000000000..931835fd5b
--- /dev/null
+++ b/include/gst/tag/tag-enumtypes.h
@@ -0,0 +1,30 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/tag/tag-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gsttagdemux.h" */
+
+GST_TAG_API
+GType gst_tag_demux_result_get_type (void);
+#define GST_TYPE_TAG_DEMUX_RESULT (gst_tag_demux_result_get_type())
+
+/* enumerations from "tag.h" */
+
+GST_TAG_API
+GType gst_tag_image_type_get_type (void);
+#define GST_TYPE_TAG_IMAGE_TYPE (gst_tag_image_type_get_type())
+
+GST_TAG_API
+GType gst_tag_license_flags_get_type (void);
+#define GST_TYPE_TAG_LICENSE_FLAGS (gst_tag_license_flags_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/tag/tag-prelude.h b/include/gst/tag/tag-prelude.h
new file mode 100644
index 0000000000..96adb0e0f5
--- /dev/null
+++ b/include/gst/tag/tag-prelude.h
@@ -0,0 +1,33 @@
+/* GStreamer Tag Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * tag-prelude.h: prelude include header for gst-tag library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TAG_PRELUDE_H__
+#define __GST_TAG_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_TAG
+#define GST_TAG_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_TAG_API GST_API_IMPORT
+#endif
+
+#endif /* __GST_TAG_PRELUDE_H__ */
diff --git a/include/gst/tag/tag.h b/include/gst/tag/tag.h
new file mode 100644
index 0000000000..f19b4c680e
--- /dev/null
+++ b/include/gst/tag/tag.h
@@ -0,0 +1,708 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2006-2011 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_TAG_TAG_H__
+#define __GST_TAG_TAG_H__
+
+#include <gst/gst.h>
+#include <gst/tag/tag-prelude.h>
+#include <gst/tag/gsttagdemux.h>
+#include <gst/tag/gsttagmux.h>
+#include <gst/tag/xmpwriter.h>
+#include <gst/tag/tag-enumtypes.h>
+
+G_BEGIN_DECLS
+
+/* Tag names */
+
+/**
+ * GST_TAG_MUSICBRAINZ_TRACKID:
+ *
+ * MusicBrainz track ID
+ */
+#define GST_TAG_MUSICBRAINZ_TRACKID "musicbrainz-trackid"
+/**
+ * GST_TAG_MUSICBRAINZ_ARTISTID:
+ *
+ * MusicBrainz artist ID
+ */
+#define GST_TAG_MUSICBRAINZ_ARTISTID "musicbrainz-artistid"
+/**
+ * GST_TAG_MUSICBRAINZ_ALBUMID:
+ *
+ * MusicBrainz album ID
+ */
+#define GST_TAG_MUSICBRAINZ_ALBUMID "musicbrainz-albumid"
+/**
+ * GST_TAG_MUSICBRAINZ_ALBUMARTISTID:
+ *
+ * MusicBrainz album artist ID
+ */
+#define GST_TAG_MUSICBRAINZ_ALBUMARTISTID "musicbrainz-albumartistid"
+/**
+ * GST_TAG_MUSICBRAINZ_RELEASEGROUPID:
+ *
+ * MusicBrainz Release Group ID
+ *
+ * Since: 1.18
+ */
+#define GST_TAG_MUSICBRAINZ_RELEASEGROUPID "musicbrainz-releasegroupid"
+/**
+ * GST_TAG_MUSICBRAINZ_RELEASETRACKID:
+ *
+ * MusicBrainz Release Track ID
+ *
+ * Since: 1.18
+ */
+#define GST_TAG_MUSICBRAINZ_RELEASETRACKID "musicbrainz-releasetrackid"
+/**
+ * GST_TAG_MUSICBRAINZ_TRMID:
+ *
+ * MusicBrainz track TRM ID
+ */
+#define GST_TAG_MUSICBRAINZ_TRMID "musicbrainz-trmid"
+
+/**
+ * GST_TAG_ACOUSTID_ID:
+ *
+ * AcoustID Identifier
+ *
+ * Since: 1.18
+ */
+#define GST_TAG_ACOUSTID_ID "acoustid-id"
+
+/**
+ * GST_TAG_ACOUSTID_FINGERPRINT:
+ *
+ * AcoustID Fingerprint (Chromaprint)
+ *
+ * Since: 1.18
+ */
+/*
+ * FIXME 2.0: Using "chromaprint-fingerprint" for backwards compatibility with the
+ * old custom tag from the chromaprint plugin but should change this to
+ * "acoustid-fingerprint" in 2.0 for consistency.
+*/
+#define GST_TAG_ACOUSTID_FINGERPRINT "chromaprint-fingerprint"
+
+/**
+ * GST_TAG_CMML_STREAM:
+ *
+ * Annodex CMML stream element tag
+ */
+#define GST_TAG_CMML_STREAM "cmml-stream"
+/**
+ * GST_TAG_CMML_HEAD:
+ *
+ * Annodex CMML head element tag
+ */
+
+#define GST_TAG_CMML_HEAD "cmml-head"
+/**
+ * GST_TAG_CMML_CLIP:
+ *
+ * Annodex CMML clip element tag
+ */
+#define GST_TAG_CMML_CLIP "cmml-clip"
+/**
+ * GST_TAG_MUSICAL_KEY:
+ *
+ * Musical key in which the sound starts. It is represented as a string
+ * with a maximum length of three characters. The ground keys are
+ * represented with "A","B","C","D","E", "F" and "G" and halfkeys
+ * represented with "b" and "#". Minor is represented as "m" (e.g. "Dbm").
+ * Off key is represented with an "o" only.
+ * This notation might be extended in the future to support non-minor/major
+ * keys.
+ *
+ * Since: 1.2
+ */
+#define GST_TAG_MUSICAL_KEY "musical-key"
+
+
+/* CDDA tags */
+
+/**
+ * GST_TAG_CDDA_CDDB_DISCID:
+ *
+ * CDDB disc id in its short form (e.g. 'aa063d0f')
+ */
+#define GST_TAG_CDDA_CDDB_DISCID "discid"
+
+/**
+ * GST_TAG_CDDA_CDDB_DISCID_FULL:
+ *
+ * CDDB disc id including all details
+ */
+#define GST_TAG_CDDA_CDDB_DISCID_FULL "discid-full"
+
+/**
+ * GST_TAG_CDDA_MUSICBRAINZ_DISCID:
+ *
+ * Musicbrainz disc id (e.g. 'ahg7JUcfR3vCYBphSDIogOOWrr0-')
+ */
+#define GST_TAG_CDDA_MUSICBRAINZ_DISCID "musicbrainz-discid"
+
+/**
+ * GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL:
+ *
+ * Musicbrainz disc id details
+ */
+#define GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL "musicbrainz-discid-full"
+
+/**
+ * GST_TAG_CAPTURING_SHUTTER_SPEED:
+ *
+ * Shutter speed used when capturing an image, in seconds. (fraction)
+ */
+#define GST_TAG_CAPTURING_SHUTTER_SPEED "capturing-shutter-speed"
+
+/**
+ * GST_TAG_CAPTURING_FOCAL_RATIO:
+ *
+ * Focal ratio (f-number) used when capturing an image. (double)
+ *
+ * The value stored is the denominator of the focal ratio (f-number).
+ * For example, if this tag value is 2, the focal ratio is f/2.
+ */
+#define GST_TAG_CAPTURING_FOCAL_RATIO "capturing-focal-ratio"
+
+/**
+ * GST_TAG_CAPTURING_FOCAL_LENGTH:
+ *
+ * Focal length used when capturing an image, in mm. (double)
+ */
+#define GST_TAG_CAPTURING_FOCAL_LENGTH "capturing-focal-length"
+
+/**
+ * GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM:
+ *
+ * 35 mm equivalent focal length used when capturing an image, in mm. (double)
+ *
+ * Since: 1.10
+ */
+#define GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM "capturing-focal-length-35mm"
+
+/**
+ * GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO:
+ *
+ * Digital zoom ratio used when capturing an image. (double)
+ */
+#define GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO "capturing-digital-zoom-ratio"
+
+/**
+ * GST_TAG_CAPTURING_ISO_SPEED:
+ *
+ * ISO speed used when capturing an image. (integer)
+ */
+#define GST_TAG_CAPTURING_ISO_SPEED "capturing-iso-speed"
+
+/**
+ * GST_TAG_CAPTURING_EXPOSURE_PROGRAM:
+ *
+ * Type of exposure control used when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "undefined"
+ * "manual"
+ * "normal" - automatically controlled
+ * "aperture-priority" - user selects aperture value
+ * "shutter-priority" - user selects shutter speed
+ * "creative" - biased towards depth of field
+ * "action" - biased towards fast shutter speed
+ * "portrait" - closeup, leaving background out of focus
+ * "landscape" - landscape photos, background in focus
+ */
+#define GST_TAG_CAPTURING_EXPOSURE_PROGRAM "capturing-exposure-program"
+
+/**
+ * GST_TAG_CAPTURING_EXPOSURE_MODE:
+ *
+ * Exposure mode used when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "auto-exposure"
+ * "manual-exposure"
+ * "auto-bracket"
+ */
+#define GST_TAG_CAPTURING_EXPOSURE_MODE "capturing-exposure-mode"
+
+/**
+ * GST_TAG_CAPTURING_EXPOSURE_COMPENSATION:
+ *
+ * Exposure compensation using when capturing an image in EV. (double)
+ */
+#define GST_TAG_CAPTURING_EXPOSURE_COMPENSATION "capturing-exposure-compensation"
+
+/**
+ * GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE:
+ *
+ * Scene mode used when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "standard"
+ * "landscape"
+ * "portrait"
+ * "night-scene"
+ */
+#define GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE "capturing-scene-capture-type"
+
+/**
+ * GST_TAG_CAPTURING_GAIN_ADJUSTMENT:
+ *
+ * Gain adjustment applied to an image. (string)
+ *
+ * The allowed values are:
+ * "none"
+ * "low-gain-up"
+ * "high-gain-up"
+ * "low-gain-down"
+ * "high-gain-down"
+ */
+#define GST_TAG_CAPTURING_GAIN_ADJUSTMENT "capturing-gain-adjustment"
+
+/**
+ * GST_TAG_CAPTURING_WHITE_BALANCE:
+ *
+ * White balance mode used when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "auto"
+ * "manual"
+ * "daylight"
+ * "cloudy"
+ * "tungsten"
+ * "fluorescent"
+ * "fluorescent h" (newer daylight-calibrated fluorescents)
+ * "flash"
+ */
+#define GST_TAG_CAPTURING_WHITE_BALANCE "capturing-white-balance"
+
+/**
+ * GST_TAG_CAPTURING_CONTRAST:
+ *
+ * Direction of contrast processing applied when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "normal"
+ * "soft"
+ * "hard"
+ */
+#define GST_TAG_CAPTURING_CONTRAST "capturing-contrast"
+
+/**
+ * GST_TAG_CAPTURING_SATURATION:
+ *
+ * Direction of saturation processing applied when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "normal"
+ * "low-saturation"
+ * "high-saturation"
+ */
+#define GST_TAG_CAPTURING_SATURATION "capturing-saturation"
+
+/**
+ * GST_TAG_CAPTURING_SHARPNESS:
+ *
+ * Direction of sharpness processing applied when capturing an image. (string)
+ *
+ * The allowed values are:
+ * "normal"
+ * "soft"
+ * "hard"
+ */
+#define GST_TAG_CAPTURING_SHARPNESS "capturing-sharpness"
+
+/**
+ * GST_TAG_CAPTURING_FLASH_FIRED:
+ *
+ * If flash was fired during the capture of an image. (boolean)
+ *
+ * Note that if this tag isn't present, it should not be assumed that
+ * the flash did not fire. It should be treated as unknown.
+ */
+#define GST_TAG_CAPTURING_FLASH_FIRED "capturing-flash-fired"
+
+/**
+ * GST_TAG_CAPTURING_FLASH_MODE:
+ *
+ * The flash mode selected during the capture of an image. (string)
+ *
+ * The allowed values are:
+ * "auto"
+ * "always"
+ * "never"
+ */
+#define GST_TAG_CAPTURING_FLASH_MODE "capturing-flash-mode"
+
+/**
+ * GST_TAG_CAPTURING_METERING_MODE:
+ *
+ * Defines the way a camera determines the exposure. (string)
+ *
+ * The allowed values are:
+ * "unknown"
+ * "average"
+ * "center-weighted-average"
+ * "spot"
+ * "multi-spot"
+ * "pattern"
+ * "partial"
+ * "other"
+ */
+#define GST_TAG_CAPTURING_METERING_MODE "capturing-metering-mode"
+
+/**
+ * GST_TAG_CAPTURING_SOURCE:
+ *
+ * Indicates the source of capture. The device/medium used to do the
+ * capture. (string)
+ *
+ * Allowed values are:
+ * "dsc" (= digital still camera)
+ * "transparent-scanner"
+ * "reflex-scanner"
+ * "other"
+ */
+#define GST_TAG_CAPTURING_SOURCE "capturing-source"
+
+/**
+ * GST_TAG_IMAGE_HORIZONTAL_PPI:
+ *
+ * Media (image/video) intended horizontal pixel density in ppi. (double)
+ */
+#define GST_TAG_IMAGE_HORIZONTAL_PPI "image-horizontal-ppi"
+/**
+ * GST_TAG_IMAGE_VERTICAL_PPI:
+ *
+ * Media (image/video) intended vertical pixel density in ppi. (double)
+ */
+#define GST_TAG_IMAGE_VERTICAL_PPI "image-vertical-ppi"
+
+
+/* additional information for image tags */
+
+/**
+ * GstTagImageType:
+ * @GST_TAG_IMAGE_TYPE_NONE : No image type. Can be used to
+ * tell functions such as gst_tag_image_data_to_image_sample() that no
+ * image type should be set.
+ * @GST_TAG_IMAGE_TYPE_UNDEFINED : Undefined/other image type
+ * @GST_TAG_IMAGE_TYPE_FRONT_COVER : Cover (front)
+ * @GST_TAG_IMAGE_TYPE_BACK_COVER : Cover (back)
+ * @GST_TAG_IMAGE_TYPE_LEAFLET_PAGE : Leaflet page
+ * @GST_TAG_IMAGE_TYPE_MEDIUM : Medium (e.g. label side of CD)
+ * @GST_TAG_IMAGE_TYPE_LEAD_ARTIST : Lead artist/lead performer/soloist
+ * @GST_TAG_IMAGE_TYPE_ARTIST : Artist/performer
+ * @GST_TAG_IMAGE_TYPE_CONDUCTOR : Conductor
+ * @GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA : Band/orchestra
+ * @GST_TAG_IMAGE_TYPE_COMPOSER : Composer
+ * @GST_TAG_IMAGE_TYPE_LYRICIST : Lyricist/text writer
+ * @GST_TAG_IMAGE_TYPE_RECORDING_LOCATION : Recording location
+ * @GST_TAG_IMAGE_TYPE_DURING_RECORDING : During recording
+ * @GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE : During performance
+ * @GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE : Movie/video screen capture
+ * @GST_TAG_IMAGE_TYPE_FISH : A fish as funny as the ID3v2 spec
+ * @GST_TAG_IMAGE_TYPE_ILLUSTRATION : Illustration
+ * @GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO : Band/artist logotype
+ * @GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO : Publisher/studio logotype
+ *
+ * Type of image contained in an image tag (specified as "image-type" field in
+ * the info structure in the image's #GstSample)
+ */
+/* Note: keep in sync with register_tag_image_type_enum() */
+typedef enum {
+ GST_TAG_IMAGE_TYPE_NONE = -1,
+ GST_TAG_IMAGE_TYPE_UNDEFINED = 0,
+ GST_TAG_IMAGE_TYPE_FRONT_COVER,
+ GST_TAG_IMAGE_TYPE_BACK_COVER,
+ GST_TAG_IMAGE_TYPE_LEAFLET_PAGE,
+ GST_TAG_IMAGE_TYPE_MEDIUM,
+ GST_TAG_IMAGE_TYPE_LEAD_ARTIST,
+ GST_TAG_IMAGE_TYPE_ARTIST,
+ GST_TAG_IMAGE_TYPE_CONDUCTOR,
+ GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA,
+ GST_TAG_IMAGE_TYPE_COMPOSER,
+ GST_TAG_IMAGE_TYPE_LYRICIST,
+ GST_TAG_IMAGE_TYPE_RECORDING_LOCATION,
+ GST_TAG_IMAGE_TYPE_DURING_RECORDING,
+ GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE,
+ GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE,
+ GST_TAG_IMAGE_TYPE_FISH,
+ GST_TAG_IMAGE_TYPE_ILLUSTRATION,
+ GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO,
+ GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO
+} GstTagImageType;
+
+/**
+ * GST_TAG_ID3V2_HEADER_SIZE:
+ *
+ * ID3V2 header size considered minimum input for some functions such as
+ * gst_tag_list_from_id3v2_tag() and gst_tag_get_id3v2_tag_size() for example.
+ */
+#define GST_TAG_ID3V2_HEADER_SIZE 10
+
+/* functions for vorbis comment manipulation */
+
+GST_TAG_API
+const gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
+
+GST_TAG_API
+const gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
+
+GST_TAG_API
+void gst_vorbis_tag_add (GstTagList * list,
+ const gchar * tag,
+ const gchar * value);
+
+GST_TAG_API
+GList * gst_tag_to_vorbis_comments (const GstTagList * list,
+ const gchar * tag);
+
+/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_vorbiscomment (const guint8 * data,
+ gsize size,
+ const guint8 * id_data,
+ const guint id_data_length,
+ gchar ** vendor_string);
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_vorbiscomment_buffer (GstBuffer * buffer,
+ const guint8 * id_data,
+ const guint id_data_length,
+ gchar ** vendor_string);
+
+GST_TAG_API
+GstBuffer * gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
+ const guint8 * id_data,
+ const guint id_data_length,
+ const gchar * vendor_string);
+
+/* functions for ID3 tag manipulation */
+
+/* FIXME 0.11: inconsistent API naming: gst_tag_list_new_from_id3v1(), gst_tag_list_from_*_buffer(),
+ * gst_tag_list_from_id3v2_tag(). Also, note gst.tag.list_xyz() namespace vs. gst.tag_list_xyz(),
+ * which is a bit confusing and possibly doesn't map too well */
+
+GST_TAG_API
+guint gst_tag_id3_genre_count (void);
+
+GST_TAG_API
+const gchar * gst_tag_id3_genre_get (const guint id);
+
+GST_TAG_API
+GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data);
+
+GST_TAG_API
+const gchar * gst_tag_from_id3_tag (const gchar * id3_tag);
+
+GST_TAG_API
+const gchar * gst_tag_from_id3_user_tag (const gchar * type,
+ const gchar * id3_user_tag);
+
+GST_TAG_API
+const gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
+
+GST_TAG_API
+gboolean gst_tag_list_add_id3_image (GstTagList * tag_list,
+ const guint8 * image_data,
+ guint image_data_len,
+ guint id3_picture_type);
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_id3v2_tag (GstBuffer * buffer);
+
+GST_TAG_API
+guint gst_tag_get_id3v2_tag_size (GstBuffer * buffer);
+
+/* functions to convert GstBuffers with xmp packets contents to GstTagLists and back */
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_xmp_buffer (GstBuffer * buffer);
+
+GST_TAG_API
+GstBuffer * gst_tag_list_to_xmp_buffer (const GstTagList * list,
+ gboolean read_only,
+ const gchar ** schemas);
+
+GST_TAG_API
+const gchar** gst_tag_xmp_list_schemas (void);
+
+/* functions related to exif */
+
+GST_TAG_API
+GstBuffer * gst_tag_list_to_exif_buffer (const GstTagList * taglist,
+ gint byte_order,
+ guint32 base_offset);
+
+GST_TAG_API
+GstBuffer * gst_tag_list_to_exif_buffer_with_tiff_header (const GstTagList * taglist);
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_exif_buffer (GstBuffer * buffer,
+ gint byte_order,
+ guint32 base_offset);
+
+GST_TAG_API
+GstTagList * gst_tag_list_from_exif_buffer_with_tiff_header (
+ GstBuffer * buffer);
+
+/* other tag-related functions */
+
+GST_TAG_API
+gboolean gst_tag_parse_extended_comment (const gchar * ext_comment,
+ gchar ** key,
+ gchar ** lang,
+ gchar ** value,
+ gboolean fail_if_no_key);
+
+GST_TAG_API
+gchar * gst_tag_freeform_string_to_utf8 (const gchar * data,
+ gint size,
+ const gchar ** env_vars);
+
+GST_TAG_API
+GstSample * gst_tag_image_data_to_image_sample (const guint8 * image_data,
+ guint image_data_len,
+ GstTagImageType image_type);
+
+/* FIXME 0.11: get rid of this awkward register/init function, see tags.c */
+
+GST_TAG_API
+void gst_tag_register_musicbrainz_tags (void);
+
+
+/* language tag related functions */
+
+GST_TAG_API
+gchar ** gst_tag_get_language_codes (void);
+
+GST_TAG_API
+const gchar * gst_tag_get_language_name (const gchar * language_code);
+
+GST_TAG_API
+const gchar * gst_tag_get_language_code_iso_639_1 (const gchar * lang_code);
+
+GST_TAG_API
+const gchar * gst_tag_get_language_code_iso_639_2B (const gchar * lang_code);
+
+GST_TAG_API
+const gchar * gst_tag_get_language_code_iso_639_2T (const gchar * lang_code);
+
+GST_TAG_API
+gboolean gst_tag_check_language_code (const gchar * lang_code);
+
+/**
+ * gst_tag_get_language_code:
+ * @lang_code: ISO-639 language code (e.g. "deu" or "ger" or "de")
+ *
+ * Convenience macro wrapping gst_tag_get_language_code_iso_639_1().
+ */
+#define gst_tag_get_language_code(lang_code) \
+ gst_tag_get_language_code_iso_639_1(lang_code)
+
+
+/* functions to deal with (mostly) Creative Commons licenses */
+
+/**
+ * GstTagLicenseFlags:
+ * @GST_TAG_LICENSE_PERMITS_REPRODUCTION: making multiple copies
+ * is allowed
+ * @GST_TAG_LICENSE_PERMITS_DISTRIBUTION: distribution, public display
+ * and public performance are allowed
+ * @GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: distribution of derivative
+ * works is allowed
+ * @GST_TAG_LICENSE_PERMITS_SHARING: commercial derivatives are allowed,
+ * but only non-commercial distribution is allowed
+ * @GST_TAG_LICENSE_REQUIRES_NOTICE: copyright and license notices
+ * must be kept intact
+ * @GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: credit must be given to
+ * copyright holder and/or author
+ * @GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: derivative works must be
+ * licensed under the same terms or compatible terms as the original work
+ * @GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: source code (the preferred
+ * form for making modifications) must be provided when exercising some
+ * rights granted by the license
+ * @GST_TAG_LICENSE_REQUIRES_COPYLEFT: derivative and combined works
+ * must be licensed under specified terms, similar to those of the original
+ * work
+ * @GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: derivative works must be
+ * licensed under specified terms, with at least the same conditions as
+ * the original work; combinations with the work may be licensed under
+ * different terms
+ * @GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: exercising rights for
+ * commercial purposes is prohibited
+ * @GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: use in a
+ * non-developing country is prohibited
+ * @GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: this license was created
+ * by the Creative Commons project
+ * @GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: this license was
+ * created by the Free Software Foundation (FSF)
+ *
+ * See http://creativecommons.org/ns for more information.
+ */
+typedef enum {
+ GST_TAG_LICENSE_PERMITS_REPRODUCTION = (1 << 0),
+ GST_TAG_LICENSE_PERMITS_DISTRIBUTION = (1 << 1),
+ GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS = (1 << 2),
+ GST_TAG_LICENSE_PERMITS_SHARING = (1 << 3),
+
+ GST_TAG_LICENSE_REQUIRES_NOTICE = (1 << 8),
+ GST_TAG_LICENSE_REQUIRES_ATTRIBUTION = (1 << 9),
+ GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE = (1 << 10),
+ GST_TAG_LICENSE_REQUIRES_SOURCE_CODE = (1 << 11),
+ GST_TAG_LICENSE_REQUIRES_COPYLEFT = (1 << 12),
+ GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT = (1 << 13),
+
+ GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE = (1 << 16),
+ GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE = (1 << 17),
+
+ GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE = (1 << 24),
+ GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE = (1 << 25)
+} GstTagLicenseFlags;
+
+GST_TAG_API
+gchar ** gst_tag_get_licenses (void);
+
+GST_TAG_API
+GstTagLicenseFlags gst_tag_get_license_flags (const gchar * license_ref);
+
+GST_TAG_API
+const gchar * gst_tag_get_license_nick (const gchar * license_ref);
+
+GST_TAG_API
+const gchar * gst_tag_get_license_title (const gchar * license_ref);
+
+GST_TAG_API
+const gchar * gst_tag_get_license_version (const gchar * license_ref);
+
+GST_TAG_API
+const gchar * gst_tag_get_license_description (const gchar * license_ref);
+
+GST_TAG_API
+const gchar * gst_tag_get_license_jurisdiction (const gchar * license_ref);
+
+G_END_DECLS
+
+#endif /* __GST_TAG_TAG_H__ */
diff --git a/include/gst/tag/xmpwriter.h b/include/gst/tag/xmpwriter.h
new file mode 100644
index 0000000000..e8418514a0
--- /dev/null
+++ b/include/gst/tag/xmpwriter.h
@@ -0,0 +1,72 @@
+/* GStreamer XmpConfig
+ * Copyright (C) 2011 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __TAG_XMP_WRITER_H__
+#define __TAG_XMP_WRITER_H__
+
+#include <gst/gst.h>
+#include <gst/tag/tag-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_TAG_XMP_WRITER \
+ (gst_tag_xmp_writer_get_type ())
+#define GST_TAG_XMP_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TAG_XMP_WRITER, GstTagXmpWriter))
+#define GST_IS_TAG_XMP_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TAG_XMP_WRITER))
+#define GST_TAG_XMP_WRITER_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TAG_XMP_WRITER, GstTagXmpWriterInterface))
+
+typedef struct _GstTagXmpWriter GstTagXmpWriter;
+typedef struct _GstTagXmpWriterInterface GstTagXmpWriterInterface;
+
+struct _GstTagXmpWriterInterface {
+ GTypeInterface parent;
+};
+
+GST_TAG_API
+GType gst_tag_xmp_writer_get_type (void);
+
+GST_TAG_API
+void gst_tag_xmp_writer_add_all_schemas (GstTagXmpWriter * config);
+
+GST_TAG_API
+void gst_tag_xmp_writer_add_schema (GstTagXmpWriter * config,
+ const gchar * schema);
+
+GST_TAG_API
+gboolean gst_tag_xmp_writer_has_schema (GstTagXmpWriter * config,
+ const gchar * schema);
+
+GST_TAG_API
+void gst_tag_xmp_writer_remove_schema (GstTagXmpWriter * config,
+ const gchar * schema);
+
+GST_TAG_API
+void gst_tag_xmp_writer_remove_all_schemas (GstTagXmpWriter * config);
+
+GST_TAG_API
+GstBuffer* gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
+ const GstTagList * taglist,
+ gboolean read_only);
+
+G_END_DECLS
+
+#endif /* __TAG_XMP_WRITER_H__ */
diff --git a/include/gst/transcoder/gsttranscoder-signal-adapter.h b/include/gst/transcoder/gsttranscoder-signal-adapter.h
new file mode 100644
index 0000000000..198efe073a
--- /dev/null
+++ b/include/gst/transcoder/gsttranscoder-signal-adapter.h
@@ -0,0 +1,55 @@
+/* GStreamer
+ *
+ * Copyright (C) 2019-2020 Stephan Hesse <stephan@emliri.com>
+ * Copyright (C) 2020 Thibault Saunier <tsaunier@igalia.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+#include <gst/gst.h>
+#include <gst/transcoder/gsttranscoder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstTranscoderSignalAdapter:
+ *
+ * Transforms #GstTranscoder bus messages to signals from the adapter object.
+ *
+ * Since: 1.20
+ */
+
+/**
+ * GST_TYPE_TRANSCODER_SIGNAL_ADAPTER:
+ *
+ * Since: 1.20
+ */
+#define GST_TYPE_TRANSCODER_SIGNAL_ADAPTER (gst_transcoder_signal_adapter_get_type ())
+GST_TRANSCODER_API
+
+/**
+ * GstTranscoderSignalAdapterClass:
+ *
+ * Since: 1.20
+ */
+G_DECLARE_FINAL_TYPE(GstTranscoderSignalAdapter, gst_transcoder_signal_adapter, GST, TRANSCODER_SIGNAL_ADAPTER, GObject)
+
+GST_TRANSCODER_API
+GstTranscoder * gst_transcoder_signal_adapter_get_transcoder (GstTranscoderSignalAdapter * self);
+
+
+G_END_DECLS
diff --git a/include/gst/transcoder/gsttranscoder.h b/include/gst/transcoder/gsttranscoder.h
new file mode 100644
index 0000000000..97aea3ab92
--- /dev/null
+++ b/include/gst/transcoder/gsttranscoder.h
@@ -0,0 +1,178 @@
+#ifndef __GST_TRANSCODER_H
+#define __GST_TRANSCODER_H
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils.h>
+#include <gst/transcoder/transcoder-prelude.h>
+#include <gst/transcoder/transcoder-enumtypes.h>
+
+G_BEGIN_DECLS
+
+/*********** Error definitions ************/
+#define GST_TRANSCODER_ERROR (gst_transcoder_error_quark ())
+
+/**
+ * GstTranscoderError:
+ * @GST_TRANSCODER_ERROR_FAILED: generic error.
+ */
+typedef enum {
+ GST_TRANSCODER_ERROR_FAILED = 0
+} GstTranscoderError;
+
+GST_TRANSCODER_API
+GQuark gst_transcoder_error_quark (void);
+GST_TRANSCODER_API
+const gchar * gst_transcoder_error_get_name (GstTranscoderError error);
+
+/*********** State definition ************/
+
+/**
+ * GstTranscoderState:
+ * @GST_TRANSCODER_STATE_STOPPED: the transcoder is stopped.
+ * @GST_TRANSCODER_STATE_PAUSED: the transcoder is paused.
+ * @GST_TRANSCODER_STATE_PLAYING: the transcoder is currently transcoding a
+ * stream.
+ *
+ * High level representation of the transcoder pipeline state.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_TRANSCODER_STATE_STOPPED,
+ GST_TRANSCODER_STATE_PAUSED,
+ GST_TRANSCODER_STATE_PLAYING
+} GstTranscoderState;
+
+GST_TRANSCODER_API
+const gchar * gst_transcoder_state_get_name (GstTranscoderState state);
+
+/*********** Messages types definitions ************/
+
+/**
+ * GstTranscoderMessage:
+ * @GST_TRANSCODER_MESSAGE_POSITION_UPDATED: Sink position changed
+ * @GST_TRANSCODER_MESSAGE_DURATION_CHANGED: Duration of stream changed
+ * @GST_TRANSCODER_MESSAGE_STATE_CHANGED: Pipeline state changed
+ * @GST_TRANSCODER_MESSAGE_DONE: Transcoding is done
+ * @GST_TRANSCODER_MESSAGE_ERROR: Message contains an error
+ * @GST_TRANSCODER_MESSAGE_WARNING: Message contains an error
+ *
+ * Types of messages that will be posted on the transcoder API bus.
+ *
+ * See also #gst_transcoder_get_message_bus()
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_TRANSCODER_MESSAGE_POSITION_UPDATED,
+ GST_TRANSCODER_MESSAGE_DURATION_CHANGED,
+ GST_TRANSCODER_MESSAGE_STATE_CHANGED,
+ GST_TRANSCODER_MESSAGE_DONE,
+ GST_TRANSCODER_MESSAGE_ERROR,
+ GST_TRANSCODER_MESSAGE_WARNING,
+} GstTranscoderMessage;
+
+GST_TRANSCODER_API
+gboolean gst_transcoder_is_transcoder_message (GstMessage * msg);
+
+GST_TRANSCODER_API
+const gchar * gst_transcoder_message_get_name (GstTranscoderMessage message);
+
+GST_TRANSCODER_API
+void gst_transcoder_message_parse_position (GstMessage * msg, GstClockTime * position);
+
+GST_TRANSCODER_API
+void gst_transcoder_message_parse_duration (GstMessage * msg, GstClockTime * duration);
+
+GST_TRANSCODER_API
+void gst_transcoder_message_parse_state (GstMessage * msg, GstTranscoderState * state);
+
+GST_TRANSCODER_API
+void gst_transcoder_message_parse_error (GstMessage * msg, GError * error, GstStructure ** details);
+
+GST_TRANSCODER_API
+void gst_transcoder_message_parse_warning (GstMessage * msg, GError * error, GstStructure ** details);
+
+
+
+/*********** GstTranscoder definition ************/
+#define GST_TYPE_TRANSCODER (gst_transcoder_get_type ())
+
+/**
+ * GstTranscoderClass.parent_class:
+ *
+ * Since: 1.20
+ */
+GST_TRANSCODER_API
+G_DECLARE_FINAL_TYPE (GstTranscoder, gst_transcoder, GST, TRANSCODER, GstObject)
+
+GST_TRANSCODER_API
+GstTranscoder * gst_transcoder_new (const gchar * source_uri,
+ const gchar * dest_uri,
+ const gchar * encoding_profile);
+
+GST_TRANSCODER_API
+GstTranscoder * gst_transcoder_new_full (const gchar * source_uri,
+ const gchar * dest_uri,
+ GstEncodingProfile * profile);
+
+GST_TRANSCODER_API
+gboolean gst_transcoder_run (GstTranscoder * self,
+ GError ** error);
+
+GST_TRANSCODER_API
+GstBus * gst_transcoder_get_message_bus (GstTranscoder * transcoder);
+
+GST_TRANSCODER_API
+void gst_transcoder_set_cpu_usage (GstTranscoder * self,
+ gint cpu_usage);
+
+GST_TRANSCODER_API
+void gst_transcoder_run_async (GstTranscoder * self);
+
+GST_TRANSCODER_API
+void gst_transcoder_set_position_update_interval (GstTranscoder * self,
+ guint interval);
+
+GST_TRANSCODER_API
+gchar * gst_transcoder_get_source_uri (GstTranscoder * self);
+
+GST_TRANSCODER_API
+gchar * gst_transcoder_get_dest_uri (GstTranscoder * self);
+
+GST_TRANSCODER_API
+guint gst_transcoder_get_position_update_interval (GstTranscoder * self);
+
+GST_TRANSCODER_API
+GstClockTime gst_transcoder_get_position (GstTranscoder * self);
+
+GST_TRANSCODER_API
+GstClockTime gst_transcoder_get_duration (GstTranscoder * self);
+
+GST_TRANSCODER_API
+GstElement * gst_transcoder_get_pipeline (GstTranscoder * self);
+
+GST_TRANSCODER_API
+gboolean gst_transcoder_get_avoid_reencoding (GstTranscoder * self);
+GST_TRANSCODER_API
+void gst_transcoder_set_avoid_reencoding (GstTranscoder * self,
+ gboolean avoid_reencoding);
+
+#include "gsttranscoder-signal-adapter.h"
+
+GST_TRANSCODER_API
+GstTranscoderSignalAdapter*
+gst_transcoder_get_signal_adapter (GstTranscoder * self,
+ GMainContext *context);
+GST_TRANSCODER_API
+GstTranscoderSignalAdapter*
+gst_transcoder_get_sync_signal_adapter (GstTranscoder * self);
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/transcoder/transcoder-enumtypes.h b/include/gst/transcoder/transcoder-enumtypes.h
new file mode 100644
index 0000000000..88f6fc0eff
--- /dev/null
+++ b/include/gst/transcoder/transcoder-enumtypes.h
@@ -0,0 +1,28 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/transcoder/transcoder-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "gsttranscoder.h" */
+
+GST_TRANSCODER_API
+GType gst_transcoder_error_get_type (void);
+#define GST_TYPE_TRANSCODER_ERROR (gst_transcoder_error_get_type())
+
+GST_TRANSCODER_API
+GType gst_transcoder_state_get_type (void);
+#define GST_TYPE_TRANSCODER_STATE (gst_transcoder_state_get_type())
+
+GST_TRANSCODER_API
+GType gst_transcoder_message_get_type (void);
+#define GST_TYPE_TRANSCODER_MESSAGE (gst_transcoder_message_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/transcoder/transcoder-prelude.h b/include/gst/transcoder/transcoder-prelude.h
new file mode 100644
index 0000000000..4745db5044
--- /dev/null
+++ b/include/gst/transcoder/transcoder-prelude.h
@@ -0,0 +1,38 @@
+/* GStreamer Transcoder Library
+ *
+ * Copyright (C) 2019 Thibault Saunier <tsaunier@igalia.com>
+ *
+ * transcoder-prelude.h: prelude include header for the gst-transcoder library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TRANSCODER_PRELUDE_H__
+#define __GST_TRANSCODER_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_TRANSCODER_API
+# ifdef BUILDING_GST_TRANSCODER
+# define GST_TRANSCODER_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_TRANSCODER_API GST_API_IMPORT
+# endif
+#endif
+
+#include <gst/transcoder/transcoder-enumtypes.h>
+
+#endif /* __GST_TRANSCODER_PRELUDE_H__ */
diff --git a/include/gst/validate/gst-validate-bin-monitor.h b/include/gst/validate/gst-validate-bin-monitor.h
new file mode 100644
index 0000000000..300161d360
--- /dev/null
+++ b/include/gst/validate/gst-validate-bin-monitor.h
@@ -0,0 +1,91 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-bin-monitor.h - Validate BinMonitor class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_BIN_MONITOR_H__
+#define __GST_VALIDATE_BIN_MONITOR_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include <gst/validate/gst-validate-element-monitor.h>
+#include <gst/validate/gst-validate-runner.h>
+#include <gst/validate/gst-validate-scenario.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_BIN_MONITOR (gst_validate_bin_monitor_get_type ())
+#define GST_IS_VALIDATE_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_BIN_MONITOR))
+#define GST_IS_VALIDATE_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_BIN_MONITOR))
+#define GST_VALIDATE_BIN_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitorClass))
+#define GST_VALIDATE_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitor))
+#define GST_VALIDATE_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitorClass))
+#define GST_VALIDATE_BIN_MONITOR_CAST(obj) ((GstValidateBinMonitor*)(obj))
+#define GST_VALIDATE_BIN_MONITOR_CLASS_CAST(klass) ((GstValidateBinMonitorClass*)(klass))
+#endif
+
+typedef struct _GstValidateBinMonitor GstValidateBinMonitor;
+typedef struct _GstValidateBinMonitorClass GstValidateBinMonitorClass;
+
+/**
+ * GstValidateBinMonitor:
+ *
+ * GStreamer Validate BinMonitor class.
+ *
+ * Class that wraps a #GstBin for Validate checks
+ */
+struct _GstValidateBinMonitor {
+ GstValidateElementMonitor parent;
+
+ GList *element_monitors;
+
+ GstValidateScenario *scenario;
+
+ /*< private >*/
+ gulong element_added_id;
+ gulong element_removed_id;
+};
+
+/**
+ * GstValidateBinMonitorClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate BinMonitor object class.
+ */
+struct _GstValidateBinMonitorClass {
+ GstValidateElementMonitorClass parent_class;
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_bin_monitor_get_type (void);
+
+GST_VALIDATE_API GstValidateBinMonitor *
+gst_validate_bin_monitor_new (GstBin * bin,
+ GstValidateRunner * runner,
+ GstValidateMonitor * parent);
+
+GST_VALIDATE_API GstValidateScenario *
+gst_validate_bin_monitor_get_scenario (GstValidateBinMonitor * monitor);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_BIN_MONITOR_H__ */
+
diff --git a/include/gst/validate/gst-validate-element-monitor.h b/include/gst/validate/gst-validate-element-monitor.h
new file mode 100644
index 0000000000..025153d1f8
--- /dev/null
+++ b/include/gst/validate/gst-validate-element-monitor.h
@@ -0,0 +1,93 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-element-monitor.h - Validate ElementMonitor class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_ELEMENT_MONITOR_H__
+#define __GST_VALIDATE_ELEMENT_MONITOR_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/validate/gst-validate-monitor.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_ELEMENT_MONITOR (gst_validate_element_monitor_get_type ())
+#define GST_IS_VALIDATE_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR))
+#define GST_IS_VALIDATE_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_ELEMENT_MONITOR))
+#define GST_VALIDATE_ELEMENT_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitorClass))
+#define GST_VALIDATE_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitor))
+#define GST_VALIDATE_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitorClass))
+#define GST_VALIDATE_ELEMENT_MONITOR_CAST(obj) ((GstValidateElementMonitor*)(obj))
+#define GST_VALIDATE_ELEMENT_MONITOR_CLASS_CAST(klass) ((GstValidateElementMonitorClass*)(klass))
+#endif
+
+#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_DECODER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_decoder)
+#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_ENCODER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_encoder)
+#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_DEMUXER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_demuxer)
+#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_CONVERTER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_converter)
+#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_SINK(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_sink)
+
+typedef struct _GstValidateElementMonitor GstValidateElementMonitor;
+typedef struct _GstValidateElementMonitorClass GstValidateElementMonitorClass;
+
+/**
+ * GstValidateElementMonitor:
+ *
+ * GStreamer Validate ElementMonitor class.
+ *
+ * Class that wraps a #GstElement for Validate checks
+ */
+struct _GstValidateElementMonitor {
+ GstValidateMonitor parent;
+
+ /*< private >*/
+ gulong pad_added_id;
+ GList *pad_monitors;
+
+ gboolean is_decoder;
+ gboolean is_encoder;
+ gboolean is_demuxer;
+ gboolean is_converter;
+ gboolean is_sink;
+};
+
+/**
+ * GstValidateElementMonitorClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate ElementMonitor object class.
+ */
+struct _GstValidateElementMonitorClass {
+ GstValidateMonitorClass parent_class;
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_element_monitor_get_type (void);
+
+GST_VALIDATE_API
+GstValidateElementMonitor * gst_validate_element_monitor_new (GstElement * element, GstValidateRunner * runner, GstValidateMonitor * parent);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_ELEMENT_MONITOR_H__ */
+
diff --git a/include/gst/validate/gst-validate-enum-types.h b/include/gst/validate/gst-validate-enum-types.h
new file mode 100644
index 0000000000..748aa15732
--- /dev/null
+++ b/include/gst/validate/gst-validate-enum-types.h
@@ -0,0 +1,47 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#ifndef __GST_ENUM_TYPES_H__
+#define __GST_ENUM_TYPES_H__
+
+#include <glib-object.h>
+#include <gst/validate/validate.h>
+#include <gst/validate/media-descriptor-writer.h>
+
+G_BEGIN_DECLS
+
+/* enumerations from "gst-validate-enums.h" */
+GST_VALIDATE_API GType gst_validate_reporting_details_get_type (void);
+#define GST_TYPE_VALIDATE_REPORTING_DETAILS (gst_validate_reporting_details_get_type ())
+GST_VALIDATE_API GType gst_validate_verbosity_flags_get_type (void);
+#define GST_TYPE_VALIDATE_VERBOSITY_FLAGS (gst_validate_verbosity_flags_get_type ())
+GST_VALIDATE_API GType gst_validate_structure_resolve_variables_flags_get_type (void);
+#define GST_TYPE_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_FLAGS (gst_validate_structure_resolve_variables_flags_get_type ())
+
+/* enumerations from "gst-validate-report.h" */
+GST_VALIDATE_API GType gst_validate_debug_flags_get_type (void);
+#define GST_TYPE_VALIDATE_DEBUG_FLAGS (gst_validate_debug_flags_get_type ())
+GST_VALIDATE_API GType gst_validate_report_level_get_type (void);
+#define GST_TYPE_VALIDATE_REPORT_LEVEL (gst_validate_report_level_get_type ())
+GST_VALIDATE_API GType gst_validate_issue_flags_get_type (void);
+#define GST_TYPE_VALIDATE_ISSUE_FLAGS (gst_validate_issue_flags_get_type ())
+
+/* enumerations from "gst-validate-reporter.h" */
+GST_VALIDATE_API GType gst_validate_interception_return_get_type (void);
+#define GST_TYPE_VALIDATE_INTERCEPTION_RETURN (gst_validate_interception_return_get_type ())
+
+/* enumerations from "gst-validate-scenario.h" */
+GST_VALIDATE_API GType gst_validate_action_return_get_type (void);
+#define GST_TYPE_VALIDATE_ACTION_RETURN (gst_validate_action_return_get_type ())
+GST_VALIDATE_API GType gst_validate_action_type_flags_get_type (void);
+#define GST_TYPE_VALIDATE_ACTION_TYPE_FLAGS (gst_validate_action_type_flags_get_type ())
+
+/* enumerations from "media-descriptor-writer.h" */
+GST_VALIDATE_API GType gst_validate_media_descriptor_writer_flags_get_type (void);
+#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS (gst_validate_media_descriptor_writer_flags_get_type ())
+G_END_DECLS
+
+#endif /* __GST_ENUM_TYPES_H__ */
+
+/* Generated data ends here */
+
diff --git a/include/gst/validate/gst-validate-enums.h b/include/gst/validate/gst-validate-enums.h
new file mode 100644
index 0000000000..3dbf994818
--- /dev/null
+++ b/include/gst/validate/gst-validate-enums.h
@@ -0,0 +1,116 @@
+/* GStreamer
+ * Copyright (C) 2014 Mathieu Duponchelle <mathieu.duponchelle@collabora.com>
+ *
+ * gst-validate-enums.h - Validate constants.
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_ENUMS_H__
+#define __GST_VALIDATE_ENUMS_H__
+
+/**
+ * SECTION: gst-validate-enums.h
+ * @title: GstValidate enums
+ */
+
+/**
+ * GstValidateReportingDetails:
+ * @GST_VALIDATE_SHOW_NONE: No debugging level specified or desired. Used to deactivate
+ * debugging output.
+ * @GST_VALIDATE_SHOW_SMART: Sythetic for not fatal issues and detailed for
+ * others
+ * @GST_VALIDATE_SHOW_SYNTHETIC: Summary of the issues found, with no
+ * details.
+ * @GST_VALIDATE_SHOW_SUBCHAIN: If set as the default level, similar
+ * issues can be reported multiple times for different subchains.
+ * If set as the level for a particular object (my_object:subchain), validate
+ * will report the issues where the object is the first to report an issue for
+ * a subchain.
+ * @GST_VALIDATE_SHOW_MONITOR: If set as the default level, all the
+ * distinct issues for all the monitors will be reported.
+ * If set as the level for a particular object, all the distinct issues for this object
+ * will be reported.
+ * Note that if the same issue happens twice on the same object, up until this
+ * level that issue is only reported once.
+ * @GST_VALIDATE_SHOW_ALL: All the issues will be reported, even those
+ * that repeat themselves inside the same object. This can be *very* verbose if
+ * set globally.
+ * @GST_VALIDATE_SHOW_UNKNOWN: No reporting level known,
+ * reporting will default to the global reporting level.
+ *
+ * Setting the reporting level allows to control the way issues are reported
+ * when calling #gst_validate_runner_printf.
+ *
+ * The reporting level can be set through the "GST_VALIDATE_REPORTING_DETAILS"
+ * environment variable, as a comma-separated list of (optional) object categories / names
+ * and levels. No object category / name sets the global level.
+ *
+ * Examples: GST_VALIDATE_REPORTING_DETAILS=synthetic,h264parse:all
+ * GST_VALIDATE_REPORTING_DETAILS=none,h264parse::sink_0:synthetic
+ */
+typedef enum {
+ GST_VALIDATE_SHOW_UNKNOWN = 0,
+ GST_VALIDATE_SHOW_NONE = 1,
+ GST_VALIDATE_SHOW_SYNTHETIC = 2,
+ GST_VALIDATE_SHOW_SUBCHAIN = 3,
+ GST_VALIDATE_SHOW_MONITOR = 4,
+ GST_VALIDATE_SHOW_ALL = 5,
+ GST_VALIDATE_SHOW_SMART = 6,
+ GST_VALIDATE_SHOW_COUNT
+} GstValidateReportingDetails;
+
+/**
+ * GST_VALIDATE_SHOW_DEFAULT:
+ *
+ * Defines the default reporting level to be used with gst-validate. It is normally
+ * set to #GST_VALIDATE_SHOW_SYNTHETIC so only a synthetic report
+ * gets printed.
+ * As it can be configured at compile time, developer builds may chose to
+ * override that though.
+ */
+#ifndef GST_VALIDATE_SHOW_DEFAULT
+#define GST_VALIDATE_SHOW_DEFAULT GST_VALIDATE_SHOW_SMART
+#endif
+
+/**
+ * GstValidateVerbosityFlags:
+ *
+ * Defines the level of verbosity of -validate (ie, printing on stdout).
+ */
+typedef enum
+{
+ GST_VALIDATE_VERBOSITY_NONE = 0,
+ GST_VALIDATE_VERBOSITY_POSITION = 1 << 1,
+ GST_VALIDATE_VERBOSITY_MESSAGES = 1 << 2,
+ GST_VALIDATE_VERBOSITY_PROPS_CHANGES = 1 << 3,
+ GST_VALIDATE_VERBOSITY_NEW_ELEMENTS = 1 << 4,
+ GST_VALIDATE_VERBOSITY_ALL = GST_VALIDATE_VERBOSITY_POSITION | GST_VALIDATE_VERBOSITY_MESSAGES | GST_VALIDATE_VERBOSITY_PROPS_CHANGES | GST_VALIDATE_VERBOSITY_NEW_ELEMENTS
+} GstValidateVerbosityFlags;
+
+/**
+ * GstValidateStructureResolveVariablesFlags:
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_ALL = 0,
+ GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_LOCAL_ONLY = 1 << 0,
+ GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_FAILURE = 1 << 1,
+ GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_EXPRESSION = 1 << 1,
+} GstValidateStructureResolveVariablesFlags;
+
+#endif /* __GST_VALIDATE_ENUMS_H__ */
diff --git a/include/gst/validate/gst-validate-media-info.h b/include/gst/validate/gst-validate-media-info.h
new file mode 100644
index 0000000000..9df9bf1fe6
--- /dev/null
+++ b/include/gst/validate/gst-validate-media-info.h
@@ -0,0 +1,89 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-media-info.h - Media information structure
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_MEDIA_INFO_H__
+#define __GST_VALIDATE_MEDIA_INFO_H__
+
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils.h>
+#include <gst/validate/validate-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstValidateMediaInfo GstValidateMediaInfo;
+typedef struct _GstValidateStreamInfo GstValidateStreamInfo;
+
+/**
+ * GstValidateMediaInfo:
+ *
+ * GStreamer Validate MediaInfo struct.
+ *
+ * Stores extracted information about a media
+ */
+struct _GstValidateMediaInfo {
+
+ /* <File checking data> */
+ /* Value for the expected total duration of the file in nanosecs
+ * Set to GST_CLOCK_TIME_NONE if it shouldn't be tested */
+ GstClockTime duration;
+ gboolean is_image;
+
+ /* Expected file_size, set to 0 to skip test */
+ guint64 file_size;
+
+ gboolean seekable;
+
+ gchar *playback_error;
+ gchar *reverse_playback_error;
+ gchar *track_switch_error;
+
+ gchar *uri;
+
+ gboolean discover_only;
+
+ GstValidateStreamInfo *stream_info;
+};
+
+GST_VALIDATE_API
+void gst_validate_media_info_init (GstValidateMediaInfo * mi);
+GST_VALIDATE_API
+void gst_validate_media_info_clear (GstValidateMediaInfo * mi);
+GST_VALIDATE_API
+void gst_validate_media_info_free (GstValidateMediaInfo * mi);
+
+GST_VALIDATE_API
+gchar * gst_validate_media_info_to_string (GstValidateMediaInfo * mi, gsize * length);
+GST_VALIDATE_API
+gboolean gst_validate_media_info_save (GstValidateMediaInfo * mi, const gchar * path, GError ** err);
+GST_VALIDATE_API
+GstValidateMediaInfo * gst_validate_media_info_load (const gchar * path, GError ** err);
+
+GST_VALIDATE_API
+gboolean gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi, const gchar * uri,
+ gboolean discover_only, GError ** err);
+
+GST_VALIDATE_API
+gboolean gst_validate_media_info_compare (GstValidateMediaInfo * expected, GstValidateMediaInfo * extracted);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_MEDIA_INFO_H__ */
+
diff --git a/include/gst/validate/gst-validate-monitor-factory.h b/include/gst/validate/gst-validate-monitor-factory.h
new file mode 100644
index 0000000000..24fe9cb788
--- /dev/null
+++ b/include/gst/validate/gst-validate-monitor-factory.h
@@ -0,0 +1,39 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-monitor-factory.h - Validate Element monitors factory utility functions
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_MONITOR_FACTORY_H__
+#define __GST_VALIDATE_MONITOR_FACTORY_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/validate/gst-validate-monitor.h>
+#include <gst/validate/gst-validate-runner.h>
+
+G_BEGIN_DECLS
+
+GST_VALIDATE_API
+GstValidateMonitor * gst_validate_monitor_factory_create (GstObject * target, GstValidateRunner * runner, GstValidateMonitor * parent);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_MONITOR_FACTORY_H__ */
+
diff --git a/include/gst/validate/gst-validate-monitor.h b/include/gst/validate/gst-validate-monitor.h
new file mode 100644
index 0000000000..2964705f23
--- /dev/null
+++ b/include/gst/validate/gst-validate-monitor.h
@@ -0,0 +1,142 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-monitor.h - Validate Monitor abstract base class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_MONITOR_H__
+#define __GST_VALIDATE_MONITOR_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+typedef struct _GstValidateMonitor GstValidateMonitor;
+typedef struct _GstValidateMonitorClass GstValidateMonitorClass;
+
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-reporter.h>
+#include <gst/validate/gst-validate-runner.h>
+#include <gst/validate/gst-validate-override.h>
+#include <gst/validate/media-descriptor-parser.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_MONITOR (gst_validate_monitor_get_type ())
+#define GST_IS_VALIDATE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MONITOR))
+#define GST_IS_VALIDATE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MONITOR))
+#define GST_VALIDATE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitorClass))
+#define GST_VALIDATE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitor))
+#define GST_VALIDATE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitorClass))
+#define GST_VALIDATE_MONITOR_CAST(obj) ((GstValidateMonitor*)(obj))
+#define GST_VALIDATE_MONITOR_CLASS_CAST(klass) ((GstValidateMonitorClass*)(klass))
+#endif
+
+#define GST_VALIDATE_MONITOR_GET_PARENT(m) (GST_VALIDATE_MONITOR_CAST (m)->parent)
+
+#define GST_VALIDATE_MONITOR_LOCK(m) \
+ G_STMT_START { \
+ GST_LOG_OBJECT (m, "About to lock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
+ (g_mutex_lock (&GST_VALIDATE_MONITOR_CAST(m)->mutex)); \
+ GST_LOG_OBJECT (m, "Acquired lock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
+ } G_STMT_END
+
+#define GST_VALIDATE_MONITOR_UNLOCK(m) \
+ G_STMT_START { \
+ GST_LOG_OBJECT (m, "About to unlock %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
+ (g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST(m)->mutex)); \
+ GST_LOG_OBJECT (m, "unlocked %p", &GST_VALIDATE_MONITOR_CAST(m)->mutex); \
+ } G_STMT_END
+
+#define GST_VALIDATE_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
+#define GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
+#define GST_VALIDATE_MONITOR_OVERRIDES(m) (GST_VALIDATE_MONITOR_CAST (m)->overrides)
+
+/* #else TODO Implemen no variadic macros, use inline,
+ * Problem being:
+ * GST_VALIDATE_REPORT_LEVEL_ ## status
+ * GST_VALIDATE_AREA_ ## area ## _ ## subarea
+ */
+
+/**
+ * GstValidateMonitor:
+ *
+ * GStreamer Validate Monitor class.
+ *
+ * Class that wraps a #GObject for Validate checks
+ */
+struct _GstValidateMonitor {
+ GstObject object;
+
+ GWeakRef target;
+ GWeakRef pipeline;
+ GMutex mutex;
+ gchar *target_name;
+
+ GstValidateMonitor *parent;
+
+ GMutex overrides_mutex;
+ GQueue overrides;
+ GstValidateMediaDescriptor *media_descriptor;
+
+ GstValidateReportingDetails level;
+
+ /*< private >*/
+ GHashTable *reports;
+
+ GstValidateVerbosityFlags verbosity;
+};
+
+/**
+ * GstValidateMonitorClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate Monitor object class.
+ */
+struct _GstValidateMonitorClass {
+ GstObjectClass parent_class;
+
+ gboolean (* setup) (GstValidateMonitor * monitor);
+ GstElement *(* get_element) (GstValidateMonitor * monitor);
+ void (*set_media_descriptor) (GstValidateMonitor * monitor,
+ GstValidateMediaDescriptor * media_descriptor);
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_monitor_get_type (void);
+
+GST_VALIDATE_API
+void gst_validate_monitor_attach_override (GstValidateMonitor * monitor,
+ GstValidateOverride * override);
+
+GST_VALIDATE_API
+GstElement * gst_validate_monitor_get_element (GstValidateMonitor * monitor);
+GST_VALIDATE_API
+gchar * gst_validate_monitor_get_element_name (GstValidateMonitor * monitor);
+GST_VALIDATE_API
+void gst_validate_monitor_set_media_descriptor (GstValidateMonitor * monitor,
+ GstValidateMediaDescriptor *media_descriptor);
+GST_VALIDATE_API
+GstPipeline * gst_validate_monitor_get_pipeline (GstValidateMonitor * monitor);
+GST_VALIDATE_API
+GstObject * gst_validate_monitor_get_target (GstValidateMonitor * monitor);
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_MONITOR_H__ */
+
diff --git a/include/gst/validate/gst-validate-override-registry.h b/include/gst/validate/gst-validate-override-registry.h
new file mode 100644
index 0000000000..7dfcdb318a
--- /dev/null
+++ b/include/gst/validate/gst-validate-override-registry.h
@@ -0,0 +1,66 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-override-registry.h - Validate Override registry
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_OVERRIDE_REGISTRY_H__
+#define __GST_VALIDATE_OVERRIDE_REGISTRY_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-monitor.h>
+#include <gst/validate/gst-validate-override.h>
+
+G_BEGIN_DECLS
+
+typedef struct {
+ GMutex mutex;
+
+ GQueue name_overrides;
+ GQueue gtype_overrides;
+ GQueue klass_overrides;
+} GstValidateOverrideRegistry;
+
+GST_VALIDATE_API
+GstValidateOverrideRegistry * gst_validate_override_registry_get (void);
+
+GST_VALIDATE_API GList *
+gst_validate_override_registry_get_override_for_names (GstValidateOverrideRegistry *reg,
+ const gchar *name, ...);
+GST_VALIDATE_API GList *
+gst_validate_override_registry_get_override_list (GstValidateOverrideRegistry *registry);
+GST_VALIDATE_API
+void gst_validate_override_register_by_name (const gchar * name, GstValidateOverride * override);
+GST_VALIDATE_API
+void gst_validate_override_register_by_type (GType gtype, GstValidateOverride * override);
+GST_VALIDATE_API
+void gst_validate_override_register_by_klass (const gchar * klass, GstValidateOverride * override);
+
+GST_VALIDATE_API
+void gst_validate_override_registry_attach_overrides (GstValidateMonitor * monitor);
+
+GST_VALIDATE_API
+int gst_validate_override_registry_preload (void);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_OVERRIDE_REGISTRY_H__ */
+
diff --git a/include/gst/validate/gst-validate-override.h b/include/gst/validate/gst-validate-override.h
new file mode 100644
index 0000000000..93eef630fd
--- /dev/null
+++ b/include/gst/validate/gst-validate-override.h
@@ -0,0 +1,141 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-override.h - Validate Override that allows customizing Validate behavior
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_OVERRIDE_H__
+#define __GST_VALIDATE_OVERRIDE_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+typedef struct _GstValidateOverride GstValidateOverride;
+typedef struct _GstValidateOverrideClass GstValidateOverrideClass;
+typedef struct _GstValidateOverridePrivate GstValidateOverridePrivate;
+
+
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-monitor.h>
+
+G_BEGIN_DECLS
+
+typedef void (*GstValidateOverrideBufferHandler)(GstValidateOverride * override,
+ GstValidateMonitor * pad_monitor, GstBuffer * buffer);
+typedef void (*GstValidateOverrideEventHandler)(GstValidateOverride * override,
+ GstValidateMonitor * pad_monitor, GstEvent * event);
+typedef void (*GstValidateOverrideQueryHandler)(GstValidateOverride * override,
+ GstValidateMonitor * pad_monitor, GstQuery * query);
+typedef void (*GstValidateOverrideGetCapsHandler)(GstValidateOverride * override,
+ GstValidateMonitor * pad_monitor, GstCaps * caps);
+typedef void (*GstValidateOverrideSetCapsHandler)(GstValidateOverride * override,
+ GstValidateMonitor * pad_monitor, GstCaps * caps);
+typedef void (*GstValidateOverrideElementAddedHandler)(GstValidateOverride * override,
+ GstValidateMonitor * bin_monitor, GstElement * new_child);
+
+struct _GstValidateOverrideClass
+{
+ /*<private>*/
+ GstObjectClass parent_class;
+
+ gboolean (*can_attach)(GstValidateOverride * override,
+ GstValidateMonitor * monitor);
+
+ void (*attached)(GstValidateOverride * override);
+};
+
+struct _GstValidateOverride
+{
+ GstObject parent;
+
+ GstValidateOverrideBufferHandler buffer_handler;
+ GstValidateOverrideEventHandler event_handler;
+ GstValidateOverrideQueryHandler query_handler;
+ GstValidateOverrideBufferHandler buffer_probe_handler;
+ GstValidateOverrideGetCapsHandler getcaps_handler;
+ GstValidateOverrideSetCapsHandler setcaps_handler;
+ GstValidateOverrideElementAddedHandler element_added_handler;
+
+ /*<private>*/
+ GstValidateOverridePrivate *priv;
+};
+
+GST_VALIDATE_API
+GType gst_validate_override_get_type (void) G_GNUC_CONST;
+
+/* TYPE MACROS */
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_OVERRIDE (gst_validate_override_get_type ())
+#define GST_VALIDATE_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VALIDATE_OVERRIDE, GstValidateOverride))
+#define GST_VALIDATE_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VALIDATE_OVERRIDE, GstValidateOverrideClass))
+#define GST_IS_VALIDATE_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VALIDATE_OVERRIDE))
+#define GST_IS_VALIDATE_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VALIDATE_OVERRIDE))
+#define GST_VALIDATE_OVERRIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_OVERRIDE, GstValidateOverrideClass))
+#endif
+
+GST_VALIDATE_API
+GstValidateOverride * gst_validate_override_new (void);
+
+void gst_validate_override_free (GstValidateOverride * override);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstValidateOverride, gst_validate_override_free)
+
+GST_VALIDATE_API
+void gst_validate_override_change_severity (GstValidateOverride * override, GstValidateIssueId issue_id, GstValidateReportLevel new_level);
+GST_VALIDATE_API
+GstValidateReportLevel gst_validate_override_get_severity (GstValidateOverride * override, GstValidateIssueId issue_id, GstValidateReportLevel default_level);
+
+GST_VALIDATE_API
+void gst_validate_override_event_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstEvent * event);
+GST_VALIDATE_API
+void gst_validate_override_buffer_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstBuffer * buffer);
+GST_VALIDATE_API
+void gst_validate_override_query_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstQuery * query);
+GST_VALIDATE_API
+void gst_validate_override_buffer_probe_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstBuffer * buffer);
+GST_VALIDATE_API
+void gst_validate_override_getcaps_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstCaps * caps);
+GST_VALIDATE_API
+void gst_validate_override_setcaps_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstCaps * caps);
+
+GST_VALIDATE_API
+void gst_validate_override_set_event_handler (GstValidateOverride * override, GstValidateOverrideEventHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_set_buffer_handler (GstValidateOverride * override, GstValidateOverrideBufferHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_set_query_handler (GstValidateOverride * override, GstValidateOverrideQueryHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_set_buffer_probe_handler (GstValidateOverride * override, GstValidateOverrideBufferHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_set_getcaps_handler (GstValidateOverride * override, GstValidateOverrideGetCapsHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_set_setcaps_handler (GstValidateOverride * override, GstValidateOverrideSetCapsHandler handler);
+GST_VALIDATE_API
+void gst_validate_override_element_added_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstElement * child);
+GST_VALIDATE_API
+void gst_validate_override_set_element_added_handler (GstValidateOverride * override, GstValidateOverrideElementAddedHandler func);
+
+GST_VALIDATE_API
+gboolean gst_validate_override_can_attach (GstValidateOverride * override, GstValidateMonitor *monitor);
+
+GST_VALIDATE_API
+void gst_validate_override_attached (GstValidateOverride * override);
+
+G_END_DECLS
+
+#endif /* #ifndef __GST_VALIDATE_OVERRIDE_H__*/
diff --git a/include/gst/validate/gst-validate-pad-monitor.h b/include/gst/validate/gst-validate-pad-monitor.h
new file mode 100644
index 0000000000..22c3479bcb
--- /dev/null
+++ b/include/gst/validate/gst-validate-pad-monitor.h
@@ -0,0 +1,156 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-pad-monitor.h - Validate PadMonitor class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_PAD_MONITOR_H__
+#define __GST_VALIDATE_PAD_MONITOR_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+typedef struct _GstValidatePadMonitor GstValidatePadMonitor;
+typedef struct _GstValidatePadMonitorClass GstValidatePadMonitorClass;
+typedef struct _GstValidatePadSeekData GstValidatePadSeekData;
+
+#include <gst/validate/gst-validate-monitor.h>
+#include <gst/validate/media-descriptor-parser.h>
+#include <gst/validate/gst-validate-element-monitor.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_PAD_MONITOR (gst_validate_pad_monitor_get_type ())
+#define GST_IS_VALIDATE_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_PAD_MONITOR))
+#define GST_IS_VALIDATE_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_PAD_MONITOR))
+#define GST_VALIDATE_PAD_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitorClass))
+#define GST_VALIDATE_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitor))
+#define GST_VALIDATE_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitorClass))
+#define GST_VALIDATE_PAD_MONITOR_CAST(obj) ((GstValidatePadMonitor*)(obj))
+#define GST_VALIDATE_PAD_MONITOR_CLASS_CAST(klass) ((GstValidatePadMonitorClass*)(klass))
+#endif
+
+/**
+ * GstValidatePadMonitor:
+ *
+ * GStreamer Validate PadMonitor class.
+ *
+ * Class that wraps a #GstPad for Validate checks
+ */
+struct _GstValidatePadMonitor {
+ GstValidateMonitor parent;
+
+ gboolean setup;
+
+ GstPadChainFunction chain_func;
+ GstPadEventFunction event_func;
+ GstPadEventFullFunction event_full_func;
+ GstPadQueryFunction query_func;
+ GstPadActivateModeFunction activatemode_func;
+ GstPadGetRangeFunction get_range_func;
+
+ gulong pad_probe_id;
+
+ /*< private >*/
+ /* Last caps pushed/received */
+ GstCaps *last_caps;
+ gboolean caps_is_audio;
+ gboolean caps_is_video;
+ gboolean caps_is_raw;
+
+ /* FIXME : Let's migrate all those booleans into a 32 (or 64) bit flag */
+ gboolean first_buffer;
+
+ gboolean has_segment;
+ gboolean is_eos;
+
+ gboolean pending_flush_stop;
+ guint32 pending_newsegment_seqnum;
+ guint32 pending_eos_seqnum;
+
+ /* List of GstValidatePadSeekData containing pending/current seeks */
+ GList *seeks;
+ GstValidatePadSeekData *current_seek;
+
+ /* Whether the next buffer should have a DISCONT flag on it, because
+ * it's the first one, or follows a SEGMENT and/or a FLUSH */
+ gboolean pending_buffer_discont;
+
+ GstEvent *expected_segment;
+ GPtrArray *serialized_events;
+ GList *expired_events;
+
+ GstStructure *pending_setcaps_fields;
+
+ GstCaps * last_refused_caps;
+ GstCaps * last_query_filter;
+ GstCaps * last_query_res;
+
+ /* tracked data */
+ GstSegment segment;
+ GstClockTime current_timestamp;
+ GstClockTime current_duration;
+
+ /* Stores the timestamp range of data that has flown through
+ * this pad by using TIMESTAMP and TIMESTAMP+DURATION from
+ * incomming buffers. Every time a buffer is pushed, this range
+ * is extended.
+ *
+ * When a buffer is pushed, the timestamp range is checked against
+ * the outgoing timestamp to check it is in the received boundaries.
+ */
+ GstClockTime timestamp_range_start;
+ GstClockTime timestamp_range_end;
+
+ /* GstValidateMediaCheck related fields */
+ GList *all_bufs;
+ /* The GstBuffer that should arrive next in a GList */
+ GList *current_buf;
+ gboolean check_buffers;
+
+ /* 'min-buffer-frequency' config check */
+ gdouble min_buf_freq;
+ gint buffers_pushed;
+ gint last_buffers_pushed;
+ GstClockTime min_buf_freq_interval_ts;
+ GstClockTime min_buf_freq_first_buffer_ts;
+ GstClockTime min_buf_freq_start;
+};
+
+/**
+ * GstValidatePadMonitorClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate PadMonitor object class.
+ */
+struct _GstValidatePadMonitorClass {
+ GstValidateMonitorClass parent_class;
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_pad_monitor_get_type (void);
+
+GST_VALIDATE_API
+GstValidatePadMonitor * gst_validate_pad_monitor_new (GstPad * pad, GstValidateRunner * runner, GstValidateElementMonitor *element_monitor);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_PAD_MONITOR_H__ */
+
diff --git a/include/gst/validate/gst-validate-pipeline-monitor.h b/include/gst/validate/gst-validate-pipeline-monitor.h
new file mode 100644
index 0000000000..37c88bcc57
--- /dev/null
+++ b/include/gst/validate/gst-validate-pipeline-monitor.h
@@ -0,0 +1,98 @@
+/* GStreamer
+ * Copyright (C) 2014 Thibault Saunier <tsaunier@gnome.org>
+ *
+ * gst-validate-pipeline-monitor.h - Validate PipelineMonitor class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_PIPELINE_MONITOR_H__
+#define __GST_VALIDATE_PIPELINE_MONITOR_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include <gst/validate/gst-validate-bin-monitor.h>
+#include <gst/validate/gst-validate-runner.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_PIPELINE_MONITOR (gst_validate_pipeline_monitor_get_type ())
+#define GST_IS_VALIDATE_PIPELINE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_PIPELINE_MONITOR))
+#define GST_IS_VALIDATE_PIPELINE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_PIPELINE_MONITOR))
+#define GST_VALIDATE_PIPELINE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_PIPELINE_MONITOR, GstValidatePipelineMonitorClass))
+#define GST_VALIDATE_PIPELINE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_PIPELINE_MONITOR, GstValidatePipelineMonitor))
+#define GST_VALIDATE_PIPELINE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_PIPELINE_MONITOR, GstValidatePipelineMonitorClass))
+#define GST_VALIDATE_PIPELINE_MONITOR_CAST(obj) ((GstValidatePipelineMonitor*)(obj))
+#define GST_VALIDATE_PIPELINE_MONITOR_CLASS_CAST(klass) ((GstValidatePipelineMonitorClass*)(klass))
+#endif
+
+#define GST_VALIDATE_PIPELINE_MONITOR_GET_PIPELINE(m) (GST_PIPELINE_CAST (GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (m)))
+
+typedef struct _GstValidatePipelineMonitor GstValidatePipelineMonitor;
+typedef struct _GstValidatePipelineMonitorClass GstValidatePipelineMonitorClass;
+
+/**
+ * GstValidatePipelineMonitor:
+ *
+ * GStreamer Validate PipelineMonitor class.
+ *
+ * Class that wraps a #GstPipeline for Validate checks
+ */
+struct _GstValidatePipelineMonitor {
+ GstValidateBinMonitor parent;
+
+ /*< private >*/
+ gulong element_added_id;
+ guint print_pos_srcid;
+ gboolean buffering;
+ gboolean got_error;
+
+ /* TRUE if monitoring a playbin2 pipeline */
+ gboolean is_playbin;
+ /* TRUE if monitoring a playbin3 pipeline */
+ gboolean is_playbin3;
+
+ /* Latest collection received from GST_MESSAGE_STREAM_COLLECTION */
+ GstStreamCollection *stream_collection;
+ /* Latest GstStream received from GST_MESSAGE_STREAMS_SELECTED */
+ GList *streams_selected;
+
+ gulong deep_notify_id;
+};
+
+/**
+ * GstValidatePipelineMonitorClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate PipelineMonitor object class.
+ */
+struct _GstValidatePipelineMonitorClass {
+ GstValidateBinMonitorClass parent_class;
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_pipeline_monitor_get_type (void);
+
+GST_VALIDATE_API
+GstValidatePipelineMonitor * gst_validate_pipeline_monitor_new (GstPipeline * pipeline,
+ GstValidateRunner * runner, GstValidateMonitor * parent);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_PIPELINE_MONITOR_H__ */
+
diff --git a/include/gst/validate/gst-validate-report.h b/include/gst/validate/gst-validate-report.h
new file mode 100644
index 0000000000..c16a420e71
--- /dev/null
+++ b/include/gst/validate/gst-validate-report.h
@@ -0,0 +1,336 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-monitor-report.h - Validate Element report structures and functions
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_REPORT_H__
+#define __GST_VALIDATE_REPORT_H__
+
+#include <glib-object.h>
+
+typedef struct _GstValidateReport GstValidateReport;
+typedef guintptr GstValidateIssueId;
+
+#include <gst/gst.h>
+#include <gst/validate/validate-prelude.h>
+#include <gst/validate/gst-validate-reporter.h>
+#include "gst-validate-types.h"
+
+G_BEGIN_DECLS
+
+GST_VALIDATE_API
+GType gst_validate_report_get_type (void);
+#define GST_TYPE_VALIDATE_REPORT (gst_validate_report_get_type ())
+
+/**
+ * GstValidateDebugFlags:
+ * GST_VALIDATE_FATAL_DEFAULT:
+ * GST_VALIDATE_FATAL_ISSUES:
+ * GST_VALIDATE_FATAL_WARNINGS:
+ * GST_VALIDATE_FATAL_CRITICALS:
+ * GST_VALIDATE_PRINT_ISSUES:
+ * GST_VALIDATE_PRINT_WARNINGS:
+ * GST_VALIDATE_PRINT_CRITICALS:
+ */
+typedef enum {
+ GST_VALIDATE_FATAL_DEFAULT = 0,
+ GST_VALIDATE_FATAL_ISSUES = 1 << 0,
+ GST_VALIDATE_FATAL_WARNINGS = 1 << 1,
+ GST_VALIDATE_FATAL_CRITICALS = 1 << 2,
+ GST_VALIDATE_PRINT_ISSUES = 1 << 3,
+ GST_VALIDATE_PRINT_WARNINGS = 1 << 4,
+ GST_VALIDATE_PRINT_CRITICALS = 1 << 5
+} GstValidateDebugFlags;
+
+/**
+ * GstValidateReportLevel:
+ */
+typedef enum {
+ GST_VALIDATE_REPORT_LEVEL_CRITICAL,
+ GST_VALIDATE_REPORT_LEVEL_WARNING,
+ GST_VALIDATE_REPORT_LEVEL_ISSUE,
+ GST_VALIDATE_REPORT_LEVEL_IGNORE,
+ GST_VALIDATE_REPORT_LEVEL_UNKNOWN,
+ GST_VALIDATE_REPORT_LEVEL_EXPECTED,
+ GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES,
+} GstValidateReportLevel;
+
+#define _QUARK g_quark_from_static_string
+
+#define BUFFER_BEFORE_SEGMENT _QUARK("buffer::before-segment")
+#define BUFFER_IS_OUT_OF_SEGMENT _QUARK("buffer::is-out-of-segment")
+#define BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE _QUARK("buffer::timestamp-out-of-received-range")
+#define WRONG_FLOW_RETURN _QUARK("buffer::wrong-flow-return")
+#define BUFFER_AFTER_EOS _QUARK("buffer::after-eos")
+#define WRONG_BUFFER _QUARK("buffer::not-expected-one")
+#define FLOW_ERROR_WITHOUT_ERROR_MESSAGE _QUARK("buffer::flow-error-without-error-message")
+#define BUFFER_MISSING_DISCONT _QUARK("buffer::missing-discont")
+
+#define PULL_RANGE_FROM_WRONG_THREAD _QUARK("threading::pull-range-from-wrong-thread")
+
+#define CAPS_IS_MISSING_FIELD _QUARK("caps::is-missing-field")
+#define CAPS_FIELD_HAS_BAD_TYPE _QUARK("caps::field-has-bad-type")
+#define CAPS_EXPECTED_FIELD_NOT_FOUND _QUARK("caps::expected-field-not-found")
+#define GET_CAPS_NOT_PROXYING_FIELDS _QUARK("caps::not-proxying-fields")
+#define CAPS_FIELD_UNEXPECTED_VALUE _QUARK("caps::field-unexpected-value")
+
+#define EVENT_NEWSEGMENT_NOT_PUSHED _QUARK("event::newsegment-not-pushed")
+#define SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME _QUARK("event::serialized-event-wasnt-pushed-in-time")
+
+#define EOS_HAS_WRONG_SEQNUM _QUARK("event::eos-has-wrong-seqnum")
+#define FLUSH_START_HAS_WRONG_SEQNUM _QUARK("event::flush-start-has-wrong-seqnum")
+#define FLUSH_STOP_HAS_WRONG_SEQNUM _QUARK("event::flush-stop-has-wrong-seqnum")
+#define SEGMENT_HAS_WRONG_SEQNUM _QUARK("event::segment-has-wrong-seqnum")
+#define SEGMENT_HAS_WRONG_START _QUARK("event::segment-has-wrong-start")
+
+
+#define EVENT_SERIALIZED_OUT_OF_ORDER _QUARK("event::serialized-out-of-order")
+#define EVENT_NEW_SEGMENT_MISMATCH _QUARK("event::segment-mismatch")
+#define EVENT_FLUSH_START_UNEXPECTED _QUARK("event::flush-start-unexpected")
+#define EVENT_FLUSH_STOP_UNEXPECTED _QUARK("event::flush-stop-unexpected")
+#define EVENT_CAPS_DUPLICATE _QUARK("event::caps-duplicate")
+#define EVENT_SEEK_NOT_HANDLED _QUARK("event::seek-not-handled")
+#define EVENT_SEEK_RESULT_POSITION_WRONG _QUARK("event::seek-result-position-wrong")
+#define EVENT_SEEK_INVALID_SEQNUM _QUARK("event::seek-invalid_seqnum")
+#define EVENT_EOS_WITHOUT_SEGMENT _QUARK("event::eos-without-segment")
+#define EVENT_INVALID_SEQNUM _QUARK("event::invalid-seqnum")
+
+#define STATE_CHANGE_FAILURE _QUARK("state::change-failure")
+
+#define FILE_NO_STREAM_INFO _QUARK("file-checking::no-stream-info")
+#define FILE_NO_STREAM_ID _QUARK("file-checking::no-stream-id")
+#define FILE_TAG_DETECTION_INCORRECT _QUARK("file-checking::tag-detection-incorrect")
+#define FILE_SIZE_INCORRECT _QUARK("file-checking::size-incorrect")
+#define FILE_DURATION_INCORRECT _QUARK("file-checking::duration-incorrect")
+#define FILE_SEEKABLE_INCORRECT _QUARK("file-checking::seekable-incorrect")
+#define FILE_PROFILE_INCORRECT _QUARK("file-checking::profile-incorrect")
+#define FILE_FRAMES_INCORRECT _QUARK("file-checking::frames-incorrect")
+#define FILE_SEGMENT_INCORRECT _QUARK("file-checking::segment-incorrect")
+
+#define ALLOCATION_FAILURE _QUARK("runtime::allocation-failure")
+#define MISSING_PLUGIN _QUARK("runtime::missing-plugin")
+#define NOT_NEGOTIATED _QUARK("runtime::not-negotiated")
+#define WARNING_ON_BUS _QUARK("runtime::warning-on-bus")
+#define ERROR_ON_BUS _QUARK("runtime::error-on-bus")
+
+#define QUERY_POSITION_SUPERIOR_DURATION _QUARK("query::position-superior-duration")
+#define QUERY_POSITION_OUT_OF_SEGMENT _QUARK("query::position-out-of-segment")
+
+#define SCENARIO_NOT_ENDED _QUARK("scenario::not-ended")
+#define SCENARIO_FILE_MALFORMED _QUARK("scenario::malformed")
+#define SCENARIO_ACTION_EXECUTION_ERROR _QUARK("scenario::execution-error")
+#define SCENARIO_ACTION_CHECK_ERROR _QUARK("scenario::check-error")
+#define SCENARIO_ACTION_TIMEOUT _QUARK("scenario::action-timeout")
+#define SCENARIO_ACTION_EXECUTION_ISSUE _QUARK("scenario::execution-issue")
+
+#define CONFIG_LATENCY_TOO_HIGH _QUARK("config::latency-too-high")
+#define CONFIG_TOO_MANY_BUFFERS_DROPPED _QUARK("config::too-many-buffers-dropped")
+#define CONFIG_BUFFER_FREQUENCY_TOO_LOW _QUARK("config::buffer-frequency-too-low")
+
+#define G_LOG_ISSUE _QUARK("g-log::issue")
+#define G_LOG_WARNING _QUARK("g-log::warning")
+#define G_LOG_CRITICAL _QUARK("g-log::critical")
+
+/**
+ * GstValidateIssueFlags:
+ * GST_VALIDATE_ISSUE_FLAGS_NONE: No special flags for the issue type
+ * GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS: Always show all accurences of the issue in full details
+ * GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE: Do not generate backtrace for the issue type
+ */
+typedef enum {
+ GST_VALIDATE_ISSUE_FLAGS_NONE = 0,
+ GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS = 1 << 0,
+ GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE = 1 << 1,
+
+ /**
+ * GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE:
+ *
+ * Always generate backtrace, even if not a critical issue
+ *
+ * Since: 1.20
+ */
+ GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE = 1 << 2,
+} GstValidateIssueFlags;
+
+typedef struct {
+ GstValidateIssueId issue_id;
+
+ /* Summary: one-liner translatable description of the issue */
+ gchar *summary;
+ /* description: multi-line translatable description of:
+ * * what the issue is (and why it's an issue)
+ * * what the source problem could be
+ * * pointers to fixing the issue
+ */
+ gchar *description;
+
+ /* The name of the area of issue
+ * this one is in */
+ gchar *area;
+ /* The name of the issue type */
+ gchar *name;
+
+ /* default_level: The default level of severity for this
+ * issue. */
+ GstValidateReportLevel default_level;
+
+ gint refcount;
+
+ GstValidateIssueFlags flags;
+
+ gpointer _gst_reserved[GST_PADDING];
+
+} GstValidateIssue;
+
+GST_VALIDATE_API
+GType gst_validate_issue_get_type (void);
+
+struct _GstValidateReport {
+ GstMiniObject mini_object;
+
+ /* issue: The issue this report corresponds to (to get description, summary,...) */
+ GstValidateIssue *issue;
+
+ GstValidateReportLevel level;
+
+ /* The reporter that reported the issue (to get names, info, ...) */
+ GstValidateReporter *reporter;
+
+ /* timestamp: The time at which this issue happened since
+ * the process start (to stay in sync with gst logging) */
+ GstClockTime timestamp;
+
+ /* message: issue-specific message. Gives more detail on the actual
+ * issue. Can be NULL */
+ gchar *message;
+
+ /* When reporter->intercept_report returns KEEP, the report is not
+ * added to the runner. It can be added as a "shadow_report" to
+ * the upstream report, which is tracked by the runner. */
+ GMutex shadow_reports_lock;
+ GstValidateReport *master_report;
+ GList *shadow_reports;
+
+ /* Lists the reports that were repeated inside the same reporter */
+ GList *repeated_reports;
+
+ GstValidateReportingDetails reporting_level;
+ gchar *reporter_name;
+ gchar *trace;
+ gchar *dotfile_name;
+
+ gpointer _gst_reserved[GST_PADDING - 2];
+};
+
+void gst_validate_report_add_message (GstValidateReport *report,
+ const gchar *message);
+
+#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s: %s"
+#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), \
+ gst_validate_report_level_get_name (i->default_level), \
+ i->area, \
+ i->summary
+
+#define GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT " <%s>: %" GST_VALIDATE_ISSUE_FORMAT ": %s"
+#define GST_VALIDATE_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
+ gst_validate_reporter_get_name (r->reporter), \
+ GST_VALIDATE_ISSUE_ARGS (r->issue), \
+ r->message
+GST_VALIDATE_API
+void gst_validate_report_init (void);
+GST_VALIDATE_API
+GstValidateIssue *gst_validate_issue_from_id (GstValidateIssueId issue_id);
+GST_VALIDATE_API
+GstValidateIssueId gst_validate_issue_get_id (GstValidateIssue * issue);
+GST_VALIDATE_API
+void gst_validate_issue_register (GstValidateIssue * issue);
+GST_VALIDATE_API
+GstValidateIssue *gst_validate_issue_new (GstValidateIssueId issue_id, const gchar * summary,
+ const gchar * description,
+ GstValidateReportLevel default_level);
+GST_VALIDATE_API
+GstValidateIssue* gst_validate_issue_new_full(GstValidateIssueId issue_id, const gchar* summary,
+ const gchar* description, GstValidateReportLevel default_level,
+ GstValidateIssueFlags flags);
+GST_VALIDATE_API
+void gst_validate_issue_set_default_level (GstValidateIssue *issue,
+ GstValidateReportLevel default_level);
+
+GST_VALIDATE_API
+GstValidateReport *gst_validate_report_new (GstValidateIssue * issue,
+ GstValidateReporter * reporter,
+ const gchar * message);
+GST_VALIDATE_API
+void gst_validate_report_unref (GstValidateReport * report);
+GST_VALIDATE_API
+GstValidateReport *gst_validate_report_ref (GstValidateReport * report);
+
+GST_VALIDATE_API
+GstValidateIssueId gst_validate_report_get_issue_id (GstValidateReport * report);
+
+GST_VALIDATE_API
+gboolean gst_validate_report_check_abort (GstValidateReport * report);
+GST_VALIDATE_API
+void gst_validate_report_printf (GstValidateReport * report);
+GST_VALIDATE_API
+void gst_validate_report_print_level (GstValidateReport *report);
+GST_VALIDATE_API
+void gst_validate_report_print_detected_on (GstValidateReport *report);
+GST_VALIDATE_API
+void gst_validate_report_print_details (GstValidateReport *report);
+GST_VALIDATE_API
+void gst_validate_report_print_description (GstValidateReport *report);
+
+GST_VALIDATE_API
+const gchar * gst_validate_report_level_get_name (GstValidateReportLevel level);
+
+GST_VALIDATE_API
+void gst_validate_printf (gpointer source,
+ const gchar * format,
+ ...) G_GNUC_PRINTF (2, 3) G_GNUC_NO_INSTRUMENT;
+GST_VALIDATE_API
+void gst_validate_print_action (GstValidateAction *action, const gchar * message);
+GST_VALIDATE_API
+void gst_validate_printf_valist (gpointer source,
+ const gchar * format,
+ va_list args) G_GNUC_PRINTF (2, 0) G_GNUC_NO_INSTRUMENT;
+GST_VALIDATE_API
+gboolean gst_validate_report_should_print (GstValidateReport * report);
+GST_VALIDATE_API
+gboolean gst_validate_report_set_master_report(GstValidateReport *report, GstValidateReport *master_report);
+GST_VALIDATE_API
+void gst_validate_report_set_reporting_level (GstValidateReport *report, GstValidateReportingDetails level);
+GST_VALIDATE_API
+void gst_validate_report_add_repeated_report (GstValidateReport *report, GstValidateReport *repeated_report);
+GST_VALIDATE_API
+GstValidateReportLevel gst_validate_report_level_from_name (const gchar *level_name);
+GST_VALIDATE_API
+void gst_validate_print_position(GstClockTime position, GstClockTime duration, gdouble rate, gchar* extra_info);
+GST_VALIDATE_API void gst_validate_print_issues (void);
+
+GST_VALIDATE_API
+void gst_validate_error_structure (gpointer action, const gchar* format, ...) G_GNUC_PRINTF (2, 3);
+GST_VALIDATE_API
+void gst_validate_abort (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
+GST_VALIDATE_API
+void gst_validate_skip_test (const gchar* format, ...);
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_REPORT_H__ */
+
diff --git a/include/gst/validate/gst-validate-reporter.h b/include/gst/validate/gst-validate-reporter.h
new file mode 100644
index 0000000000..c4e6180368
--- /dev/null
+++ b/include/gst/validate/gst-validate-reporter.h
@@ -0,0 +1,158 @@
+/* GStreamer
+ *
+ * Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef _GST_VALIDATE_REPORTER_
+#define _GST_VALIDATE_REPORTER_
+
+typedef struct _GstValidateReporter GstValidateReporter;
+typedef struct _GstValidateReporterInterface GstValidateReporterInterface;
+
+#include <glib-object.h>
+#include <gst/validate/validate-prelude.h>
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-runner.h>
+#include <gst/validate/gst-validate-enums.h>
+#include <gst/validate/gst-validate-scenario.h>
+
+G_BEGIN_DECLS
+
+/* GstValidateReporter interface declarations */
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_REPORTER (gst_validate_reporter_get_type ())
+#define GST_VALIDATE_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_REPORTER, GstValidateReporter))
+#define GST_IS_VALIDATE_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_REPORTER))
+#define GST_VALIDATE_REPORTER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VALIDATE_REPORTER, GstValidateReporterInterface))
+#define GST_VALIDATE_REPORTER_CAST(obj) ((GstValidateReporter *) obj)
+#endif
+
+/**
+ * GST_VALIDATE_REPORT:
+ * @m: The #GstValidateReporter where the issue happened
+ * @issue_id: The #GstValidateIssueId of the issue
+ * @...: The format of the message describing the issue in a printf
+ * format, followed by the parameters.
+ *
+ * Reports a new issue in the GstValidate reporting system with @m
+ * as the source of that issue.
+ */
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_VALIDATE_REPORT(m, issue_id, ...) \
+ G_STMT_START { \
+ gst_validate_report (GST_VALIDATE_REPORTER (m), \
+ issue_id, \
+ __VA_ARGS__ ); \
+ } G_STMT_END
+
+#define GST_VALIDATE_REPORT_ACTION(m, a, issue_id, ...) \
+ G_STMT_START { \
+ gst_validate_report_action (GST_VALIDATE_REPORTER (m), a, \
+ issue_id, \
+ __VA_ARGS__ ); \
+ } G_STMT_END
+
+#else /* G_HAVE_GNUC_VARARGS */
+#ifdef G_HAVE_GNUC_VARARGS
+#define GST_VALIDATE_REPORT(m, issue_id, args...) \
+ G_STMT_START { \
+ gst_validate_report (GST_VALIDATE_REPORTER (m), \
+ issue_id, ##args ); \
+ } G_STMT_END
+#define GST_VALIDATE_REPORT_ACTION(m, a, issue_id, args...) \
+ G_STMT_START { \
+ gst_validate_report_action (GST_VALIDATE_REPORTER (m), a, \
+ issue_id, ##args ); \
+ } G_STMT_END
+#endif /* G_HAVE_ISO_VARARGS */
+#endif /* G_HAVE_GNUC_VARARGS */
+GST_VALIDATE_API
+GType gst_validate_reporter_get_type (void);
+
+/**
+ * GstValidateInterceptionReturn:
+ * @GST_VALIDATE_REPORTER_DROP: The report will be completely ignored.
+ * @GST_VALIDATE_REPORTER_KEEP: The report will be kept by the reporter,
+ * but not reported to the runner.
+ * @GST_VALIDATE_REPORTER_REPORT: The report will be kept by the reporter
+ * and reported to the runner.
+ */
+typedef enum
+{
+ GST_VALIDATE_REPORTER_DROP,
+ GST_VALIDATE_REPORTER_KEEP,
+ GST_VALIDATE_REPORTER_REPORT
+} GstValidateInterceptionReturn;
+
+/**
+ * GstValidateReporter:
+ */
+struct _GstValidateReporterInterface
+{
+ GTypeInterface parent;
+
+ GstValidateInterceptionReturn (*intercept_report) (GstValidateReporter * reporter,
+ GstValidateReport * report);
+ GstValidateReportingDetails (*get_reporting_level) (GstValidateReporter * reporter);
+ GstPipeline * (*get_pipeline) (GstValidateReporter *reporter);
+};
+
+GST_VALIDATE_API
+void gst_validate_reporter_set_name (GstValidateReporter * reporter,
+ gchar * name);
+GST_VALIDATE_API
+const gchar * gst_validate_reporter_get_name (GstValidateReporter * reporter);
+GST_VALIDATE_API
+GstValidateRunner * gst_validate_reporter_get_runner (GstValidateReporter *reporter);
+GST_VALIDATE_API
+void gst_validate_reporter_init (GstValidateReporter * reporter, const gchar *name);
+GST_VALIDATE_API
+void gst_validate_report (GstValidateReporter * reporter, GstValidateIssueId issue_id,
+ const gchar * format, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NO_INSTRUMENT;
+GST_VALIDATE_API
+void gst_validate_report_action (GstValidateReporter * reporter,
+ GstValidateAction *action,
+ GstValidateIssueId issue_id,
+ const gchar * format, ...) G_GNUC_PRINTF (4, 5) G_GNUC_NO_INSTRUMENT;
+GST_VALIDATE_API
+void gst_validate_report_valist (GstValidateReporter * reporter, GstValidateIssueId issue_id,
+ const gchar * format, va_list var_args) G_GNUC_PRINTF (3, 0);
+GST_VALIDATE_API void
+gst_validate_reporter_report_simple (GstValidateReporter * reporter, GstValidateIssueId issue_id,
+ const gchar * message);
+
+GST_VALIDATE_API
+void gst_validate_reporter_set_runner (GstValidateReporter * reporter, GstValidateRunner *runner);
+GST_VALIDATE_API
+void gst_validate_reporter_set_handle_g_logs (GstValidateReporter * reporter);
+GST_VALIDATE_API
+GstValidateReport * gst_validate_reporter_get_report (GstValidateReporter *reporter,
+ GstValidateIssueId issue_id);
+GST_VALIDATE_API
+GList * gst_validate_reporter_get_reports (GstValidateReporter * reporter);
+GST_VALIDATE_API
+gint gst_validate_reporter_get_reports_count (GstValidateReporter *reporter);
+GST_VALIDATE_API
+GstValidateReportingDetails gst_validate_reporter_get_reporting_level (GstValidateReporter *reporter);
+
+GST_VALIDATE_API
+void gst_validate_reporter_purge_reports (GstValidateReporter * reporter);
+GST_VALIDATE_API
+GstPipeline * gst_validate_reporter_get_pipeline (GstValidateReporter * reporter);
+
+G_END_DECLS
+#endif /* _GST_VALIDATE_REPORTER_ */
diff --git a/include/gst/validate/gst-validate-runner.h b/include/gst/validate/gst-validate-runner.h
new file mode 100644
index 0000000000..e513803182
--- /dev/null
+++ b/include/gst/validate/gst-validate-runner.h
@@ -0,0 +1,104 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-validate-runner.h - Validate Runner class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_RUNNER_H__
+#define __GST_VALIDATE_RUNNER_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+#include <gst/gsttracer.h>
+
+typedef struct _GstValidateRunner GstValidateRunner;
+typedef struct _GstValidateRunnerClass GstValidateRunnerClass;
+
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-enums.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_RUNNER (gst_validate_runner_get_type ())
+#define GST_IS_VALIDATE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_RUNNER))
+#define GST_IS_VALIDATE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_RUNNER))
+#define GST_VALIDATE_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_RUNNER, GstValidateRunnerClass))
+#define GST_VALIDATE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_RUNNER, GstValidateRunner))
+#define GST_VALIDATE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_RUNNER, GstValidateRunnerClass))
+#define GST_VALIDATE_RUNNER_CAST(obj) ((GstValidateRunner*)(obj))
+#define GST_VALIDATE_RUNNER_CLASS_CAST(klass) ((GstValidateRunnerClass*)(klass))
+#endif
+
+typedef struct _GstValidateRunnerPrivate GstValidateRunnerPrivate;
+
+/**
+ * GstValidateRunner:
+ *
+ * GStreamer Validate Runner class.
+ *
+ * Class that manages a Validate test run for some pipeline
+ */
+struct _GstValidateRunner {
+ GstTracer object;
+
+ /* <private> */
+ GstValidateRunnerPrivate *priv;
+};
+
+/**
+ * GstValidateRunnerClass:
+ * @parent_class: parent
+ *
+ * GStreamer Validate Runner object class.
+ */
+struct _GstValidateRunnerClass {
+ GstTracerClass parent_class;
+};
+
+/* normal GObject stuff */
+GST_VALIDATE_API
+GType gst_validate_runner_get_type (void);
+
+GST_VALIDATE_API
+GstValidateRunner * gst_validate_runner_new (void);
+
+GST_VALIDATE_API
+void gst_validate_runner_add_report (GstValidateRunner * runner, GstValidateReport * report);
+
+GST_VALIDATE_API
+guint gst_validate_runner_get_reports_count (GstValidateRunner * runner);
+GST_VALIDATE_API
+GList * gst_validate_runner_get_reports (GstValidateRunner * runner);
+
+GST_VALIDATE_API
+int gst_validate_runner_printf (GstValidateRunner * runner);
+GST_VALIDATE_API
+int gst_validate_runner_exit (GstValidateRunner * runner, gboolean print_result);
+
+GST_VALIDATE_API
+GstValidateReportingDetails gst_validate_runner_get_default_reporting_level (GstValidateRunner *runner);
+GST_VALIDATE_API
+GstValidateReportingDetails gst_validate_runner_get_reporting_level_for_name (GstValidateRunner *runner,
+ const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_RUNNER_H__ */
+
diff --git a/include/gst/validate/gst-validate-scenario.h b/include/gst/validate/gst-validate-scenario.h
new file mode 100644
index 0000000000..dc8a7e1a4e
--- /dev/null
+++ b/include/gst/validate/gst-validate-scenario.h
@@ -0,0 +1,425 @@
+/* GStreamer
+ * Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * gst-validate-runner.c - Validate Runner class
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_SCENARIO_H__
+#define __GST_VALIDATE_SCENARIO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "gst-validate-types.h"
+#include <gst/validate/gst-validate-runner.h>
+
+G_BEGIN_DECLS
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_SCENARIO (gst_validate_scenario_get_type ())
+#define GST_VALIDATE_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenario))
+#define GST_VALIDATE_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioClass))
+#define GST_IS_VALIDATE_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_SCENARIO))
+#define GST_IS_VALIDATE_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_SCENARIO))
+#define GST_VALIDATE_SCENARIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioClass))
+#endif
+
+typedef struct _GstValidateScenarioPrivate GstValidateScenarioPrivate;
+typedef struct _GstValidateActionParameter GstValidateActionParameter;
+
+/**
+ * GstValidateActionReturn:
+ * GST_VALIDATE_EXECUTE_ACTION_ERROR:
+ * GST_VALIDATE_EXECUTE_ACTION_OK:
+ * GST_VALIDATE_EXECUTE_ACTION_ASYNC:
+ * GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED:
+ * GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS:
+ * GST_VALIDATE_EXECUTE_ACTION_NONE:
+ * GST_VALIDATE_EXECUTE_ACTION_DONE:
+ */
+typedef enum
+{
+ GST_VALIDATE_EXECUTE_ACTION_ERROR,
+ GST_VALIDATE_EXECUTE_ACTION_OK,
+ GST_VALIDATE_EXECUTE_ACTION_ASYNC,
+
+ /**
+ * GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING:
+ *
+ * The action will be executed asynchronously without blocking further
+ * actions to be executed
+ *
+ * Since: 1.20
+ */
+ GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING,
+
+ /**
+ * GST_VALIDATE_EXECUTE_ACTION_INTERLACED:
+ *
+ * Deprecated: 1.20: Use #GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING instead.
+ */
+ GST_VALIDATE_EXECUTE_ACTION_INTERLACED = GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING,
+ GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED,
+ GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS,
+ GST_VALIDATE_EXECUTE_ACTION_NONE,
+ GST_VALIDATE_EXECUTE_ACTION_DONE,
+} GstValidateActionReturn;
+
+const gchar *gst_validate_action_return_get_name (GstValidateActionReturn r);
+
+/* TODO 2.0 -- Make it an actual enum type */
+#define GstValidateExecuteActionReturn gint
+
+/**
+ * GstValidateExecuteAction:
+ * @scenario: The #GstValidateScenario from which the @action is executed
+ * @action: The #GstValidateAction being executed
+ *
+ * A function that executes a #GstValidateAction
+ *
+ * Returns: a #GstValidateExecuteActionReturn
+ */
+typedef GstValidateExecuteActionReturn (*GstValidateExecuteAction) (GstValidateScenario * scenario, GstValidateAction * action);
+
+/**
+ * GstValidatePrepareAction:
+ * @action: The #GstValidateAction to prepare before execution
+ *
+ * A function that prepares @action so it can be executed right after.
+ * Most of the time this function is used to parse and set fields with
+ * equations in the action structure.
+ *
+ * Returns: %TRUE if the action could be prepared and is ready to be run
+ * , %FALSE otherwise
+ */
+typedef GstValidateExecuteActionReturn (*GstValidatePrepareAction) (GstValidateAction * action);
+
+
+typedef struct _GstValidateActionPrivate GstValidateActionPrivate;
+
+#define GST_VALIDATE_ACTION_LINENO(action) (((GstValidateAction*) action)->ABI.abi.lineno)
+#define GST_VALIDATE_ACTION_FILENAME(action) (((GstValidateAction*) action)->ABI.abi.filename)
+#define GST_VALIDATE_ACTION_DEBUG(action) (((GstValidateAction*) action)->ABI.abi.debug)
+#define GST_VALIDATE_ACTION_N_REPEATS(action) (((GstValidateAction*) action)->ABI.abi.n_repeats)
+#define GST_VALIDATE_ACTION_RANGE_NAME(action) (((GstValidateAction*) action)->ABI.abi.rangename)
+
+/**
+ * GstValidateAction:
+ * @type: The type of the #GstValidateAction, which is the name of the
+ * GstValidateActionType registered with
+ * #gst_validate_register_action_type
+ * @name: The name of the action, set from the user in the scenario
+ * @structure: the #GstStructure defining the action
+ * @scenario: The scenario for this action. This is not thread-safe
+ * and should be accessed exclusively from the main thread.
+ * If you need to access it from another thread use the
+ * #gst_validate_action_get_scenario method
+ *
+ * The GstValidateAction defined to be executed as part of a scenario
+ *
+ * Only access it from the default main context.
+ */
+struct _GstValidateAction
+{
+ GstMiniObject mini_object;
+
+ /*< public > */
+ const gchar *type;
+ const gchar *name;
+ GstStructure *structure;
+
+ /* < private > */
+ guint action_number;
+ gint repeat;
+ GstClockTime playback_time;
+
+ GstValidateActionPrivate *priv;
+
+ union {
+ gpointer _gst_reserved[GST_PADDING_LARGE - 1]; /* ->priv */
+ struct {
+ gint lineno;
+ gchar *filename;
+ gchar *debug;
+ gint n_repeats;
+ const gchar *rangename;
+ } abi;
+ } ABI;
+};
+
+GST_VALIDATE_API
+void gst_validate_action_set_done (GstValidateAction *action);
+GST_VALIDATE_API
+GstValidateScenario * gst_validate_action_get_scenario (GstValidateAction *action);
+GST_VALIDATE_API
+GstValidateAction * gst_validate_action_new (GstValidateScenario * scenario,
+ GstValidateActionType * action_type,
+ GstStructure *structure,
+ gboolean add_to_lists);
+GST_VALIDATE_API
+GstValidateAction* gst_validate_action_ref (GstValidateAction * action);
+GST_VALIDATE_API
+void gst_validate_action_unref (GstValidateAction * action);
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ())
+#define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
+#define GST_VALIDATE_ACTION_GET_TYPE(obj) ((GstValidateActionType*)gst_validate_get_action_type(((GstValidateAction*)obj)->type))
+#endif
+
+GST_VALIDATE_API
+GType gst_validate_action_get_type (void);
+
+/**
+ * GstValidateActionTypeFlags:
+ * @GST_VALIDATE_ACTION_TYPE_NONE: No special flag
+ * @GST_VALIDATE_ACTION_TYPE_CONFIG: The action is a config
+ * @GST_VALIDATE_ACTION_TYPE_ASYNC: The action can be executed ASYNC
+ * @GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION: The action will be executed on 'element-added'
+ * for a particular element type if no playback-time
+ * is specified
+ * @GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK: The pipeline will need to be synchronized with the clock
+ * for that action type to be used.
+ * @GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL: Do not consider the non execution of the action
+ * as a fatal error.
+ * @GST_VALIDATE_ACTION_TYPE_CAN_BE_OPTIONAL: The action can use the 'optional' keyword. Such action
+ * instances will have the #GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL
+ * flag set and won't be considered as fatal if they fail.
+ * @GST_VALIDATE_ACTION_TYPE_HANDLED_IN_CONFIG: The action can be used in config files even if it is not strictly a config
+ * action (ie. it needs a scenario to run).
+ */
+typedef enum
+{
+ GST_VALIDATE_ACTION_TYPE_NONE = 0,
+ GST_VALIDATE_ACTION_TYPE_CONFIG = 1 << 1,
+ GST_VALIDATE_ACTION_TYPE_ASYNC = 1 << 2,
+ GST_VALIDATE_ACTION_TYPE_NON_BLOCKING = 1 << 3,
+
+ /**
+ * GST_VALIDATE_ACTION_TYPE_INTERLACED:
+ *
+ * Deprecated: 1.20: Use #GST_VALIDATE_ACTION_TYPE_NON_BLOCKING instead.
+ */
+ GST_VALIDATE_ACTION_TYPE_INTERLACED = 1 << 3,
+
+ /**
+ * GST_VALIDATE_ACTION_TYPE_NON_BLOCKING:
+ *
+ * The action can be executed asynchronously but without blocking further
+ * actions execution.
+ *
+ * Since: 1.20
+ */
+ GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION = 1 << 4,
+ GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK = 1 << 5,
+ GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL = 1 << 6,
+ GST_VALIDATE_ACTION_TYPE_CAN_BE_OPTIONAL = 1 << 7,
+ GST_VALIDATE_ACTION_TYPE_DOESNT_NEED_PIPELINE = 1 << 8,
+ GST_VALIDATE_ACTION_TYPE_HANDLED_IN_CONFIG = 1 << 9,
+} GstValidateActionTypeFlags;
+
+typedef struct _GstValidateActionTypePrivate GstValidateActionTypePrivate;
+
+/**
+ * GstValidateActionType:
+ * @name: The name of the new action type to add
+ * @implementer_namespace: The namespace of the implementer of the action type
+ * @execute: The function to be called to execute the action
+ * @parameters: (allow-none) (array zero-terminated=1) (element-type GstValidateActionParameter): The #GstValidateActionParameter usable as parameter of the type
+ * @description: A description of the new type
+ * @flags: The flags of the action type
+ */
+struct _GstValidateActionType
+{
+ GstMiniObject mini_object;
+
+ gchar *name;
+ gchar *implementer_namespace;
+
+ GstValidatePrepareAction prepare;
+ GstValidateExecuteAction execute;
+
+ GstValidateActionParameter *parameters;
+
+ gchar *description;
+ GstValidateActionTypeFlags flags;
+
+ GstRank rank;
+
+ GstValidateActionType *overriden_type;
+ GstValidateActionTypePrivate* priv;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE - sizeof (GstRank) - 2];
+};
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_ACTION_TYPE (gst_validate_action_type_get_type ())
+#define GST_IS_VALIDATE_ACTION_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION_TYPE))
+#define GST_VALIDATE_ACTION_TYPE(obj) ((GstValidateActionType*) obj)
+#endif
+
+GST_VALIDATE_API
+GType gst_validate_action_type_get_type (void);
+
+GST_VALIDATE_API
+gboolean gst_validate_print_action_types (const gchar ** wanted_types, gint num_wanted_types);
+
+/**
+ * GstValidateActionParameter:
+ * @name: The name of the parameter
+ * @description: The description of the parameter
+ * @mandatory: Whether the parameter is mandatory for
+ * a specific action type
+ * @types: The types the parameter can take described as a
+ * string. It can be precisely describing how the typing works
+ * using '\n' between the various acceptable types.
+ * NOTE: The types should end with `(GstClockTime)` if its final
+ * type is a GstClockTime, this way it will be processed when preparing
+ * the actions.
+ * @possible_variables: The name of the variables that can be
+ * used to compute the value of the parameter.
+ * For example for the start value of a seek
+ * action, we will accept to take 'duration'
+ * which will be replace by the total duration
+ * of the stream on which the action is executed.
+ * @def: The default value of a parameter as a string, should be %NULL
+ * for mandatory streams.
+ */
+struct _GstValidateActionParameter
+{
+ const gchar *name;
+ const gchar *description;
+ gboolean mandatory;
+ const gchar *types;
+ const gchar *possible_variables;
+ const gchar *def;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstValidateScenarioClass
+{
+ GstObjectClass parent_class;
+
+ /*< public >*/
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstValidateScenario:
+ */
+struct _GstValidateScenario
+{
+ GstObject parent;
+
+ /*< public >*/
+ GstStructure *description;
+
+ /*< private >*/
+ GstValidateScenarioPrivate *priv;
+
+ union {
+ gpointer _gst_reserved[GST_PADDING];
+ struct {
+ GMutex eos_handling_lock;
+ } abi;
+ } ABI;
+};
+
+/* Some actions may trigger EOS during their execution. Unlocked this
+ * could cause a race condition as the main thread may terminate the test
+ * in response to the EOS message in the bus while the action is still
+ * going in a different thread.
+ * To avoid this, the handling of the EOS message is protected with this
+ * lock. Actions expecting to cause an EOS can hold the lock for their
+ * duration so that they are guaranteed to finish before the EOS
+ * terminates the test. */
+#define GST_VALIDATE_SCENARIO_EOS_HANDLING_LOCK(scenario) (g_mutex_lock(&(scenario)->ABI.abi.eos_handling_lock))
+#define GST_VALIDATE_SCENARIO_EOS_HANDLING_UNLOCK(scenario) (g_mutex_unlock(&(scenario)->ABI.abi.eos_handling_lock))
+
+GST_VALIDATE_API
+GType gst_validate_scenario_get_type (void);
+
+GST_VALIDATE_API
+GstValidateScenario * gst_validate_scenario_factory_create (GstValidateRunner *runner,
+ GstElement *pipeline,
+ const gchar *scenario_name);
+GST_VALIDATE_API gboolean
+gst_validate_list_scenarios (gchar **scenarios,
+ gint num_scenarios,
+ gchar * output_file);
+
+GST_VALIDATE_API GstValidateActionType *
+gst_validate_get_action_type (const gchar *type_name);
+
+GST_VALIDATE_API GstValidateActionType *
+gst_validate_register_action_type (const gchar *type_name,
+ const gchar *implementer_namespace,
+ GstValidateExecuteAction function,
+ GstValidateActionParameter * parameters,
+ const gchar *description,
+ GstValidateActionTypeFlags flags);
+
+GST_VALIDATE_API GstValidateActionType *
+gst_validate_register_action_type_dynamic (GstPlugin *plugin,
+ const gchar * type_name,
+ GstRank rank,
+ GstValidateExecuteAction function,
+ GstValidateActionParameter * parameters,
+ const gchar * description,
+ GstValidateActionTypeFlags flags);
+
+
+GST_VALIDATE_API
+gboolean gst_validate_action_get_clocktime (GstValidateScenario * scenario,
+ GstValidateAction *action,
+ const gchar * name,
+ GstClockTime * retval);
+
+GST_VALIDATE_API GstValidateExecuteActionReturn
+gst_validate_scenario_execute_seek (GstValidateScenario *scenario,
+ GstValidateAction *action,
+ gdouble rate,
+ GstFormat format,
+ GstSeekFlags flags,
+ GstSeekType start_type,
+ GstClockTime start,
+ GstSeekType stop_type,
+ GstClockTime stop);
+
+GST_VALIDATE_API GList *
+gst_validate_scenario_get_actions (GstValidateScenario *scenario);
+GST_VALIDATE_API GstValidateExecuteActionReturn
+gst_validate_execute_action (GstValidateActionType * action_type,
+ GstValidateAction * action);
+
+GST_VALIDATE_API GstState
+gst_validate_scenario_get_target_state (GstValidateScenario *scenario);
+
+GST_VALIDATE_API GstElement *
+gst_validate_scenario_get_pipeline (GstValidateScenario * scenario);
+
+GST_VALIDATE_API
+void gst_validate_scenario_deinit (void);
+
+G_END_DECLS
+
+#endif /* __GST_VALIDATE_SCENARIOS__ */
diff --git a/include/gst/validate/gst-validate-types.h b/include/gst/validate/gst-validate-types.h
new file mode 100644
index 0000000000..6ba6c20924
--- /dev/null
+++ b/include/gst/validate/gst-validate-types.h
@@ -0,0 +1,30 @@
+/* GStreamer
+ *
+ * Copyright (C) 2015 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VALIDATE_TYPES_H__
+#define __GST_VALIDATE_TYPES_H__
+
+typedef struct _GstValidateScenario GstValidateScenario;
+typedef struct _GstValidateScenarioClass GstValidateScenarioClass;
+
+typedef struct _GstValidateAction GstValidateAction;
+typedef struct _GstValidateActionType GstValidateActionType;
+
+#endif /* __GST_VALIDATE_TYPES_ */
diff --git a/include/gst/validate/gst-validate-utils.h b/include/gst/validate/gst-validate-utils.h
new file mode 100644
index 0000000000..2589f18f15
--- /dev/null
+++ b/include/gst/validate/gst-validate-utils.h
@@ -0,0 +1,93 @@
+/* GStreamer
+ *
+ * Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * gst-validate-utils.h - Some utility functions
+ *
+ * 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.1 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; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EXPRESSION_PARSER_H
+#define EXPRESSION_PARSER_H
+
+#include<setjmp.h>
+#include<stdlib.h>
+#include<glib.h>
+#include<gio/gio.h>
+#include <gst/gst.h>
+#include "gst-validate-scenario.h"
+#include "gst-validate-reporter.h"
+
+typedef int (*GstValidateParseVariableFunc) (const gchar *name,
+ double *value, gpointer user_data);
+
+typedef gchar** (*GstValidateGetIncludePathsFunc)(const gchar* includer_file);
+
+GST_VALIDATE_API
+gdouble gst_validate_utils_parse_expression (const gchar *expr,
+ GstValidateParseVariableFunc variable_func,
+ gpointer user_data,
+ gchar **error);
+GST_VALIDATE_API
+guint gst_validate_utils_flags_from_str (GType type, const gchar * str_flags);
+GST_VALIDATE_API
+gboolean gst_validate_utils_enum_from_str (GType type,
+ const gchar * str_enum,
+ guint * enum_value);
+GST_VALIDATE_API
+gchar ** gst_validate_utils_get_strv (GstStructure *str, const gchar *fieldname);
+
+GST_VALIDATE_API
+GList * gst_validate_utils_structs_parse_from_filename (const gchar * scenario_file,
+ GstValidateGetIncludePathsFunc get_include_paths_func,
+ gchar **file_path);
+GST_VALIDATE_API
+GstStructure * gst_validate_utils_test_file_get_meta (const gchar * testfile, gboolean use_fakesinks);
+
+GST_VALIDATE_API
+GList * gst_validate_structs_parse_from_gfile (GFile * scenario_file,
+ GstValidateGetIncludePathsFunc get_include_paths_func);
+
+GST_VALIDATE_API
+gboolean gst_validate_element_has_klass (GstElement * element, const gchar * klass);
+GST_VALIDATE_API
+gboolean gst_validate_utils_get_clocktime (GstStructure *structure, const gchar * name,
+ GstClockTime * retval);
+
+GST_VALIDATE_API
+GstValidateActionReturn gst_validate_object_set_property (GstValidateReporter * reporter,
+ GObject * object,
+ const gchar * property,
+ const GValue * value,
+ gboolean optional);
+
+GST_VALIDATE_API
+void gst_validate_spin_on_fault_signals (void);
+
+GST_VALIDATE_API
+gboolean gst_validate_element_matches_target (GstElement * element, GstStructure * s);
+gchar * gst_validate_replace_variables_in_string (gpointer incom, GstStructure * local_vars, const gchar * in_string,
+ GstValidateStructureResolveVariablesFlags flags);
+GST_VALIDATE_API
+void gst_validate_structure_resolve_variables (gpointer source, GstStructure *structure, GstStructure *local_variables,
+ GstValidateStructureResolveVariablesFlags flags);
+void gst_validate_structure_set_variables_from_struct_file(GstStructure* vars, const gchar* struct_file);
+void gst_validate_set_globals(GstStructure* structure);
+GST_VALIDATE_API
+gboolean gst_validate_fail_on_missing_plugin(void);
+GST_VALIDATE_API gboolean gst_validate_has_colored_output(void);
+
+#endif
diff --git a/include/gst/validate/media-descriptor-parser.h b/include/gst/validate/media-descriptor-parser.h
new file mode 100644
index 0000000000..b10dc05fbd
--- /dev/null
+++ b/include/gst/validate/media-descriptor-parser.h
@@ -0,0 +1,83 @@
+/* GstValidate
+ *
+ * Copyright (c) 2012, Collabora Ltd
+ * Author: Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gst.h>
+#include "media-descriptor.h"
+
+G_BEGIN_DECLS
+
+GST_VALIDATE_API
+GType gst_validate_media_descriptor_parser_get_type (void);
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER (gst_validate_media_descriptor_parser_get_type ())
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParser))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParserClass))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParserClass))
+#endif
+
+typedef struct _GstValidateMediaDescriptorParserPrivate GstValidateMediaDescriptorParserPrivate;
+
+
+typedef struct {
+ GstValidateMediaDescriptor parent;
+
+ GstValidateMediaDescriptorParserPrivate *priv;
+
+} GstValidateMediaDescriptorParser;
+
+typedef struct {
+
+ GstValidateMediaDescriptorClass parent;
+
+} GstValidateMediaDescriptorParserClass;
+
+GST_VALIDATE_API
+GstValidateMediaDescriptorParser * gst_validate_media_descriptor_parser_new (GstValidateRunner *runner,
+ const gchar * xmlpath,
+ GError **error);
+GST_VALIDATE_API GstValidateMediaDescriptorParser *
+gst_validate_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
+ const gchar * xml,
+ GError ** error);
+GST_VALIDATE_API
+gchar * gst_validate_media_descriptor_parser_get_xml_path (GstValidateMediaDescriptorParser *parser);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_parser_add_stream (GstValidateMediaDescriptorParser *parser,
+ GstPad *pad);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_parser_add_taglist (GstValidateMediaDescriptorParser *parser,
+ GstTagList *taglist);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_parser_all_stream_found (GstValidateMediaDescriptorParser *parser);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_parser_all_tags_found (GstValidateMediaDescriptorParser *parser);
+
+G_END_DECLS
+
+#endif /* GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h */
diff --git a/include/gst/validate/media-descriptor-writer.h b/include/gst/validate/media-descriptor-writer.h
new file mode 100644
index 0000000000..334568b7c4
--- /dev/null
+++ b/include/gst/validate/media-descriptor-writer.h
@@ -0,0 +1,113 @@
+/* GstValidate
+ *
+ * Copyright (c) 2012, Collabora Ltd
+ * Author: Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gst.h>
+#include <gst/pbutils/pbutils.h>
+#include "media-descriptor.h"
+
+G_BEGIN_DECLS
+
+GST_VALIDATE_API
+GType gst_validate_media_descriptor_writer_get_type (void);
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER (gst_validate_media_descriptor_writer_get_type ())
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriter))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriterClass))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriterClass))
+#endif
+
+typedef struct _GstValidateMediaDescriptorWriterPrivate GstValidateMediaDescriptorWriterPrivate;
+
+
+typedef struct {
+ GstValidateMediaDescriptor parent;
+
+ GstValidateMediaDescriptorWriterPrivate *priv;
+
+} GstValidateMediaDescriptorWriter;
+
+typedef struct {
+
+ GstValidateMediaDescriptorClass parent;
+
+} GstValidateMediaDescriptorWriterClass;
+
+/**
+ * GstValidateMediaDescriptorWriterFlags
+ */
+typedef enum
+{
+ GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NONE = 1 << 0,
+ GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NO_PARSER = 1 << 1,
+ GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_FULL = 1 << 2,
+ GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_HANDLE_GLOGS = 1 << 3,
+} GstValidateMediaDescriptorWriterFlags;
+
+GST_VALIDATE_API
+GstValidateMediaDescriptorWriter * gst_validate_media_descriptor_writer_new_discover (GstValidateRunner *runner,
+ const gchar *uri,
+ GstValidateMediaDescriptorWriterFlags flags,
+ GError **err);
+
+GST_VALIDATE_API
+GstValidateMediaDescriptorWriter * gst_validate_media_descriptor_writer_new (GstValidateRunner *runner,
+ const gchar *location,
+ GstClockTime duration,
+ gboolean seekable);
+
+gchar * gst_validate_media_descriptor_writer_get_xml_path (GstValidateMediaDescriptorWriter *writer);
+
+gboolean gst_validate_media_descriptor_writer_detects_frames (GstValidateMediaDescriptorWriter *writer);
+GstClockTime gst_validate_media_descriptor_writer_get_duration (GstValidateMediaDescriptorWriter *writer);
+gboolean gst_validate_media_descriptor_writer_get_seekable (GstValidateMediaDescriptorWriter * writer);
+
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_writer_add_pad (GstValidateMediaDescriptorWriter *writer,
+ GstPad *pad);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_writer_add_taglist (GstValidateMediaDescriptorWriter *writer,
+ const GstTagList *taglist);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_writer_add_frame (GstValidateMediaDescriptorWriter *writer,
+ GstPad *pad,
+ GstBuffer *buf);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_writer_add_tags (GstValidateMediaDescriptorWriter *writer,
+ const gchar *stream_id,
+ const GstTagList *taglist);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_writer_write (GstValidateMediaDescriptorWriter * writer,
+ const gchar * filename);
+GST_VALIDATE_API
+gchar * gst_validate_media_descriptor_writer_serialize (GstValidateMediaDescriptorWriter *writer);
+
+
+G_END_DECLS
+
+#endif /* GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h */
diff --git a/include/gst/validate/media-descriptor.h b/include/gst/validate/media-descriptor.h
new file mode 100644
index 0000000000..65b3a57ac1
--- /dev/null
+++ b/include/gst/validate/media-descriptor.h
@@ -0,0 +1,194 @@
+/* GstValidate
+ *
+ * Copyright (c) 2012, Collabora Ltd.
+ * Author: Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VALIDATE_MEDIA_DESCRIPTOR_H__
+#define __GST_VALIDATE_MEDIA_DESCRIPTOR_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gst/gst.h>
+#include "gst-validate-report.h"
+
+G_BEGIN_DECLS
+
+#define GST_VALIDATE_UNKNOWN_UINT64 (G_MAXUINT64 - 2)
+#define GST_VALIDATE_UNKNOWN_BOOL (G_MAXUINT32 - 2)
+typedef struct
+{
+ /* Children */
+ /* GstValidateMediaTagNode */
+ GList *tags;
+
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateMediaTagsNode;
+
+/* Parsing structures */
+typedef struct
+{
+ /* Children */
+ /* GstValidateMediaStreamNode */
+ GList *streams;
+ /* GstValidateMediaTagsNode */
+ GstValidateMediaTagsNode *tags;
+
+ /* attributes */
+ guint64 id;
+ gchar *uri;
+ GstClockTime duration;
+ gboolean frame_detection;
+ gboolean skip_parsers;
+ gboolean seekable;
+
+ GstCaps *caps;
+
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateMediaFileNode;
+
+typedef struct
+{
+ /* Children */
+ GstTagList *taglist;
+
+ /* Testing infos */
+ gboolean found;
+
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateMediaTagNode;
+
+typedef struct
+{
+ /* Children */
+ /* GstValidateMediaFrameNode */
+ GList *frames;
+
+ /* GstValidateMediaTagsNode */
+ GstValidateMediaTagsNode *tags;
+
+ /* Attributes */
+ GstCaps *caps;
+ GList * segments;
+ gchar *id;
+ gchar *padname;
+
+ /* Testing infos */
+ GstPad *pad;
+ GList *cframe;
+
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateMediaStreamNode;
+
+typedef struct
+{
+ /* Attributes */
+ guint64 id;
+ guint64 offset;
+ guint64 offset_end;
+ GstClockTime duration;
+ GstClockTime pts, dts;
+ GstClockTime running_time;
+ gboolean is_keyframe;
+
+ GstBuffer *buf;
+
+ gchar *checksum;
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateMediaFrameNode;
+
+typedef struct
+{
+ gint next_frame_id;
+
+ GstSegment segment;
+
+ gchar *str_open;
+ gchar *str_close;
+} GstValidateSegmentNode;
+
+GST_VALIDATE_API
+void gst_validate_filenode_free (GstValidateMediaFileNode *
+ filenode);
+GST_VALIDATE_API
+gboolean gst_validate_tag_node_compare (GstValidateMediaTagNode *
+ tnode, const GstTagList * tlist);
+
+GST_VALIDATE_API
+GType gst_validate_media_descriptor_get_type (void);
+
+#ifndef __GI_SCANNER__
+#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR (gst_validate_media_descriptor_get_type ())
+#define GST_VALIDATE_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptor))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorClass))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR))
+#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorClass))
+#endif
+
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj) (&GST_VALIDATE_MEDIA_DESCRIPTOR(obj)->lock)
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_LOCK(obj) g_mutex_lock(GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj))
+#define GST_VALIDATE_MEDIA_DESCRIPTOR_UNLOCK(obj) g_mutex_unlock(GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj))
+
+typedef struct _GstValidateMediaDescriptorPrivate
+ GstValidateMediaDescriptorPrivate;
+
+typedef struct
+{
+ GstObject parent;
+
+ GstValidateMediaFileNode *filenode;
+
+ GMutex lock;
+
+ GstValidateMediaDescriptorPrivate *priv;
+} GstValidateMediaDescriptor;
+
+typedef struct
+{
+ GstObjectClass parent;
+
+} GstValidateMediaDescriptorClass;
+
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptors_compare (GstValidateMediaDescriptor *
+ ref, GstValidateMediaDescriptor * compared);
+GST_VALIDATE_API gboolean
+gst_validate_media_descriptor_detects_frames (GstValidateMediaDescriptor *
+ self);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_get_buffers (GstValidateMediaDescriptor *
+ self, GstPad * pad, GCompareFunc compare_func, GList ** bufs);
+GST_VALIDATE_API gboolean
+gst_validate_media_descriptor_has_frame_info (GstValidateMediaDescriptor *
+ self);
+GST_VALIDATE_API GstClockTime
+gst_validate_media_descriptor_get_duration (GstValidateMediaDescriptor * self);
+GST_VALIDATE_API
+gboolean gst_validate_media_descriptor_get_seekable (GstValidateMediaDescriptor
+ * self);
+GST_VALIDATE_API
+GList *gst_validate_media_descriptor_get_pads (GstValidateMediaDescriptor *
+ self);
+G_END_DECLS
+#endif
diff --git a/include/gst/validate/validate-prelude.h b/include/gst/validate/validate-prelude.h
new file mode 100644
index 0000000000..5163463765
--- /dev/null
+++ b/include/gst/validate/validate-prelude.h
@@ -0,0 +1,31 @@
+/* GStreamer Validate Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * validate-prelude.h: prelude include header for gst-validate library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VALIDATE_PRELUDE_H__
+#define __GST_VALIDATE_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifndef GST_VALIDATE_API
+#define GST_VALIDATE_API GST_EXPORT
+#endif
+
+#endif /* __GST_VALIDATE_PRELUDE_H__ */
diff --git a/include/gst/validate/validate.h b/include/gst/validate/validate.h
new file mode 100644
index 0000000000..64691b575a
--- /dev/null
+++ b/include/gst/validate/validate.h
@@ -0,0 +1,38 @@
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ */
+
+#ifndef _GST_VALIDATE_H
+#define _GST_VALIDATE_H
+
+#include <gst/validate/validate-prelude.h>
+
+#include <gst/validate/gst-validate-types.h>
+#include <gst/validate/gst-validate-enums.h>
+#include <gst/validate/gst-validate-scenario.h>
+
+#include <gst/validate/gst-validate-runner.h>
+#include <gst/validate/gst-validate-monitor-factory.h>
+#include <gst/validate/gst-validate-override-registry.h>
+#include <gst/validate/gst-validate-report.h>
+#include <gst/validate/gst-validate-reporter.h>
+#include <gst/validate/gst-validate-media-info.h>
+
+G_BEGIN_DECLS
+
+GST_VALIDATE_API
+void gst_validate_init (void);
+GST_VALIDATE_API
+void gst_validate_init_debug (void);
+GST_VALIDATE_API
+void gst_validate_deinit (void);
+GST_VALIDATE_API
+GList * gst_validate_plugin_get_config (GstPlugin * plugin);
+GST_VALIDATE_API
+gboolean gst_validate_is_initialized (void);
+GST_VALIDATE_API
+GstStructure *gst_validate_setup_test_file(const gchar * testfile, gboolean use_fakesinks);
+
+G_END_DECLS
+
+#endif /* _GST_VALIDATE_H */
diff --git a/include/gst/video/colorbalance.h b/include/gst/video/colorbalance.h
new file mode 100644
index 0000000000..282ded9fcd
--- /dev/null
+++ b/include/gst/video/colorbalance.h
@@ -0,0 +1,124 @@
+/* GStreamer Color Balance
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * color-balance.h: image color balance interface design
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_COLOR_BALANCE_H__
+#define __GST_COLOR_BALANCE_H__
+
+#include <gst/gst.h>
+#include <gst/video/colorbalancechannel.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_COLOR_BALANCE \
+ (gst_color_balance_get_type ())
+#define GST_COLOR_BALANCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, GstColorBalance))
+#define GST_IS_COLOR_BALANCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
+#define GST_COLOR_BALANCE_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceInterface))
+
+typedef struct _GstColorBalance GstColorBalance;
+typedef struct _GstColorBalanceInterface GstColorBalanceInterface;
+
+/**
+ * GstColorBalanceType:
+ * @GST_COLOR_BALANCE_HARDWARE: Color balance is implemented with dedicated
+ * hardware.
+ * @GST_COLOR_BALANCE_SOFTWARE: Color balance is implemented via software
+ * processing.
+ *
+ * An enumeration indicating whether an element implements color balancing
+ * operations in software or in dedicated hardware. In general, dedicated
+ * hardware implementations (such as those provided by xvimagesink) are
+ * preferred.
+ */
+typedef enum
+{
+ GST_COLOR_BALANCE_HARDWARE,
+ GST_COLOR_BALANCE_SOFTWARE
+} GstColorBalanceType;
+
+/**
+ * GstColorBalanceInterface:
+ * @iface: the parent interface
+ * @get_balance_type: implementation type
+ * @list_channels: list handled channels
+ * @set_value: set a channel value
+ * @get_value: get a channel value
+ * @value_changed: default handler for value changed notification
+ *
+ * Color-balance interface.
+ */
+struct _GstColorBalanceInterface {
+ GTypeInterface iface;
+
+ /* virtual functions */
+ const GList * (* list_channels) (GstColorBalance *balance);
+
+ void (* set_value) (GstColorBalance *balance,
+ GstColorBalanceChannel *channel,
+ gint value);
+ gint (* get_value) (GstColorBalance *balance,
+ GstColorBalanceChannel *channel);
+ GstColorBalanceType (*get_balance_type) (GstColorBalance *balance);
+
+ /* signals */
+ void (* value_changed) (GstColorBalance *balance,
+ GstColorBalanceChannel *channel,
+ gint value);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+GType gst_color_balance_get_type (void);
+
+/* virtual class function wrappers */
+
+GST_VIDEO_API
+const GList *
+ gst_color_balance_list_channels (GstColorBalance *balance);
+
+GST_VIDEO_API
+void gst_color_balance_set_value (GstColorBalance *balance,
+ GstColorBalanceChannel *channel,
+ gint value);
+
+GST_VIDEO_API
+gint gst_color_balance_get_value (GstColorBalance *balance,
+ GstColorBalanceChannel *channel);
+
+GST_VIDEO_API
+GstColorBalanceType
+ gst_color_balance_get_balance_type (GstColorBalance *balance);
+
+/* trigger signal */
+
+GST_VIDEO_API
+void gst_color_balance_value_changed (GstColorBalance *balance,
+ GstColorBalanceChannel *channel,
+ gint value);
+
+G_END_DECLS
+
+#endif /* __GST_COLOR_BALANCE_H__ */
diff --git a/include/gst/video/colorbalancechannel.h b/include/gst/video/colorbalancechannel.h
new file mode 100644
index 0000000000..35aca0f0e8
--- /dev/null
+++ b/include/gst/video/colorbalancechannel.h
@@ -0,0 +1,89 @@
+/* GStreamer Color Balance
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * colorbalancechannel.h: individual channel object
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_COLOR_BALANCE_CHANNEL_H__
+#define __GST_COLOR_BALANCE_CHANNEL_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_COLOR_BALANCE_CHANNEL \
+ (gst_color_balance_channel_get_type ())
+#define GST_COLOR_BALANCE_CHANNEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL, \
+ GstColorBalanceChannel))
+#define GST_COLOR_BALANCE_CHANNEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL, \
+ GstColorBalanceChannelClass))
+#define GST_IS_COLOR_BALANCE_CHANNEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL))
+#define GST_IS_COLOR_BALANCE_CHANNEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL))
+
+typedef struct _GstColorBalanceChannel GstColorBalanceChannel;
+typedef struct _GstColorBalanceChannelClass GstColorBalanceChannelClass;
+
+/**
+ * GstColorBalanceChannel:
+ * @label: A string containing a descriptive name for this channel
+ * @min_value: The minimum valid value for this channel.
+ * @max_value: The maximum valid value for this channel.
+ */
+struct _GstColorBalanceChannel {
+ GObject parent;
+
+ /*< public >*/
+ gchar *label;
+ gint min_value;
+ gint max_value;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstColorBalanceChannelClass:
+ * @parent: the parent class
+ * @value_changed: default handler for value changed notification
+ *
+ * Color-balance channel class.
+ */
+struct _GstColorBalanceChannelClass {
+ GObjectClass parent;
+
+ /* signals */
+ void (* value_changed) (GstColorBalanceChannel *channel,
+ gint value);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+GType gst_color_balance_channel_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstColorBalanceChannel, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */
diff --git a/include/gst/video/gstvideoaffinetransformationmeta.h b/include/gst/video/gstvideoaffinetransformationmeta.h
new file mode 100644
index 0000000000..8dee6d9027
--- /dev/null
+++ b/include/gst/video/gstvideoaffinetransformationmeta.h
@@ -0,0 +1,81 @@
+/* GStreamer
+ * Copyright (C) Collabora Ltd.
+ * Author: Matthieu Bouron <matthieu.bouron@collabora.com>
+ * Copyright (C) 2015, Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__
+#define __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+#define GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE (gst_video_affine_transformation_meta_api_get_type())
+#define GST_VIDEO_AFFINE_TRANSFORMATION_META_INFO (gst_video_affine_transformation_meta_get_info())
+
+typedef struct _GstVideoAffineTransformationMeta GstVideoAffineTransformationMeta;
+typedef gboolean (*GstVideoAffineTransformationGetMatrix) (GstVideoAffineTransformationMeta * meta, gfloat * matrix);
+
+#define GST_CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META "meta:GstVideoAffineTransformation"
+#define GST_BUFFER_POOL_OPTION_VIDEO_AFFINE_TRANSFORMATION_META "GstBufferPoolOptionVideoAffineTransformation"
+
+/**
+ * GstVideoAffineTransformationMeta:
+ * @meta: parent #GstMeta
+ * @matrix: the column-major 4x4 transformation matrix
+ *
+ * Extra buffer metadata for performing an affine transformation using a 4x4
+ * matrix. The transformation matrix can be composed with
+ * gst_video_affine_transformation_meta_apply_matrix().
+ *
+ * The vertices operated on are all in the range 0 to 1, not in
+ * Normalized Device Coordinates (-1 to +1). Transforming points in this space
+ * are assumed to have an origin at (0.5, 0.5, 0.5) in a left-handed coordinate
+ * system with the x-axis moving horizontally (positive values to the right),
+ * the y-axis moving vertically (positive values up the screen) and the z-axis
+ * perpendicular to the screen (positive values into the screen).
+ *
+ * Since: 1.8
+ */
+struct _GstVideoAffineTransformationMeta
+{
+ GstMeta meta;
+
+ gfloat matrix[16];
+};
+
+GST_VIDEO_API
+GType gst_video_affine_transformation_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo *gst_video_affine_transformation_meta_get_info (void);
+
+#define gst_buffer_get_video_affine_transformation_meta(b) \
+ ((GstVideoAffineTransformationMeta *)gst_buffer_get_meta((b),GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE))
+GST_VIDEO_API
+GstVideoAffineTransformationMeta *gst_buffer_add_video_affine_transformation_meta (GstBuffer * buffer);
+
+GST_VIDEO_API
+void gst_video_affine_transformation_meta_apply_matrix (GstVideoAffineTransformationMeta * meta,
+ const gfloat matrix[16]);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__ */
diff --git a/include/gst/video/gstvideoaggregator.h b/include/gst/video/gstvideoaggregator.h
new file mode 100644
index 0000000000..368c723e8e
--- /dev/null
+++ b/include/gst/video/gstvideoaggregator.h
@@ -0,0 +1,332 @@
+/* Generic video aggregator plugin
+ * Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_AGGREGATOR_H__
+#define __GST_VIDEO_AGGREGATOR_H__
+
+#include <gst/video/video.h>
+#include <gst/base/gstaggregator.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoAggregator GstVideoAggregator;
+typedef struct _GstVideoAggregatorClass GstVideoAggregatorClass;
+typedef struct _GstVideoAggregatorPrivate GstVideoAggregatorPrivate;
+
+/*************************
+ * GstVideoAggregatorPad *
+ *************************/
+
+#define GST_TYPE_VIDEO_AGGREGATOR_PAD (gst_video_aggregator_pad_get_type())
+#define GST_VIDEO_AGGREGATOR_PAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD, GstVideoAggregatorPad))
+#define GST_VIDEO_AGGREGATOR_PAD_CAST(obj) ((GstVideoAggregatorPad *)(obj))
+#define GST_VIDEO_AGGREGATOR_PAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR_PAD, GstVideoAggregatorPadClass))
+#define GST_IS_VIDEO_AGGREGATOR_PAD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD))
+#define GST_IS_VIDEO_AGGREGATOR_PAD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR_PAD))
+#define GST_VIDEO_AGGREGATOR_PAD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD,GstVideoAggregatorPadClass))
+
+typedef struct _GstVideoAggregatorPad GstVideoAggregatorPad;
+typedef struct _GstVideoAggregatorPadClass GstVideoAggregatorPadClass;
+typedef struct _GstVideoAggregatorPadPrivate GstVideoAggregatorPadPrivate;
+
+/**
+ * GstVideoAggregatorPad:
+ * @info: The #GstVideoInfo currently set on the pad
+ *
+ * Since: 1.16
+ */
+struct _GstVideoAggregatorPad
+{
+ GstAggregatorPad parent;
+
+ /*< public >*/
+ /* read-only, with OBJECT_LOCK */
+ GstVideoInfo info;
+
+ /* < private > */
+ GstVideoAggregatorPadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstVideoAggregatorPadClass:
+ * @update_conversion_info: Called when either the input or output formats
+ * have changed.
+ * @prepare_frame: Prepare the frame from the pad buffer and sets it to prepared_frame.
+ * Implementations should always return TRUE. Returning FALSE will cease
+ * iteration over subsequent pads.
+ * @clean_frame: clean the frame previously prepared in prepare_frame
+ *
+ * Since: 1.16
+ */
+/**
+ * GstVideoAggregatorPadClass::prepare_frame_start:
+ * @pad: the #GstVideoAggregatorPad
+ * @videoaggregator: the parent #GstVideoAggregator
+ * @buffer: the input #GstBuffer to prepare
+ * @prepared_frame: the #GstVideoFrame to prepare into
+ *
+ * Begin preparing the frame from the pad buffer and sets it to prepared_frame.
+ *
+ * If overriden, `prepare_frame_finish` must also be overriden.
+ *
+ * Since: 1.20
+ */
+/**
+ * GstVideoAggregatorPadClass::prepare_frame_finish:
+ * @pad: the #GstVideoAggregatorPad
+ * @videoaggregator: the parent #GstVideoAggregator
+ * @prepared_frame: the #GstVideoFrame to prepare into
+ *
+ * Finish preparing @prepared_frame.
+ *
+ * If overriden, `prepare_frame_start` must also be overriden.
+ *
+ * Since: 1.20
+ */
+struct _GstVideoAggregatorPadClass
+{
+ GstAggregatorPadClass parent_class;
+ void (*update_conversion_info) (GstVideoAggregatorPad * pad);
+
+ gboolean (*prepare_frame) (GstVideoAggregatorPad * pad,
+ GstVideoAggregator * videoaggregator,
+ GstBuffer * buffer,
+ GstVideoFrame * prepared_frame);
+
+ void (*clean_frame) (GstVideoAggregatorPad * pad,
+ GstVideoAggregator * videoaggregator,
+ GstVideoFrame * prepared_frame);
+
+ void (*prepare_frame_start) (GstVideoAggregatorPad * pad,
+ GstVideoAggregator * videoaggregator,
+ GstBuffer * buffer,
+ GstVideoFrame * prepared_frame);
+
+ void (*prepare_frame_finish) (GstVideoAggregatorPad * pad,
+ GstVideoAggregator * videoaggregator,
+ GstVideoFrame * prepared_frame);
+
+ gpointer _gst_reserved[GST_PADDING_LARGE-2];
+};
+
+GST_VIDEO_API
+GType gst_video_aggregator_pad_get_type (void);
+
+GST_VIDEO_API
+gboolean gst_video_aggregator_pad_has_current_buffer (GstVideoAggregatorPad *pad);
+
+GST_VIDEO_API
+GstBuffer * gst_video_aggregator_pad_get_current_buffer (GstVideoAggregatorPad *pad);
+
+GST_VIDEO_API
+GstVideoFrame * gst_video_aggregator_pad_get_prepared_frame (GstVideoAggregatorPad *pad);
+
+GST_VIDEO_API
+void gst_video_aggregator_pad_set_needs_alpha (GstVideoAggregatorPad *pad, gboolean needs_alpha);
+
+/********************************
+ * GstVideoAggregatorConvertPad *
+ *******************************/
+
+#define GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD (gst_video_aggregator_convert_pad_get_type())
+#define GST_VIDEO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD, GstVideoAggregatorConvertPad))
+#define GST_VIDEO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD, GstVideoAggregatorConvertPadClass))
+#define GST_VIDEO_AGGREGATOR_CONVERT_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD, GstVideoAggregatorConvertPadClass))
+#define GST_IS_VIDEO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD))
+#define GST_IS_VIDEO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD))
+
+typedef struct _GstVideoAggregatorConvertPad GstVideoAggregatorConvertPad;
+typedef struct _GstVideoAggregatorConvertPadClass GstVideoAggregatorConvertPadClass;
+typedef struct _GstVideoAggregatorConvertPadPrivate GstVideoAggregatorConvertPadPrivate;
+
+/**
+ * GstVideoAggregatorConvertPad:
+ *
+ * An implementation of GstPad that can be used with #GstVideoAggregator.
+ *
+ * See #GstVideoAggregator for more details.
+ *
+ * Since: 1.16
+ */
+struct _GstVideoAggregatorConvertPad
+{
+ /*< private >*/
+ GstVideoAggregatorPad parent;
+
+ GstVideoAggregatorConvertPadPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstVideoAggregatorConvertPadClass:
+ *
+ * Since: 1.16
+ */
+struct _GstVideoAggregatorConvertPadClass
+{
+ GstVideoAggregatorPadClass parent_class;
+
+ void (*create_conversion_info) (GstVideoAggregatorConvertPad *pad, GstVideoAggregator *agg, GstVideoInfo *conversion_info);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+GType gst_video_aggregator_convert_pad_get_type (void);
+
+GST_VIDEO_API
+void gst_video_aggregator_convert_pad_update_conversion_info (GstVideoAggregatorConvertPad * pad);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoAggregatorConvertPad, gst_object_unref)
+
+/****************************************
+ * GstVideoAggregatorParallelConvertPad *
+ ****************************************/
+
+#define GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD (gst_video_aggregator_parallel_convert_pad_get_type())
+GST_VIDEO_API
+G_DECLARE_DERIVABLE_TYPE (GstVideoAggregatorParallelConvertPad, gst_video_aggregator_parallel_convert_pad, GST, VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD, GstVideoAggregatorConvertPad)
+
+#define GST_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD, GstVideoAggregatorParallelConvertPad))
+#define GST_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD, GstVideoAggregatorConvertPadClass))
+#define GST_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD, GstVideoAggregatorConvertPadClass))
+#define GST_IS_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD))
+#define GST_IS_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR_PARALLEL_CONVERT_PAD))
+
+/**
+ * GstVideoAggregatorParallelConvertPad:
+ *
+ * An implementation of GstPad that can be used with #GstVideoAggregator.
+ *
+ * See #GstVideoAggregator for more details.
+ *
+ * Since: 1.20
+ */
+
+/**
+ * GstVideoAggregatorParallelConvertPadClass:
+ *
+ * Since: 1.20
+ */
+struct _GstVideoAggregatorParallelConvertPadClass
+{
+ GstVideoAggregatorConvertPadClass parent_class;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**********************
+ * GstVideoAggregator *
+ *********************/
+
+#define GST_TYPE_VIDEO_AGGREGATOR (gst_video_aggregator_get_type())
+#define GST_VIDEO_AGGREGATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregator))
+#define GST_VIDEO_AGGREGATOR_CAST(obj) ((GstVideoAggregator *)(obj))
+#define GST_VIDEO_AGGREGATOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregatorClass))
+#define GST_IS_VIDEO_AGGREGATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR))
+#define GST_IS_VIDEO_AGGREGATOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR))
+#define GST_VIDEO_AGGREGATOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_AGGREGATOR,GstVideoAggregatorClass))
+
+/**
+ * GstVideoAggregator:
+ * @info: The #GstVideoInfo representing the currently set
+ * srcpad caps.
+ *
+ * Since: 1.16
+ */
+struct _GstVideoAggregator
+{
+ GstAggregator aggregator;
+
+ /*< public >*/
+ /* Output caps */
+ GstVideoInfo info;
+
+ /* < private > */
+ GstVideoAggregatorPrivate *priv;
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+/**
+ * GstVideoAggregatorClass:
+ * @update_caps: Optional.
+ * Lets subclasses update the #GstCaps representing
+ * the src pad caps before usage. Return %NULL to indicate failure.
+ * @aggregate_frames: Lets subclasses aggregate frames that are ready. Subclasses
+ * should iterate the GstElement.sinkpads and use the already
+ * mapped #GstVideoFrame from gst_video_aggregator_pad_get_prepared_frame()
+ * or directly use the #GstBuffer from gst_video_aggregator_pad_get_current_buffer()
+ * if it needs to map the buffer in a special way. The result of the
+ * aggregation should land in @outbuffer.
+ * @create_output_buffer: Optional.
+ * Lets subclasses provide a #GstBuffer to be used as @outbuffer of
+ * the #aggregate_frames vmethod.
+ * @find_best_format: Optional.
+ * Lets subclasses decide of the best common format to use.
+ *
+ * Since: 1.16
+ **/
+struct _GstVideoAggregatorClass
+{
+ /*< private >*/
+ GstAggregatorClass parent_class;
+
+ /*< public >*/
+ GstCaps * (*update_caps) (GstVideoAggregator * videoaggregator,
+ GstCaps * caps);
+ GstFlowReturn (*aggregate_frames) (GstVideoAggregator * videoaggregator,
+ GstBuffer * outbuffer);
+ GstFlowReturn (*create_output_buffer) (GstVideoAggregator * videoaggregator,
+ GstBuffer ** outbuffer);
+ void (*find_best_format) (GstVideoAggregator * vagg,
+ GstCaps * downstream_caps,
+ GstVideoInfo * best_info,
+ gboolean * at_least_one_alpha);
+
+ /* < private > */
+ gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+GST_VIDEO_API
+GType gst_video_aggregator_get_type (void);
+
+GST_VIDEO_API
+GstTaskPool * gst_video_aggregator_get_execution_task_pool (GstVideoAggregator * vagg);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoAggregator, gst_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoAggregatorPad, gst_object_unref)
+
+G_END_DECLS
+#endif /* __GST_VIDEO_AGGREGATOR_H__ */
diff --git a/include/gst/video/gstvideocodecalphameta.h b/include/gst/video/gstvideocodecalphameta.h
new file mode 100644
index 0000000000..14e371c393
--- /dev/null
+++ b/include/gst/video/gstvideocodecalphameta.h
@@ -0,0 +1,88 @@
+/* GStreamer
+ * Copyright (C) 2021 Collabora Ltd.
+ * Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_CODEC_ALPHA_META_H__
+#define __GST_VIDEO_CODEC_ALPHA_META_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_VIDEO_CODEC_ALPHA_META_API_TYPE:
+ *
+ * Since: 1.20
+ */
+#define GST_VIDEO_CODEC_ALPHA_META_API_TYPE (gst_video_codec_alpha_meta_api_get_type())
+
+/**
+ * GST_VIDEO_CODEC_ALPHA_META_INFO:
+ *
+ * Since: 1.20
+ */
+#define GST_VIDEO_CODEC_ALPHA_META_INFO (gst_video_codec_alpha_meta_get_info())
+
+typedef struct _GstVideoCodecAlphaMeta GstVideoCodecAlphaMeta;
+
+/**
+ * GstVideoCodecAlphaMeta:
+ * @meta: parent #GstMeta
+ * @buffer: the encoded alpha frame
+ *
+ * Encapsulate an extra frame containing the encoded alpha channel for the
+ * currently negotiated CODEC. The streams must be of the same dimention as
+ * the original one.
+ *
+ * Since: 1.20
+ */
+struct _GstVideoCodecAlphaMeta
+{
+ GstMeta meta;
+
+ GstBuffer *buffer;
+};
+
+GST_VIDEO_API
+GType gst_video_codec_alpha_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo *gst_video_codec_alpha_meta_get_info (void);
+
+/**
+ * gst_buffer_get_video_codec_alpha_meta:
+ * @b: A #GstBuffer pointer, must be writable.
+ *
+ * Helper macro to get #GstVideoCodecAlphaMeta from an existing #GstBuffer.
+ *
+ * Returns: (nullable): the #GstVideoCodecAlphaMeta pointer, or %NULL if none.
+ *
+ * Since: 1.20
+ */
+#define gst_buffer_get_video_codec_alpha_meta(b) \
+ ((GstVideoCodecAlphaMeta *)gst_buffer_get_meta((b),GST_VIDEO_CODEC_ALPHA_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoCodecAlphaMeta *gst_buffer_add_video_codec_alpha_meta (GstBuffer * buffer,
+ GstBuffer * alpha_buffer);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_CODEC_ALPHA_META_H__ */
diff --git a/include/gst/video/gstvideodecoder.h b/include/gst/video/gstvideodecoder.h
new file mode 100644
index 0000000000..a38287336a
--- /dev/null
+++ b/include/gst/video/gstvideodecoder.h
@@ -0,0 +1,558 @@
+/* GStreamer
+ * Copyright (C) 2008 David Schleef <ds@schleef.org>
+ * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
+ * Copyright (C) 2011 Nokia Corporation. All rights reserved.
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ * Copyright (C) 2012 Collabora Ltd.
+ * Author : Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_VIDEO_DECODER_H_
+#define _GST_VIDEO_DECODER_H_
+
+#include <gst/base/gstadapter.h>
+#include <gst/video/gstvideoutils.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_DECODER \
+ (gst_video_decoder_get_type())
+#define GST_VIDEO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_DECODER,GstVideoDecoder))
+#define GST_VIDEO_DECODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_DECODER,GstVideoDecoderClass))
+#define GST_VIDEO_DECODER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_DECODER,GstVideoDecoderClass))
+#define GST_IS_VIDEO_DECODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_DECODER))
+#define GST_IS_VIDEO_DECODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_DECODER))
+#define GST_VIDEO_DECODER_CAST(obj) ((GstVideoDecoder *)(obj))
+
+/**
+ * GST_VIDEO_DECODER_SINK_NAME:
+ *
+ * The name of the templates for the sink pad.
+ */
+#define GST_VIDEO_DECODER_SINK_NAME "sink"
+/**
+ * GST_VIDEO_DECODER_SRC_NAME:
+ *
+ * The name of the templates for the source pad.
+ */
+#define GST_VIDEO_DECODER_SRC_NAME "src"
+
+/**
+ * GST_VIDEO_DECODER_SRC_PAD:
+ * @obj: a #GstVideoDecoder
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_VIDEO_DECODER_SRC_PAD(obj) (((GstVideoDecoder *) (obj))->srcpad)
+
+/**
+ * GST_VIDEO_DECODER_SINK_PAD:
+ * @obj: a #GstVideoDecoder
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_VIDEO_DECODER_SINK_PAD(obj) (((GstVideoDecoder *) (obj))->sinkpad)
+/**
+ * GST_VIDEO_DECODER_FLOW_NEED_DATA:
+ *
+ * Returned while parsing to indicate more data is needed.
+ **/
+#define GST_VIDEO_DECODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS
+
+/**
+ * GST_VIDEO_DECODER_INPUT_SEGMENT:
+ * @obj: base decoder instance
+ *
+ * Gives the segment of the element.
+ */
+#define GST_VIDEO_DECODER_INPUT_SEGMENT(obj) (GST_VIDEO_DECODER_CAST (obj)->input_segment)
+
+/**
+ * GST_VIDEO_DECODER_OUTPUT_SEGMENT:
+ * @obj: base decoder instance
+ *
+ * Gives the segment of the element.
+ */
+#define GST_VIDEO_DECODER_OUTPUT_SEGMENT(obj) (GST_VIDEO_DECODER_CAST (obj)->output_segment)
+
+/**
+ * GST_VIDEO_DECODER_STREAM_LOCK:
+ * @decoder: video decoder instance
+ *
+ * Obtain a lock to protect the decoder function from concurrent access.
+ */
+#define GST_VIDEO_DECODER_STREAM_LOCK(decoder) g_rec_mutex_lock (&GST_VIDEO_DECODER (decoder)->stream_lock)
+
+/**
+ * GST_VIDEO_DECODER_STREAM_UNLOCK:
+ * @decoder: video decoder instance
+ *
+ * Release the lock that protects the decoder function from concurrent access.
+ */
+#define GST_VIDEO_DECODER_STREAM_UNLOCK(decoder) g_rec_mutex_unlock (&GST_VIDEO_DECODER (decoder)->stream_lock)
+
+typedef struct _GstVideoDecoder GstVideoDecoder;
+typedef struct _GstVideoDecoderClass GstVideoDecoderClass;
+typedef struct _GstVideoDecoderPrivate GstVideoDecoderPrivate;
+
+
+/* do not use this one, use macro below */
+
+GST_VIDEO_API
+GstFlowReturn _gst_video_decoder_error (GstVideoDecoder *dec, gint weight,
+ GQuark domain, gint code,
+ gchar *txt, gchar *debug,
+ const gchar *file, const gchar *function,
+ gint line);
+
+/**
+ * GST_VIDEO_DECODER_ERROR:
+ * @el: the base video decoder element that generates the error
+ * @w: element defined weight of the error, added to error count
+ * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
+ * @code: error code defined for that domain (see #gstreamer-GstGError)
+ * @text: the message to display (format string and args enclosed in
+ * parentheses)
+ * @debug: debugging information for the message (format string and args
+ * enclosed in parentheses)
+ * @ret: variable to receive return value
+ *
+ * Utility function that video decoder elements can use in case they encountered
+ * a data processing error that may be fatal for the current "data unit" but
+ * need not prevent subsequent decoding. Such errors are counted and if there
+ * are too many, as configured in the context's max_errors, the pipeline will
+ * post an error message and the application will be requested to stop further
+ * media processing. Otherwise, it is considered a "glitch" and only a warning
+ * is logged. In either case, @ret is set to the proper value to
+ * return to upstream/caller (indicating either GST_FLOW_ERROR or GST_FLOW_OK).
+ */
+#define GST_VIDEO_DECODER_ERROR(el, w, domain, code, text, debug, ret) \
+G_STMT_START { \
+ gchar *__txt = _gst_element_error_printf text; \
+ gchar *__dbg = _gst_element_error_printf debug; \
+ GstVideoDecoder *__dec = GST_VIDEO_DECODER (el); \
+ ret = _gst_video_decoder_error (__dec, w, GST_ ## domain ## _ERROR, \
+ GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \
+ GST_FUNCTION, __LINE__); \
+} G_STMT_END
+
+/**
+ * GST_VIDEO_DECODER_MAX_ERRORS:
+ *
+ * Default maximum number of errors tolerated before signaling error.
+ */
+#define GST_VIDEO_DECODER_MAX_ERRORS 10
+
+
+/**
+ * GstVideoDecoder:
+ *
+ * The opaque #GstVideoDecoder data structure.
+ */
+struct _GstVideoDecoder
+{
+ /*< private >*/
+ GstElement element;
+
+ /*< protected >*/
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* protects all data processing, i.e. is locked
+ * in the chain function, finish_frame and when
+ * processing serialized events */
+ GRecMutex stream_lock;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment input_segment;
+ GstSegment output_segment;
+
+ GstVideoDecoderPrivate *priv;
+
+ /*< private >*/
+ gpointer padding[GST_PADDING_LARGE];
+};
+
+/**
+ * GstVideoDecoderClass:
+ * @open: Optional.
+ * Called when the element changes to GST_STATE_READY.
+ * Allows opening external resources.
+ * @close: Optional.
+ * Called when the element changes to GST_STATE_NULL.
+ * Allows closing external resources.
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_format: Notifies subclass of incoming data format (caps).
+ * @parse: Required for non-packetized input.
+ * Allows chopping incoming data into manageable units (frames)
+ * for subsequent decoding.
+ * @reset: Optional.
+ * Allows subclass (decoder) to perform post-seek semantics reset.
+ * Deprecated.
+ * @handle_frame: Provides input data frame to subclass. In subframe mode, the subclass needs
+ * to take ownership of @GstVideoCodecFrame.input_buffer as it will be modified
+ * by the base class on the next subframe buffer receiving.
+ * @finish: Optional.
+ * Called to request subclass to dispatch any pending remaining
+ * data at EOS. Sub-classes can refuse to decode new data after.
+ * @drain: Optional.
+ * Called to request subclass to decode any data it can at this
+ * point, but that more data may arrive after. (e.g. at segment end).
+ * Sub-classes should be prepared to handle new data afterward,
+ * or seamless segment processing will break. Since: 1.6
+ * @sink_event: Optional.
+ * Event handler on the sink pad. This function should return
+ * TRUE if the event was handled and should be discarded
+ * (i.e. not unref'ed).
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @src_event: Optional.
+ * Event handler on the source pad. This function should return
+ * TRUE if the event was handled and should be discarded
+ * (i.e. not unref'ed).
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @negotiate: Optional.
+ * Negotiate with downstream and configure buffer pools, etc.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @decide_allocation: Optional.
+ * Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @propose_allocation: Optional.
+ * Propose buffer allocation parameters for upstream elements.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @flush: Optional.
+ * Flush all remaining data from the decoder without
+ * pushing it downstream. Since: 1.2
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.4
+ * @src_query: Optional.
+ * Query handler on the source pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.4
+ * @getcaps: Optional.
+ * Allows for a custom sink getcaps implementation.
+ * If not implemented, default returns
+ * gst_video_decoder_proxy_getcaps
+ * applied to sink template caps.
+ * @transform_meta: Optional. Transform the metadata on the input buffer to the
+ * output buffer. By default this method is copies all meta without
+ * tags and meta with only the "video" tag. subclasses can
+ * implement this method and return %TRUE if the metadata is to be
+ * copied. Since: 1.6
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @handle_frame needs to be overridden, and @set_format
+ * and likely as well. If non-packetized input is supported or expected,
+ * @parse needs to be overridden as well.
+ */
+struct _GstVideoDecoderClass
+{
+ /*< private >*/
+ GstElementClass element_class;
+
+ /*< public >*/
+ gboolean (*open) (GstVideoDecoder *decoder);
+
+ gboolean (*close) (GstVideoDecoder *decoder);
+
+ gboolean (*start) (GstVideoDecoder *decoder);
+
+ gboolean (*stop) (GstVideoDecoder *decoder);
+
+ GstFlowReturn (*parse) (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame,
+ GstAdapter *adapter,
+ gboolean at_eos);
+
+ gboolean (*set_format) (GstVideoDecoder *decoder,
+ GstVideoCodecState * state);
+
+ gboolean (*reset) (GstVideoDecoder *decoder,
+ gboolean hard);
+
+ GstFlowReturn (*finish) (GstVideoDecoder *decoder);
+
+ /**
+ * GstVideoDecoderClass::handle_frame:
+ * @decoder: The #GstVideoDecoder
+ * @frame: (transfer full): The frame to handle
+ */
+ GstFlowReturn (*handle_frame) (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame);
+
+ gboolean (*sink_event) (GstVideoDecoder *decoder,
+ GstEvent *event);
+
+ gboolean (*src_event) (GstVideoDecoder *decoder,
+ GstEvent *event);
+
+ gboolean (*negotiate) (GstVideoDecoder *decoder);
+
+ gboolean (*decide_allocation) (GstVideoDecoder *decoder, GstQuery *query);
+
+ gboolean (*propose_allocation) (GstVideoDecoder *decoder, GstQuery * query);
+
+ gboolean (*flush) (GstVideoDecoder *decoder);
+
+ gboolean (*sink_query) (GstVideoDecoder *decoder,
+ GstQuery *query);
+
+ gboolean (*src_query) (GstVideoDecoder *decoder,
+ GstQuery *query);
+
+ GstCaps* (*getcaps) (GstVideoDecoder *decoder,
+ GstCaps *filter);
+
+ GstFlowReturn (*drain) (GstVideoDecoder *decoder);
+
+ gboolean (*transform_meta) (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame,
+ GstMeta * meta);
+
+ /**
+ * GstVideoDecoderClass::handle_missing_data:
+ * @decoder: The #GstVideoDecoder
+ * @timestamp: Timestamp of the missing data
+ * @duration: Duration of the missing data
+ *
+ * Returns: %TRUE if the decoder should be drained afterwards.
+ *
+ * Since: 1.20
+ */
+ gboolean (*handle_missing_data) (GstVideoDecoder *decoder,
+ GstClockTime timestamp,
+ GstClockTime duration);
+
+ /*< private >*/
+ gpointer padding[GST_PADDING_LARGE-7];
+};
+
+/**
+ * GstVideoDecoderRequestSyncPointFlags:
+ * @GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT: discard all following
+ * input until the next sync point.
+ * @GST_VIDEO_DECODER_REQUEST_SYNC_POINT_CORRUPT_OUTPUT: discard all following
+ * output until the next sync point.
+ *
+ * Flags to be used in combination with gst_video_decoder_request_sync_point().
+ * See the function documentation for more details.
+ *
+ * Since: 1.20
+ */
+typedef enum {
+ GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT = (1<<0),
+ GST_VIDEO_DECODER_REQUEST_SYNC_POINT_CORRUPT_OUTPUT = (1<<1),
+} GstVideoDecoderRequestSyncPointFlags;
+
+GST_VIDEO_API
+GType gst_video_decoder_get_type (void);
+
+/* Context parameters */
+
+GST_VIDEO_API
+void gst_video_decoder_set_packetized (GstVideoDecoder * decoder,
+ gboolean packetized);
+
+GST_VIDEO_API
+gboolean gst_video_decoder_get_packetized (GstVideoDecoder * decoder);
+
+GST_VIDEO_API
+void gst_video_decoder_set_subframe_mode (GstVideoDecoder * decoder,
+ gboolean subframe_mode);
+
+GST_VIDEO_API
+gboolean gst_video_decoder_get_subframe_mode (GstVideoDecoder * decoder);
+
+GST_VIDEO_API
+guint gst_video_decoder_get_input_subframe_index (GstVideoDecoder * decoder, GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+guint gst_video_decoder_get_processed_subframe_index (GstVideoDecoder * decoder, GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+void gst_video_decoder_set_estimate_rate (GstVideoDecoder * dec,
+ gboolean enabled);
+
+GST_VIDEO_API
+gint gst_video_decoder_get_estimate_rate (GstVideoDecoder * dec);
+
+GST_VIDEO_API
+void gst_video_decoder_set_max_errors (GstVideoDecoder * dec,
+ gint num);
+
+GST_VIDEO_API
+gint gst_video_decoder_get_max_errors (GstVideoDecoder * dec);
+
+GST_VIDEO_API
+void gst_video_decoder_set_needs_format (GstVideoDecoder * dec,
+ gboolean enabled);
+
+GST_VIDEO_API
+gboolean gst_video_decoder_get_needs_format (GstVideoDecoder * dec);
+
+GST_VIDEO_API
+void gst_video_decoder_set_needs_sync_point (GstVideoDecoder * dec,
+ gboolean enabled);
+
+GST_VIDEO_API
+gboolean gst_video_decoder_get_needs_sync_point (GstVideoDecoder * dec);
+
+GST_VIDEO_API
+void gst_video_decoder_set_latency (GstVideoDecoder *decoder,
+ GstClockTime min_latency,
+ GstClockTime max_latency);
+
+GST_VIDEO_API
+void gst_video_decoder_get_latency (GstVideoDecoder *decoder,
+ GstClockTime *min_latency,
+ GstClockTime *max_latency);
+
+GST_VIDEO_API
+void gst_video_decoder_get_allocator (GstVideoDecoder *decoder,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+
+GST_VIDEO_API
+GstBufferPool *gst_video_decoder_get_buffer_pool (GstVideoDecoder *decoder);
+
+/* Object methods */
+
+GST_VIDEO_API
+GstVideoCodecFrame *gst_video_decoder_get_frame (GstVideoDecoder *decoder,
+ int frame_number);
+
+GST_VIDEO_API
+GstVideoCodecFrame *gst_video_decoder_get_oldest_frame (GstVideoDecoder *decoder);
+
+GST_VIDEO_API
+GList * gst_video_decoder_get_frames (GstVideoDecoder *decoder);
+
+/* Parsing related methods */
+
+GST_VIDEO_API
+void gst_video_decoder_add_to_frame (GstVideoDecoder *decoder,
+ int n_bytes);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_have_frame (GstVideoDecoder *decoder);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_have_last_subframe (GstVideoDecoder *decoder,
+ GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+gsize gst_video_decoder_get_pending_frame_size (GstVideoDecoder *decoder);
+
+GST_VIDEO_API
+GstBuffer *gst_video_decoder_allocate_output_buffer (GstVideoDecoder * decoder);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_allocate_output_frame_with_params (GstVideoDecoder *decoder,
+ GstVideoCodecFrame * frame,
+ GstBufferPoolAcquireParams *params);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_allocate_output_frame (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame);
+
+GST_VIDEO_API
+GstVideoCodecState *gst_video_decoder_set_output_state (GstVideoDecoder *decoder,
+ GstVideoFormat fmt, guint width, guint height,
+ GstVideoCodecState *reference);
+
+GST_VIDEO_API
+GstVideoCodecState *gst_video_decoder_set_interlaced_output_state (GstVideoDecoder *decoder,
+ GstVideoFormat fmt, GstVideoInterlaceMode interlace_mode,
+ guint width, guint height, GstVideoCodecState *reference);
+
+GST_VIDEO_API
+GstVideoCodecState *gst_video_decoder_get_output_state (GstVideoDecoder *decoder);
+
+GST_VIDEO_API
+gboolean gst_video_decoder_negotiate (GstVideoDecoder * decoder);
+
+GST_VIDEO_API
+GstClockTimeDiff gst_video_decoder_get_max_decode_time (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame);
+
+GST_VIDEO_API
+gdouble gst_video_decoder_get_qos_proportion (GstVideoDecoder * decoder);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_finish_frame (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame);
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_finish_subframe (GstVideoDecoder *decoder,
+ GstVideoCodecFrame *frame);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_drop_frame (GstVideoDecoder *dec,
+ GstVideoCodecFrame *frame);
+GST_VIDEO_API
+GstFlowReturn gst_video_decoder_drop_subframe (GstVideoDecoder *dec,
+ GstVideoCodecFrame *frame);
+
+GST_VIDEO_API
+void gst_video_decoder_request_sync_point (GstVideoDecoder *dec,
+ GstVideoCodecFrame *frame,
+ GstVideoDecoderRequestSyncPointFlags flags);
+
+GST_VIDEO_API
+void gst_video_decoder_release_frame (GstVideoDecoder * dec,
+ GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+void gst_video_decoder_merge_tags (GstVideoDecoder *decoder,
+ const GstTagList *tags,
+ GstTagMergeMode mode);
+
+GST_VIDEO_API
+GstCaps * gst_video_decoder_proxy_getcaps (GstVideoDecoder * decoder,
+ GstCaps * caps,
+ GstCaps * filter);
+
+GST_VIDEO_API
+void gst_video_decoder_set_use_default_pad_acceptcaps (GstVideoDecoder * decoder,
+ gboolean use);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoDecoder, gst_object_unref)
+
+G_END_DECLS
+
+#endif
+
diff --git a/include/gst/video/gstvideoencoder.h b/include/gst/video/gstvideoencoder.h
new file mode 100644
index 0000000000..2a03fdda20
--- /dev/null
+++ b/include/gst/video/gstvideoencoder.h
@@ -0,0 +1,395 @@
+/* GStreamer
+ * Copyright (C) 2008 David Schleef <ds@schleef.org>
+ * Copyright (C) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>.
+ * Copyright (C) 2011 Nokia Corporation. All rights reserved.
+ * Contact: Stefan Kost <stefan.kost@nokia.com>
+ * Copyright (C) 2012 Collabora Ltd.
+ * Author : Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_VIDEO_ENCODER_H_
+#define _GST_VIDEO_ENCODER_H_
+
+#include <gst/video/gstvideoutils.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_ENCODER \
+ (gst_video_encoder_get_type())
+#define GST_VIDEO_ENCODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_ENCODER,GstVideoEncoder))
+#define GST_VIDEO_ENCODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_ENCODER,GstVideoEncoderClass))
+#define GST_VIDEO_ENCODER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_ENCODER,GstVideoEncoderClass))
+#define GST_IS_VIDEO_ENCODER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_ENCODER))
+#define GST_IS_VIDEO_ENCODER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_ENCODER))
+#define GST_VIDEO_ENCODER_CAST(enc) ((GstVideoEncoder*)enc)
+
+/**
+ * GST_VIDEO_ENCODER_SINK_NAME:
+ *
+ * The name of the templates for the sink pad.
+ */
+#define GST_VIDEO_ENCODER_SINK_NAME "sink"
+/**
+ * GST_VIDEO_ENCODER_SRC_NAME:
+ *
+ * The name of the templates for the source pad.
+ */
+#define GST_VIDEO_ENCODER_SRC_NAME "src"
+
+/**
+ * GST_VIDEO_ENCODER_SRC_PAD:
+ * @obj: a #GstVideoEncoder
+ *
+ * Gives the pointer to the source #GstPad object of the element.
+ */
+#define GST_VIDEO_ENCODER_SRC_PAD(obj) (((GstVideoEncoder *) (obj))->srcpad)
+
+/**
+ * GST_VIDEO_ENCODER_SINK_PAD:
+ * @obj: a #GstVideoEncoder
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_VIDEO_ENCODER_SINK_PAD(obj) (((GstVideoEncoder *) (obj))->sinkpad)
+
+/**
+ * GST_VIDEO_ENCODER_FLOW_NEED_DATA:
+ *
+ * Returned while parsing to indicate more data is needed.
+ **/
+#define GST_VIDEO_ENCODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS
+
+/**
+ * GST_VIDEO_ENCODER_FLOW_DROPPED:
+ *
+ * Returned when the event/buffer should be dropped.
+ *
+ * Deprecated: since 1.8. use gst_video_encoder_finish_frame with
+ * a %NULL frame->output_buffer to drop the frame instead.
+ */
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_VIDEO_ENCODER_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS_1
+#endif
+
+/**
+ * GST_VIDEO_ENCODER_INPUT_SEGMENT:
+ * @obj: base parse instance
+ *
+ * Gives the segment of the element.
+ */
+#define GST_VIDEO_ENCODER_INPUT_SEGMENT(obj) (GST_VIDEO_ENCODER_CAST (obj)->input_segment)
+
+/**
+ * GST_VIDEO_ENCODER_OUTPUT_SEGMENT:
+ * @obj: base parse instance
+ *
+ * Gives the segment of the element.
+ */
+#define GST_VIDEO_ENCODER_OUTPUT_SEGMENT(obj) (GST_VIDEO_ENCODER_CAST (obj)->output_segment)
+
+/**
+ * GST_VIDEO_ENCODER_STREAM_LOCK:
+ * @encoder: video encoder instance
+ *
+ * Obtain a lock to protect the encoder function from concurrent access.
+ */
+#define GST_VIDEO_ENCODER_STREAM_LOCK(encoder) g_rec_mutex_lock (&GST_VIDEO_ENCODER (encoder)->stream_lock)
+
+/**
+ * GST_VIDEO_ENCODER_STREAM_UNLOCK:
+ * @encoder: video encoder instance
+ *
+ * Release the lock that protects the encoder function from concurrent access.
+ */
+#define GST_VIDEO_ENCODER_STREAM_UNLOCK(encoder) g_rec_mutex_unlock (&GST_VIDEO_ENCODER (encoder)->stream_lock)
+
+typedef struct _GstVideoEncoder GstVideoEncoder;
+typedef struct _GstVideoEncoderPrivate GstVideoEncoderPrivate;
+typedef struct _GstVideoEncoderClass GstVideoEncoderClass;
+
+/**
+ * GstVideoEncoder:
+ *
+ * The opaque #GstVideoEncoder data structure.
+ */
+struct _GstVideoEncoder
+{
+ /*< private >*/
+ GstElement element;
+
+ /*< protected >*/
+ GstPad *sinkpad;
+ GstPad *srcpad;
+
+ /* protects all data processing, i.e. is locked
+ * in the chain function, finish_frame and when
+ * processing serialized events */
+ GRecMutex stream_lock;
+
+ /* MT-protected (with STREAM_LOCK) */
+ GstSegment input_segment;
+ GstSegment output_segment;
+
+ /*< private >*/
+ GstVideoEncoderPrivate *priv;
+
+ gpointer padding[GST_PADDING_LARGE];
+};
+
+/**
+ * GstVideoEncoderClass:
+ * @open: Optional.
+ * Called when the element changes to GST_STATE_READY.
+ * Allows opening external resources.
+ * @close: Optional.
+ * Called when the element changes to GST_STATE_NULL.
+ * Allows closing external resources.
+ * @start: Optional.
+ * Called when the element starts processing.
+ * Allows opening external resources.
+ * @stop: Optional.
+ * Called when the element stops processing.
+ * Allows closing external resources.
+ * @set_format: Optional.
+ * Notifies subclass of incoming data format.
+ * GstVideoCodecState fields have already been
+ * set according to provided caps.
+ * @handle_frame: Provides input frame to subclass.
+ * @reset: Optional.
+ * Allows subclass (encoder) to perform post-seek semantics reset.
+ * Deprecated.
+ * @finish: Optional.
+ * Called to request subclass to dispatch any pending remaining
+ * data (e.g. at EOS).
+ * @pre_push: Optional.
+ * Allows subclass to push frame downstream in whatever
+ * shape or form it deems appropriate. If not provided,
+ * provided encoded frame data is simply pushed downstream.
+ * @getcaps: Optional.
+ * Allows for a custom sink getcaps implementation (e.g.
+ * for multichannel input specification). If not implemented,
+ * default returns gst_video_encoder_proxy_getcaps
+ * applied to sink template caps.
+ * @sink_event: Optional.
+ * Event handler on the sink pad. This function should return
+ * TRUE if the event was handled and should be discarded
+ * (i.e. not unref'ed).
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @src_event: Optional.
+ * Event handler on the source pad. This function should return
+ * TRUE if the event was handled and should be discarded
+ * (i.e. not unref'ed).
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @negotiate: Optional.
+ * Negotiate with downstream and configure buffer pools, etc.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @decide_allocation: Optional.
+ * Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @propose_allocation: Optional.
+ * Propose buffer allocation parameters for upstream elements.
+ * Subclasses should chain up to the parent implementation to
+ * invoke the default handler.
+ * @flush: Optional.
+ * Flush all remaining data from the encoder without
+ * pushing it downstream. Since: 1.2
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.4
+ * @src_query: Optional.
+ * Query handler on the source pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since: 1.4
+ * @transform_meta: Optional. Transform the metadata on the input buffer to the
+ * output buffer. By default this method is copies all meta without
+ * tags and meta with only the "video" tag. subclasses can
+ * implement this method and return %TRUE if the metadata is to be
+ * copied. Since: 1.6
+ *
+ * Subclasses can override any of the available virtual methods or not, as
+ * needed. At minimum @handle_frame needs to be overridden, and @set_format
+ * and @get_caps are likely needed as well.
+ */
+struct _GstVideoEncoderClass
+{
+ /*< private >*/
+ GstElementClass element_class;
+
+ /*< public >*/
+ /* virtual methods for subclasses */
+ gboolean (*open) (GstVideoEncoder *encoder);
+
+ gboolean (*close) (GstVideoEncoder *encoder);
+
+ gboolean (*start) (GstVideoEncoder *encoder);
+
+ gboolean (*stop) (GstVideoEncoder *encoder);
+
+ gboolean (*set_format) (GstVideoEncoder *encoder,
+ GstVideoCodecState *state);
+
+ GstFlowReturn (*handle_frame) (GstVideoEncoder *encoder,
+ GstVideoCodecFrame *frame);
+
+ gboolean (*reset) (GstVideoEncoder *encoder,
+ gboolean hard);
+
+ GstFlowReturn (*finish) (GstVideoEncoder *encoder);
+
+ GstFlowReturn (*pre_push) (GstVideoEncoder *encoder,
+ GstVideoCodecFrame *frame);
+
+ GstCaps * (*getcaps) (GstVideoEncoder *enc,
+ GstCaps *filter);
+
+ gboolean (*sink_event) (GstVideoEncoder *encoder,
+ GstEvent *event);
+
+ gboolean (*src_event) (GstVideoEncoder *encoder,
+ GstEvent *event);
+
+ gboolean (*negotiate) (GstVideoEncoder *encoder);
+
+ gboolean (*decide_allocation) (GstVideoEncoder *encoder, GstQuery *query);
+
+ gboolean (*propose_allocation) (GstVideoEncoder * encoder,
+ GstQuery * query);
+ gboolean (*flush) (GstVideoEncoder *encoder);
+
+ gboolean (*sink_query) (GstVideoEncoder *encoder,
+ GstQuery *query);
+
+ gboolean (*src_query) (GstVideoEncoder *encoder,
+ GstQuery *query);
+
+ gboolean (*transform_meta) (GstVideoEncoder *encoder,
+ GstVideoCodecFrame *frame,
+ GstMeta * meta);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING_LARGE-4];
+};
+
+GST_VIDEO_API
+GType gst_video_encoder_get_type (void);
+
+GST_VIDEO_API
+GstVideoCodecState* gst_video_encoder_get_output_state (GstVideoEncoder *encoder);
+
+GST_VIDEO_API
+GstVideoCodecState* gst_video_encoder_set_output_state (GstVideoEncoder * encoder,
+ GstCaps * caps,
+ GstVideoCodecState * reference);
+
+GST_VIDEO_API
+gboolean gst_video_encoder_negotiate (GstVideoEncoder * encoder);
+
+GST_VIDEO_API
+GstVideoCodecFrame* gst_video_encoder_get_frame (GstVideoEncoder *encoder,
+ int frame_number);
+
+GST_VIDEO_API
+GstVideoCodecFrame* gst_video_encoder_get_oldest_frame (GstVideoEncoder *encoder);
+
+GST_VIDEO_API
+GList * gst_video_encoder_get_frames (GstVideoEncoder *encoder);
+
+GST_VIDEO_API
+GstBuffer * gst_video_encoder_allocate_output_buffer (GstVideoEncoder * encoder,
+ gsize size);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_encoder_allocate_output_frame (GstVideoEncoder *encoder,
+ GstVideoCodecFrame *frame,
+ gsize size);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_encoder_finish_frame (GstVideoEncoder *encoder,
+ GstVideoCodecFrame *frame);
+
+GST_VIDEO_API
+GstFlowReturn gst_video_encoder_finish_subframe (GstVideoEncoder * encoder,
+ GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+GstCaps * gst_video_encoder_proxy_getcaps (GstVideoEncoder * enc,
+ GstCaps * caps,
+ GstCaps * filter);
+
+GST_VIDEO_API
+void gst_video_encoder_set_latency (GstVideoEncoder *encoder,
+ GstClockTime min_latency,
+ GstClockTime max_latency);
+
+GST_VIDEO_API
+void gst_video_encoder_get_latency (GstVideoEncoder *encoder,
+ GstClockTime *min_latency,
+ GstClockTime *max_latency);
+
+GST_VIDEO_API
+void gst_video_encoder_set_headers (GstVideoEncoder *encoder,
+ GList *headers);
+
+GST_VIDEO_API
+void gst_video_encoder_merge_tags (GstVideoEncoder *encoder,
+ const GstTagList *tags,
+ GstTagMergeMode mode);
+
+GST_VIDEO_API
+void gst_video_encoder_get_allocator (GstVideoEncoder *encoder,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+
+GST_VIDEO_API
+void gst_video_encoder_set_min_pts(GstVideoEncoder *encoder, GstClockTime min_pts);
+
+GST_VIDEO_API
+void gst_video_encoder_set_qos_enabled (GstVideoEncoder * encoder, gboolean enabled);
+
+GST_VIDEO_API
+gboolean gst_video_encoder_is_qos_enabled (GstVideoEncoder * encoder);
+
+GST_VIDEO_API
+GstClockTimeDiff gst_video_encoder_get_max_encode_time (GstVideoEncoder *encoder, GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+void gst_video_encoder_set_min_force_key_unit_interval (GstVideoEncoder * encoder,
+ GstClockTime interval);
+GST_VIDEO_API
+GstClockTime gst_video_encoder_get_min_force_key_unit_interval (GstVideoEncoder * encoder);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoEncoder, gst_object_unref)
+
+G_END_DECLS
+
+#endif
+
diff --git a/include/gst/video/gstvideofilter.h b/include/gst/video/gstvideofilter.h
new file mode 100644
index 0000000000..869728678e
--- /dev/null
+++ b/include/gst/video/gstvideofilter.h
@@ -0,0 +1,89 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_VIDEO_FILTER_H__
+#define __GST_VIDEO_FILTER_H__
+
+#include <gst/base/gstbasetransform.h>
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoFilter GstVideoFilter;
+typedef struct _GstVideoFilterClass GstVideoFilterClass;
+
+#define GST_TYPE_VIDEO_FILTER \
+ (gst_video_filter_get_type())
+#define GST_VIDEO_FILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_FILTER,GstVideoFilter))
+#define GST_VIDEO_FILTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_FILTER,GstVideoFilterClass))
+#define GST_VIDEO_FILTER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VIDEO_FILTER, GstVideoFilterClass))
+#define GST_IS_VIDEO_FILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_FILTER))
+#define GST_IS_VIDEO_FILTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_FILTER))
+#define GST_VIDEO_FILTER_CAST(obj) ((GstVideoFilter *)(obj))
+
+struct _GstVideoFilter {
+ GstBaseTransform element;
+
+ gboolean negotiated;
+ GstVideoInfo in_info;
+ GstVideoInfo out_info;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstVideoFilterClass:
+ * @parent_class: the parent class structure
+ * @set_info: function to be called with the negotiated caps and video infos
+ * @transform_frame: transform a video frame
+ * @transform_frame_ip: transform a video frame in place
+ *
+ * The video filter class structure.
+ */
+struct _GstVideoFilterClass {
+ GstBaseTransformClass parent_class;
+
+ gboolean (*set_info) (GstVideoFilter *filter,
+ GstCaps *incaps, GstVideoInfo *in_info,
+ GstCaps *outcaps, GstVideoInfo *out_info);
+
+ /* transform */
+ GstFlowReturn (*transform_frame) (GstVideoFilter *filter,
+ GstVideoFrame *inframe, GstVideoFrame *outframe);
+ GstFlowReturn (*transform_frame_ip) (GstVideoFilter *trans, GstVideoFrame *frame);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+GType gst_video_filter_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoFilter, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_FILTER_H__ */
diff --git a/include/gst/video/gstvideometa.h b/include/gst/video/gstvideometa.h
new file mode 100644
index 0000000000..8c8436b68c
--- /dev/null
+++ b/include/gst/video/gstvideometa.h
@@ -0,0 +1,418 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_META_H__
+#define __GST_VIDEO_META_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video.h>
+#include <gst/video/gstvideotimecode.h>
+
+G_BEGIN_DECLS
+
+#define GST_VIDEO_META_API_TYPE (gst_video_meta_api_get_type())
+#define GST_VIDEO_META_INFO (gst_video_meta_get_info())
+typedef struct _GstVideoMeta GstVideoMeta;
+
+#define GST_CAPS_FEATURE_META_GST_VIDEO_META "meta:GstVideoMeta"
+
+#define GST_VIDEO_CROP_META_API_TYPE (gst_video_crop_meta_api_get_type())
+#define GST_VIDEO_CROP_META_INFO (gst_video_crop_meta_get_info())
+typedef struct _GstVideoCropMeta GstVideoCropMeta;
+
+/**
+ * GstVideoMeta:
+ * @meta: parent #GstMeta
+ * @buffer: the buffer this metadata belongs to
+ * @flags: additional video flags
+ * @format: the video format
+ * @id: identifier of the frame
+ * @width: the video width
+ * @height: the video height
+ * @n_planes: the number of planes in the image
+ * @offset: array of offsets for the planes. This field might not always be
+ * valid, it is used by the default implementation of @map.
+ * @stride: array of strides for the planes. This field might not always be
+ * valid, it is used by the default implementation of @map.
+ * @map: map the memory of a plane
+ * @unmap: unmap the memory of a plane
+ * @alignment: the paddings and alignment constraints of the video buffer.
+ * It is up to the caller of `gst_buffer_add_video_meta_full()` to set it
+ * using gst_video_meta_set_alignment(), if they did not it defaults
+ * to no padding and no alignment. Since: 1.18
+ *
+ * Extra buffer metadata describing image properties
+ *
+ * This meta can also be used by downstream elements to specifiy their
+ * buffer layout requirements for upstream. Upstream should try to
+ * fit those requirements, if possible, in order to prevent buffer copies.
+ *
+ * This is done by passing a custom #GstStructure to
+ * gst_query_add_allocation_meta() when handling the ALLOCATION query.
+ * This structure should be named 'video-meta' and can have the following
+ * fields:
+ * - padding-top (uint): extra pixels on the top
+ * - padding-bottom (uint): extra pixels on the bottom
+ * - padding-left (uint): extra pixels on the left side
+ * - padding-right (uint): extra pixels on the right side
+ * The padding fields have the same semantic as #GstVideoMeta.alignment
+ * and so represent the paddings requested on produced video buffers.
+ */
+struct _GstVideoMeta {
+ GstMeta meta;
+
+ GstBuffer *buffer;
+
+ GstVideoFrameFlags flags;
+ GstVideoFormat format;
+ gint id;
+ guint width;
+ guint height;
+
+ guint n_planes;
+ gsize offset[GST_VIDEO_MAX_PLANES];
+ gint stride[GST_VIDEO_MAX_PLANES];
+
+ gboolean (*map) (GstVideoMeta *meta, guint plane, GstMapInfo *info,
+ gpointer *data, gint * stride, GstMapFlags flags);
+ gboolean (*unmap) (GstVideoMeta *meta, guint plane, GstMapInfo *info);
+
+ GstVideoAlignment alignment;
+};
+
+GST_VIDEO_API
+GType gst_video_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo * gst_video_meta_get_info (void);
+
+GST_VIDEO_API
+GstVideoMeta * gst_buffer_get_video_meta (GstBuffer *buffer);
+
+GST_VIDEO_API
+GstVideoMeta * gst_buffer_get_video_meta_id (GstBuffer *buffer, gint id);
+
+GST_VIDEO_API
+GstVideoMeta * gst_buffer_add_video_meta (GstBuffer *buffer, GstVideoFrameFlags flags,
+ GstVideoFormat format, guint width, guint height);
+
+GST_VIDEO_API
+GstVideoMeta * gst_buffer_add_video_meta_full (GstBuffer *buffer, GstVideoFrameFlags flags,
+ GstVideoFormat format, guint width, guint height,
+ guint n_planes, gsize offset[GST_VIDEO_MAX_PLANES],
+ gint stride[GST_VIDEO_MAX_PLANES]);
+
+GST_VIDEO_API
+gboolean gst_video_meta_map (GstVideoMeta *meta, guint plane, GstMapInfo *info,
+ gpointer *data, gint *stride, GstMapFlags flags);
+
+GST_VIDEO_API
+gboolean gst_video_meta_unmap (GstVideoMeta *meta, guint plane, GstMapInfo *info);
+
+GST_VIDEO_API
+gboolean gst_video_meta_set_alignment (GstVideoMeta * meta, GstVideoAlignment alignment);
+
+GST_VIDEO_API
+gboolean gst_video_meta_get_plane_size (GstVideoMeta * meta, gsize plane_size[GST_VIDEO_MAX_PLANES]);
+
+GST_VIDEO_API
+gboolean gst_video_meta_get_plane_height (GstVideoMeta * meta, guint plane_height[GST_VIDEO_MAX_PLANES]);
+
+/**
+ * GstVideoCropMeta:
+ * @meta: parent #GstMeta
+ * @x: the horizontal offset
+ * @y: the vertical offset
+ * @width: the cropped width
+ * @height: the cropped height
+ *
+ * Extra buffer metadata describing image cropping.
+ */
+struct _GstVideoCropMeta {
+ GstMeta meta;
+
+ guint x;
+ guint y;
+ guint width;
+ guint height;
+};
+
+GST_VIDEO_API
+GType gst_video_crop_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo * gst_video_crop_meta_get_info (void);
+
+#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_API_TYPE))
+#define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))
+
+/* video metadata transforms */
+
+GST_VIDEO_API
+GQuark gst_video_meta_transform_scale_get_quark (void);
+/**
+ * gst_video_meta_transform_scale:
+ *
+ * GQuark for the video "gst-video-scale" transform.
+ */
+#define GST_VIDEO_META_TRANSFORM_IS_SCALE(type) ((type) == gst_video_meta_transform_scale_get_quark())
+
+/**
+ * GstVideoMetaTransform:
+ * @in_info: the input #GstVideoInfo
+ * @out_info: the output #GstVideoInfo
+ *
+ * Extra data passed to a video transform #GstMetaTransformFunction such as:
+ * "gst-video-scale".
+ */
+typedef struct {
+ GstVideoInfo *in_info;
+ GstVideoInfo *out_info;
+} GstVideoMetaTransform;
+
+/**
+ * GstVideoGLTextureType:
+ * @GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE: Luminance texture, GL_LUMINANCE
+ * @GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA: Luminance-alpha texture, GL_LUMINANCE_ALPHA
+ * @GST_VIDEO_GL_TEXTURE_TYPE_RGB16: RGB 565 texture, GL_RGB
+ * @GST_VIDEO_GL_TEXTURE_TYPE_RGB: RGB texture, GL_RGB
+ * @GST_VIDEO_GL_TEXTURE_TYPE_RGBA: RGBA texture, GL_RGBA
+ * @GST_VIDEO_GL_TEXTURE_TYPE_R: R texture, GL_RED_EXT
+ * @GST_VIDEO_GL_TEXTURE_TYPE_RG: RG texture, GL_RG_EXT
+ *
+ * The GL texture type.
+ */
+typedef enum
+{
+ GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE,
+ GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
+ GST_VIDEO_GL_TEXTURE_TYPE_RGB16,
+ GST_VIDEO_GL_TEXTURE_TYPE_RGB,
+ GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
+ GST_VIDEO_GL_TEXTURE_TYPE_R,
+ GST_VIDEO_GL_TEXTURE_TYPE_RG
+} GstVideoGLTextureType;
+
+/**
+ * GstVideoGLTextureOrientation:
+ * @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL: Top line first in memory, left row first
+ * @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP: Bottom line first in memory, left row first
+ * @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL: Top line first in memory, right row first
+ * @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP: Bottom line first in memory, right row first
+ *
+ * The orientation of the GL texture.
+ */
+typedef enum
+{
+ GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL,
+ GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP,
+ GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL,
+ GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP
+} GstVideoGLTextureOrientation;
+
+#define GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE (gst_video_gl_texture_upload_meta_api_get_type())
+#define GST_VIDEO_GL_TEXTURE_UPLOAD_META_INFO (gst_video_gl_texture_upload_meta_get_info())
+
+typedef struct _GstVideoGLTextureUploadMeta GstVideoGLTextureUploadMeta;
+typedef gboolean (*GstVideoGLTextureUpload) (GstVideoGLTextureUploadMeta *meta, guint texture_id[4]);
+
+#define GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META "meta:GstVideoGLTextureUploadMeta"
+
+/**
+ * GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META:
+ *
+ * An option that can be activated on a bufferpool to request gl texture upload
+ * meta on buffers from the pool.
+ *
+ * When this option is enabled on the bufferpool,
+ * @GST_BUFFER_POOL_OPTION_VIDEO_META should also be enabled.
+ *
+ * Since: 1.2.2
+ */
+#define GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META "GstBufferPoolOptionVideoGLTextureUploadMeta"
+
+/**
+ * GstVideoGLTextureUploadMeta:
+ * @meta: parent #GstMeta
+ * @texture_orientation: Orientation of the textures
+ * @n_textures: Number of textures that are generated
+ * @texture_type: Type of each texture
+ *
+ * Extra buffer metadata for uploading a buffer to an OpenGL texture
+ * ID. The caller of gst_video_gl_texture_upload_meta_upload() must
+ * have OpenGL set up and call this from a thread where it is valid
+ * to upload something to an OpenGL texture.
+ */
+
+struct _GstVideoGLTextureUploadMeta {
+ GstMeta meta;
+
+ GstVideoGLTextureOrientation texture_orientation;
+ guint n_textures;
+ GstVideoGLTextureType texture_type[4];
+
+ /* <private> */
+ GstBuffer *buffer;
+ GstVideoGLTextureUpload upload;
+
+ gpointer user_data;
+ GBoxedCopyFunc user_data_copy;
+ GBoxedFreeFunc user_data_free;
+};
+
+GST_VIDEO_API
+GType gst_video_gl_texture_upload_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo * gst_video_gl_texture_upload_meta_get_info (void);
+
+#define gst_buffer_get_video_gl_texture_upload_meta(b) ((GstVideoGLTextureUploadMeta*)gst_buffer_get_meta((b),GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoGLTextureUploadMeta *
+ gst_buffer_add_video_gl_texture_upload_meta (GstBuffer *buffer,
+ GstVideoGLTextureOrientation texture_orientation,
+ guint n_textures,
+ GstVideoGLTextureType texture_type[4],
+ GstVideoGLTextureUpload upload,
+ gpointer user_data,
+ GBoxedCopyFunc user_data_copy,
+ GBoxedFreeFunc user_data_free);
+
+GST_VIDEO_API
+gboolean gst_video_gl_texture_upload_meta_upload (GstVideoGLTextureUploadMeta *meta,
+ guint texture_id[4]);
+
+
+/**
+ * GstVideoRegionOfInterestMeta:
+ * @meta: parent #GstMeta
+ * @roi_type: GQuark describing the semantic of the Roi (f.i. a face, a pedestrian)
+ * @id: identifier of this particular ROI
+ * @parent_id: identifier of its parent ROI, used f.i. for ROI hierarchisation.
+ * @x: x component of upper-left corner
+ * @y: y component of upper-left corner
+ * @w: bounding box width
+ * @h: bounding box height
+ * @params: list of #GstStructure containing element-specific params for downstream,
+ * see gst_video_region_of_interest_meta_add_param(). (Since: 1.14)
+ *
+ * Extra buffer metadata describing an image region of interest
+ */
+typedef struct {
+ GstMeta meta;
+
+ GQuark roi_type;
+ gint id;
+ gint parent_id;
+
+ guint x;
+ guint y;
+ guint w;
+ guint h;
+
+ GList *params;
+} GstVideoRegionOfInterestMeta;
+
+GST_VIDEO_API
+GType gst_video_region_of_interest_meta_api_get_type (void);
+#define GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE (gst_video_region_of_interest_meta_api_get_type())
+GST_VIDEO_API
+const GstMetaInfo *gst_video_region_of_interest_meta_get_info (void);
+#define GST_VIDEO_REGION_OF_INTEREST_META_INFO (gst_video_region_of_interest_meta_get_info())
+
+#define gst_buffer_get_video_region_of_interest_meta(b) \
+ ((GstVideoRegionOfInterestMeta*)gst_buffer_get_meta((b),GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE))
+GST_VIDEO_API
+GstVideoRegionOfInterestMeta *gst_buffer_get_video_region_of_interest_meta_id (GstBuffer * buffer,
+ gint id);
+
+GST_VIDEO_API
+GstVideoRegionOfInterestMeta *gst_buffer_add_video_region_of_interest_meta (GstBuffer * buffer,
+ const gchar * roi_type,
+ guint x,
+ guint y,
+ guint w,
+ guint h);
+
+GST_VIDEO_API
+GstVideoRegionOfInterestMeta *gst_buffer_add_video_region_of_interest_meta_id (GstBuffer * buffer,
+ GQuark roi_type,
+ guint x,
+ guint y,
+ guint w,
+ guint h);
+GST_VIDEO_API
+void gst_video_region_of_interest_meta_add_param (GstVideoRegionOfInterestMeta * meta,
+ GstStructure * s);
+
+GST_VIDEO_API
+GstStructure *gst_video_region_of_interest_meta_get_param (GstVideoRegionOfInterestMeta * meta,
+ const gchar * name);
+
+/**
+ * GstVideoTimeCodeMeta:
+ * @meta: parent #GstMeta
+ * @tc: the GstVideoTimeCode to attach
+ *
+ * Extra buffer metadata describing the GstVideoTimeCode of the frame.
+ *
+ * Each frame is assumed to have its own timecode, i.e. they are not
+ * automatically incremented/interpolated.
+ *
+ * Since: 1.10
+ */
+typedef struct {
+ GstMeta meta;
+
+ GstVideoTimeCode tc;
+} GstVideoTimeCodeMeta;
+
+GST_VIDEO_API
+GType gst_video_time_code_meta_api_get_type (void);
+#define GST_VIDEO_TIME_CODE_META_API_TYPE (gst_video_time_code_meta_api_get_type())
+
+GST_VIDEO_API
+const GstMetaInfo *gst_video_time_code_meta_get_info (void);
+#define GST_VIDEO_TIME_CODE_META_INFO (gst_video_time_code_meta_get_info())
+
+#define gst_buffer_get_video_time_code_meta(b) \
+ ((GstVideoTimeCodeMeta*)gst_buffer_get_meta((b),GST_VIDEO_TIME_CODE_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoTimeCodeMeta *gst_buffer_add_video_time_code_meta (GstBuffer * buffer,
+ const GstVideoTimeCode* tc);
+
+GST_VIDEO_API
+GstVideoTimeCodeMeta *
+gst_buffer_add_video_time_code_meta_full (GstBuffer * buffer,
+ guint fps_n,
+ guint fps_d,
+ GDateTime * latest_daily_jam,
+ GstVideoTimeCodeFlags flags,
+ guint hours,
+ guint minutes,
+ guint seconds,
+ guint frames,
+ guint field_count);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_META_H__ */
diff --git a/include/gst/video/gstvideopool.h b/include/gst/video/gstvideopool.h
new file mode 100644
index 0000000000..6fd0db1bcd
--- /dev/null
+++ b/include/gst/video/gstvideopool.h
@@ -0,0 +1,88 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_POOL_H__
+#define __GST_VIDEO_POOL_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_BUFFER_POOL_OPTION_VIDEO_META:
+ *
+ * An option that can be activated on bufferpool to request video metadata
+ * on buffers from the pool.
+ */
+#define GST_BUFFER_POOL_OPTION_VIDEO_META "GstBufferPoolOptionVideoMeta"
+
+/**
+ * GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT:
+ *
+ * A bufferpool option to enable extra padding. When a bufferpool supports this
+ * option, gst_buffer_pool_config_set_video_alignment() can be called.
+ *
+ * When this option is enabled on the bufferpool,
+ * #GST_BUFFER_POOL_OPTION_VIDEO_META should also be enabled.
+ */
+#define GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT "GstBufferPoolOptionVideoAlignment"
+
+/* setting a bufferpool config */
+
+GST_VIDEO_API
+void gst_buffer_pool_config_set_video_alignment (GstStructure *config, const GstVideoAlignment *align);
+
+GST_VIDEO_API
+gboolean gst_buffer_pool_config_get_video_alignment (GstStructure *config, GstVideoAlignment *align);
+
+/* video bufferpool */
+typedef struct _GstVideoBufferPool GstVideoBufferPool;
+typedef struct _GstVideoBufferPoolClass GstVideoBufferPoolClass;
+typedef struct _GstVideoBufferPoolPrivate GstVideoBufferPoolPrivate;
+
+#define GST_TYPE_VIDEO_BUFFER_POOL (gst_video_buffer_pool_get_type())
+#define GST_IS_VIDEO_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_BUFFER_POOL))
+#define GST_VIDEO_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_BUFFER_POOL, GstVideoBufferPool))
+#define GST_VIDEO_BUFFER_POOL_CAST(obj) ((GstVideoBufferPool*)(obj))
+
+struct _GstVideoBufferPool
+{
+ GstBufferPool bufferpool;
+
+ GstVideoBufferPoolPrivate *priv;
+};
+
+struct _GstVideoBufferPoolClass
+{
+ GstBufferPoolClass parent_class;
+};
+
+GST_VIDEO_API
+GType gst_video_buffer_pool_get_type (void);
+
+GST_VIDEO_API
+GstBufferPool * gst_video_buffer_pool_new (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoBufferPool, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_POOL_H__ */
diff --git a/include/gst/video/gstvideosink.h b/include/gst/video/gstvideosink.h
new file mode 100644
index 0000000000..a7a226dde2
--- /dev/null
+++ b/include/gst/video/gstvideosink.h
@@ -0,0 +1,153 @@
+/* GStreamer video sink base class
+ * Copyright (C) <2003> Julien Moutte <julien@moutte.net>
+ * Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* FIXME 0.11: turn this into a proper base class */
+
+#ifndef __GST_VIDEO_SINK_H__
+#define __GST_VIDEO_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasesink.h>
+#include <gst/video/video-prelude.h>
+#include <gst/video/video-info.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
+#define GST_VIDEO_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
+#define GST_VIDEO_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
+#define GST_IS_VIDEO_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
+#define GST_IS_VIDEO_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
+#define GST_VIDEO_SINK_GET_CLASS(klass) \
+ (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
+
+/**
+ * GST_VIDEO_SINK_CAST:
+ * @obj: a #GstVideoSink or derived object
+ *
+ * Cast @obj to a #GstVideoSink without runtime type check.
+ */
+#define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
+
+/**
+ * GST_VIDEO_SINK_PAD:
+ * @obj: a #GstVideoSink
+ *
+ * Get the sink #GstPad of @obj.
+ */
+#define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
+
+#define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
+#define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
+
+typedef struct _GstVideoSink GstVideoSink;
+typedef struct _GstVideoSinkClass GstVideoSinkClass;
+typedef struct _GstVideoRectangle GstVideoRectangle;
+typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
+
+/**
+ * GstVideoRectangle:
+ * @x: X coordinate of rectangle's top-left point
+ * @y: Y coordinate of rectangle's top-left point
+ * @w: width of the rectangle
+ * @h: height of the rectangle
+ *
+ * Helper structure representing a rectangular area.
+ */
+struct _GstVideoRectangle {
+ gint x;
+ gint y;
+ gint w;
+ gint h;
+};
+
+/**
+ * GstVideoSink:
+ * @height: video height (derived class needs to set this)
+ * @width: video width (derived class needs to set this)
+ *
+ * The video sink instance structure. Derived video sinks should set the
+ * @height and @width members.
+ */
+struct _GstVideoSink {
+ GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
+
+ /*< public >*/
+ gint width, height;
+
+ /*< private >*/
+ GstVideoSinkPrivate *priv;
+
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstVideoSinkClass:
+ * @parent_class: the parent class structure
+ * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
+ * #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
+ * suppressed if the #GstVideoSink:show-preroll-frame property is set to
+ * %FALSE.
+ *
+ * The video sink class structure. Derived classes should override the
+ * @show_frame virtual function.
+ */
+struct _GstVideoSinkClass {
+ GstBaseSinkClass parent_class;
+
+ GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
+
+ /**
+ * GstVideoSinkClass::set_info:
+ * @caps: A #GstCaps.
+ * @info: A #GstVideoInfo corresponding to @caps.
+ *
+ * Notifies the subclass of changed #GstVideoInfo.
+ *
+ * Since: 1.20
+ */
+ gboolean (*set_info) (GstVideoSink *video_sink, GstCaps *caps, const GstVideoInfo *info);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING-1];
+};
+
+GST_VIDEO_API
+GType gst_video_sink_get_type (void);
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_center_rect)
+void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
+ GstVideoRectangle *result, gboolean scaling);
+
+GST_VIDEO_API
+void gst_video_center_rect (const GstVideoRectangle * src,
+ const GstVideoRectangle * dst,
+ GstVideoRectangle * result,
+ gboolean scaling);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoSink, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_SINK_H__ */
diff --git a/include/gst/video/gstvideotimecode.h b/include/gst/video/gstvideotimecode.h
new file mode 100644
index 0000000000..d35269687a
--- /dev/null
+++ b/include/gst/video/gstvideotimecode.h
@@ -0,0 +1,257 @@
+/* GStreamer
+ * Copyright (C) <2016> Vivia Nikolaidou <vivia@toolsonair.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_TIME_CODE_H__
+#define __GST_VIDEO_TIME_CODE_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoTimeCodeConfig GstVideoTimeCodeConfig;
+typedef struct _GstVideoTimeCode GstVideoTimeCode;
+typedef struct _GstVideoTimeCodeInterval GstVideoTimeCodeInterval;
+
+/**
+ * GstVideoTimeCodeFlags:
+ * @GST_VIDEO_TIME_CODE_FLAGS_NONE: No flags
+ * @GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME: Whether we have drop frame rate
+ * @GST_VIDEO_TIME_CODE_FLAGS_INTERLACED: Whether we have interlaced video
+ *
+ * Flags related to the time code information.
+ * For drop frame, only 30000/1001 and 60000/1001 frame rates are supported.
+ *
+ * Since: 1.10
+ */
+typedef enum
+{
+ GST_VIDEO_TIME_CODE_FLAGS_NONE = 0,
+ GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME = (1<<0),
+ GST_VIDEO_TIME_CODE_FLAGS_INTERLACED = (1<<1)
+ /* Not supported yet:
+ * GST_VIDEO_TIME_CODE_ALLOW_MORE_THAN_24H = (1<<2)
+ * GST_VIDEO_TIME_CODE_ALLOW_NEGATIVE = (1<<3)
+ */
+} GstVideoTimeCodeFlags;
+
+/**
+ * GstVideoTimeCodeConfig:
+ * @fps_n: Numerator of the frame rate
+ * @fps_d: Denominator of the frame rate
+ * @flags: the corresponding #GstVideoTimeCodeFlags
+ * @latest_daily_jam: The latest daily jam information, if present, or NULL
+ *
+ * Supported frame rates: 30000/1001, 60000/1001 (both with and without drop
+ * frame), and integer frame rates e.g. 25/1, 30/1, 50/1, 60/1.
+ *
+ * The configuration of the time code.
+ *
+ * Since: 1.10
+ */
+struct _GstVideoTimeCodeConfig {
+ guint fps_n;
+ guint fps_d;
+ GstVideoTimeCodeFlags flags;
+ GDateTime *latest_daily_jam;
+};
+
+/**
+ * GstVideoTimeCode:
+ * @hours: the hours field of #GstVideoTimeCode
+ * @minutes: the minutes field of #GstVideoTimeCode
+ * @seconds: the seconds field of #GstVideoTimeCode
+ * @frames: the frames field of #GstVideoTimeCode
+ * @field_count: Interlaced video field count
+ * @config: the corresponding #GstVideoTimeCodeConfig
+ *
+ * @field_count must be 0 for progressive video and 1 or 2 for interlaced.
+ *
+ * A representation of a SMPTE time code.
+ *
+ * @hours must be positive and less than 24. Will wrap around otherwise.
+ * @minutes and @seconds must be positive and less than 60.
+ * @frames must be less than or equal to @config.fps_n / @config.fps_d
+ * These values are *NOT* automatically normalized.
+ *
+ * Since: 1.10
+ */
+struct _GstVideoTimeCode {
+ GstVideoTimeCodeConfig config;
+
+ guint hours;
+ guint minutes;
+ guint seconds;
+ guint frames;
+ guint field_count;
+};
+
+/**
+ * GstVideoTimeCodeInterval:
+ * @hours: the hours field of #GstVideoTimeCodeInterval
+ * @minutes: the minutes field of #GstVideoTimeCodeInterval
+ * @seconds: the seconds field of #GstVideoTimeCodeInterval
+ * @frames: the frames field of #GstVideoTimeCodeInterval
+ *
+ * A representation of a difference between two #GstVideoTimeCode instances.
+ * Will not necessarily correspond to a real timecode (e.g. 00:00:10;00)
+ *
+ * Since: 1.12
+ */
+struct _GstVideoTimeCodeInterval {
+ guint hours;
+ guint minutes;
+ guint seconds;
+ guint frames;
+};
+
+#define GST_VIDEO_TIME_CODE_INIT { {0, 0, 0, NULL}, 0, 0, 0, 0, 0 }
+
+#define GST_TYPE_VIDEO_TIME_CODE (gst_video_time_code_get_type())
+GST_VIDEO_API
+GType gst_video_time_code_get_type (void);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_new (guint fps_n,
+ guint fps_d,
+ GDateTime * latest_daily_jam,
+ GstVideoTimeCodeFlags flags,
+ guint hours,
+ guint minutes,
+ guint seconds,
+ guint frames,
+ guint field_count);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_new_empty (void);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_new_from_string (const gchar * tc_str);
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_time_code_new_from_date_time_full)
+GstVideoTimeCode * gst_video_time_code_new_from_date_time (guint fps_n,
+ guint fps_d,
+ GDateTime * dt,
+ GstVideoTimeCodeFlags flags,
+ guint field_count);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_new_from_date_time_full (guint fps_n,
+ guint fps_d,
+ GDateTime * dt,
+ GstVideoTimeCodeFlags flags,
+ guint field_count);
+
+GST_VIDEO_API
+void gst_video_time_code_free (GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_copy (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+void gst_video_time_code_init (GstVideoTimeCode * tc,
+ guint fps_n,
+ guint fps_d,
+ GDateTime * latest_daily_jam,
+ GstVideoTimeCodeFlags flags,
+ guint hours,
+ guint minutes,
+ guint seconds,
+ guint frames,
+ guint field_count);
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_time_code_init_from_date_time_full)
+void gst_video_time_code_init_from_date_time (GstVideoTimeCode * tc,
+ guint fps_n,
+ guint fps_d,
+ GDateTime * dt,
+ GstVideoTimeCodeFlags flags,
+ guint field_count);
+GST_VIDEO_API
+gboolean gst_video_time_code_init_from_date_time_full (GstVideoTimeCode * tc,
+ guint fps_n,
+ guint fps_d,
+ GDateTime * dt,
+ GstVideoTimeCodeFlags flags,
+ guint field_count);
+
+GST_VIDEO_API
+void gst_video_time_code_clear (GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+gboolean gst_video_time_code_is_valid (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+gint gst_video_time_code_compare (const GstVideoTimeCode * tc1,
+ const GstVideoTimeCode * tc2);
+
+GST_VIDEO_API
+void gst_video_time_code_increment_frame (GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+void gst_video_time_code_add_frames (GstVideoTimeCode * tc,
+ gint64 frames);
+
+GST_VIDEO_API
+gchar *gst_video_time_code_to_string (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+GDateTime *gst_video_time_code_to_date_time (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+guint64 gst_video_time_code_nsec_since_daily_jam (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+guint64 gst_video_time_code_frames_since_daily_jam (const GstVideoTimeCode * tc);
+
+GST_VIDEO_API
+GstVideoTimeCode * gst_video_time_code_add_interval (const GstVideoTimeCode * tc, const GstVideoTimeCodeInterval * tc_inter);
+
+#define GST_TYPE_VIDEO_TIME_CODE_INTERVAL (gst_video_time_code_interval_get_type())
+GST_VIDEO_API
+GType gst_video_time_code_interval_get_type (void);
+
+GST_VIDEO_API
+GstVideoTimeCodeInterval * gst_video_time_code_interval_new (guint hours,
+ guint minutes,
+ guint seconds,
+ guint frames);
+
+GST_VIDEO_API
+GstVideoTimeCodeInterval * gst_video_time_code_interval_new_from_string (const gchar * tc_inter_str);
+
+GST_VIDEO_API
+void gst_video_time_code_interval_free (GstVideoTimeCodeInterval * tc);
+
+GST_VIDEO_API
+GstVideoTimeCodeInterval * gst_video_time_code_interval_copy (const GstVideoTimeCodeInterval * tc);
+
+GST_VIDEO_API
+void gst_video_time_code_interval_init (GstVideoTimeCodeInterval * tc,
+ guint hours,
+ guint minutes,
+ guint seconds,
+ guint frames);
+
+GST_VIDEO_API
+void gst_video_time_code_interval_clear (GstVideoTimeCodeInterval * tc);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_TIME_CODE_H__ */
diff --git a/include/gst/video/gstvideoutils.h b/include/gst/video/gstvideoutils.h
new file mode 100644
index 0000000000..cbe19f0e61
--- /dev/null
+++ b/include/gst/video/gstvideoutils.h
@@ -0,0 +1,341 @@
+/* GStreamer
+ * Copyright (C) 2008 David Schleef <ds@schleef.org>
+ * Copyright (C) 2012 Collabora Ltd.
+ * Author : Edward Hervey <edward@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_H__
+#include <gst/video/video.h>
+#endif
+
+#ifndef _GST_VIDEO_UTILS_H_
+#define _GST_VIDEO_UTILS_H_
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+#include <gst/video/video-hdr.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_VIDEO_CODEC_STATE \
+ (gst_video_codec_state_get_type())
+
+#define GST_TYPE_VIDEO_CODEC_FRAME \
+ (gst_video_codec_frame_get_type())
+
+typedef struct _GstVideoCodecState GstVideoCodecState;
+typedef struct _GstVideoCodecFrame GstVideoCodecFrame;
+
+/**
+ * GstVideoCodecState:
+ * @info: The #GstVideoInfo describing the stream
+ * @caps: The #GstCaps used in the caps negotiation of the pad.
+ * @codec_data: a #GstBuffer corresponding to the
+ * 'codec_data' field of a stream, or NULL.
+ * @allocation_caps: The #GstCaps for allocation query and pool
+ * negotiation. Since: 1.10
+ * @mastering_display_info: Mastering display color volume information
+ * (HDR metadata) for the stream. Since: 1.20
+ * @content_light_level: Content light level information for the stream.
+ * Since: 1.20
+ *
+ * Structure representing the state of an incoming or outgoing video
+ * stream for encoders and decoders.
+ *
+ * Decoders and encoders will receive such a state through their
+ * respective @set_format vmethods.
+ *
+ * Decoders and encoders can set the downstream state, by using the
+ * gst_video_decoder_set_output_state() or
+ * gst_video_encoder_set_output_state() methods.
+ */
+/**
+ * GstVideoCodecState.mastering_display_info:
+ *
+ * Mastering display color volume information (HDR metadata) for the stream.
+ *
+ * Since: 1.20
+ */
+/**
+ * GstVideoCodecState.content_light_level:
+ *
+ * Content light level information for the stream.
+ *
+ * Since: 1.20
+ */
+struct _GstVideoCodecState
+{
+ /*< private >*/
+ gint ref_count;
+
+ /*< public >*/
+ GstVideoInfo info;
+
+ GstCaps *caps;
+
+ GstBuffer *codec_data;
+
+ GstCaps *allocation_caps;
+
+ GstVideoMasteringDisplayInfo *mastering_display_info;
+ GstVideoContentLightLevel *content_light_level;
+
+ /*< private >*/
+ gpointer padding[GST_PADDING_LARGE - 3];
+};
+
+/**
+ * GstVideoCodecFrameFlags:
+ * @GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY: is the frame only meant to be decoded
+ * @GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT: is the frame a synchronization point (keyframe)
+ * @GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME: should the output frame be made a keyframe
+ * @GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS: should the encoder output stream headers
+ * @GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED: the buffer data is corrupted (Since: 1.20)
+ *
+ * Flags for #GstVideoCodecFrame
+ */
+typedef enum
+{
+ GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY = (1<<0),
+ GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT = (1<<1),
+ GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME = (1<<2),
+ GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS = (1<<3),
+ /**
+ * GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED:
+ *
+ * The buffer data is corrupted.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED = (1<<4),
+} GstVideoCodecFrameFlags;
+
+/**
+ * GST_VIDEO_CODEC_FRAME_FLAGS:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * The entire set of flags for the @frame
+ */
+#define GST_VIDEO_CODEC_FRAME_FLAGS(frame) ((frame)->flags)
+
+/**
+ * GST_VIDEO_CODEC_FRAME_FLAG_IS_SET:
+ * @frame: a #GstVideoCodecFrame
+ * @flag: a flag to check for
+ *
+ * Checks whether the given @flag is set
+ */
+#define GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame,flag) !!(GST_VIDEO_CODEC_FRAME_FLAGS(frame) & (flag))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_FLAG_SET:
+ * @frame: a #GstVideoCodecFrame
+ * @flag: Flag to set, can be any number of bits in guint32.
+ *
+ * This macro sets the given bits
+ */
+#define GST_VIDEO_CODEC_FRAME_FLAG_SET(frame,flag) (GST_VIDEO_CODEC_FRAME_FLAGS(frame) |= (flag))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_FLAG_UNSET:
+ * @frame: a #GstVideoCodecFrame
+ * @flag: Flag to unset
+ *
+ * This macro usets the given bits.
+ */
+#define GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame,flag) (GST_VIDEO_CODEC_FRAME_FLAGS(frame) &= ~(flag))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Tests if the buffer should only be decoded but not sent downstream.
+ */
+#define GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY(frame) (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Sets the buffer to not be sent downstream.
+ *
+ * Decoder implementation can use this if they have frames that
+ * are not meant to be displayed.
+ *
+ * Encoder implementation can safely ignore this field.
+ */
+#define GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY(frame) (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Tests if the frame is a synchronization point (like a keyframe).
+ *
+ * Decoder implementations can use this to detect keyframes.
+ */
+#define GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT(frame) (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Sets the frame to be a synchronization point (like a keyframe).
+ *
+ * Encoder implementations should set this accordingly.
+ *
+ * Decoder implementing parsing features should set this when they
+ * detect such a synchronization point.
+ */
+#define GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT(frame) (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))
+#define GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT(frame) (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT))
+
+
+/**
+ * GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Tests if the frame must be encoded as a keyframe. Applies only to
+ * frames provided to encoders. Decoders can safely ignore this field.
+ */
+#define GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME(frame) (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))
+#define GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME(frame) (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))
+#define GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME(frame) (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME))
+
+/**
+ * GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME_HEADERS:
+ * @frame: a #GstVideoCodecFrame
+ *
+ * Tests if encoder should output stream headers before outputting the
+ * resulting encoded buffer for the given frame.
+ *
+ * Applies only to frames provided to encoders. Decoders can safely
+ * ignore this field.
+ */
+#define GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME_HEADERS(frame) (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))
+#define GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME_HEADERS(frame) (GST_VIDEO_CODEC_FRAME_FLAG_SET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))
+#define GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME_HEADERS(frame) (GST_VIDEO_CODEC_FRAME_FLAG_UNSET(frame, GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS))
+
+/**
+ * GstVideoCodecFrame:
+ * @pts: Presentation timestamp
+ * @dts: Decoding timestamp
+ * @duration: Duration of the frame
+ * @system_frame_number: Unique identifier for the frame. Use this if you need
+ * to get hold of the frame later (like when data is being decoded).
+ * Typical usage in decoders is to set this on the opaque value provided
+ * to the library and get back the frame using gst_video_decoder_get_frame()
+ * @distance_from_sync: Distance in frames from the last synchronization point.
+ * @input_buffer: the input #GstBuffer that created this frame. The buffer is owned
+ * by the frame and references to the frame instead of the buffer should
+ * be kept.
+ * @output_buffer: the output #GstBuffer. Implementations should set this either
+ * directly, or by using the
+ * gst_video_decoder_allocate_output_frame() or
+ * gst_video_decoder_allocate_output_buffer() methods. The buffer is
+ * owned by the frame and references to the frame instead of the
+ * buffer should be kept.
+ * @deadline: Running time when the frame will be used.
+ *
+ * A #GstVideoCodecFrame represents a video frame both in raw and
+ * encoded form.
+ */
+struct _GstVideoCodecFrame
+{
+ /*< private >*/
+ gint ref_count;
+ guint32 flags;
+
+ /*< public >*/
+ guint32 system_frame_number; /* ED */
+
+ /*< private >*/
+ guint32 decode_frame_number; /* ED */
+ guint32 presentation_frame_number; /* ED */
+
+ /*< public >*/
+ GstClockTime dts; /* ED */
+ GstClockTime pts; /* ED */
+ GstClockTime duration; /* ED */
+
+ int distance_from_sync; /* ED */
+
+ GstBuffer *input_buffer; /* ED */
+ GstBuffer *output_buffer; /* ED */
+
+ GstClockTime deadline; /* D */
+
+ /*< private >*/
+
+ /* Events that should be pushed downstream *before*
+ * the next output_buffer */
+ /* FIXME 2.0: Use a GQueue or similar */
+ GList *events; /* ED */
+
+ gpointer user_data;
+ GDestroyNotify user_data_destroy_notify;
+
+ union {
+ struct {
+ /*< private >*/
+ GstClockTime ts;
+ GstClockTime ts2;
+ guint num_subframes;
+ guint subframes_processed;
+ } ABI;
+ gpointer padding[GST_PADDING_LARGE];
+ } abidata;
+};
+
+/* GstVideoCodecState */
+
+GST_VIDEO_API
+GType gst_video_codec_state_get_type (void);
+
+GST_VIDEO_API
+GstVideoCodecState *gst_video_codec_state_ref (GstVideoCodecState * state);
+
+GST_VIDEO_API
+void gst_video_codec_state_unref (GstVideoCodecState * state);
+
+
+/* GstVideoCodecFrame */
+
+GST_VIDEO_API
+GType gst_video_codec_frame_get_type (void);
+
+GST_VIDEO_API
+GstVideoCodecFrame *gst_video_codec_frame_ref (GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+void gst_video_codec_frame_unref (GstVideoCodecFrame * frame);
+
+GST_VIDEO_API
+void gst_video_codec_frame_set_user_data (GstVideoCodecFrame *frame,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+GST_VIDEO_API
+gpointer gst_video_codec_frame_get_user_data (GstVideoCodecFrame *frame);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoCodecFrame, gst_video_codec_frame_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoCodecState, gst_video_codec_state_unref)
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/video/navigation.h b/include/gst/video/navigation.h
new file mode 100644
index 0000000000..6bd61a5991
--- /dev/null
+++ b/include/gst/video/navigation.h
@@ -0,0 +1,338 @@
+/* GStreamer Navigation
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
+ *
+ * navigation.h: navigation interface design
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_NAVIGATION_H__
+#define __GST_NAVIGATION_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_NAVIGATION \
+ (gst_navigation_get_type ())
+#define GST_NAVIGATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation))
+#define GST_IS_NAVIGATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
+#define GST_NAVIGATION_GET_INTERFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
+
+typedef struct _GstNavigation GstNavigation;
+typedef struct _GstNavigationInterface GstNavigationInterface;
+
+/**
+ * GstNavigationInterface:
+ * @iface: the parent interface
+ * @send_event: sending a navigation event
+ *
+ * Navigation interface.
+ */
+struct _GstNavigationInterface {
+ GTypeInterface iface;
+
+ /* virtual functions */
+ void (*send_event) (GstNavigation *navigation, GstStructure *structure);
+};
+
+GST_VIDEO_API
+GType gst_navigation_get_type (void);
+
+/* Navigation commands */
+
+/**
+ * GstNavigationCommand:
+ * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
+ * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
+ * this enters the DVD root menu, or exits back to the title from the menu.
+ * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
+ * this jumps to the DVD title menu.
+ * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
+ * this jumps into the DVD root menu.
+ * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
+ * this jumps to the Subpicture menu.
+ * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
+ * the jumps to the audio menu.
+ * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
+ * this jumps to the angles menu.
+ * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
+ * this jumps to the chapter menu.
+ * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
+ * if such a button exists.
+ * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
+ * if such a button exists.
+ * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
+ * menu, if such a button exists.
+ * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
+ * menu, if such a button exists.
+ * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
+ * button in a menu, if such a button exists.
+ * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
+ * multiangle feature.
+ * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
+ * feature.
+ *
+ * A set of commands that may be issued to an element providing the
+ * #GstNavigation interface. The available commands can be queried via
+ * the gst_navigation_query_new_commands() query.
+ *
+ * For convenience in handling DVD navigation, the MENU commands are aliased as:
+ * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1
+ * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2
+ * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3
+ * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
+ * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5
+ * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6
+ * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7
+ */
+typedef enum {
+ GST_NAVIGATION_COMMAND_INVALID = 0,
+
+ GST_NAVIGATION_COMMAND_MENU1 = 1,
+ GST_NAVIGATION_COMMAND_MENU2 = 2,
+ GST_NAVIGATION_COMMAND_MENU3 = 3,
+ GST_NAVIGATION_COMMAND_MENU4 = 4,
+ GST_NAVIGATION_COMMAND_MENU5 = 5,
+ GST_NAVIGATION_COMMAND_MENU6 = 6,
+ GST_NAVIGATION_COMMAND_MENU7 = 7,
+
+ GST_NAVIGATION_COMMAND_LEFT = 20,
+ GST_NAVIGATION_COMMAND_RIGHT = 21,
+ GST_NAVIGATION_COMMAND_UP = 22,
+ GST_NAVIGATION_COMMAND_DOWN = 23,
+ GST_NAVIGATION_COMMAND_ACTIVATE = 24,
+
+ GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
+ GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
+} GstNavigationCommand;
+
+/* Some aliases for the menu command types */
+#define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
+#define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
+#define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
+#define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
+#define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
+#define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
+#define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
+
+/* Queries */
+/**
+ * GstNavigationQueryType:
+ * @GST_NAVIGATION_QUERY_INVALID: invalid query
+ * @GST_NAVIGATION_QUERY_COMMANDS: command query
+ * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
+ *
+ * Types of navigation interface queries.
+ */
+typedef enum
+{
+ GST_NAVIGATION_QUERY_INVALID = 0,
+ GST_NAVIGATION_QUERY_COMMANDS = 1,
+ GST_NAVIGATION_QUERY_ANGLES = 2
+} GstNavigationQueryType;
+
+GST_VIDEO_API
+GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
+
+GST_VIDEO_API
+GstQuery * gst_navigation_query_new_commands (void);
+
+GST_VIDEO_API
+void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
+
+GST_VIDEO_API
+void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
+ GstNavigationCommand *cmds);
+
+GST_VIDEO_API
+gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
+ guint *n_cmds);
+
+GST_VIDEO_API
+gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
+ GstNavigationCommand *cmd);
+
+GST_VIDEO_API
+GstQuery * gst_navigation_query_new_angles (void);
+
+GST_VIDEO_API
+void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
+ guint n_angles);
+
+GST_VIDEO_API
+gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
+ guint *n_angles);
+
+/* Element messages */
+/**
+ * GstNavigationMessageType:
+ * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
+ * gst_navigation_message_get_type() when the passed message is not a
+ * navigation message.
+ * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
+ * clickable region of the output, such as a DVD menu button.
+ * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
+ * changes and should re-queried by interested applications.
+ * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
+ * feature (such as a multiangle DVD) change - either angles have appeared or
+ * disappeared.
+ * @GST_NAVIGATION_MESSAGE_EVENT: Sent when a navigation event was not handled
+ * by any element in the pipeline (Since: 1.6)
+ *
+ * A set of notifications that may be received on the bus when navigation
+ * related status changes.
+ */
+typedef enum {
+ GST_NAVIGATION_MESSAGE_INVALID,
+ GST_NAVIGATION_MESSAGE_MOUSE_OVER,
+ GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
+ GST_NAVIGATION_MESSAGE_ANGLES_CHANGED,
+ GST_NAVIGATION_MESSAGE_EVENT
+} GstNavigationMessageType;
+
+GST_VIDEO_API
+GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
+
+GST_VIDEO_API
+GstMessage * gst_navigation_message_new_mouse_over (GstObject *src,
+ gboolean active);
+
+GST_VIDEO_API
+gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
+ gboolean *active);
+
+GST_VIDEO_API
+GstMessage * gst_navigation_message_new_commands_changed (GstObject *src);
+
+GST_VIDEO_API
+GstMessage * gst_navigation_message_new_angles_changed (GstObject *src,
+ guint cur_angle,
+ guint n_angles);
+
+GST_VIDEO_API
+gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
+ guint *cur_angle,
+ guint *n_angles);
+
+GST_VIDEO_API
+GstMessage * gst_navigation_message_new_event (GstObject *src,
+ GstEvent *event);
+
+GST_VIDEO_API
+gboolean gst_navigation_message_parse_event (GstMessage *message,
+ GstEvent ** event);
+/* event parsing functions */
+/**
+ * GstNavigationEventType:
+ * @GST_NAVIGATION_EVENT_INVALID: Returned from
+ * gst_navigation_event_get_type() when the passed event is not a navigation event.
+ * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
+ * gst_navigation_event_parse_key_event() to extract the details from the event.
+ * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
+ * gst_navigation_event_parse_key_event() to extract the details from the event.
+ * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
+ * gst_navigation_event_parse_mouse_button_event() to extract the details from the
+ * event.
+ * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
+ * gst_navigation_event_parse_mouse_button_event() to extract the details from the
+ * event.
+ * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
+ * gst_navigation_event_parse_mouse_move_event() to extract the details from the
+ * event.
+ * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
+ * gst_navigation_event_parse_command() to extract the details from the event.
+ * @GST_NAVIGATION_EVENT_MOUSE_SCROLL: A mouse scroll event. Use
+ * gst_navigation_event_parse_mouse_scroll_event() to extract the details from
+ * the event. (Since: 1.18)
+ *
+ * Enum values for the various events that an element implementing the
+ * GstNavigation interface might send up the pipeline.
+ */
+typedef enum {
+ GST_NAVIGATION_EVENT_INVALID = 0,
+ GST_NAVIGATION_EVENT_KEY_PRESS = 1,
+ GST_NAVIGATION_EVENT_KEY_RELEASE = 2,
+ GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS = 3,
+ GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE = 4,
+ GST_NAVIGATION_EVENT_MOUSE_MOVE = 5,
+ GST_NAVIGATION_EVENT_COMMAND = 6,
+
+ /**
+ * GST_NAVIGATION_EVENT_MOUSE_SCROLL:
+ *
+ * A mouse scroll event. Use gst_navigation_event_parse_mouse_scroll_event()
+ * to extract the details from the event.
+ *
+ * Since: 1.18
+ */
+ GST_NAVIGATION_EVENT_MOUSE_SCROLL = 7
+} GstNavigationEventType;
+
+GST_VIDEO_API
+GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
+
+GST_VIDEO_API
+gboolean gst_navigation_event_parse_key_event (GstEvent *event,
+ const gchar **key);
+
+GST_VIDEO_API
+gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
+ gint *button, gdouble *x, gdouble *y);
+
+GST_VIDEO_API
+gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
+ gdouble *x, gdouble *y);
+
+GST_VIDEO_API
+gboolean gst_navigation_event_parse_mouse_scroll_event (GstEvent *event,
+ gdouble *x, gdouble *y,
+ gdouble *delta_x, gdouble *delta_y);
+
+GST_VIDEO_API
+gboolean gst_navigation_event_parse_command (GstEvent *event,
+ GstNavigationCommand *command);
+
+/* interface virtual function wrappers */
+
+GST_VIDEO_API
+void gst_navigation_send_event (GstNavigation *navigation,
+ GstStructure *structure);
+
+GST_VIDEO_API
+void gst_navigation_send_key_event (GstNavigation *navigation,
+ const char *event, const char *key);
+
+GST_VIDEO_API
+void gst_navigation_send_mouse_event (GstNavigation *navigation,
+ const char *event, int button, double x, double y);
+
+GST_VIDEO_API
+void gst_navigation_send_mouse_scroll_event (GstNavigation *navigation,
+ double x, double y, double delta_x, double delta_y);
+
+GST_VIDEO_API
+void gst_navigation_send_command (GstNavigation *navigation,
+ GstNavigationCommand command);
+
+G_END_DECLS
+
+#endif /* __GST_NAVIGATION_H__ */
diff --git a/include/gst/video/video-anc.h b/include/gst/video/video-anc.h
new file mode 100644
index 0000000000..a28d0f2bf2
--- /dev/null
+++ b/include/gst/video/video-anc.h
@@ -0,0 +1,504 @@
+/* GStreamer
+ * Copyright (C) <2018> Edward Hervey <edward@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_ANC_H__
+#define __GST_VIDEO_ANC_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-format.h>
+#include <gst/video/video-info.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoAncillary GstVideoAncillary;
+
+/**
+ * GstVideoAncillary:
+ * @DID: The Data Identifier
+ * @SDID_block_number: The Secondary Data Identifier (if type 2) or the Data
+ * Block Number (if type 1)
+ * @data_count: The amount of data (in bytes) in @data (max 255 bytes)
+ * @data: (array length=data_count): The user data content of the Ancillary packet.
+ * Does not contain the ADF, DID, SDID nor CS.
+ *
+ * Video Ancillary data, according to SMPTE-291M specification.
+ *
+ * Note that the contents of the data are always stored as 8bit data (i.e. do not contain
+ * the parity check bits).
+ *
+ * Since: 1.16
+ */
+struct _GstVideoAncillary {
+ guint8 DID;
+ guint8 SDID_block_number;
+ guint8 data_count;
+ guint8 data[256];
+
+ /*< private >*/
+ /* Padding for future extension */
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstVideoAncillaryDID:
+ *
+ * Since: 1.16
+ */
+typedef enum {
+ GST_VIDEO_ANCILLARY_DID_UNDEFINED = 0x00,
+ GST_VIDEO_ANCILLARY_DID_DELETION = 0x80,
+ GST_VIDEO_ANCILLARY_DID_HANC_3G_AUDIO_DATA_FIRST = 0xa0,
+ GST_VIDEO_ANCILLARY_DID_HANC_3G_AUDIO_DATA_LAST = 0xa7,
+ GST_VIDEO_ANCILLARY_DID_HANC_HDTV_AUDIO_DATA_FIRST = 0xe0,
+ GST_VIDEO_ANCILLARY_DID_HANC_HDTV_AUDIO_DATA_LAST = 0xe7,
+ GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_1_FIRST = 0xec,
+ GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_1_LAST = 0xef,
+ GST_VIDEO_ANCILLARY_DID_CAMERA_POSITION = 0xf0,
+ GST_VIDEO_ANCILLARY_DID_HANC_ERROR_DETECTION = 0xf4,
+ GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_2_FIRST = 0xf8,
+ GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_2_LAST = 0xff,
+} GstVideoAncillaryDID;
+
+/**
+ * GST_VIDEO_ANCILLARY_DID16:
+ * @anc: a #GstVideoAncillary
+ *
+ * Returns the #GstVideoAncillaryDID16 of the ancillary data.
+ *
+ * Since: 1.16
+ *
+ * Returns: a #GstVideoAncillaryDID16 identifier
+ */
+#define GST_VIDEO_ANCILLARY_DID16(anc) ((guint16)((anc)->DID) << 8 | (guint16)((anc)->SDID_block_number))
+
+/**
+ * GstVideoAncillaryDID16:
+ * @GST_VIDEO_ANCILLARY_DID16_S334_EIA_708: CEA 708 Ancillary data according to SMPTE 334
+ * @GST_VIDEO_ANCILLARY_DID16_S334_EIA_608: CEA 608 Ancillary data according to SMPTE 334
+ * @GST_VIDEO_ANCILLARY_DID16_S2016_3_AFD_BAR: AFD/Bar Ancillary data according to SMPTE 2016-3 (Since: 1.18)
+ *
+ * Some know types of Ancillary Data identifiers.
+ *
+ * Since: 1.16
+ */
+typedef enum {
+ GST_VIDEO_ANCILLARY_DID16_S334_EIA_708 = 0x6101,
+ GST_VIDEO_ANCILLARY_DID16_S334_EIA_608 = 0x6102,
+ GST_VIDEO_ANCILLARY_DID16_S2016_3_AFD_BAR = 0x4105,
+} GstVideoAncillaryDID16;
+
+/**
+ * GstVideoAFDValue:
+ * @GST_VIDEO_AFD_UNAVAILABLE: Unavailable (see note 0 below).
+ * @GST_VIDEO_AFD_16_9_TOP_ALIGNED: For 4:3 coded frame, letterbox 16:9 image,
+ * at top of the coded frame. For 16:9 coded frame, full frame 16:9 image,
+ * the same as the coded frame.
+ * @GST_VIDEO_AFD_14_9_TOP_ALIGNED: For 4:3 coded frame, letterbox 14:9 image,
+ * at top of the coded frame. For 16:9 coded frame, pillarbox 14:9 image,
+ * horizontally centered in the coded frame.
+ * @GST_VIDEO_AFD_GREATER_THAN_16_9: For 4:3 coded frame, letterbox image with an aspect ratio
+ * greater than 16:9, vertically centered in the coded frame. For 16:9 coded frame,
+ * letterbox image with an aspect ratio greater than 16:9.
+ * @GST_VIDEO_AFD_4_3_FULL_16_9_FULL: For 4:3 coded frame, full frame 4:3 image,
+ * the same as the coded frame. For 16:9 coded frame, full frame 16:9 image, the same as
+ * the coded frame.
+ * @GST_VIDEO_AFD_4_3_FULL_4_3_PILLAR: For 4:3 coded frame, full frame 4:3 image, the same as
+ * the coded frame. For 16:9 coded frame, pillarbox 4:3 image, horizontally centered in the
+ * coded frame.
+ * @GST_VIDEO_AFD_16_9_LETTER_16_9_FULL: For 4:3 coded frame, letterbox 16:9 image, vertically centered in
+ * the coded frame with all image areas protected. For 16:9 coded frame, full frame 16:9 image,
+ * with all image areas protected.
+ * @GST_VIDEO_AFD_14_9_LETTER_14_9_PILLAR: For 4:3 coded frame, letterbox 14:9 image, vertically centered in
+ * the coded frame. For 16:9 coded frame, pillarbox 14:9 image, horizontally centered in the
+ * coded frame.
+ * @GST_VIDEO_AFD_4_3_FULL_14_9_CENTER: For 4:3 coded frame, full frame 4:3 image, with alternative 14:9
+ * center. For 16:9 coded frame, pillarbox 4:3 image, with alternative 14:9 center.
+ * @GST_VIDEO_AFD_16_9_LETTER_14_9_CENTER: For 4:3 coded frame, letterbox 16:9 image, with alternative 14:9
+ * center. For 16:9 coded frame, full frame 16:9 image, with alternative 14:9 center.
+ * @GST_VIDEO_AFD_16_9_LETTER_4_3_CENTER: For 4:3 coded frame, letterbox 16:9 image, with alternative 4:3
+ * center. For 16:9 coded frame, full frame 16:9 image, with alternative 4:3 center.
+ *
+ * Enumeration of the various values for Active Format Description (AFD)
+ *
+ * AFD should be included in video user data whenever the rectangular
+ * picture area containing useful information does not extend to the full height or width of the coded
+ * frame. AFD data may also be included in user data when the rectangular picture area containing
+ * useful information extends to the full height and width of the coded frame.
+ *
+ * For details, see Table 6.14 Active Format in:
+ *
+ * ATSC Digital Television Standard:
+ * Part 4 – MPEG-2 Video System Characteristics
+ *
+ * https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
+ *
+ * and Active Format Description in Complete list of AFD codes
+ *
+ * https://en.wikipedia.org/wiki/Active_Format_Description#Complete_list_of_AFD_codes
+ *
+ * and SMPTE ST2016-1
+ *
+ * Notes:
+ *
+ * 1) AFD 0 is undefined for ATSC and SMPTE ST2016-1, indicating that AFD data is not available:
+ * If Bar Data is not present, AFD '0000' indicates that exact information
+ * is not available and the active image should be assumed to be the same as the coded frame. AFD '0000'.
+ * AFD '0000' accompanied by Bar Data signals that the active image’s aspect ratio is narrower than 16:9,
+ * but is not 4:3 or 14:9. As the exact aspect ratio cannot be conveyed by AFD alone, wherever possible,
+ * AFD ‘0000’ should be accompanied by Bar Data to define the exact vertical or horizontal extent
+ * of the active image.
+ * 2) AFD 0 is reserved for DVB/ETSI
+ * 3) values 1, 5, 6, 7, and 12 are reserved for both ATSC and DVB/ETSI
+ * 4) values 2 and 3 are not recommended for ATSC, but are valid for DVB/ETSI
+ *
+ * Since: 1.18
+ */
+typedef enum {
+ GST_VIDEO_AFD_UNAVAILABLE = 0,
+ GST_VIDEO_AFD_16_9_TOP_ALIGNED = 2,
+ GST_VIDEO_AFD_14_9_TOP_ALIGNED = 3,
+ GST_VIDEO_AFD_GREATER_THAN_16_9 = 4,
+ GST_VIDEO_AFD_4_3_FULL_16_9_FULL = 8,
+ GST_VIDEO_AFD_4_3_FULL_4_3_PILLAR = 9,
+ GST_VIDEO_AFD_16_9_LETTER_16_9_FULL = 10,
+ GST_VIDEO_AFD_14_9_LETTER_14_9_PILLAR = 11,
+ GST_VIDEO_AFD_4_3_FULL_14_9_CENTER = 13,
+ GST_VIDEO_AFD_16_9_LETTER_14_9_CENTER = 14,
+ GST_VIDEO_AFD_16_9_LETTER_4_3_CENTER = 15
+} GstVideoAFDValue;
+
+/**
+ * GstVideoAFDSpec:
+ * @GST_VIDEO_AFD_SPEC_DVB_ETSI: AFD value is from DVB/ETSI standard
+ * @GST_VIDEO_AFD_SPEC_ATSC_A53: AFD value is from ATSC A/53 standard
+ * @GST_VIDEO_AFD_SPEC_SMPT_ST2016_1 : AFD value is from SMPTE ST2016-1 standard
+ *
+ * Enumeration of the different standards that may apply to AFD data:
+ *
+ * 0) ETSI/DVB:
+ * https://www.etsi.org/deliver/etsi_ts/101100_101199/101154/02.01.01_60/ts_101154v020101p.pdf
+ *
+ * 1) ATSC A/53:
+ * https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
+ *
+ * 2) SMPTE ST2016-1:
+ *
+ * Since: 1.18
+ */
+typedef enum {
+ GST_VIDEO_AFD_SPEC_DVB_ETSI,
+ GST_VIDEO_AFD_SPEC_ATSC_A53,
+ GST_VIDEO_AFD_SPEC_SMPTE_ST2016_1
+} GstVideoAFDSpec;
+
+/**
+ * GstVideoAFDMeta:
+ * @meta: parent #GstMeta
+ * @field: 0 for progressive or field 1 and 1 for field 2
+ * @spec: #GstVideoAFDSpec that applies to @afd
+ * @afd: #GstVideoAFDValue AFD value
+ *
+ * Active Format Description (AFD)
+ *
+ * For details, see Table 6.14 Active Format in:
+ *
+ * ATSC Digital Television Standard:
+ * Part 4 – MPEG-2 Video System Characteristics
+ *
+ * https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
+ *
+ * and Active Format Description in Complete list of AFD codes
+ *
+ * https://en.wikipedia.org/wiki/Active_Format_Description#Complete_list_of_AFD_codes
+ *
+ * and SMPTE ST2016-1
+ *
+ * Since: 1.18
+ */
+typedef struct {
+ GstMeta meta;
+
+ guint8 field;
+ GstVideoAFDSpec spec;
+ GstVideoAFDValue afd;
+} GstVideoAFDMeta;
+
+GST_VIDEO_API GType gst_video_afd_meta_api_get_type (void);
+#define GST_VIDEO_AFD_META_API_TYPE (gst_video_afd_meta_api_get_type())
+
+GST_VIDEO_API const GstMetaInfo *gst_video_afd_meta_get_info (void);
+#define GST_VIDEO_AFD_META_INFO (gst_video_afd_meta_get_info())
+
+/**
+ * gst_buffer_get_video_afd_meta:
+ * @b: A #GstBuffer
+ *
+ * Gets the #GstVideoAFDMeta that might be present on @b.
+ *
+ * Note: there may be two #GstVideoAFDMeta structs for interlaced video.
+ *
+ * Since: 1.18
+ *
+ * Returns: The first #GstVideoAFDMeta present on @b, or %NULL if
+ * no #GstVideoAFDMeta are present
+ */
+#define gst_buffer_get_video_afd_meta(b) \
+ ((GstVideoAFDMeta*)gst_buffer_get_meta((b),GST_VIDEO_AFD_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoAFDMeta *gst_buffer_add_video_afd_meta (GstBuffer * buffer, guint8 field,
+ GstVideoAFDSpec spec,
+ GstVideoAFDValue afd);
+/**
+ * GstVideoBarMeta:
+ * @meta: parent #GstMeta
+ * @field: 0 for progressive or field 1 and 1 for field 2
+ * @is_letterbox: if true then bar data specifies letterbox, otherwise pillarbox
+ * @bar_data1: If @is_letterbox is true, then the value specifies the
+ * last line of a horizontal letterbox bar area at top of reconstructed frame.
+ * Otherwise, it specifies the last horizontal luminance sample of a vertical pillarbox
+ * bar area at the left side of the reconstructed frame
+ * @bar_data2: If @is_letterbox is true, then the value specifies the
+ * first line of a horizontal letterbox bar area at bottom of reconstructed frame.
+ * Otherwise, it specifies the first horizontal
+ * luminance sample of a vertical pillarbox bar area at the right side of the reconstructed frame.
+ *
+ * Bar data should be included in video user data
+ * whenever the rectangular picture area containing useful information
+ * does not extend to the full height or width of the coded frame
+ * and AFD alone is insufficient to describe the extent of the image.
+ *
+ * Note: either vertical or horizontal bars are specified, but not both.
+ *
+ * For more details, see:
+ *
+ * https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
+ *
+ * and SMPTE ST2016-1
+ *
+ * Since: 1.18
+ */
+typedef struct {
+ GstMeta meta;
+
+ guint8 field;
+ gboolean is_letterbox;
+ guint bar_data1;
+ guint bar_data2;
+} GstVideoBarMeta;
+
+GST_VIDEO_API GType gst_video_bar_meta_api_get_type (void);
+#define GST_VIDEO_BAR_META_API_TYPE (gst_video_bar_meta_api_get_type())
+
+GST_VIDEO_API const GstMetaInfo *gst_video_bar_meta_get_info (void);
+#define GST_VIDEO_BAR_META_INFO (gst_video_bar_meta_get_info())
+/**
+ * gst_buffer_get_video_bar_meta:
+ * @b: A #GstBuffer
+ *
+ * Gets the #GstVideoBarMeta that might be present on @b.
+ *
+ * Since: 1.18
+ *
+ * Returns: The first #GstVideoBarMeta present on @b, or %NULL if
+ * no #GstVideoBarMeta are present
+ */
+#define gst_buffer_get_video_bar_meta(b) \
+ ((GstVideoBarMeta*)gst_buffer_get_meta((b),GST_VIDEO_BAR_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoBarMeta *gst_buffer_add_video_bar_meta (GstBuffer * buffer, guint8 field,
+ gboolean is_letterbox, guint bar_data1, guint bar_data2);
+
+/* Closed Caption support */
+/**
+ * GstVideoCaptionType:
+ * @GST_VIDEO_CAPTION_TYPE_UNKNOWN: Unknown type of CC
+ * @GST_VIDEO_CAPTION_TYPE_CEA608_RAW: CEA-608 as byte pairs. Note that
+ * this format is not recommended since is does not specify to
+ * which field the caption comes from and therefore assumes
+ * it comes from the first field (and that there is no information
+ * on the second field). Use @GST_VIDEO_CAPTION_TYPE_CEA708_RAW
+ * if you wish to store CEA-608 from two fields and prefix each byte pair
+ * with 0xFC for the first field and 0xFD for the second field.
+ * @GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A: CEA-608 as byte triplets as defined
+ * in SMPTE S334-1 Annex A. The second and third byte of the byte triplet
+ * is the raw CEA608 data, the first byte is a bitfield: The top/7th bit is
+ * 0 for the second field, 1 for the first field, bit 6 and 5 are 0 and
+ * bits 4 to 0 are a 5 bit unsigned integer that represents the line
+ * offset relative to the base-line of the original image format (line 9
+ * for 525-line field 1, line 272 for 525-line field 2, line 5 for
+ * 625-line field 1 and line 318 for 625-line field 2).
+ * @GST_VIDEO_CAPTION_TYPE_CEA708_RAW: CEA-708 as cc_data byte triplets. They
+ * can also contain 608-in-708 and the first byte of each triplet has to
+ * be inspected for detecting the type.
+ * @GST_VIDEO_CAPTION_TYPE_CEA708_CDP: CEA-708 (and optionally CEA-608) in
+ * a CDP (Caption Distribution Packet) defined by SMPTE S-334-2.
+ * Contains the whole CDP (starting with 0x9669).
+ *
+ * The various known types of Closed Caption (CC).
+ *
+ * Since: 1.16
+ */
+typedef enum {
+ GST_VIDEO_CAPTION_TYPE_UNKNOWN = 0,
+ GST_VIDEO_CAPTION_TYPE_CEA608_RAW = 1,
+ GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A = 2,
+ GST_VIDEO_CAPTION_TYPE_CEA708_RAW = 3,
+ GST_VIDEO_CAPTION_TYPE_CEA708_CDP = 4
+} GstVideoCaptionType;
+
+GST_VIDEO_API
+GstVideoCaptionType
+gst_video_caption_type_from_caps (const GstCaps *caps);
+
+GST_VIDEO_API
+GstCaps *
+gst_video_caption_type_to_caps (GstVideoCaptionType type);
+
+/**
+ * GstVideoCaptionMeta:
+ * @meta: parent #GstMeta
+ * @caption_type: The type of Closed Caption contained in the meta.
+ * @data: (array length=size): The Closed Caption data.
+ * @size: The size in bytes of @data
+ *
+ * Extra buffer metadata providing Closed Caption.
+ *
+ * Since: 1.16
+ */
+typedef struct {
+ GstMeta meta;
+
+ GstVideoCaptionType caption_type;
+ guint8 *data;
+ gsize size;
+} GstVideoCaptionMeta;
+
+GST_VIDEO_API
+GType gst_video_caption_meta_api_get_type (void);
+#define GST_VIDEO_CAPTION_META_API_TYPE (gst_video_caption_meta_api_get_type())
+
+GST_VIDEO_API
+const GstMetaInfo *gst_video_caption_meta_get_info (void);
+#define GST_VIDEO_CAPTION_META_INFO (gst_video_caption_meta_get_info())
+
+/**
+ * gst_buffer_get_video_caption_meta:
+ * @b: A #GstBuffer
+ *
+ * Gets the #GstVideoCaptionMeta that might be present on @b.
+ *
+ * Since: 1.16
+ *
+ * Returns: The first #GstVideoCaptionMeta present on @b, or %NULL if
+ * no #GstVideoCaptionMeta are present
+ */
+#define gst_buffer_get_video_caption_meta(b) \
+ ((GstVideoCaptionMeta*)gst_buffer_get_meta((b),GST_VIDEO_CAPTION_META_API_TYPE))
+
+GST_VIDEO_API
+GstVideoCaptionMeta *gst_buffer_add_video_caption_meta (GstBuffer * buffer,
+ GstVideoCaptionType caption_type,
+ const guint8 *data,
+ gsize size);
+
+/**
+ * GstVideoVBIParser:
+ *
+ * A parser for detecting and extracting @GstVideoAncillary data from
+ * Vertical Blanking Interval lines of component signals.
+ *
+ * Since: 1.16
+ */
+
+typedef struct _GstVideoVBIParser GstVideoVBIParser;
+
+GST_VIDEO_API
+GType gst_video_vbi_parser_get_type (void);
+
+/**
+ * GstVideoVBIParserResult:
+ * @GST_VIDEO_VBI_PARSER_RESULT_DONE: No line were provided, or no more Ancillary data was found.
+ * @GST_VIDEO_VBI_PARSER_RESULT_OK: A #GstVideoAncillary was found.
+ * @GST_VIDEO_VBI_PARSER_RESULT_ERROR: An error occurred
+ *
+ * Return values for #GstVideoVBIParser
+ *
+ * Since: 1.16
+ */
+typedef enum {
+ GST_VIDEO_VBI_PARSER_RESULT_DONE = 0,
+ GST_VIDEO_VBI_PARSER_RESULT_OK = 1,
+ GST_VIDEO_VBI_PARSER_RESULT_ERROR = 2
+} GstVideoVBIParserResult;
+
+GST_VIDEO_API
+GstVideoVBIParserResult gst_video_vbi_parser_get_ancillary(GstVideoVBIParser *parser,
+ GstVideoAncillary *anc);
+
+GST_VIDEO_API
+GstVideoVBIParser *gst_video_vbi_parser_new (GstVideoFormat format, guint32 pixel_width);
+
+GST_VIDEO_API
+GstVideoVBIParser *gst_video_vbi_parser_copy (const GstVideoVBIParser *parser);
+
+GST_VIDEO_API
+void gst_video_vbi_parser_free (GstVideoVBIParser *parser);
+
+GST_VIDEO_API
+void gst_video_vbi_parser_add_line (GstVideoVBIParser *parser, const guint8 *data);
+
+/**
+ * GstVideoVBIEncoder:
+ *
+ * An encoder for writing ancillary data to the
+ * Vertical Blanking Interval lines of component signals.
+ *
+ * Since: 1.16
+ */
+
+typedef struct _GstVideoVBIEncoder GstVideoVBIEncoder;
+
+GST_VIDEO_API
+GType gst_video_vbi_encoder_get_type (void);
+
+GST_VIDEO_API
+GstVideoVBIEncoder *gst_video_vbi_encoder_new (GstVideoFormat format, guint32 pixel_width);
+
+GST_VIDEO_API
+GstVideoVBIEncoder *gst_video_vbi_encoder_copy (const GstVideoVBIEncoder *encoder);
+
+GST_VIDEO_API
+void gst_video_vbi_encoder_free (GstVideoVBIEncoder *encoder);
+
+GST_VIDEO_API
+gboolean gst_video_vbi_encoder_add_ancillary (GstVideoVBIEncoder *encoder,
+ gboolean composite,
+ guint8 DID,
+ guint8 SDID_block_number,
+ const guint8 *data,
+ guint data_count);
+
+GST_VIDEO_API
+void gst_video_vbi_encoder_write_line (GstVideoVBIEncoder *encoder, guint8 *data);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_ANC_H__ */
diff --git a/include/gst/video/video-blend.h b/include/gst/video/video-blend.h
new file mode 100644
index 0000000000..1d6175b793
--- /dev/null
+++ b/include/gst/video/video-blend.h
@@ -0,0 +1,41 @@
+/* Gstreamer video blending utility functions
+ *
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_VIDEO_BLEND__
+#define __GST_VIDEO_BLEND__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+GST_VIDEO_API
+void gst_video_blend_scale_linear_RGBA (GstVideoInfo * src, GstBuffer * src_buffer,
+ gint dest_height, gint dest_width,
+ GstVideoInfo * dest, GstBuffer ** dest_buffer);
+
+GST_VIDEO_API
+gboolean gst_video_blend (GstVideoFrame * dest,
+ GstVideoFrame * src,
+ gint x, gint y,
+ gfloat global_alpha);
+
+#endif
diff --git a/include/gst/video/video-chroma.h b/include/gst/video/video-chroma.h
new file mode 100644
index 0000000000..16720b4b52
--- /dev/null
+++ b/include/gst/video/video-chroma.h
@@ -0,0 +1,118 @@
+/* GStreamer
+ * Copyright (C) <2013> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_CHROMA_H__
+#define __GST_VIDEO_CHROMA_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoChromaSite:
+ * @GST_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
+ * @GST_VIDEO_CHROMA_SITE_NONE: no cositing
+ * @GST_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
+ * @GST_VIDEO_CHROMA_SITE_V_COSITED: chroma is vertically cosited
+ * @GST_VIDEO_CHROMA_SITE_ALT_LINE: choma samples are sited on alternate lines
+ * @GST_VIDEO_CHROMA_SITE_COSITED: chroma samples cosited with luma samples
+ * @GST_VIDEO_CHROMA_SITE_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
+ * @GST_VIDEO_CHROMA_SITE_MPEG2: mpeg2 style cositing
+ * @GST_VIDEO_CHROMA_SITE_DV: DV style cositing
+ *
+ * Various Chroma sitings.
+ */
+typedef enum {
+ GST_VIDEO_CHROMA_SITE_UNKNOWN = 0,
+ GST_VIDEO_CHROMA_SITE_NONE = (1 << 0),
+ GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
+ GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
+ GST_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
+ /* some common chroma cositing */
+ GST_VIDEO_CHROMA_SITE_COSITED = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
+ GST_VIDEO_CHROMA_SITE_JPEG = (GST_VIDEO_CHROMA_SITE_NONE),
+ GST_VIDEO_CHROMA_SITE_MPEG2 = (GST_VIDEO_CHROMA_SITE_H_COSITED),
+ GST_VIDEO_CHROMA_SITE_DV = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
+} GstVideoChromaSite;
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_chroma_site_from_string)
+GstVideoChromaSite gst_video_chroma_from_string (const gchar * s);
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_chroma_site_to_string)
+const gchar * gst_video_chroma_to_string (GstVideoChromaSite site);
+
+GST_VIDEO_API
+GstVideoChromaSite gst_video_chroma_site_from_string (const gchar * s);
+
+GST_VIDEO_API
+gchar * gst_video_chroma_site_to_string (GstVideoChromaSite site);
+
+/**
+ * GstVideoChromaMethod:
+ * @GST_VIDEO_CHROMA_METHOD_NEAREST: Duplicates the chroma samples when
+ * upsampling and drops when subsampling
+ * @GST_VIDEO_CHROMA_METHOD_LINEAR: Uses linear interpolation to reconstruct
+ * missing chroma and averaging to subsample
+ *
+ * Different subsampling and upsampling methods
+ */
+typedef enum {
+ GST_VIDEO_CHROMA_METHOD_NEAREST,
+ GST_VIDEO_CHROMA_METHOD_LINEAR
+} GstVideoChromaMethod;
+
+/**
+ * GstVideoChromaFlags:
+ * @GST_VIDEO_CHROMA_FLAG_NONE: no flags
+ * @GST_VIDEO_CHROMA_FLAG_INTERLACED: the input is interlaced
+ *
+ * Extra flags that influence the result from gst_video_chroma_resample_new().
+ */
+typedef enum {
+ GST_VIDEO_CHROMA_FLAG_NONE = 0,
+ GST_VIDEO_CHROMA_FLAG_INTERLACED = (1 << 0),
+} GstVideoChromaFlags;
+
+typedef struct _GstVideoChromaResample GstVideoChromaResample;
+
+/* circular dependency, need to include this after defining the enums */
+#include <gst/video/video-format.h>
+
+GST_VIDEO_API
+GstVideoChromaResample * gst_video_chroma_resample_new (GstVideoChromaMethod method,
+ GstVideoChromaSite site,
+ GstVideoChromaFlags flags,
+ GstVideoFormat format,
+ gint h_factor, gint v_factor);
+
+GST_VIDEO_API
+void gst_video_chroma_resample_free (GstVideoChromaResample *resample);
+
+GST_VIDEO_API
+void gst_video_chroma_resample_get_info (GstVideoChromaResample *resample,
+ guint * n_lines, gint *offset);
+
+GST_VIDEO_API
+void gst_video_chroma_resample (GstVideoChromaResample *resample,
+ gpointer lines[], gint width);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_CHROMA_H__ */
diff --git a/include/gst/video/video-color.h b/include/gst/video/video-color.h
new file mode 100644
index 0000000000..c6ff3c8d85
--- /dev/null
+++ b/include/gst/video/video-color.h
@@ -0,0 +1,304 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_COLOR_H__
+#define __GST_VIDEO_COLOR_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video-format.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoColorRange:
+ * @GST_VIDEO_COLOR_RANGE_UNKNOWN: unknown range
+ * @GST_VIDEO_COLOR_RANGE_0_255: [0..255] for 8 bit components
+ * @GST_VIDEO_COLOR_RANGE_16_235: [16..235] for 8 bit components. Chroma has
+ * [16..240] range.
+ *
+ * Possible color range values. These constants are defined for 8 bit color
+ * values and can be scaled for other bit depths.
+ */
+typedef enum {
+ GST_VIDEO_COLOR_RANGE_UNKNOWN = 0,
+ GST_VIDEO_COLOR_RANGE_0_255,
+ GST_VIDEO_COLOR_RANGE_16_235
+} GstVideoColorRange;
+
+/**
+ * GstVideoColorMatrix:
+ * @GST_VIDEO_COLOR_MATRIX_UNKNOWN: unknown matrix
+ * @GST_VIDEO_COLOR_MATRIX_RGB: identity matrix. Order of coefficients is
+ * actually GBR, also IEC 61966-2-1 (sRGB)
+ * @GST_VIDEO_COLOR_MATRIX_FCC: FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
+ * @GST_VIDEO_COLOR_MATRIX_BT709: ITU-R BT.709 color matrix, also ITU-R BT1361
+ * / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ * @GST_VIDEO_COLOR_MATRIX_BT601: ITU-R BT.601 color matrix, also SMPTE170M / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ * @GST_VIDEO_COLOR_MATRIX_SMPTE240M: SMPTE 240M color matrix
+ * @GST_VIDEO_COLOR_MATRIX_BT2020: ITU-R BT.2020 color matrix. Since: 1.6
+ *
+ * The color matrix is used to convert between Y'PbPr and
+ * non-linear RGB (R'G'B')
+ */
+typedef enum {
+ GST_VIDEO_COLOR_MATRIX_UNKNOWN = 0,
+ GST_VIDEO_COLOR_MATRIX_RGB,
+ GST_VIDEO_COLOR_MATRIX_FCC,
+ GST_VIDEO_COLOR_MATRIX_BT709,
+ GST_VIDEO_COLOR_MATRIX_BT601,
+ GST_VIDEO_COLOR_MATRIX_SMPTE240M,
+ GST_VIDEO_COLOR_MATRIX_BT2020
+} GstVideoColorMatrix;
+
+GST_VIDEO_API
+gboolean gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr, gdouble * Kb);
+
+/**
+ * GstVideoTransferFunction:
+ * @GST_VIDEO_TRANSFER_UNKNOWN: unknown transfer function
+ * @GST_VIDEO_TRANSFER_GAMMA10: linear RGB, gamma 1.0 curve
+ * @GST_VIDEO_TRANSFER_GAMMA18: Gamma 1.8 curve
+ * @GST_VIDEO_TRANSFER_GAMMA20: Gamma 2.0 curve
+ * @GST_VIDEO_TRANSFER_GAMMA22: Gamma 2.2 curve
+ * @GST_VIDEO_TRANSFER_BT709: Gamma 2.2 curve with a linear segment in the lower
+ * range, also ITU-R BT470M / ITU-R BT1700 625 PAL &
+ * SECAM / ITU-R BT1361
+ * @GST_VIDEO_TRANSFER_SMPTE240M: Gamma 2.2 curve with a linear segment in the
+ * lower range
+ * @GST_VIDEO_TRANSFER_SRGB: Gamma 2.4 curve with a linear segment in the lower
+ * range. IEC 61966-2-1 (sRGB or sYCC)
+ * @GST_VIDEO_TRANSFER_GAMMA28: Gamma 2.8 curve, also ITU-R BT470BG
+ * @GST_VIDEO_TRANSFER_LOG100: Logarithmic transfer characteristic
+ * 100:1 range
+ * @GST_VIDEO_TRANSFER_LOG316: Logarithmic transfer characteristic
+ * 316.22777:1 range (100 * sqrt(10) : 1)
+ * @GST_VIDEO_TRANSFER_BT2020_12: Gamma 2.2 curve with a linear segment in the lower
+ * range. Used for BT.2020 with 12 bits per
+ * component. Since: 1.6
+ * @GST_VIDEO_TRANSFER_ADOBERGB: Gamma 2.19921875. Since: 1.8
+ * @GST_VIDEO_TRANSFER_BT2020_10: Rec. ITU-R BT.2020-2 with 10 bits per component.
+ * (functionally the same as the values
+ * GST_VIDEO_TRANSFER_BT709 and GST_VIDEO_TRANSFER_BT601).
+ * Since: 1.18
+ * @GST_VIDEO_TRANSFER_SMPTE2084: SMPTE ST 2084 for 10, 12, 14, and 16-bit systems.
+ * Known as perceptual quantization (PQ)
+ * Since: 1.18
+ * @GST_VIDEO_TRANSFER_ARIB_STD_B67: Association of Radio Industries and Businesses (ARIB)
+ * STD-B67 and Rec. ITU-R BT.2100-1 hybrid loggamma (HLG) system
+ * Since: 1.18
+ * @GST_VIDEO_TRANSFER_BT601: also known as SMPTE170M / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
+ * Functionally the same as the values
+ * GST_VIDEO_TRANSFER_BT709, and GST_VIDEO_TRANSFER_BT2020_10.
+ * Since: 1.18
+ *
+ * The video transfer function defines the formula for converting between
+ * non-linear RGB (R'G'B') and linear RGB
+ */
+typedef enum {
+ GST_VIDEO_TRANSFER_UNKNOWN = 0,
+ GST_VIDEO_TRANSFER_GAMMA10,
+ GST_VIDEO_TRANSFER_GAMMA18,
+ GST_VIDEO_TRANSFER_GAMMA20,
+ GST_VIDEO_TRANSFER_GAMMA22,
+ GST_VIDEO_TRANSFER_BT709,
+ GST_VIDEO_TRANSFER_SMPTE240M,
+ GST_VIDEO_TRANSFER_SRGB,
+ GST_VIDEO_TRANSFER_GAMMA28,
+ GST_VIDEO_TRANSFER_LOG100,
+ GST_VIDEO_TRANSFER_LOG316,
+ GST_VIDEO_TRANSFER_BT2020_12,
+ GST_VIDEO_TRANSFER_ADOBERGB,
+ GST_VIDEO_TRANSFER_BT2020_10,
+ GST_VIDEO_TRANSFER_SMPTE2084,
+ GST_VIDEO_TRANSFER_ARIB_STD_B67,
+ /**
+ * GST_VIDEO_TRANSFER_BT601:
+ *
+ * also known as SMPTE170M / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
+ *
+ * Since: 1.18
+ */
+ GST_VIDEO_TRANSFER_BT601
+} GstVideoTransferFunction;
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_transfer_function_encode)
+gdouble gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val);
+GST_VIDEO_API
+gdouble gst_video_transfer_function_encode (GstVideoTransferFunction func, gdouble val);
+
+GST_VIDEO_DEPRECATED_FOR(gst_video_transfer_function_decode)
+gdouble gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val);
+GST_VIDEO_API
+gdouble gst_video_transfer_function_decode (GstVideoTransferFunction func, gdouble val);
+
+/**
+ * GstVideoColorPrimaries:
+ * @GST_VIDEO_COLOR_PRIMARIES_UNKNOWN: unknown color primaries
+ * @GST_VIDEO_COLOR_PRIMARIES_BT709: BT709 primaries, also ITU-R BT1361 / IEC
+ * 61966-2-4 / SMPTE RP177 Annex B
+ * @GST_VIDEO_COLOR_PRIMARIES_BT470M: BT470M primaries, also FCC Title 47 Code
+ * of Federal Regulations 73.682 (a)(20)
+ * @GST_VIDEO_COLOR_PRIMARIES_BT470BG: BT470BG primaries, also ITU-R BT601-6
+ * 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
+ * @GST_VIDEO_COLOR_PRIMARIES_SMPTE170M: SMPTE170M primaries, also ITU-R
+ * BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ * @GST_VIDEO_COLOR_PRIMARIES_SMPTE240M: SMPTE240M primaries
+ * @GST_VIDEO_COLOR_PRIMARIES_FILM: Generic film (colour filters using
+ * Illuminant C)
+ * @GST_VIDEO_COLOR_PRIMARIES_BT2020: ITU-R BT2020 primaries. Since: 1.6
+ * @GST_VIDEO_COLOR_PRIMARIES_ADOBERGB: Adobe RGB primaries. Since: 1.8
+ * @GST_VIDEO_COLOR_PRIMARIES_SMPTEST428: SMPTE ST 428 primaries (CIE 1931
+ * XYZ). Since: 1.16
+ * @GST_VIDEO_COLOR_PRIMARIES_SMPTERP431: SMPTE RP 431 primaries (ST 431-2
+ * (2011) / DCI P3). Since: 1.16
+ * @GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432: SMPTE EG 432 primaries (ST 432-1
+ * (2010) / P3 D65). Since: 1.16
+ * @GST_VIDEO_COLOR_PRIMARIES_EBU3213: EBU 3213 primaries (JEDEC P22
+ * phosphors). Since: 1.16
+ *
+ * The color primaries define the how to transform linear RGB values to and from
+ * the CIE XYZ colorspace.
+ */
+typedef enum {
+ GST_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0,
+ GST_VIDEO_COLOR_PRIMARIES_BT709,
+ GST_VIDEO_COLOR_PRIMARIES_BT470M,
+ GST_VIDEO_COLOR_PRIMARIES_BT470BG,
+ GST_VIDEO_COLOR_PRIMARIES_SMPTE170M,
+ GST_VIDEO_COLOR_PRIMARIES_SMPTE240M,
+ GST_VIDEO_COLOR_PRIMARIES_FILM,
+ GST_VIDEO_COLOR_PRIMARIES_BT2020,
+ GST_VIDEO_COLOR_PRIMARIES_ADOBERGB,
+ GST_VIDEO_COLOR_PRIMARIES_SMPTEST428,
+ GST_VIDEO_COLOR_PRIMARIES_SMPTERP431,
+ GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432,
+ GST_VIDEO_COLOR_PRIMARIES_EBU3213,
+} GstVideoColorPrimaries;
+
+/**
+ * GstVideoColorPrimariesInfo:
+ * @primaries: a #GstVideoColorPrimaries
+ * @Wx: reference white x coordinate
+ * @Wy: reference white y coordinate
+ * @Rx: red x coordinate
+ * @Ry: red y coordinate
+ * @Gx: green x coordinate
+ * @Gy: green y coordinate
+ * @Bx: blue x coordinate
+ * @By: blue y coordinate
+ *
+ * Structure describing the chromaticity coordinates of an RGB system. These
+ * values can be used to construct a matrix to transform RGB to and from the
+ * XYZ colorspace.
+ *
+ * Since: 1.6
+ */
+typedef struct {
+ GstVideoColorPrimaries primaries;
+ gdouble Wx, Wy;
+ gdouble Rx, Ry;
+ gdouble Gx, Gy;
+ gdouble Bx, By;
+} GstVideoColorPrimariesInfo;
+
+GST_VIDEO_API
+const GstVideoColorPrimariesInfo *
+ gst_video_color_primaries_get_info (GstVideoColorPrimaries primaries);
+
+/**
+ * GstVideoColorimetry:
+ * @range: the color range. This is the valid range for the samples.
+ * It is used to convert the samples to Y'PbPr values.
+ * @matrix: the color matrix. Used to convert between Y'PbPr and
+ * non-linear RGB (R'G'B')
+ * @transfer: the transfer function. used to convert between R'G'B' and RGB
+ * @primaries: color primaries. used to convert between R'G'B' and CIE XYZ
+ *
+ * Structure describing the color info.
+ */
+typedef struct {
+ GstVideoColorRange range;
+ GstVideoColorMatrix matrix;
+ GstVideoTransferFunction transfer;
+ GstVideoColorPrimaries primaries;
+} GstVideoColorimetry;
+
+/* predefined colorimetry */
+#define GST_VIDEO_COLORIMETRY_BT601 "bt601"
+#define GST_VIDEO_COLORIMETRY_BT709 "bt709"
+#define GST_VIDEO_COLORIMETRY_SMPTE240M "smpte240m"
+#define GST_VIDEO_COLORIMETRY_SRGB "sRGB"
+#define GST_VIDEO_COLORIMETRY_BT2020 "bt2020"
+#define GST_VIDEO_COLORIMETRY_BT2020_10 "bt2020-10"
+#define GST_VIDEO_COLORIMETRY_BT2100_PQ "bt2100-pq"
+#define GST_VIDEO_COLORIMETRY_BT2100_HLG "bt2100-hlg"
+
+GST_VIDEO_API
+gboolean gst_video_colorimetry_matches (const GstVideoColorimetry *cinfo, const gchar *color);
+
+GST_VIDEO_API
+gboolean gst_video_colorimetry_from_string (GstVideoColorimetry *cinfo, const gchar *color);
+
+GST_VIDEO_API
+gchar * gst_video_colorimetry_to_string (const GstVideoColorimetry *cinfo);
+
+GST_VIDEO_API
+gboolean gst_video_colorimetry_is_equal (const GstVideoColorimetry *cinfo, const GstVideoColorimetry *other);
+
+/* compute offset and scale */
+
+GST_VIDEO_API
+void gst_video_color_range_offsets (GstVideoColorRange range,
+ const GstVideoFormatInfo *info,
+ gint offset[GST_VIDEO_MAX_COMPONENTS],
+ gint scale[GST_VIDEO_MAX_COMPONENTS]);
+
+/* conversion between GStreamer color{matrix,transfer,primaries} enum and
+ * values defined by ISO/IEC 23001-8 and ITU-T H.273 specification.
+ * Also H264 and H265 specifications follow the color{matrix,transfer,primaries}
+ * values */
+
+GST_VIDEO_API
+guint gst_video_color_matrix_to_iso (GstVideoColorMatrix matrix);
+
+GST_VIDEO_API
+guint gst_video_transfer_function_to_iso (GstVideoTransferFunction func);
+
+GST_VIDEO_API
+guint gst_video_color_primaries_to_iso (GstVideoColorPrimaries primaries);
+
+GST_VIDEO_API
+GstVideoColorMatrix gst_video_color_matrix_from_iso (guint value);
+
+GST_VIDEO_API
+GstVideoTransferFunction gst_video_transfer_function_from_iso (guint value);
+
+GST_VIDEO_API
+GstVideoColorPrimaries gst_video_color_primaries_from_iso (guint value);
+
+GST_VIDEO_API
+gboolean gst_video_transfer_function_is_equivalent (GstVideoTransferFunction from_func,
+ guint from_bpp,
+ GstVideoTransferFunction to_func,
+ guint to_bpp);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_COLOR_H__ */
diff --git a/include/gst/video/video-converter.h b/include/gst/video/video-converter.h
new file mode 100644
index 0000000000..7175f42b12
--- /dev/null
+++ b/include/gst/video/video-converter.h
@@ -0,0 +1,318 @@
+/* Video conversion api function
+ * Copyright (C) 2014 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_CONVERTER_H__
+#define __GST_VIDEO_CONVERTER_H__
+
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD:
+ *
+ * #GstVideoResamplerMethod, The resampler method to use for
+ * resampling. Other options for the resampler can be used, see
+ * the #GstVideoResampler. Default is #GST_VIDEO_RESAMPLER_METHOD_CUBIC
+ */
+#define GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD "GstVideoConverter.resampler-method"
+/**
+ * GST_VIDEO_CONVERTER_OPT_CHROMA_RESAMPLER_METHOD:
+ *
+ * #GstVideoChromaMethod, The resampler method to use for
+ * chroma resampling. Other options for the resampler can be used, see
+ * the #GstVideoResampler. Default is #GST_VIDEO_RESAMPLER_METHOD_LINEAR
+ */
+#define GST_VIDEO_CONVERTER_OPT_CHROMA_RESAMPLER_METHOD "GstVideoConverter.chroma-resampler-method"
+/**
+ * GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS:
+ *
+ * #G_TYPE_UINT, The number of taps for the resampler.
+ * Default is 0: let the resampler choose a good value.
+ */
+#define GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS "GstVideoConverter.resampler-taps"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_DITHER_METHOD:
+ *
+ * #GstVideoDitherMethod, The dither method to use when
+ * changing bit depth.
+ * Default is #GST_VIDEO_DITHER_BAYER.
+ */
+#define GST_VIDEO_CONVERTER_OPT_DITHER_METHOD "GstVideoConverter.dither-method"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_DITHER_QUANTIZATION:
+ *
+ * #G_TYPE_UINT, The quantization amount to dither to. Components will be
+ * quantized to multiples of this value.
+ * Default is 1
+ */
+#define GST_VIDEO_CONVERTER_OPT_DITHER_QUANTIZATION "GstVideoConverter.dither-quantization"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_SRC_X:
+ *
+ * #G_TYPE_INT, source x position to start conversion, default 0
+ */
+#define GST_VIDEO_CONVERTER_OPT_SRC_X "GstVideoConverter.src-x"
+/**
+ * GST_VIDEO_CONVERTER_OPT_SRC_Y:
+ *
+ * #G_TYPE_INT, source y position to start conversion, default 0
+ */
+#define GST_VIDEO_CONVERTER_OPT_SRC_Y "GstVideoConverter.src-y"
+/**
+ * GST_VIDEO_CONVERTER_OPT_SRC_WIDTH:
+ *
+ * #G_TYPE_INT, source width to convert, default source width
+ */
+#define GST_VIDEO_CONVERTER_OPT_SRC_WIDTH "GstVideoConverter.src-width"
+/**
+ * GST_VIDEO_CONVERTER_OPT_SRC_HEIGHT:
+ *
+ * #G_TYPE_INT, source height to convert, default source height
+ */
+#define GST_VIDEO_CONVERTER_OPT_SRC_HEIGHT "GstVideoConverter.src-height"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_DEST_X:
+ *
+ * #G_TYPE_INT, x position in the destination frame, default 0
+ */
+#define GST_VIDEO_CONVERTER_OPT_DEST_X "GstVideoConverter.dest-x"
+/**
+ * GST_VIDEO_CONVERTER_OPT_DEST_Y:
+ *
+ * #G_TYPE_INT, y position in the destination frame, default 0
+ */
+#define GST_VIDEO_CONVERTER_OPT_DEST_Y "GstVideoConverter.dest-y"
+/**
+ * GST_VIDEO_CONVERTER_OPT_DEST_WIDTH:
+ *
+ * #G_TYPE_INT, width in the destination frame, default destination width
+ */
+#define GST_VIDEO_CONVERTER_OPT_DEST_WIDTH "GstVideoConverter.dest-width"
+/**
+ * GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT:
+ *
+ * #G_TYPE_INT, height in the destination frame, default destination height
+ */
+#define GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT "GstVideoConverter.dest-height"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_FILL_BORDER:
+ *
+ * #G_TYPE_BOOLEAN, if the destination rectangle does not fill the complete
+ * destination image, render a border with
+ * #GST_VIDEO_CONVERTER_OPT_BORDER_ARGB. Otherwise the unusded pixels in the
+ * destination are untouched. Default %TRUE.
+ */
+#define GST_VIDEO_CONVERTER_OPT_FILL_BORDER "GstVideoConverter.fill-border"
+/**
+ * GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE:
+ *
+ * #G_TYPE_DOUBLE, the alpha color value to use.
+ * Default to 1.0
+ */
+#define GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE "GstVideoConverter.alpha-value"
+/**
+ * GstVideoAlphaMode:
+ * @GST_VIDEO_ALPHA_MODE_COPY: When input and output have alpha, it will be copied.
+ * When the input has no alpha, alpha will be set to
+ * #GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE
+ * @GST_VIDEO_ALPHA_MODE_SET: set all alpha to
+ * #GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE
+ * @GST_VIDEO_ALPHA_MODE_MULT: multiply all alpha with
+ * #GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE.
+ * When the input format has no alpha but the output format has, the
+ * alpha value will be set to #GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE
+ *
+ * Different alpha modes.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_ALPHA_MODE_COPY,
+ GST_VIDEO_ALPHA_MODE_SET,
+ GST_VIDEO_ALPHA_MODE_MULT
+} GstVideoAlphaMode;
+/**
+ * GST_VIDEO_CONVERTER_OPT_ALPHA_MODE:
+ *
+ * #GstVideoAlphaMode, the alpha mode to use.
+ * Default is #GST_VIDEO_ALPHA_MODE_COPY.
+ */
+#define GST_VIDEO_CONVERTER_OPT_ALPHA_MODE "GstVideoConverter.alpha-mode"
+/**
+ * GST_VIDEO_CONVERTER_OPT_BORDER_ARGB:
+ *
+ * #G_TYPE_UINT, the border color to use if #GST_VIDEO_CONVERTER_OPT_FILL_BORDER
+ * is set to %TRUE. The color is in ARGB format.
+ * Default 0xff000000
+ */
+#define GST_VIDEO_CONVERTER_OPT_BORDER_ARGB "GstVideoConverter.border-argb"
+
+/**
+ * GstVideoChromaMode:
+ * @GST_VIDEO_CHROMA_MODE_FULL: do full chroma up and down sampling
+ * @GST_VIDEO_CHROMA_MODE_UPSAMPLE_ONLY: only perform chroma upsampling
+ * @GST_VIDEO_CHROMA_MODE_DOWNSAMPLE_ONLY: only perform chroma downsampling
+ * @GST_VIDEO_CHROMA_MODE_NONE: disable chroma resampling
+ *
+ * Different chroma downsampling and upsampling modes
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_CHROMA_MODE_FULL,
+ GST_VIDEO_CHROMA_MODE_UPSAMPLE_ONLY,
+ GST_VIDEO_CHROMA_MODE_DOWNSAMPLE_ONLY,
+ GST_VIDEO_CHROMA_MODE_NONE
+} GstVideoChromaMode;
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_CHROMA_MODE:
+ *
+ * #GstVideoChromaMode, set the chroma resample mode subsampled
+ * formats. Default is #GST_VIDEO_CHROMA_MODE_FULL.
+ */
+#define GST_VIDEO_CONVERTER_OPT_CHROMA_MODE "GstVideoConverter.chroma-mode"
+
+/**
+ *GstVideoMatrixMode:
+ * @GST_VIDEO_MATRIX_MODE_FULL: do conversion between color matrices
+ * @GST_VIDEO_MATRIX_MODE_INPUT_ONLY: use the input color matrix to convert
+ * to and from R'G'B
+ * @GST_VIDEO_MATRIX_MODE_OUTPUT_ONLY: use the output color matrix to convert
+ * to and from R'G'B
+ * @GST_VIDEO_MATRIX_MODE_NONE: disable color matrix conversion.
+ *
+ * Different color matrix conversion modes
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_MATRIX_MODE_FULL,
+ GST_VIDEO_MATRIX_MODE_INPUT_ONLY,
+ GST_VIDEO_MATRIX_MODE_OUTPUT_ONLY,
+ GST_VIDEO_MATRIX_MODE_NONE
+} GstVideoMatrixMode;
+/**
+ * GST_VIDEO_CONVERTER_OPT_MATRIX_MODE:
+ *
+ * #GstVideoMatrixMode, set the color matrix conversion mode for
+ * converting between Y'PbPr and non-linear RGB (R'G'B').
+ * Default is #GST_VIDEO_MATRIX_MODE_FULL.
+ */
+#define GST_VIDEO_CONVERTER_OPT_MATRIX_MODE "GstVideoConverter.matrix-mode"
+/**
+ * GstVideoGammaMode:
+ * @GST_VIDEO_GAMMA_MODE_NONE: disable gamma handling
+ * @GST_VIDEO_GAMMA_MODE_REMAP: convert between input and output gamma
+ * Different gamma conversion modes
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_GAMMA_MODE_NONE,
+ GST_VIDEO_GAMMA_MODE_REMAP
+} GstVideoGammaMode;
+/**
+ * GST_VIDEO_CONVERTER_OPT_GAMMA_MODE:
+ *
+ * #GstVideoGammaMode, set the gamma mode.
+ * Default is #GST_VIDEO_GAMMA_MODE_NONE.
+ */
+#define GST_VIDEO_CONVERTER_OPT_GAMMA_MODE "GstVideoConverter.gamma-mode"
+/**
+ * GstVideoPrimariesMode:
+ * @GST_VIDEO_PRIMARIES_MODE_NONE: disable conversion between primaries
+ * @GST_VIDEO_PRIMARIES_MODE_MERGE_ONLY: do conversion between primaries only
+ * when it can be merged with color matrix conversion.
+ * @GST_VIDEO_PRIMARIES_MODE_FAST: fast conversion between primaries
+ *
+ * Different primaries conversion modes
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_PRIMARIES_MODE_NONE,
+ GST_VIDEO_PRIMARIES_MODE_MERGE_ONLY,
+ GST_VIDEO_PRIMARIES_MODE_FAST
+} GstVideoPrimariesMode;
+/**
+ * GST_VIDEO_CONVERTER_OPT_PRIMARIES_MODE:
+ *
+ * #GstVideoPrimariesMode, set the primaries conversion mode.
+ * Default is #GST_VIDEO_PRIMARIES_MODE_NONE.
+ */
+#define GST_VIDEO_CONVERTER_OPT_PRIMARIES_MODE "GstVideoConverter.primaries-mode"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_THREADS:
+ *
+ * #G_TYPE_UINT, maximum number of threads to use. Default 1, 0 for the number
+ * of cores.
+ */
+#define GST_VIDEO_CONVERTER_OPT_THREADS "GstVideoConverter.threads"
+
+/**
+ * GST_VIDEO_CONVERTER_OPT_ASYNC_TASKS:
+ *
+ * #G_TYPE_BOOLEAN, whether gst_video_converter_frame() will return immediately
+ * without waiting for the conversion to complete. A subsequent
+ * gst_video_converter_frame_finish() must be performed to ensure completion of the
+ * conversion before subsequent use. Default %FALSE
+ *
+ * Since: 1.20
+ */
+#define GST_VIDEO_CONVERTER_OPT_ASYNC_TASKS "GstVideoConverter.async-tasks"
+
+typedef struct _GstVideoConverter GstVideoConverter;
+
+GST_VIDEO_API
+GstVideoConverter * gst_video_converter_new (const GstVideoInfo *in_info,
+ const GstVideoInfo *out_info,
+ GstStructure *config);
+
+GST_VIDEO_API
+GstVideoConverter * gst_video_converter_new_with_pool (const GstVideoInfo * in_info,
+ const GstVideoInfo * out_info,
+ GstStructure * config,
+ GstTaskPool * pool);
+
+GST_VIDEO_API
+void gst_video_converter_free (GstVideoConverter * convert);
+
+GST_VIDEO_API
+gboolean gst_video_converter_set_config (GstVideoConverter * convert, GstStructure *config);
+
+GST_VIDEO_API
+const GstStructure * gst_video_converter_get_config (GstVideoConverter * convert);
+
+GST_VIDEO_API
+void gst_video_converter_frame (GstVideoConverter * convert,
+ const GstVideoFrame *src, GstVideoFrame *dest);
+GST_VIDEO_API
+void gst_video_converter_frame_finish (GstVideoConverter * convert);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_CONVERTER_H__ */
diff --git a/include/gst/video/video-dither.h b/include/gst/video/video-dither.h
new file mode 100644
index 0000000000..61a696ed32
--- /dev/null
+++ b/include/gst/video/video-dither.h
@@ -0,0 +1,81 @@
+/* GStreamer
+ * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_DITHER_H__
+#define __GST_VIDEO_DITHER_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoDitherMethod:
+ * @GST_VIDEO_DITHER_NONE: no dithering
+ * @GST_VIDEO_DITHER_VERTERR: propagate rounding errors downwards
+ * @GST_VIDEO_DITHER_FLOYD_STEINBERG: Dither with floyd-steinberg error diffusion
+ * @GST_VIDEO_DITHER_SIERRA_LITE: Dither with Sierra Lite error diffusion
+ * @GST_VIDEO_DITHER_BAYER: ordered dither using a bayer pattern
+ *
+ * Different dithering methods to use.
+ */
+typedef enum {
+ GST_VIDEO_DITHER_NONE,
+ GST_VIDEO_DITHER_VERTERR,
+ GST_VIDEO_DITHER_FLOYD_STEINBERG,
+ GST_VIDEO_DITHER_SIERRA_LITE,
+ GST_VIDEO_DITHER_BAYER,
+} GstVideoDitherMethod;
+
+/**
+ * GstVideoDitherFlags:
+ * @GST_VIDEO_DITHER_FLAG_NONE: no flags
+ * @GST_VIDEO_DITHER_FLAG_INTERLACED: the input is interlaced
+ * @GST_VIDEO_DITHER_FLAG_QUANTIZE: quantize values in addition to adding dither.
+ *
+ * Extra flags that influence the result from gst_video_chroma_resample_new().
+ */
+typedef enum {
+ GST_VIDEO_DITHER_FLAG_NONE = 0,
+ GST_VIDEO_DITHER_FLAG_INTERLACED = (1 << 0),
+ GST_VIDEO_DITHER_FLAG_QUANTIZE = (1 << 1),
+} GstVideoDitherFlags;
+
+typedef struct _GstVideoDither GstVideoDither;
+
+/* circular dependency, need to include this after defining the enums */
+#include <gst/video/video-format.h>
+
+GST_VIDEO_API
+GstVideoDither * gst_video_dither_new (GstVideoDitherMethod method,
+ GstVideoDitherFlags flags,
+ GstVideoFormat format,
+ guint quantizer[GST_VIDEO_MAX_COMPONENTS],
+ guint width);
+
+GST_VIDEO_API
+void gst_video_dither_free (GstVideoDither *dither);
+
+GST_VIDEO_API
+void gst_video_dither_line (GstVideoDither *dither,
+ gpointer line, guint x, guint y, guint width);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_DITHER_H__ */
diff --git a/include/gst/video/video-enumtypes.h b/include/gst/video/video-enumtypes.h
new file mode 100644
index 0000000000..2341679f4c
--- /dev/null
+++ b/include/gst/video/video-enumtypes.h
@@ -0,0 +1,248 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/video/video-prelude.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "colorbalance.h" */
+
+GST_VIDEO_API
+GType gst_color_balance_type_get_type (void);
+#define GST_TYPE_COLOR_BALANCE_TYPE (gst_color_balance_type_get_type())
+
+/* enumerations from "gstvideodecoder.h" */
+
+GST_VIDEO_API
+GType gst_video_decoder_request_sync_point_flags_get_type (void);
+#define GST_TYPE_VIDEO_DECODER_REQUEST_SYNC_POINT_FLAGS (gst_video_decoder_request_sync_point_flags_get_type())
+
+/* enumerations from "gstvideometa.h" */
+
+GST_VIDEO_API
+GType gst_video_gl_texture_type_get_type (void);
+#define GST_TYPE_VIDEO_GL_TEXTURE_TYPE (gst_video_gl_texture_type_get_type())
+
+GST_VIDEO_API
+GType gst_video_gl_texture_orientation_get_type (void);
+#define GST_TYPE_VIDEO_GL_TEXTURE_ORIENTATION (gst_video_gl_texture_orientation_get_type())
+
+/* enumerations from "gstvideotimecode.h" */
+
+GST_VIDEO_API
+GType gst_video_time_code_flags_get_type (void);
+#define GST_TYPE_VIDEO_TIME_CODE_FLAGS (gst_video_time_code_flags_get_type())
+
+/* enumerations from "gstvideoutils.h" */
+
+GST_VIDEO_API
+GType gst_video_codec_frame_flags_get_type (void);
+#define GST_TYPE_VIDEO_CODEC_FRAME_FLAGS (gst_video_codec_frame_flags_get_type())
+
+/* enumerations from "navigation.h" */
+
+GST_VIDEO_API
+GType gst_navigation_command_get_type (void);
+#define GST_TYPE_NAVIGATION_COMMAND (gst_navigation_command_get_type())
+
+GST_VIDEO_API
+GType gst_navigation_query_type_get_type (void);
+#define GST_TYPE_NAVIGATION_QUERY_TYPE (gst_navigation_query_type_get_type())
+
+GST_VIDEO_API
+GType gst_navigation_message_type_get_type (void);
+#define GST_TYPE_NAVIGATION_MESSAGE_TYPE (gst_navigation_message_type_get_type())
+
+GST_VIDEO_API
+GType gst_navigation_event_type_get_type (void);
+#define GST_TYPE_NAVIGATION_EVENT_TYPE (gst_navigation_event_type_get_type())
+
+/* enumerations from "video-anc.h" */
+
+GST_VIDEO_API
+GType gst_video_ancillary_did_get_type (void);
+#define GST_TYPE_VIDEO_ANCILLARY_DID (gst_video_ancillary_did_get_type())
+
+GST_VIDEO_API
+GType gst_video_ancillary_di_d16_get_type (void);
+#define GST_TYPE_VIDEO_ANCILLARY_DI_D16 (gst_video_ancillary_di_d16_get_type())
+
+GST_VIDEO_API
+GType gst_video_afd_value_get_type (void);
+#define GST_TYPE_VIDEO_AFD_VALUE (gst_video_afd_value_get_type())
+
+GST_VIDEO_API
+GType gst_video_afd_spec_get_type (void);
+#define GST_TYPE_VIDEO_AFD_SPEC (gst_video_afd_spec_get_type())
+
+GST_VIDEO_API
+GType gst_video_caption_type_get_type (void);
+#define GST_TYPE_VIDEO_CAPTION_TYPE (gst_video_caption_type_get_type())
+
+GST_VIDEO_API
+GType gst_video_vbi_parser_result_get_type (void);
+#define GST_TYPE_VIDEO_VBI_PARSER_RESULT (gst_video_vbi_parser_result_get_type())
+
+/* enumerations from "video-chroma.h" */
+
+GST_VIDEO_API
+GType gst_video_chroma_site_get_type (void);
+#define GST_TYPE_VIDEO_CHROMA_SITE (gst_video_chroma_site_get_type())
+
+GST_VIDEO_API
+GType gst_video_chroma_method_get_type (void);
+#define GST_TYPE_VIDEO_CHROMA_METHOD (gst_video_chroma_method_get_type())
+
+GST_VIDEO_API
+GType gst_video_chroma_flags_get_type (void);
+#define GST_TYPE_VIDEO_CHROMA_FLAGS (gst_video_chroma_flags_get_type())
+
+/* enumerations from "video-color.h" */
+
+GST_VIDEO_API
+GType gst_video_color_range_get_type (void);
+#define GST_TYPE_VIDEO_COLOR_RANGE (gst_video_color_range_get_type())
+
+GST_VIDEO_API
+GType gst_video_color_matrix_get_type (void);
+#define GST_TYPE_VIDEO_COLOR_MATRIX (gst_video_color_matrix_get_type())
+
+GST_VIDEO_API
+GType gst_video_transfer_function_get_type (void);
+#define GST_TYPE_VIDEO_TRANSFER_FUNCTION (gst_video_transfer_function_get_type())
+
+GST_VIDEO_API
+GType gst_video_color_primaries_get_type (void);
+#define GST_TYPE_VIDEO_COLOR_PRIMARIES (gst_video_color_primaries_get_type())
+
+/* enumerations from "video-converter.h" */
+
+GST_VIDEO_API
+GType gst_video_alpha_mode_get_type (void);
+#define GST_TYPE_VIDEO_ALPHA_MODE (gst_video_alpha_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_chroma_mode_get_type (void);
+#define GST_TYPE_VIDEO_CHROMA_MODE (gst_video_chroma_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_matrix_mode_get_type (void);
+#define GST_TYPE_VIDEO_MATRIX_MODE (gst_video_matrix_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_gamma_mode_get_type (void);
+#define GST_TYPE_VIDEO_GAMMA_MODE (gst_video_gamma_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_primaries_mode_get_type (void);
+#define GST_TYPE_VIDEO_PRIMARIES_MODE (gst_video_primaries_mode_get_type())
+
+/* enumerations from "video-dither.h" */
+
+GST_VIDEO_API
+GType gst_video_dither_method_get_type (void);
+#define GST_TYPE_VIDEO_DITHER_METHOD (gst_video_dither_method_get_type())
+
+GST_VIDEO_API
+GType gst_video_dither_flags_get_type (void);
+#define GST_TYPE_VIDEO_DITHER_FLAGS (gst_video_dither_flags_get_type())
+
+/* enumerations from "video-format.h" */
+
+GST_VIDEO_API
+GType gst_video_format_get_type (void);
+#define GST_TYPE_VIDEO_FORMAT (gst_video_format_get_type())
+
+GST_VIDEO_API
+GType gst_video_format_flags_get_type (void);
+#define GST_TYPE_VIDEO_FORMAT_FLAGS (gst_video_format_flags_get_type())
+
+GST_VIDEO_API
+GType gst_video_pack_flags_get_type (void);
+#define GST_TYPE_VIDEO_PACK_FLAGS (gst_video_pack_flags_get_type())
+
+/* enumerations from "video-frame.h" */
+
+GST_VIDEO_API
+GType gst_video_frame_flags_get_type (void);
+#define GST_TYPE_VIDEO_FRAME_FLAGS (gst_video_frame_flags_get_type())
+
+GST_VIDEO_API
+GType gst_video_buffer_flags_get_type (void);
+#define GST_TYPE_VIDEO_BUFFER_FLAGS (gst_video_buffer_flags_get_type())
+
+GST_VIDEO_API
+GType gst_video_frame_map_flags_get_type (void);
+#define GST_TYPE_VIDEO_FRAME_MAP_FLAGS (gst_video_frame_map_flags_get_type())
+
+/* enumerations from "video-info.h" */
+
+GST_VIDEO_API
+GType gst_video_interlace_mode_get_type (void);
+#define GST_TYPE_VIDEO_INTERLACE_MODE (gst_video_interlace_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_multiview_mode_get_type (void);
+#define GST_TYPE_VIDEO_MULTIVIEW_MODE (gst_video_multiview_mode_get_type())
+
+GST_VIDEO_API
+GType gst_video_multiview_frame_packing_get_type (void);
+#define GST_TYPE_VIDEO_MULTIVIEW_FRAME_PACKING (gst_video_multiview_frame_packing_get_type())
+
+GST_VIDEO_API
+GType gst_video_multiview_flags_get_type (void);
+#define GST_TYPE_VIDEO_MULTIVIEW_FLAGS (gst_video_multiview_flags_get_type())
+
+GST_VIDEO_API
+GType gst_video_flags_get_type (void);
+#define GST_TYPE_VIDEO_FLAGS (gst_video_flags_get_type())
+
+GST_VIDEO_API
+GType gst_video_field_order_get_type (void);
+#define GST_TYPE_VIDEO_FIELD_ORDER (gst_video_field_order_get_type())
+
+/* enumerations from "video-overlay-composition.h" */
+
+GST_VIDEO_API
+GType gst_video_overlay_format_flags_get_type (void);
+#define GST_TYPE_VIDEO_OVERLAY_FORMAT_FLAGS (gst_video_overlay_format_flags_get_type())
+
+/* enumerations from "video-resampler.h" */
+
+GST_VIDEO_API
+GType gst_video_resampler_method_get_type (void);
+#define GST_TYPE_VIDEO_RESAMPLER_METHOD (gst_video_resampler_method_get_type())
+
+GST_VIDEO_API
+GType gst_video_resampler_flags_get_type (void);
+#define GST_TYPE_VIDEO_RESAMPLER_FLAGS (gst_video_resampler_flags_get_type())
+
+/* enumerations from "video-scaler.h" */
+
+GST_VIDEO_API
+GType gst_video_scaler_flags_get_type (void);
+#define GST_TYPE_VIDEO_SCALER_FLAGS (gst_video_scaler_flags_get_type())
+
+/* enumerations from "video-tile.h" */
+
+GST_VIDEO_API
+GType gst_video_tile_type_get_type (void);
+#define GST_TYPE_VIDEO_TILE_TYPE (gst_video_tile_type_get_type())
+
+GST_VIDEO_API
+GType gst_video_tile_mode_get_type (void);
+#define GST_TYPE_VIDEO_TILE_MODE (gst_video_tile_mode_get_type())
+
+/* enumerations from "video.h" */
+
+GST_VIDEO_API
+GType gst_video_orientation_method_get_type (void);
+#define GST_TYPE_VIDEO_ORIENTATION_METHOD (gst_video_orientation_method_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/video/video-event.h b/include/gst/video/video-event.h
new file mode 100644
index 0000000000..1fe4e504ca
--- /dev/null
+++ b/include/gst/video/video-event.h
@@ -0,0 +1,69 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_EVENT_H__
+#define __GST_VIDEO_EVENT_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+/* video still frame event creation and parsing */
+
+GST_VIDEO_API
+GstEvent * gst_video_event_new_still_frame (gboolean in_still);
+
+GST_VIDEO_API
+gboolean gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still);
+
+/* video force key unit event creation and parsing */
+
+GST_VIDEO_API
+GstEvent * gst_video_event_new_downstream_force_key_unit (GstClockTime timestamp,
+ GstClockTime stream_time,
+ GstClockTime running_time,
+ gboolean all_headers,
+ guint count);
+
+GST_VIDEO_API
+gboolean gst_video_event_parse_downstream_force_key_unit (GstEvent * event,
+ GstClockTime * timestamp,
+ GstClockTime * stream_time,
+ GstClockTime * running_time,
+ gboolean * all_headers,
+ guint * count);
+
+GST_VIDEO_API
+GstEvent * gst_video_event_new_upstream_force_key_unit (GstClockTime running_time,
+ gboolean all_headers,
+ guint count);
+
+GST_VIDEO_API
+gboolean gst_video_event_parse_upstream_force_key_unit (GstEvent * event,
+ GstClockTime * running_time,
+ gboolean * all_headers,
+ guint * count);
+
+GST_VIDEO_API
+gboolean gst_video_event_is_force_key_unit(GstEvent *event);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_EVENT_H__ */
diff --git a/include/gst/video/video-format.h b/include/gst/video/video-format.h
new file mode 100644
index 0000000000..9c701c895c
--- /dev/null
+++ b/include/gst/video/video-format.h
@@ -0,0 +1,809 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_FORMAT_H__
+#define __GST_VIDEO_FORMAT_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#include <gst/video/video-enumtypes.h>
+#include <gst/video/video-tile.h>
+
+/**
+ * GstVideoFormat:
+ * @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
+ * @GST_VIDEO_FORMAT_ENCODED: Encoded video format. Only ever use that in caps for
+ * special video formats in combination with non-system
+ * memory GstCapsFeatures where it does not make sense
+ * to specify a real video format.
+ * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
+ * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
+ * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
+ * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
+ * @GST_VIDEO_FORMAT_VYUY: packed 4:2:2 YUV (V0-Y0-U0-Y1 V2-Y2-U2-Y3 V4 ...)
+ * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...)
+ * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last
+ * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last
+ * @GST_VIDEO_FORMAT_xRGB: sparse rgb packed into 32 bit, space first
+ * @GST_VIDEO_FORMAT_xBGR: sparse reverse rgb packed into 32 bit, space first
+ * @GST_VIDEO_FORMAT_RGBA: rgb with alpha channel last
+ * @GST_VIDEO_FORMAT_BGRA: reverse rgb with alpha channel last
+ * @GST_VIDEO_FORMAT_ARGB: rgb with alpha channel first
+ * @GST_VIDEO_FORMAT_ABGR: reverse rgb with alpha channel first
+ * @GST_VIDEO_FORMAT_RGB: RGB packed into 24 bits without padding (`R-G-B-R-G-B`)
+ * @GST_VIDEO_FORMAT_BGR: reverse RGB packed into 24 bits without padding (`B-G-R-B-G-R`)
+ * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV
+ * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV
+ * @GST_VIDEO_FORMAT_YVYU: packed 4:2:2 YUV (Y0-V0-Y1-U0 Y2-V2-Y3-U2 Y4 ...)
+ * @GST_VIDEO_FORMAT_Y444: planar 4:4:4 YUV
+ * @GST_VIDEO_FORMAT_v210: packed 4:2:2 10-bit YUV, complex format
+ * @GST_VIDEO_FORMAT_v216: packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order
+ * @GST_VIDEO_FORMAT_NV12: planar 4:2:0 YUV with interleaved UV plane
+ * @GST_VIDEO_FORMAT_NV21: planar 4:2:0 YUV with interleaved VU plane
+ * @GST_VIDEO_FORMAT_NV12_10LE32: 10-bit variant of @GST_VIDEO_FORMAT_NV12, packed into 32bit words (MSB 2 bits padding) (Since: 1.14)
+ * @GST_VIDEO_FORMAT_GRAY8: 8-bit grayscale
+ * @GST_VIDEO_FORMAT_GRAY10_LE32: 10-bit grayscale, packed into 32bit words (2 bits padding) (Since: 1.14)
+ * @GST_VIDEO_FORMAT_GRAY16_BE: 16-bit grayscale, most significant byte first
+ * @GST_VIDEO_FORMAT_GRAY16_LE: 16-bit grayscale, least significant byte first
+ * @GST_VIDEO_FORMAT_v308: packed 4:4:4 YUV (Y-U-V ...)
+ * @GST_VIDEO_FORMAT_IYU2: packed 4:4:4 YUV (U-Y-V ...) (Since: 1.10)
+ * @GST_VIDEO_FORMAT_RGB16: rgb 5-6-5 bits per component
+ * @GST_VIDEO_FORMAT_BGR16: reverse rgb 5-6-5 bits per component
+ * @GST_VIDEO_FORMAT_RGB15: rgb 5-5-5 bits per component
+ * @GST_VIDEO_FORMAT_BGR15: reverse rgb 5-5-5 bits per component
+ * @GST_VIDEO_FORMAT_UYVP: packed 10-bit 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
+ * @GST_VIDEO_FORMAT_A420: planar 4:4:2:0 AYUV
+ * @GST_VIDEO_FORMAT_RGB8P: 8-bit paletted RGB
+ * @GST_VIDEO_FORMAT_YUV9: planar 4:1:0 YUV
+ * @GST_VIDEO_FORMAT_YVU9: planar 4:1:0 YUV (like YUV9 but UV planes swapped)
+ * @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...)
+ * @GST_VIDEO_FORMAT_ARGB64: rgb with alpha channel first, 16 bits (native endianness) per channel
+ * @GST_VIDEO_FORMAT_AYUV64: packed 4:4:4 YUV with alpha channel, 16 bits (native endianness) per channel (A0-Y0-U0-V0 ...)
+ * @GST_VIDEO_FORMAT_r210: packed 4:4:4 RGB, 10 bits per channel
+ * @GST_VIDEO_FORMAT_I420_10BE: planar 4:2:0 YUV, 10 bits per channel
+ * @GST_VIDEO_FORMAT_I420_10LE: planar 4:2:0 YUV, 10 bits per channel
+ * @GST_VIDEO_FORMAT_I422_10BE: planar 4:2:2 YUV, 10 bits per channel
+ * @GST_VIDEO_FORMAT_I422_10LE: planar 4:2:2 YUV, 10 bits per channel
+ * @GST_VIDEO_FORMAT_Y444_10BE: planar 4:4:4 YUV, 10 bits per channel (Since: 1.2)
+ * @GST_VIDEO_FORMAT_Y444_10LE: planar 4:4:4 YUV, 10 bits per channel (Since: 1.2)
+ * @GST_VIDEO_FORMAT_GBR: planar 4:4:4 RGB, 8 bits per channel (Since: 1.2)
+ * @GST_VIDEO_FORMAT_GBR_10BE: planar 4:4:4 RGB, 10 bits per channel (Since: 1.2)
+ * @GST_VIDEO_FORMAT_GBR_10LE: planar 4:4:4 RGB, 10 bits per channel (Since: 1.2)
+ * @GST_VIDEO_FORMAT_NV16: planar 4:2:2 YUV with interleaved UV plane (Since: 1.2)
+ * @GST_VIDEO_FORMAT_NV16_10LE32: 10-bit variant of @GST_VIDEO_FORMAT_NV16, packed into 32bit words (MSB 2 bits padding) (Since: 1.14)
+ * @GST_VIDEO_FORMAT_NV24: planar 4:4:4 YUV with interleaved UV plane (Since: 1.2)
+ * @GST_VIDEO_FORMAT_NV12_64Z32: NV12 with 64x32 tiling in zigzag pattern (Since: 1.4)
+ * @GST_VIDEO_FORMAT_A420_10BE: planar 4:4:2:0 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_A420_10LE: planar 4:4:2:0 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_A422_10BE: planar 4:4:2:2 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_A422_10LE: planar 4:4:2:2 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_A444_10BE: planar 4:4:4:4 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_A444_10LE: planar 4:4:4:4 YUV, 10 bits per channel (Since: 1.6)
+ * @GST_VIDEO_FORMAT_NV61: planar 4:2:2 YUV with interleaved VU plane (Since: 1.6)
+ * @GST_VIDEO_FORMAT_P010_10BE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel (Since: 1.10)
+ * @GST_VIDEO_FORMAT_P010_10LE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel (Since: 1.10)
+ * @GST_VIDEO_FORMAT_GBRA: planar 4:4:4:4 ARGB, 8 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBRA_10BE: planar 4:4:4:4 ARGB, 10 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBRA_10LE: planar 4:4:4:4 ARGB, 10 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBR_12BE: planar 4:4:4 RGB, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBR_12LE: planar 4:4:4 RGB, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBRA_12BE: planar 4:4:4:4 ARGB, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_GBRA_12LE: planar 4:4:4:4 ARGB, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_I420_12BE: planar 4:2:0 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_I420_12LE: planar 4:2:0 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_I422_12BE: planar 4:2:2 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_I422_12LE: planar 4:2:2 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_Y444_12BE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_Y444_12LE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
+ * @GST_VIDEO_FORMAT_NV12_10LE40: Fully packed variant of NV12_10LE32 (Since: 1.16)
+ * @GST_VIDEO_FORMAT_Y210: packed 4:2:2 YUV, 10 bits per channel (Since: 1.16)
+ * @GST_VIDEO_FORMAT_Y410: packed 4:4:4 YUV, 10 bits per channel(A-V-Y-U...) (Since: 1.16)
+ * @GST_VIDEO_FORMAT_VUYA: packed 4:4:4 YUV with alpha channel (V0-U0-Y0-A0...) (Since: 1.16)
+ * @GST_VIDEO_FORMAT_BGR10A2_LE: packed 4:4:4 RGB with alpha channel(B-G-R-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.16)
+ * @GST_VIDEO_FORMAT_RGB10A2_LE: packed 4:4:4 RGB with alpha channel(R-G-B-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y444_16BE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y444_16LE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_P016_BE: planar 4:2:0 YUV with interleaved UV plane, 16 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_P016_LE: planar 4:2:0 YUV with interleaved UV plane, 16 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_P012_BE: planar 4:2:0 YUV with interleaved UV plane, 12 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_P012_LE: planar 4:2:0 YUV with interleaved UV plane, 12 bits per channel (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y212_BE: packed 4:2:2 YUV, 12 bits per channel (Y-U-Y-V) (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y212_LE: packed 4:2:2 YUV, 12 bits per channel (Y-U-Y-V) (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y412_BE: packed 4:4:4:4 YUV, 12 bits per channel(U-Y-V-A...) (Since: 1.18)
+ * @GST_VIDEO_FORMAT_Y412_LE: packed 4:4:4:4 YUV, 12 bits per channel(U-Y-V-A...) (Since: 1.18)
+ * @GST_VIDEO_FORMAT_NV12_4L4: NV12 with 4x4 tiles in linear order (Since: 1.18)
+ * @GST_VIDEO_FORMAT_NV12_32L32: NV12 with 32x32 tiles in linear order (Since: 1.18)
+ * @GST_VIDEO_FORMAT_RGBP: planar 4:4:4 RGB, 8 bits per channel (Since: 1.20)
+ * @GST_VIDEO_FORMAT_BGRP: planar 4:4:4 RGB, 8 bits per channel (Since: 1.20)
+ * @GST_VIDEO_FORMAT_AV12: Planar 4:2:0 YUV with interleaved UV plane with alpha as 3rd plane (Since: 1.20)
+ * @GST_VIDEO_FORMAT_ARGB64_LE: RGB with alpha channel first, 16 bits per channel
+ * @GST_VIDEO_FORMAT_ARGB64_BE: RGB with alpha channel first, 16 bits per channel
+ * @GST_VIDEO_FORMAT_RGBA64_LE: RGB with alpha channel last, 16 bits per channel
+ * @GST_VIDEO_FORMAT_RGBA64_BE: RGB with alpha channel last, 16 bits per channel
+ * @GST_VIDEO_FORMAT_BGRA64_LE: reverse RGB with alpha channel last, 16 bits per channel
+ * @GST_VIDEO_FORMAT_BGRA64_BE: reverse RGB with alpha channel last, 16 bits per channel
+ * @GST_VIDEO_FORMAT_ABGR64_LE: reverse RGB with alpha channel first, 16 bits per channel
+ * @GST_VIDEO_FORMAT_ABGR64_BE: reverse RGB with alpha channel first, 16 bits per channel
+ *
+ * Enum value describing the most common video formats.
+ *
+ * See the [GStreamer raw video format design document](https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html#formats)
+ * for details about the layout and packing of these formats in memory.
+ */
+typedef enum {
+ GST_VIDEO_FORMAT_UNKNOWN,
+ GST_VIDEO_FORMAT_ENCODED,
+ GST_VIDEO_FORMAT_I420,
+ GST_VIDEO_FORMAT_YV12,
+ GST_VIDEO_FORMAT_YUY2,
+ GST_VIDEO_FORMAT_UYVY,
+ GST_VIDEO_FORMAT_AYUV,
+ GST_VIDEO_FORMAT_RGBx,
+ GST_VIDEO_FORMAT_BGRx,
+ GST_VIDEO_FORMAT_xRGB,
+ GST_VIDEO_FORMAT_xBGR,
+ GST_VIDEO_FORMAT_RGBA,
+ GST_VIDEO_FORMAT_BGRA,
+ GST_VIDEO_FORMAT_ARGB,
+ GST_VIDEO_FORMAT_ABGR,
+ GST_VIDEO_FORMAT_RGB,
+ GST_VIDEO_FORMAT_BGR,
+ GST_VIDEO_FORMAT_Y41B,
+ GST_VIDEO_FORMAT_Y42B,
+ GST_VIDEO_FORMAT_YVYU,
+ GST_VIDEO_FORMAT_Y444,
+ GST_VIDEO_FORMAT_v210,
+ GST_VIDEO_FORMAT_v216,
+ GST_VIDEO_FORMAT_NV12,
+ GST_VIDEO_FORMAT_NV21,
+ GST_VIDEO_FORMAT_GRAY8,
+ GST_VIDEO_FORMAT_GRAY16_BE,
+ GST_VIDEO_FORMAT_GRAY16_LE,
+ GST_VIDEO_FORMAT_v308,
+ GST_VIDEO_FORMAT_RGB16,
+ GST_VIDEO_FORMAT_BGR16,
+ GST_VIDEO_FORMAT_RGB15,
+ GST_VIDEO_FORMAT_BGR15,
+ GST_VIDEO_FORMAT_UYVP,
+ GST_VIDEO_FORMAT_A420,
+ GST_VIDEO_FORMAT_RGB8P,
+ GST_VIDEO_FORMAT_YUV9,
+ GST_VIDEO_FORMAT_YVU9,
+ GST_VIDEO_FORMAT_IYU1,
+ GST_VIDEO_FORMAT_ARGB64,
+ GST_VIDEO_FORMAT_AYUV64,
+ GST_VIDEO_FORMAT_r210,
+ GST_VIDEO_FORMAT_I420_10BE,
+ GST_VIDEO_FORMAT_I420_10LE,
+ GST_VIDEO_FORMAT_I422_10BE,
+ GST_VIDEO_FORMAT_I422_10LE,
+ GST_VIDEO_FORMAT_Y444_10BE,
+ GST_VIDEO_FORMAT_Y444_10LE,
+ GST_VIDEO_FORMAT_GBR,
+ GST_VIDEO_FORMAT_GBR_10BE,
+ GST_VIDEO_FORMAT_GBR_10LE,
+ GST_VIDEO_FORMAT_NV16,
+ GST_VIDEO_FORMAT_NV24,
+ GST_VIDEO_FORMAT_NV12_64Z32,
+ GST_VIDEO_FORMAT_A420_10BE,
+ GST_VIDEO_FORMAT_A420_10LE,
+ GST_VIDEO_FORMAT_A422_10BE,
+ GST_VIDEO_FORMAT_A422_10LE,
+ GST_VIDEO_FORMAT_A444_10BE,
+ GST_VIDEO_FORMAT_A444_10LE,
+ GST_VIDEO_FORMAT_NV61,
+ GST_VIDEO_FORMAT_P010_10BE,
+ GST_VIDEO_FORMAT_P010_10LE,
+ GST_VIDEO_FORMAT_IYU2,
+ GST_VIDEO_FORMAT_VYUY,
+ GST_VIDEO_FORMAT_GBRA,
+ GST_VIDEO_FORMAT_GBRA_10BE,
+ GST_VIDEO_FORMAT_GBRA_10LE,
+ GST_VIDEO_FORMAT_GBR_12BE,
+ GST_VIDEO_FORMAT_GBR_12LE,
+ GST_VIDEO_FORMAT_GBRA_12BE,
+ GST_VIDEO_FORMAT_GBRA_12LE,
+ GST_VIDEO_FORMAT_I420_12BE,
+ GST_VIDEO_FORMAT_I420_12LE,
+ GST_VIDEO_FORMAT_I422_12BE,
+ GST_VIDEO_FORMAT_I422_12LE,
+ GST_VIDEO_FORMAT_Y444_12BE,
+ GST_VIDEO_FORMAT_Y444_12LE,
+ GST_VIDEO_FORMAT_GRAY10_LE32,
+ GST_VIDEO_FORMAT_NV12_10LE32,
+ GST_VIDEO_FORMAT_NV16_10LE32,
+ GST_VIDEO_FORMAT_NV12_10LE40,
+ GST_VIDEO_FORMAT_Y210,
+ GST_VIDEO_FORMAT_Y410,
+ GST_VIDEO_FORMAT_VUYA,
+ GST_VIDEO_FORMAT_BGR10A2_LE,
+ GST_VIDEO_FORMAT_RGB10A2_LE,
+ GST_VIDEO_FORMAT_Y444_16BE,
+ GST_VIDEO_FORMAT_Y444_16LE,
+ GST_VIDEO_FORMAT_P016_BE,
+ GST_VIDEO_FORMAT_P016_LE,
+ GST_VIDEO_FORMAT_P012_BE,
+ GST_VIDEO_FORMAT_P012_LE,
+ GST_VIDEO_FORMAT_Y212_BE,
+ GST_VIDEO_FORMAT_Y212_LE,
+ GST_VIDEO_FORMAT_Y412_BE,
+ GST_VIDEO_FORMAT_Y412_LE,
+ /**
+ * GST_VIDEO_FORMAT_NV12_4L4:
+ *
+ * NV12 with 4x4 tiles in linear order.
+ *
+ * Since: 1.18
+ */
+ GST_VIDEO_FORMAT_NV12_4L4,
+ /**
+ * GST_VIDEO_FORMAT_NV12_32L32:
+ *
+ * NV12 with 32x32 tiles in linear order.
+ *
+ * Since: 1.18
+ */
+ GST_VIDEO_FORMAT_NV12_32L32,
+
+ /**
+ * GST_VIDEO_FORMAT_RGBP:
+ *
+ * Planar 4:4:4 RGB, R-G-B order
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_RGBP,
+
+ /**
+ * GST_VIDEO_FORMAT_BGRP:
+ *
+ * Planar 4:4:4 RGB, B-G-R order
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_BGRP,
+
+ /**
+ * GST_VIDEO_FORMAT_AV12:
+ *
+ * Planar 4:2:0 YUV with interleaved UV plane with alpha as
+ * 3rd plane.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_AV12,
+
+ /**
+ * GST_VIDEO_FORMAT_ARGB64_LE:
+ *
+ * RGB with alpha channel first, 16 bits (little endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_ARGB64_LE,
+
+ /**
+ * GST_VIDEO_FORMAT_ARGB64_BE:
+ *
+ * RGB with alpha channel first, 16 bits (big endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_ARGB64_BE,
+
+ /**
+ * GST_VIDEO_FORMAT_RGBA64_LE:
+ *
+ * RGB with alpha channel last, 16 bits (little endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_RGBA64_LE,
+
+ /**
+ * GST_VIDEO_FORMAT_RGBA64_BE:
+ *
+ * RGB with alpha channel last, 16 bits (big endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_RGBA64_BE,
+
+ /**
+ * GST_VIDEO_FORMAT_BGRA64_LE:
+ *
+ * Reverse RGB with alpha channel last, 16 bits (little endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_BGRA64_LE,
+
+ /**
+ * GST_VIDEO_FORMAT_BGRA64_BE:
+ *
+ * Reverse RGB with alpha channel last, 16 bits (big endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_BGRA64_BE,
+
+ /**
+ * GST_VIDEO_FORMAT_ABGR64_LE:
+ *
+ * Reverse RGB with alpha channel first, 16 bits (little endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_ABGR64_LE,
+
+ /**
+ * GST_VIDEO_FORMAT_ABGR64_BE:
+ *
+ * Reverse RGB with alpha channel first, 16 bits (big endian)
+ * per channel.
+ *
+ * Since: 1.20
+ */
+ GST_VIDEO_FORMAT_ABGR64_BE,
+} GstVideoFormat;
+
+#define GST_VIDEO_MAX_PLANES 4
+#define GST_VIDEO_MAX_COMPONENTS 4
+
+typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
+
+/**
+ * GstVideoFormatFlags:
+ * @GST_VIDEO_FORMAT_FLAG_YUV: The video format is YUV, components are numbered
+ * 0=Y, 1=U, 2=V.
+ * @GST_VIDEO_FORMAT_FLAG_RGB: The video format is RGB, components are numbered
+ * 0=R, 1=G, 2=B.
+ * @GST_VIDEO_FORMAT_FLAG_GRAY: The video is gray, there is one gray component
+ * with index 0.
+ * @GST_VIDEO_FORMAT_FLAG_ALPHA: The video format has an alpha components with
+ * the number 3.
+ * @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
+ * endianness.
+ * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette. The palette
+ * is stored in the second plane and indexes are stored in the first plane.
+ * @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
+ * can't be described with the usual information in the #GstVideoFormatInfo.
+ * @GST_VIDEO_FORMAT_FLAG_UNPACK: This format can be used in a
+ * #GstVideoFormatUnpack and #GstVideoFormatPack function.
+ * @GST_VIDEO_FORMAT_FLAG_TILED: The format is tiled, there is tiling information
+ * in the last plane.
+ *
+ * The different video flags that a format info can have.
+ */
+typedef enum
+{
+ GST_VIDEO_FORMAT_FLAG_YUV = (1 << 0),
+ GST_VIDEO_FORMAT_FLAG_RGB = (1 << 1),
+ GST_VIDEO_FORMAT_FLAG_GRAY = (1 << 2),
+ GST_VIDEO_FORMAT_FLAG_ALPHA = (1 << 3),
+ GST_VIDEO_FORMAT_FLAG_LE = (1 << 4),
+ GST_VIDEO_FORMAT_FLAG_PALETTE = (1 << 5),
+ GST_VIDEO_FORMAT_FLAG_COMPLEX = (1 << 6),
+ GST_VIDEO_FORMAT_FLAG_UNPACK = (1 << 7),
+ GST_VIDEO_FORMAT_FLAG_TILED = (1 << 8)
+} GstVideoFormatFlags;
+
+/* YUV components */
+#define GST_VIDEO_COMP_Y 0
+#define GST_VIDEO_COMP_U 1
+#define GST_VIDEO_COMP_V 2
+
+/* RGB components */
+#define GST_VIDEO_COMP_R 0
+#define GST_VIDEO_COMP_G 1
+#define GST_VIDEO_COMP_B 2
+
+/* alpha component */
+#define GST_VIDEO_COMP_A 3
+
+/* palette components */
+#define GST_VIDEO_COMP_INDEX 0
+#define GST_VIDEO_COMP_PALETTE 1
+
+#include <gst/video/video-chroma.h>
+
+/**
+ * GstVideoPackFlags:
+ * @GST_VIDEO_PACK_FLAG_NONE: No flag
+ * @GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE: When the source has a smaller depth
+ * than the target format, set the least significant bits of the target
+ * to 0. This is likely slightly faster but less accurate. When this flag
+ * is not specified, the most significant bits of the source are duplicated
+ * in the least significant bits of the destination.
+ * @GST_VIDEO_PACK_FLAG_INTERLACED: The source is interlaced. The unpacked
+ * format will be interlaced as well with each line containing
+ * information from alternating fields. (Since: 1.2)
+ *
+ * The different flags that can be used when packing and unpacking.
+ */
+typedef enum
+{
+ GST_VIDEO_PACK_FLAG_NONE = 0,
+ GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE = (1 << 0),
+ GST_VIDEO_PACK_FLAG_INTERLACED = (1 << 1)
+} GstVideoPackFlags;
+
+/**
+ * GstVideoFormatUnpack:
+ * @info: a #GstVideoFormatInfo
+ * @flags: flags to control the unpacking
+ * @dest: a destination array
+ * @data: pointers to the data planes
+ * @stride: strides of the planes
+ * @x: the x position in the image to start from
+ * @y: the y position in the image to start from
+ * @width: the amount of pixels to unpack.
+ *
+ * Unpacks @width pixels from the given planes and strides containing data of
+ * format @info. The pixels will be unpacked into @dest with each component
+ * interleaved as per @info's unpack_format, which will usually be one of
+ * #GST_VIDEO_FORMAT_ARGB, #GST_VIDEO_FORMAT_AYUV, #GST_VIDEO_FORMAT_ARGB64 or
+ * #GST_VIDEO_FORMAT_AYUV64 depending on the format to unpack.
+ * @dest should at least be big enough to hold @width * bytes_per_pixel bytes
+ * where bytes_per_pixel relates to the unpack format and will usually be
+ * either 4 or 8 depending on the unpack format. bytes_per_pixel will be
+ * the same as the pixel stride for plane 0 for the above formats.
+ *
+ * For subsampled formats, the components will be duplicated in the destination
+ * array. Reconstruction of the missing components can be performed in a
+ * separate step after unpacking.
+ */
+typedef void (*GstVideoFormatUnpack) (const GstVideoFormatInfo *info,
+ GstVideoPackFlags flags, gpointer dest,
+ const gpointer data[GST_VIDEO_MAX_PLANES],
+ const gint stride[GST_VIDEO_MAX_PLANES],
+ gint x, gint y, gint width);
+/**
+ * GstVideoFormatPack:
+ * @info: a #GstVideoFormatInfo
+ * @flags: flags to control the packing
+ * @src: a source array
+ * @sstride: the source array stride
+ * @data: pointers to the destination data planes
+ * @stride: strides of the destination planes
+ * @chroma_site: the chroma siting of the target when subsampled (not used)
+ * @y: the y position in the image to pack to
+ * @width: the amount of pixels to pack.
+ *
+ * Packs @width pixels from @src to the given planes and strides in the
+ * format @info. The pixels from source have each component interleaved
+ * and will be packed into the planes in @data.
+ *
+ * This function operates on pack_lines lines, meaning that @src should
+ * contain at least pack_lines lines with a stride of @sstride and @y
+ * should be a multiple of pack_lines.
+ *
+ * Subsampled formats will use the horizontally and vertically cosited
+ * component from the source. Subsampling should be performed before
+ * packing.
+ *
+ * Because this function does not have a x coordinate, it is not possible to
+ * pack pixels starting from an unaligned position. For tiled images this
+ * means that packing should start from a tile coordinate. For subsampled
+ * formats this means that a complete pixel needs to be packed.
+ */
+/* FIXME(2.0): remove the chroma_site, it is unused and is not relevant for
+ * packing, chroma subsampling based on chroma-site should be done in a separate
+ * step before packing*/
+typedef void (*GstVideoFormatPack) (const GstVideoFormatInfo *info,
+ GstVideoPackFlags flags,
+ const gpointer src, gint sstride,
+ gpointer data[GST_VIDEO_MAX_PLANES],
+ const gint stride[GST_VIDEO_MAX_PLANES],
+ GstVideoChromaSite chroma_site,
+ gint y, gint width);
+
+/**
+ * GstVideoFormatInfo:
+ * @format: #GstVideoFormat
+ * @name: string representation of the format
+ * @description: use readable description of the format
+ * @flags: #GstVideoFormatFlags
+ * @bits: The number of bits used to pack data items. This can be less than 8
+ * when multiple pixels are stored in a byte. for values > 8 multiple bytes
+ * should be read according to the endianness flag before applying the shift
+ * and mask.
+ * @n_components: the number of components in the video format.
+ * @shift: the number of bits to shift away to get the component data
+ * @depth: the depth in bits for each component
+ * @pixel_stride: the pixel stride of each component. This is the amount of
+ * bytes to the pixel immediately to the right. When bits < 8, the stride is
+ * expressed in bits. For 24-bit RGB, this would be 3 bytes, for example,
+ * while it would be 4 bytes for RGBx or ARGB.
+ * @n_planes: the number of planes for this format. The number of planes can be
+ * less than the amount of components when multiple components are packed into
+ * one plane.
+ * @plane: the plane number where a component can be found
+ * @poffset: the offset in the plane where the first pixel of the components
+ * can be found.
+ * @w_sub: subsampling factor of the width for the component. Use
+ * GST_VIDEO_SUB_SCALE to scale a width.
+ * @h_sub: subsampling factor of the height for the component. Use
+ * GST_VIDEO_SUB_SCALE to scale a height.
+ * @unpack_format: the format of the unpacked pixels. This format must have the
+ * #GST_VIDEO_FORMAT_FLAG_UNPACK flag set.
+ * @unpack_func: an unpack function for this format
+ * @pack_lines: the amount of lines that will be packed
+ * @pack_func: an pack function for this format
+ * @tile_mode: The tiling mode
+ * @tile_ws: The width of a tile, in bytes, represented as a shift
+ * @tile_hs: The height of a tile, in bytes, represented as a shift
+ *
+ * Information for a video format.
+ */
+struct _GstVideoFormatInfo {
+ GstVideoFormat format;
+ const gchar *name;
+ const gchar *description;
+ GstVideoFormatFlags flags;
+ guint bits;
+ guint n_components;
+ guint shift[GST_VIDEO_MAX_COMPONENTS];
+ guint depth[GST_VIDEO_MAX_COMPONENTS];
+ gint pixel_stride[GST_VIDEO_MAX_COMPONENTS];
+ guint n_planes;
+ guint plane[GST_VIDEO_MAX_COMPONENTS];
+ guint poffset[GST_VIDEO_MAX_COMPONENTS];
+ guint w_sub[GST_VIDEO_MAX_COMPONENTS];
+ guint h_sub[GST_VIDEO_MAX_COMPONENTS];
+
+ GstVideoFormat unpack_format;
+ GstVideoFormatUnpack unpack_func;
+ gint pack_lines;
+ GstVideoFormatPack pack_func;
+
+ GstVideoTileMode tile_mode;
+ guint tile_ws;
+ guint tile_hs;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+#define GST_VIDEO_FORMAT_INFO_FORMAT(info) ((info)->format)
+#define GST_VIDEO_FORMAT_INFO_NAME(info) ((info)->name)
+#define GST_VIDEO_FORMAT_INFO_FLAGS(info) ((info)->flags)
+
+#define GST_VIDEO_FORMAT_INFO_IS_YUV(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_YUV) != 0)
+#define GST_VIDEO_FORMAT_INFO_IS_RGB(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB) != 0)
+#define GST_VIDEO_FORMAT_INFO_IS_GRAY(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY) != 0)
+#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA) != 0)
+#define GST_VIDEO_FORMAT_INFO_IS_LE(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_LE) != 0)
+#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE) != 0)
+#define GST_VIDEO_FORMAT_INFO_IS_COMPLEX(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_COMPLEX) != 0)
+#define GST_VIDEO_FORMAT_INFO_IS_TILED(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_TILED) != 0)
+
+#define GST_VIDEO_FORMAT_INFO_BITS(info) ((info)->bits)
+#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
+#define GST_VIDEO_FORMAT_INFO_SHIFT(info,c) ((info)->shift[c])
+#define GST_VIDEO_FORMAT_INFO_DEPTH(info,c) ((info)->depth[c])
+/**
+ * GST_VIDEO_FORMAT_INFO_PSTRIDE:
+ * @info: a #GstVideoFormatInfo
+ * @c: the component index
+ *
+ * pixel stride for the given component. This is the amount of bytes to the
+ * pixel immediately to the right, so basically bytes from one pixel to the
+ * next. When bits < 8, the stride is expressed in bits.
+ *
+ * Examples: for 24-bit RGB, the pixel stride would be 3 bytes, while it
+ * would be 4 bytes for RGBx or ARGB, and 8 bytes for ARGB64 or AYUV64.
+ * For planar formats such as I420 the pixel stride is usually 1. For
+ * YUY2 it would be 2 bytes.
+ */
+#define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c) ((info)->pixel_stride[c])
+/**
+ * GST_VIDEO_FORMAT_INFO_N_PLANES:
+ * @info: a #GstVideoFormatInfo
+ *
+ * Number of planes. This is the number of planes the pixel layout is
+ * organized in in memory. The number of planes can be less than the
+ * number of components (e.g. Y,U,V,A or R, G, B, A) when multiple
+ * components are packed into one plane.
+ *
+ * Examples: RGB/RGBx/RGBA: 1 plane, 3/3/4 components;
+ * I420: 3 planes, 3 components; NV21/NV12: 2 planes, 3 components.
+ */
+#define GST_VIDEO_FORMAT_INFO_N_PLANES(info) ((info)->n_planes)
+/**
+ * GST_VIDEO_FORMAT_INFO_PLANE:
+ * @info: a #GstVideoFormatInfo
+ * @c: the component index
+ *
+ * Plane number where the given component can be found. A plane may
+ * contain data for multiple components.
+ */
+#define GST_VIDEO_FORMAT_INFO_PLANE(info,c) ((info)->plane[c])
+#define GST_VIDEO_FORMAT_INFO_POFFSET(info,c) ((info)->poffset[c])
+#define GST_VIDEO_FORMAT_INFO_W_SUB(info,c) ((info)->w_sub[c])
+#define GST_VIDEO_FORMAT_INFO_H_SUB(info,c) ((info)->h_sub[c])
+
+/* rounds up */
+#define GST_VIDEO_SUB_SCALE(scale,val) (-((-((gint)(val)))>>(scale)))
+
+#define GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info,c,w) GST_VIDEO_SUB_SCALE ((info)->w_sub[c],(w))
+#define GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT(info,c,h) GST_VIDEO_SUB_SCALE ((info)->h_sub[c],(h))
+
+#define GST_VIDEO_FORMAT_INFO_DATA(info,planes,comp) \
+ (((guint8*)(planes)[(info)->plane[comp]]) + (info)->poffset[comp])
+/**
+ * GST_VIDEO_FORMAT_INFO_STRIDE:
+ * @info: a #GstVideoFormatInfo
+ * @strides: an array of strides
+ * @comp: the component index
+ *
+ * Row stride in bytes, that is number of bytes from the first pixel component
+ * of a row to the first pixel component in the next row. This might include
+ * some row padding (memory not actually used for anything, to make sure the
+ * beginning of the next row is aligned in a particular way).
+ */
+#define GST_VIDEO_FORMAT_INFO_STRIDE(info,strides,comp) ((strides)[(info)->plane[comp]])
+#define GST_VIDEO_FORMAT_INFO_OFFSET(info,offsets,comp) \
+ (((offsets)[(info)->plane[comp]]) + (info)->poffset[comp])
+
+#define GST_VIDEO_FORMAT_INFO_TILE_MODE(info) ((info)->tile_mode)
+#define GST_VIDEO_FORMAT_INFO_TILE_WS(info) ((info)->tile_ws)
+#define GST_VIDEO_FORMAT_INFO_TILE_HS(info) ((info)->tile_hs)
+
+GST_VIDEO_API
+void gst_video_format_info_component (const GstVideoFormatInfo *info, guint plane, gint components[GST_VIDEO_MAX_COMPONENTS]);
+
+/* format properties */
+
+GST_VIDEO_API
+GstVideoFormat gst_video_format_from_masks (gint depth, gint bpp, gint endianness,
+ guint red_mask, guint green_mask,
+ guint blue_mask, guint alpha_mask) G_GNUC_CONST;
+
+GST_VIDEO_API
+GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
+
+GST_VIDEO_API
+GstVideoFormat gst_video_format_from_string (const gchar *format) G_GNUC_CONST;
+
+GST_VIDEO_API
+guint32 gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
+
+GST_VIDEO_API
+const gchar * gst_video_format_to_string (GstVideoFormat format) G_GNUC_CONST;
+
+GST_VIDEO_API
+const GstVideoFormatInfo *
+ gst_video_format_get_info (GstVideoFormat format) G_GNUC_CONST;
+
+GST_VIDEO_API
+gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsize *size);
+
+#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
+#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define GST_VIDEO_NE(s) G_STRINGIFY(s)"_LE"
+# define GST_VIDEO_OE(s) G_STRINGIFY(s)"_BE"
+#else
+# define GST_VIDEO_NE(s) G_STRINGIFY(s)"_BE"
+# define GST_VIDEO_OE(s) G_STRINGIFY(s)"_LE"
+#endif
+
+/**
+ * GST_VIDEO_FORMATS_ALL:
+ *
+ * List of all video formats, for use in template caps strings.
+ *
+ * Formats are sorted by decreasing "quality", using these criteria by priority:
+ * - number of components
+ * - depth
+ * - subsampling factor of the width
+ * - subsampling factor of the height
+ * - number of planes
+ * - native endianness preferred
+ * - pixel stride
+ * - poffset
+ * - prefer non-complex formats
+ * - prefer YUV formats over RGB ones
+ * - prefer I420 over YV12
+ * - format name
+ */
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+#define GST_VIDEO_FORMATS_ALL "{ ABGR64_BE, BGRA64_BE, AYUV64, ARGB64_BE, ARGB64, " \
+ "RGBA64_BE, ABGR64_LE, BGRA64_LE, ARGB64_LE, RGBA64_LE, GBRA_12BE, GBRA_12LE, Y412_BE, " \
+ "Y412_LE, A444_10BE, GBRA_10BE, A444_10LE, GBRA_10LE, A422_10BE, A422_10LE, " \
+ "A420_10BE, A420_10LE, Y410, RGB10A2_LE, BGR10A2_LE, GBRA, ABGR, VUYA, BGRA, " \
+ "AYUV, ARGB, RGBA, A420, AV12, Y444_16BE, Y444_16LE, v216, P016_BE, P016_LE, Y444_12BE, " \
+ "GBR_12BE, Y444_12LE, GBR_12LE, I422_12BE, I422_12LE, Y212_BE, Y212_LE, I420_12BE, " \
+ "I420_12LE, P012_BE, P012_LE, Y444_10BE, GBR_10BE, Y444_10LE, GBR_10LE, r210, " \
+ "I422_10BE, I422_10LE, NV16_10LE32, Y210, v210, UYVP, I420_10BE, I420_10LE, " \
+ "P010_10BE, P010_10LE, NV12_10LE32, NV12_10LE40, Y444, RGBP, GBR, BGRP, NV24, xBGR, BGRx, " \
+ "xRGB, RGBx, BGR, IYU2, v308, RGB, Y42B, NV61, NV16, VYUY, UYVY, YVYU, YUY2, I420, " \
+ "YV12, NV21, NV12, NV12_64Z32, NV12_4L4, NV12_32L32, Y41B, IYU1, YVU9, YUV9, RGB16, " \
+ "BGR16, RGB15, BGR15, RGB8P, GRAY16_BE, GRAY16_LE, GRAY10_LE32, GRAY8 }"
+#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_VIDEO_FORMATS_ALL "{ ABGR64_LE, BGRA64_LE, AYUV64, ARGB64_LE, ARGB64, " \
+ "RGBA64_LE, ABGR64_BE, BGRA64_BE, ARGB64_BE, RGBA64_BE, GBRA_12LE, GBRA_12BE, Y412_LE, " \
+ "Y412_BE, A444_10LE, GBRA_10LE, A444_10BE, GBRA_10BE, A422_10LE, A422_10BE, " \
+ "A420_10LE, A420_10BE, RGB10A2_LE, BGR10A2_LE, Y410, GBRA, ABGR, VUYA, BGRA, " \
+ "AYUV, ARGB, RGBA, A420, AV12, Y444_16LE, Y444_16BE, v216, P016_LE, P016_BE, Y444_12LE, " \
+ "GBR_12LE, Y444_12BE, GBR_12BE, I422_12LE, I422_12BE, Y212_LE, Y212_BE, I420_12LE, " \
+ "I420_12BE, P012_LE, P012_BE, Y444_10LE, GBR_10LE, Y444_10BE, GBR_10BE, r210, " \
+ "I422_10LE, I422_10BE, NV16_10LE32, Y210, v210, UYVP, I420_10LE, I420_10BE, " \
+ "P010_10LE, NV12_10LE32, NV12_10LE40, P010_10BE, Y444, RGBP, GBR, BGRP, NV24, xBGR, BGRx, " \
+ "xRGB, RGBx, BGR, IYU2, v308, RGB, Y42B, NV61, NV16, VYUY, UYVY, YVYU, YUY2, I420, " \
+ "YV12, NV21, NV12, NV12_64Z32, NV12_4L4, NV12_32L32, Y41B, IYU1, YVU9, YUV9, RGB16, " \
+ "BGR16, RGB15, BGR15, RGB8P, GRAY16_LE, GRAY16_BE, GRAY10_LE32, GRAY8 }"
+#endif
+
+GST_VIDEO_API
+const GstVideoFormat * gst_video_formats_raw (guint * len);
+
+/**
+ * GST_VIDEO_CAPS_MAKE:
+ * @format: string format that describes the pixel layout, as string
+ * (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
+ *
+ * Generic caps string for video, for use in pad templates.
+ */
+#define GST_VIDEO_CAPS_MAKE(format) \
+ "video/x-raw, " \
+ "format = (string) " format ", " \
+ "width = " GST_VIDEO_SIZE_RANGE ", " \
+ "height = " GST_VIDEO_SIZE_RANGE ", " \
+ "framerate = " GST_VIDEO_FPS_RANGE
+
+/**
+ * GST_VIDEO_CAPS_MAKE_WITH_FEATURES:
+ * @format: string format that describes the pixel layout, as string
+ * (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
+ * @features: Requires caps features as a string, e.g.
+ * "memory:SystemMemory".
+ *
+ * Generic caps string for video, for use in pad templates.
+ *
+ * Since: 1.2
+ */
+#define GST_VIDEO_CAPS_MAKE_WITH_FEATURES(features,format) \
+ "video/x-raw(" features "), " \
+ "format = (string) " format ", " \
+ "width = " GST_VIDEO_SIZE_RANGE ", " \
+ "height = " GST_VIDEO_SIZE_RANGE ", " \
+ "framerate = " GST_VIDEO_FPS_RANGE
+
+GST_VIDEO_API
+GstCaps * gst_video_make_raw_caps (const GstVideoFormat formats[], guint len);
+
+GST_VIDEO_API
+GstCaps * gst_video_make_raw_caps_with_features (const GstVideoFormat formats[], guint len,
+ GstCapsFeatures * features);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_FORMAT_H__ */
diff --git a/include/gst/video/video-frame.h b/include/gst/video/video-frame.h
new file mode 100644
index 0000000000..f3925c47de
--- /dev/null
+++ b/include/gst/video/video-frame.h
@@ -0,0 +1,254 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_FRAME_H__
+#define __GST_VIDEO_FRAME_H__
+
+#include <gst/video/video-enumtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoFrame GstVideoFrame;
+
+/**
+ * GstVideoFrameFlags:
+ * @GST_VIDEO_FRAME_FLAG_NONE: no flags
+ * @GST_VIDEO_FRAME_FLAG_INTERLACED: The video frame is interlaced. In mixed
+ * interlace-mode, this flag specifies if the frame is interlaced or
+ * progressive.
+ * @GST_VIDEO_FRAME_FLAG_TFF: The video frame has the top field first
+ * @GST_VIDEO_FRAME_FLAG_RFF: The video frame has the repeat flag
+ * @GST_VIDEO_FRAME_FLAG_ONEFIELD: The video frame has one field
+ * @GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW: The video contains one or
+ * more non-mono views
+ * @GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE: The video frame is the first
+ * in a set of corresponding views provided as sequential frames.
+ * @GST_VIDEO_FRAME_FLAG_TOP_FIELD: The video frame has the top field only. This
+ * is the same as GST_VIDEO_FRAME_FLAG_TFF | GST_VIDEO_FRAME_FLAG_ONEFIELD
+ * (Since: 1.16).
+ * @GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD: The video frame has the bottom field
+ * only. This is the same as GST_VIDEO_FRAME_FLAG_ONEFIELD
+ * (GST_VIDEO_FRAME_FLAG_TFF flag unset) (Since: 1.16).
+ *
+ * Extra video frame flags
+ */
+typedef enum {
+ GST_VIDEO_FRAME_FLAG_NONE = 0,
+ GST_VIDEO_FRAME_FLAG_INTERLACED = (1 << 0),
+ GST_VIDEO_FRAME_FLAG_TFF = (1 << 1),
+ GST_VIDEO_FRAME_FLAG_RFF = (1 << 2),
+ GST_VIDEO_FRAME_FLAG_ONEFIELD = (1 << 3),
+ GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW = (1 << 4),
+ GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE = (1 << 5),
+ GST_VIDEO_FRAME_FLAG_TOP_FIELD = GST_VIDEO_FRAME_FLAG_TFF |
+ GST_VIDEO_FRAME_FLAG_ONEFIELD,
+ GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD = GST_VIDEO_FRAME_FLAG_ONEFIELD,
+} GstVideoFrameFlags;
+
+/* circular dependency, need to include this after defining the enums */
+#include <gst/video/video-format.h>
+#include <gst/video/video-info.h>
+
+/**
+ * GstVideoFrame:
+ * @info: the #GstVideoInfo
+ * @flags: #GstVideoFrameFlags for the frame
+ * @buffer: the mapped buffer
+ * @meta: pointer to metadata if any
+ * @id: id of the mapped frame. the id can for example be used to
+ * identify the frame in case of multiview video.
+ * @data: pointers to the plane data
+ * @map: mappings of the planes
+ *
+ * A video frame obtained from gst_video_frame_map()
+ */
+struct _GstVideoFrame {
+ GstVideoInfo info;
+ GstVideoFrameFlags flags;
+
+ GstBuffer *buffer;
+ gpointer meta;
+ gint id;
+
+ gpointer data[GST_VIDEO_MAX_PLANES];
+ GstMapInfo map[GST_VIDEO_MAX_PLANES];
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+gboolean gst_video_frame_map (GstVideoFrame *frame, const GstVideoInfo *info,
+ GstBuffer *buffer, GstMapFlags flags);
+
+GST_VIDEO_API
+gboolean gst_video_frame_map_id (GstVideoFrame *frame, const GstVideoInfo *info,
+ GstBuffer *buffer, gint id, GstMapFlags flags);
+
+GST_VIDEO_API
+void gst_video_frame_unmap (GstVideoFrame *frame);
+
+GST_VIDEO_API
+gboolean gst_video_frame_copy (GstVideoFrame *dest, const GstVideoFrame *src);
+
+GST_VIDEO_API
+gboolean gst_video_frame_copy_plane (GstVideoFrame *dest, const GstVideoFrame *src,
+ guint plane);
+
+/* general info */
+#define GST_VIDEO_FRAME_FORMAT(f) (GST_VIDEO_INFO_FORMAT(&(f)->info))
+#define GST_VIDEO_FRAME_WIDTH(f) (GST_VIDEO_INFO_WIDTH(&(f)->info))
+#define GST_VIDEO_FRAME_HEIGHT(f) (GST_VIDEO_INFO_HEIGHT(&(f)->info))
+#define GST_VIDEO_FRAME_SIZE(f) (GST_VIDEO_INFO_SIZE(&(f)->info))
+
+/* flags */
+#define GST_VIDEO_FRAME_FLAGS(f) ((f)->flags)
+#define GST_VIDEO_FRAME_FLAG_IS_SET(f,fl) ((GST_VIDEO_FRAME_FLAGS(f) & (fl)) == (fl))
+#define GST_VIDEO_FRAME_IS_INTERLACED(f) (GST_VIDEO_FRAME_FLAG_IS_SET(f, GST_VIDEO_FRAME_FLAG_INTERLACED))
+#define GST_VIDEO_FRAME_IS_TFF(f) (GST_VIDEO_FRAME_FLAG_IS_SET(f, GST_VIDEO_FRAME_FLAG_TFF))
+#define GST_VIDEO_FRAME_IS_RFF(f) (GST_VIDEO_FRAME_FLAG_IS_SET(f, GST_VIDEO_FRAME_FLAG_RFF))
+#define GST_VIDEO_FRAME_IS_ONEFIELD(f) (GST_VIDEO_FRAME_FLAG_IS_SET(f, GST_VIDEO_FRAME_FLAG_ONEFIELD))
+#define GST_VIDEO_FRAME_IS_TOP_FIELD(f) (GST_VIDEO_FRAME_FLAG_IS_SET(f, GST_VIDEO_FRAME_FLAG_TOP_FIELD))
+
+/* GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD is a subset of
+ * GST_VIDEO_FRAME_FLAG_TOP_FIELD so needs to be checked accordingly. */
+#define _GST_VIDEO_FRAME_FLAG_FIELD_MASK GST_VIDEO_FRAME_FLAG_TOP_FIELD
+
+#define GST_VIDEO_FRAME_IS_BOTTOM_FIELD(f) (((f)->flags & _GST_VIDEO_FRAME_FLAG_FIELD_MASK) == GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD)
+
+/* dealing with planes */
+#define GST_VIDEO_FRAME_N_PLANES(f) (GST_VIDEO_INFO_N_PLANES(&(f)->info))
+#define GST_VIDEO_FRAME_PLANE_DATA(f,p) ((f)->data[p])
+#define GST_VIDEO_FRAME_PLANE_OFFSET(f,p) (GST_VIDEO_INFO_PLANE_OFFSET(&(f)->info,(p)))
+#define GST_VIDEO_FRAME_PLANE_STRIDE(f,p) (GST_VIDEO_INFO_PLANE_STRIDE(&(f)->info,(p)))
+
+/* dealing with components */
+#define GST_VIDEO_FRAME_N_COMPONENTS(f) GST_VIDEO_INFO_N_COMPONENTS(&(f)->info)
+#define GST_VIDEO_FRAME_COMP_DEPTH(f,c) GST_VIDEO_INFO_COMP_DEPTH(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_DATA(f,c) GST_VIDEO_INFO_COMP_DATA(&(f)->info,(f)->data,(c))
+#define GST_VIDEO_FRAME_COMP_STRIDE(f,c) GST_VIDEO_INFO_COMP_STRIDE(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_OFFSET(f,c) GST_VIDEO_INFO_COMP_OFFSET(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_WIDTH(f,c) GST_VIDEO_INFO_COMP_WIDTH(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_HEIGHT(f,c) GST_VIDEO_INFO_COMP_HEIGHT(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_PLANE(f,c) GST_VIDEO_INFO_COMP_PLANE(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_PSTRIDE(f,c) GST_VIDEO_INFO_COMP_PSTRIDE(&(f)->info,(c))
+#define GST_VIDEO_FRAME_COMP_POFFSET(f,c) GST_VIDEO_INFO_COMP_POFFSET(&(f)->info,(c))
+
+/* buffer flags */
+
+/**
+ * GstVideoBufferFlags:
+ * @GST_VIDEO_BUFFER_FLAG_INTERLACED: If the #GstBuffer is interlaced. In mixed
+ * interlace-mode, this flags specifies if the frame is
+ * interlaced or progressive.
+ * @GST_VIDEO_BUFFER_FLAG_TFF: If the #GstBuffer is interlaced, then the first field
+ * in the video frame is the top field. If unset, the
+ * bottom field is first.
+ * @GST_VIDEO_BUFFER_FLAG_RFF: If the #GstBuffer is interlaced, then the first field
+ * (as defined by the %GST_VIDEO_BUFFER_FLAG_TFF flag setting)
+ * is repeated.
+ * @GST_VIDEO_BUFFER_FLAG_ONEFIELD: If the #GstBuffer is interlaced, then only the
+ * first field (as defined by the %GST_VIDEO_BUFFER_FLAG_TFF
+ * flag setting) is to be displayed (Since: 1.16).
+ * @GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW: The #GstBuffer contains one or more specific views,
+ * such as left or right eye view. This flags is set on
+ * any buffer that contains non-mono content - even for
+ * streams that contain only a single viewpoint. In mixed
+ * mono / non-mono streams, the absence of the flag marks
+ * mono buffers.
+ * @GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE: When conveying stereo/multiview content with
+ * frame-by-frame methods, this flag marks the first buffer
+ * in a bundle of frames that belong together.
+ * @GST_VIDEO_BUFFER_FLAG_TOP_FIELD: The video frame has the top field only. This is the
+ * same as GST_VIDEO_BUFFER_FLAG_TFF |
+ * GST_VIDEO_BUFFER_FLAG_ONEFIELD (Since: 1.16).
+ * Use GST_VIDEO_BUFFER_IS_TOP_FIELD() to check for this flag.
+ * @GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD: The video frame has the bottom field only. This is
+ * the same as GST_VIDEO_BUFFER_FLAG_ONEFIELD
+ * (GST_VIDEO_BUFFER_FLAG_TFF flag unset) (Since: 1.16).
+ * Use GST_VIDEO_BUFFER_IS_BOTTOM_FIELD() to check for this flag.
+ * @GST_VIDEO_BUFFER_FLAG_MARKER: The #GstBuffer contains the end of a video field or frame
+ * boundary such as the last subframe or packet (Since: 1.18).
+ * @GST_VIDEO_BUFFER_FLAG_LAST: Offset to define more flags
+ *
+ * Additional video buffer flags. These flags can potentially be used on any
+ * buffers carrying closed caption data, or video data - even encoded data.
+ *
+ * Note that these are only valid for #GstCaps of type: video/... and caption/...
+ * They can conflict with other extended buffer flags.
+ */
+typedef enum {
+ GST_VIDEO_BUFFER_FLAG_INTERLACED = (GST_BUFFER_FLAG_LAST << 0),
+ GST_VIDEO_BUFFER_FLAG_TFF = (GST_BUFFER_FLAG_LAST << 1),
+ GST_VIDEO_BUFFER_FLAG_RFF = (GST_BUFFER_FLAG_LAST << 2),
+ GST_VIDEO_BUFFER_FLAG_ONEFIELD = (GST_BUFFER_FLAG_LAST << 3),
+
+ GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW = (GST_BUFFER_FLAG_LAST << 4),
+ GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE = (GST_BUFFER_FLAG_LAST << 5),
+
+ GST_VIDEO_BUFFER_FLAG_TOP_FIELD = GST_VIDEO_BUFFER_FLAG_TFF |
+ GST_VIDEO_BUFFER_FLAG_ONEFIELD,
+ GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD = GST_VIDEO_BUFFER_FLAG_ONEFIELD,
+
+ GST_VIDEO_BUFFER_FLAG_MARKER = GST_BUFFER_FLAG_MARKER,
+
+ GST_VIDEO_BUFFER_FLAG_LAST = (GST_BUFFER_FLAG_LAST << 8)
+} GstVideoBufferFlags;
+
+/* GST_VIDEO_BUFFER_FLAG_TOP_FIELD is a subset of
+ * GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD so needs to be checked accordingly. */
+#define _GST_VIDEO_BUFFER_FLAG_FIELD_MASK GST_VIDEO_BUFFER_FLAG_TOP_FIELD
+
+/**
+ * GST_VIDEO_BUFFER_IS_TOP_FIELD:
+ * @buf: a #GstBuffer
+ *
+ * Check if GST_VIDEO_BUFFER_FLAG_TOP_FIELD is set on @buf (Since: 1.18).
+ */
+#define GST_VIDEO_BUFFER_IS_TOP_FIELD(buf) ((GST_BUFFER_FLAGS (buf) & _GST_VIDEO_BUFFER_FLAG_FIELD_MASK) == GST_VIDEO_BUFFER_FLAG_TOP_FIELD)
+
+/**
+ * GST_VIDEO_BUFFER_IS_BOTTOM_FIELD:
+ * @buf: a #GstBuffer
+ *
+ * Check if GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD is set on @buf (Since: 1.18).
+ */
+#define GST_VIDEO_BUFFER_IS_BOTTOM_FIELD(buf) ((GST_BUFFER_FLAGS (buf) & _GST_VIDEO_BUFFER_FLAG_FIELD_MASK) == GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD)
+
+/**
+ * GstVideoFrameMapFlags:
+ * @GST_VIDEO_FRAME_MAP_FLAG_NO_REF: Don't take another reference of the buffer and store it in
+ * the GstVideoFrame. This makes sure that the buffer stays
+ * writable while the frame is mapped, but requires that the
+ * buffer reference stays valid until the frame is unmapped again.
+ * @GST_VIDEO_FRAME_MAP_FLAG_LAST: Offset to define more flags
+ *
+ * Additional mapping flags for gst_video_frame_map().
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_FRAME_MAP_FLAG_NO_REF = (GST_MAP_FLAG_LAST << 0),
+ GST_VIDEO_FRAME_MAP_FLAG_LAST = (GST_MAP_FLAG_LAST << 8)
+ /* 8 more flags possible afterwards */
+} GstVideoFrameMapFlags;
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_FRAME_H__ */
diff --git a/include/gst/video/video-hdr.h b/include/gst/video/video-hdr.h
new file mode 100644
index 0000000000..b6ce360233
--- /dev/null
+++ b/include/gst/video/video-hdr.h
@@ -0,0 +1,143 @@
+/* GStreamer
+ * Copyright (C) <2018-2019> Seungha Yang <seungha.yang@navercorp.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_HDR_H__
+#define __GST_VIDEO_HDR_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoMasteringDisplayInfoCoordinates GstVideoMasteringDisplayInfoCoordinates;
+typedef struct _GstVideoMasteringDisplayInfo GstVideoMasteringDisplayInfo;
+typedef struct _GstVideoContentLightLevel GstVideoContentLightLevel;
+
+/**
+ * GstVideoMasteringDisplayInfoCoordinates:
+ * @x: the x coordinate of CIE 1931 color space in unit of 0.00002.
+ * @y: the y coordinate of CIE 1931 color space in unit of 0.00002.
+ *
+ * Used to represent display_primaries and white_point of
+ * #GstVideoMasteringDisplayInfo struct. See #GstVideoMasteringDisplayInfo
+ *
+ * Since: 1.18
+ */
+struct _GstVideoMasteringDisplayInfoCoordinates
+{
+ guint16 x;
+ guint16 y;
+};
+
+/**
+ * GstVideoMasteringDisplayInfo:
+ * @display_primaries: the xy coordinates of primaries in the CIE 1931 color space.
+ * the index 0 contains red, 1 is for green and 2 is for blue.
+ * each value is normalized to 50000 (meaning that in unit of 0.00002)
+ * @white_point: the xy coordinates of white point in the CIE 1931 color space.
+ * each value is normalized to 50000 (meaning that in unit of 0.00002)
+ * @max_display_mastering_luminance: the maximum value of display luminance
+ * in unit of 0.0001 candelas per square metre (cd/m^2 and nit)
+ * @min_display_mastering_luminance: the minimum value of display luminance
+ * in unit of 0.0001 candelas per square metre (cd/m^2 and nit)
+ *
+ * Mastering display color volume information defined by SMPTE ST 2086
+ * (a.k.a static HDR metadata).
+ *
+ * Since: 1.18
+ */
+struct _GstVideoMasteringDisplayInfo
+{
+ GstVideoMasteringDisplayInfoCoordinates display_primaries[3];
+ GstVideoMasteringDisplayInfoCoordinates white_point;
+ guint32 max_display_mastering_luminance;
+ guint32 min_display_mastering_luminance;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+void gst_video_mastering_display_info_init (GstVideoMasteringDisplayInfo * minfo);
+
+GST_VIDEO_API
+gboolean gst_video_mastering_display_info_from_string (GstVideoMasteringDisplayInfo * minfo,
+ const gchar * mastering);
+
+GST_VIDEO_API
+gchar * gst_video_mastering_display_info_to_string (const GstVideoMasteringDisplayInfo * minfo);
+
+GST_VIDEO_API
+gboolean gst_video_mastering_display_info_is_equal (const GstVideoMasteringDisplayInfo * minfo,
+ const GstVideoMasteringDisplayInfo * other);
+
+GST_VIDEO_API
+gboolean gst_video_mastering_display_info_from_caps (GstVideoMasteringDisplayInfo * minfo,
+ const GstCaps * caps);
+
+GST_VIDEO_API
+gboolean gst_video_mastering_display_info_add_to_caps (const GstVideoMasteringDisplayInfo * minfo,
+ GstCaps * caps);
+
+/**
+ * GstVideoContentLightLevel:
+ * @max_content_light_level: the maximum content light level
+ * (abbreviated to MaxCLL) in candelas per square meter (cd/m^2 and nit)
+ * @max_frame_average_light_level: the maximum frame average light level
+ * (abbreviated to MaxFLL) in candelas per square meter (cd/m^2 and nit)
+ *
+ * Content light level information specified in CEA-861.3, Appendix A.
+ *
+ * Since: 1.18
+ */
+struct _GstVideoContentLightLevel
+{
+ guint16 max_content_light_level;
+ guint16 max_frame_average_light_level;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GST_VIDEO_API
+void gst_video_content_light_level_init (GstVideoContentLightLevel * linfo);
+
+GST_VIDEO_API
+gboolean gst_video_content_light_level_from_string (GstVideoContentLightLevel * linfo,
+ const gchar * level);
+
+GST_VIDEO_API
+gchar * gst_video_content_light_level_to_string (const GstVideoContentLightLevel * linfo);
+
+GST_VIDEO_API
+gboolean gst_video_content_light_level_is_equal (const GstVideoContentLightLevel * linfo,
+ const GstVideoContentLightLevel * other);
+
+GST_VIDEO_API
+gboolean gst_video_content_light_level_from_caps (GstVideoContentLightLevel * linfo,
+ const GstCaps * caps);
+
+GST_VIDEO_API
+gboolean gst_video_content_light_level_add_to_caps (const GstVideoContentLightLevel * linfo,
+ GstCaps * caps);
+
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_HDR_H__ */
diff --git a/include/gst/video/video-info.h b/include/gst/video/video-info.h
new file mode 100644
index 0000000000..3de617d954
--- /dev/null
+++ b/include/gst/video/video-info.h
@@ -0,0 +1,484 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_INFO_H__
+#define __GST_VIDEO_INFO_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-format.h>
+#include <gst/video/video-color.h>
+
+G_BEGIN_DECLS
+
+#include <gst/video/video-enumtypes.h>
+
+typedef struct _GstVideoInfo GstVideoInfo;
+
+/**
+ * GST_CAPS_FEATURE_FORMAT_INTERLACED:
+ *
+ * Name of the caps feature indicating that the stream is interlaced.
+ *
+ * Currently it is only used for video with 'interlace-mode=alternate'
+ * to ensure backwards compatibility for this new mode.
+ * In this mode each buffer carries a single field of interlaced video.
+ * @GST_VIDEO_BUFFER_FLAG_TOP_FIELD and @GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD
+ * indicate whether the buffer carries a top or bottom field. The order of
+ * buffers/fields in the stream and the timestamps on the buffers indicate the
+ * temporal order of the fields.
+ * Top and bottom fields are expected to alternate in this mode.
+ * The frame rate in the caps still signals the frame rate, so the notional field
+ * rate will be twice the frame rate from the caps
+ * (see @GST_VIDEO_INFO_FIELD_RATE_N).
+ *
+ * Since: 1.16.
+ */
+#define GST_CAPS_FEATURE_FORMAT_INTERLACED "format:Interlaced"
+
+/**
+ * GstVideoInterlaceMode:
+ * @GST_VIDEO_INTERLACE_MODE_PROGRESSIVE: all frames are progressive
+ * @GST_VIDEO_INTERLACE_MODE_INTERLEAVED: 2 fields are interleaved in one video
+ * frame. Extra buffer flags describe the field order.
+ * @GST_VIDEO_INTERLACE_MODE_MIXED: frames contains both interlaced and
+ * progressive video, the buffer flags describe the frame and fields.
+ * @GST_VIDEO_INTERLACE_MODE_FIELDS: 2 fields are stored in one buffer, use the
+ * frame ID to get access to the required field. For multiview (the
+ * 'views' property > 1) the fields of view N can be found at frame ID
+ * (N * 2) and (N * 2) + 1.
+ * Each field has only half the amount of lines as noted in the
+ * height property. This mode requires multiple GstVideoMeta metadata
+ * to describe the fields.
+ * @GST_VIDEO_INTERLACE_MODE_ALTERNATE: 1 field is stored in one buffer,
+ * @GST_VIDEO_BUFFER_FLAG_TF or @GST_VIDEO_BUFFER_FLAG_BF indicates if
+ * the buffer is carrying the top or bottom field, respectively. The top and
+ * bottom buffers must alternate in the pipeline, with this mode
+ * (Since: 1.16).
+ *
+ * The possible values of the #GstVideoInterlaceMode describing the interlace
+ * mode of the stream.
+ */
+typedef enum {
+ GST_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
+ GST_VIDEO_INTERLACE_MODE_INTERLEAVED,
+ GST_VIDEO_INTERLACE_MODE_MIXED,
+ GST_VIDEO_INTERLACE_MODE_FIELDS,
+ GST_VIDEO_INTERLACE_MODE_ALTERNATE,
+} GstVideoInterlaceMode;
+
+GST_VIDEO_API
+const gchar * gst_video_interlace_mode_to_string (GstVideoInterlaceMode mode);
+
+GST_VIDEO_API
+GstVideoInterlaceMode gst_video_interlace_mode_from_string (const gchar * mode);
+
+/**
+ * GstVideoMultiviewMode:
+ * @GST_VIDEO_MULTIVIEW_MODE_NONE: A special value indicating
+ * no multiview information. Used in GstVideoInfo and other places to
+ * indicate that no specific multiview handling has been requested or
+ * provided. This value is never carried on caps.
+ * @GST_VIDEO_MULTIVIEW_MODE_MONO: All frames are monoscopic.
+ * @GST_VIDEO_MULTIVIEW_MODE_LEFT: All frames represent a left-eye view.
+ * @GST_VIDEO_MULTIVIEW_MODE_RIGHT: All frames represent a right-eye view.
+ * @GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE: Left and right eye views are
+ * provided in the left and right half of the frame respectively.
+ * @GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX: Left and right eye
+ * views are provided in the left and right half of the frame, but
+ * have been sampled using quincunx method, with half-pixel offset
+ * between the 2 views.
+ * @GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED: Alternating vertical
+ * columns of pixels represent the left and right eye view respectively.
+ * @GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED: Alternating horizontal
+ * rows of pixels represent the left and right eye view respectively.
+ * @GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM: The top half of the frame
+ * contains the left eye, and the bottom half the right eye.
+ * @GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD: Pixels are arranged with
+ * alternating pixels representing left and right eye views in a
+ * checkerboard fashion.
+ * @GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME: Left and right eye views
+ * are provided in separate frames alternately.
+ * @GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME: Multiple
+ * independent views are provided in separate frames in sequence.
+ * This method only applies to raw video buffers at the moment.
+ * Specific view identification is via the `GstVideoMultiviewMeta`
+ * and #GstVideoMeta(s) on raw video buffers.
+ * @GST_VIDEO_MULTIVIEW_MODE_SEPARATED: Multiple views are
+ * provided as separate #GstMemory framebuffers attached to each
+ * #GstBuffer, described by the `GstVideoMultiviewMeta`
+ * and #GstVideoMeta(s)
+ *
+ * All possible stereoscopic 3D and multiview representations.
+ * In conjunction with #GstVideoMultiviewFlags, describes how
+ * multiview content is being transported in the stream.
+ */
+typedef enum {
+ GST_VIDEO_MULTIVIEW_MODE_NONE = -1,
+ GST_VIDEO_MULTIVIEW_MODE_MONO = 0,
+ /* Single view modes */
+ GST_VIDEO_MULTIVIEW_MODE_LEFT,
+ GST_VIDEO_MULTIVIEW_MODE_RIGHT,
+ /* Stereo view modes */
+ GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE,
+ GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX,
+ GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED,
+ GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED,
+ GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM,
+ GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD,
+ /* Padding for new frame packing modes */
+
+ GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME = 32,
+ /* Multivew mode(s) */
+ GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME,
+ GST_VIDEO_MULTIVIEW_MODE_SEPARATED
+ /* future expansion for annotated modes */
+} GstVideoMultiviewMode;
+
+/**
+ * GstVideoMultiviewFramePacking:
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE: A special value indicating
+ * no frame packing info.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO: All frames are monoscopic.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT: All frames represent a left-eye view.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT: All frames represent a right-eye view.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE: Left and right eye views are
+ * provided in the left and right half of the frame respectively.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX: Left and right eye
+ * views are provided in the left and right half of the frame, but
+ * have been sampled using quincunx method, with half-pixel offset
+ * between the 2 views.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED: Alternating vertical
+ * columns of pixels represent the left and right eye view respectively.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED: Alternating horizontal
+ * rows of pixels represent the left and right eye view respectively.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM: The top half of the frame
+ * contains the left eye, and the bottom half the right eye.
+ * @GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD: Pixels are arranged with
+ * alternating pixels representing left and right eye views in a
+ * checkerboard fashion.
+ *
+ * #GstVideoMultiviewFramePacking represents the subset of #GstVideoMultiviewMode
+ * values that can be applied to any video frame without needing extra metadata.
+ * It can be used by elements that provide a property to override the
+ * multiview interpretation of a video stream when the video doesn't contain
+ * any markers.
+ *
+ * This enum is used (for example) on playbin, to re-interpret a played
+ * video stream as a stereoscopic video. The individual enum values are
+ * equivalent to and have the same value as the matching #GstVideoMultiviewMode.
+ *
+ */
+typedef enum {
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE = GST_VIDEO_MULTIVIEW_MODE_NONE,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO = GST_VIDEO_MULTIVIEW_MODE_MONO,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT = GST_VIDEO_MULTIVIEW_MODE_LEFT,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT = GST_VIDEO_MULTIVIEW_MODE_RIGHT,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE = GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX = GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED = GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED = GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM = GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM,
+ GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD = GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD
+} GstVideoMultiviewFramePacking;
+
+#define GST_VIDEO_MULTIVIEW_MAX_FRAME_PACKING GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD
+
+/**
+ * GstVideoMultiviewFlags:
+ * @GST_VIDEO_MULTIVIEW_FLAGS_NONE: No flags
+ * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: For stereo streams, the
+ * normal arrangement of left and right views is reversed.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED: The left view is vertically
+ * mirrored.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED: The left view is horizontally
+ * mirrored.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED: The right view is
+ * vertically mirrored.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED: The right view is
+ * horizontally mirrored.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT: For frame-packed
+ * multiview modes, indicates that the individual
+ * views have been encoded with half the true width or height
+ * and should be scaled back up for display. This flag
+ * is used for overriding input layout interpretation
+ * by adjusting pixel-aspect-ratio.
+ * For side-by-side, column interleaved or checkerboard packings, the
+ * pixel width will be doubled. For row interleaved and top-bottom
+ * encodings, pixel height will be doubled.
+ * @GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO: The video stream contains both
+ * mono and multiview portions, signalled on each buffer by the
+ * absence or presence of the @GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW
+ * buffer flag.
+ *
+ * GstVideoMultiviewFlags are used to indicate extra properties of a
+ * stereo/multiview stream beyond the frame layout and buffer mapping
+ * that is conveyed in the #GstVideoMultiviewMode.
+ */
+typedef enum {
+ GST_VIDEO_MULTIVIEW_FLAGS_NONE = 0,
+ GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = (1 << 0),
+ GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = (1 << 1),
+ GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED = (1 << 2),
+ GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED = (1 << 3),
+ GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4),
+ GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14),
+ GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15)
+} GstVideoMultiviewFlags;
+
+/**
+ * GstVideoFlags:
+ * @GST_VIDEO_FLAG_NONE: no flags
+ * @GST_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d
+ * denote the maximum fps of the video
+ * @GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA: Each color has been scaled by the alpha
+ * value.
+ *
+ * Extra video flags
+ */
+typedef enum {
+ GST_VIDEO_FLAG_NONE = 0,
+ GST_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
+ GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
+} GstVideoFlags;
+
+/**
+ * GstVideoFieldOrder:
+ * @GST_VIDEO_FIELD_ORDER_UNKNOWN: unknown field order for interlaced content.
+ * The actual field order is signalled via buffer flags.
+ * @GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST: top field is first
+ * @GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST: bottom field is first
+ *
+ * Field order of interlaced content. This is only valid for
+ * interlace-mode=interleaved and not interlace-mode=mixed. In the case of
+ * mixed or GST_VIDEO_FIELD_ORDER_UNKOWN, the field order is signalled via
+ * buffer flags.
+ *
+ * Since: 1.12
+ */
+typedef enum {
+ GST_VIDEO_FIELD_ORDER_UNKNOWN = 0,
+ GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST = 1,
+ GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST = 2,
+} GstVideoFieldOrder;
+
+GST_VIDEO_API
+const gchar * gst_video_field_order_to_string (GstVideoFieldOrder order);
+
+GST_VIDEO_API
+GstVideoFieldOrder gst_video_field_order_from_string (const gchar * order);
+
+/**
+ * GstVideoInfo:
+ * @finfo: the format info of the video
+ * @interlace_mode: the interlace mode
+ * @flags: additional video flags
+ * @width: the width of the video
+ * @height: the height of the video
+ * @views: the number of views for multiview video
+ * @size: the default size of one frame
+ * @chroma_site: a #GstVideoChromaSite.
+ * @colorimetry: the colorimetry info
+ * @par_n: the pixel-aspect-ratio numerator
+ * @par_d: the pixel-aspect-ratio denominator
+ * @fps_n: the framerate numerator
+ * @fps_d: the framerate denominator
+ * @offset: offsets of the planes
+ * @stride: strides of the planes
+ * @multiview_mode: delivery mode for multiple views. (Since: 1.6)
+ * @multiview_flags: flags for multiple views configuration (Since: 1.6)
+ *
+ * Information describing image properties. This information can be filled
+ * in from GstCaps with gst_video_info_from_caps(). The information is also used
+ * to store the specific video info when mapping a video frame with
+ * gst_video_frame_map().
+ *
+ * Use the provided macros to access the info in this structure.
+ */
+struct _GstVideoInfo {
+ const GstVideoFormatInfo *finfo;
+
+ GstVideoInterlaceMode interlace_mode;
+ GstVideoFlags flags;
+ gint width;
+ gint height;
+ gsize size;
+ gint views;
+
+ GstVideoChromaSite chroma_site;
+ GstVideoColorimetry colorimetry;
+
+ gint par_n;
+ gint par_d;
+ gint fps_n;
+ gint fps_d;
+
+ gsize offset[GST_VIDEO_MAX_PLANES];
+ gint stride[GST_VIDEO_MAX_PLANES];
+
+ /* Union preserves padded struct size for backwards compat
+ * Consumer code should use the accessor macros for fields */
+ union {
+ struct { /* < skip > */
+ GstVideoMultiviewMode multiview_mode;
+ GstVideoMultiviewFlags multiview_flags;
+ GstVideoFieldOrder field_order;
+ } abi;
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+ } ABI;
+};
+
+#define GST_TYPE_VIDEO_INFO (gst_video_info_get_type ())
+GST_VIDEO_API
+GType gst_video_info_get_type (void);
+
+/* general info */
+#define GST_VIDEO_INFO_FORMAT(i) (GST_VIDEO_FORMAT_INFO_FORMAT((i)->finfo))
+#define GST_VIDEO_INFO_NAME(i) (GST_VIDEO_FORMAT_INFO_NAME((i)->finfo))
+#define GST_VIDEO_INFO_IS_YUV(i) (GST_VIDEO_FORMAT_INFO_IS_YUV((i)->finfo))
+#define GST_VIDEO_INFO_IS_RGB(i) (GST_VIDEO_FORMAT_INFO_IS_RGB((i)->finfo))
+#define GST_VIDEO_INFO_IS_GRAY(i) (GST_VIDEO_FORMAT_INFO_IS_GRAY((i)->finfo))
+#define GST_VIDEO_INFO_HAS_ALPHA(i) (GST_VIDEO_FORMAT_INFO_HAS_ALPHA((i)->finfo))
+
+#define GST_VIDEO_INFO_INTERLACE_MODE(i) ((i)->interlace_mode)
+#define GST_VIDEO_INFO_IS_INTERLACED(i) ((i)->interlace_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE)
+#define GST_VIDEO_INFO_FIELD_ORDER(i) ((i)->ABI.abi.field_order)
+#define GST_VIDEO_INFO_FLAGS(i) ((i)->flags)
+#define GST_VIDEO_INFO_WIDTH(i) ((i)->width)
+#define GST_VIDEO_INFO_HEIGHT(i) ((i)->height)
+/**
+ * GST_VIDEO_INFO_FIELD_HEIGHT:
+ *
+ * The height of a field. It's the height of the full frame unless split-field
+ * (alternate) interlacing is in use.
+ *
+ * Since: 1.16.
+ */
+#define GST_VIDEO_INFO_FIELD_HEIGHT(i) ((i)->interlace_mode == GST_VIDEO_INTERLACE_MODE_ALTERNATE? GST_ROUND_UP_2 ((i)->height) / 2 : (i)->height)
+#define GST_VIDEO_INFO_SIZE(i) ((i)->size)
+#define GST_VIDEO_INFO_VIEWS(i) ((i)->views)
+#define GST_VIDEO_INFO_PAR_N(i) ((i)->par_n)
+#define GST_VIDEO_INFO_PAR_D(i) ((i)->par_d)
+#define GST_VIDEO_INFO_FPS_N(i) ((i)->fps_n)
+#define GST_VIDEO_INFO_FIELD_RATE_N(i) ((GST_VIDEO_INFO_INTERLACE_MODE ((i)) == \
+ GST_VIDEO_INTERLACE_MODE_ALTERNATE) ? \
+ (i)->fps_n * 2 : (i)->fps_n)
+#define GST_VIDEO_INFO_FPS_D(i) ((i)->fps_d)
+
+#define GST_VIDEO_INFO_COLORIMETRY(i) ((i)->colorimetry)
+#define GST_VIDEO_INFO_CHROMA_SITE(i) ((i)->chroma_site)
+
+#define GST_VIDEO_INFO_MULTIVIEW_MODE(i) ((i)->ABI.abi.multiview_mode)
+#define GST_VIDEO_INFO_MULTIVIEW_FLAGS(i) ((i)->ABI.abi.multiview_flags)
+
+/* dealing with GstVideoInfo flags */
+#define GST_VIDEO_INFO_FLAG_IS_SET(i,flag) ((GST_VIDEO_INFO_FLAGS(i) & (flag)) == (flag))
+#define GST_VIDEO_INFO_FLAG_SET(i,flag) (GST_VIDEO_INFO_FLAGS(i) |= (flag))
+#define GST_VIDEO_INFO_FLAG_UNSET(i,flag) (GST_VIDEO_INFO_FLAGS(i) &= ~(flag))
+
+/* dealing with planes */
+#define GST_VIDEO_INFO_N_PLANES(i) (GST_VIDEO_FORMAT_INFO_N_PLANES((i)->finfo))
+#define GST_VIDEO_INFO_PLANE_OFFSET(i,p) ((i)->offset[p])
+#define GST_VIDEO_INFO_PLANE_STRIDE(i,p) ((i)->stride[p])
+/**
+ * GST_VIDEO_INFO_PLANE_HEIGHT:
+ *
+ * The padded height in pixels of a plane (padded size divided by the plane stride).
+ * In case of GST_VIDEO_INTERLACE_MODE_ALTERNATE info, this macro returns the
+ * plane heights used to hold a single field, not the full frame.
+ *
+ * The size passed as third argument is the size of the pixel data and should
+ * not contain any extra metadata padding.
+ *
+ * It is not valid to use this macro with a TILED format.
+ *
+ * Since: 1.18
+ */
+#define GST_VIDEO_INFO_PLANE_HEIGHT(i,p,sizes) ((i)->stride[p] == 0 ? 0 : sizes[p] / (i)->stride[p])
+
+/* dealing with components */
+#define GST_VIDEO_INFO_N_COMPONENTS(i) GST_VIDEO_FORMAT_INFO_N_COMPONENTS((i)->finfo)
+#define GST_VIDEO_INFO_COMP_DEPTH(i,c) GST_VIDEO_FORMAT_INFO_DEPTH((i)->finfo,(c))
+#define GST_VIDEO_INFO_COMP_DATA(i,d,c) GST_VIDEO_FORMAT_INFO_DATA((i)->finfo,d,(c))
+#define GST_VIDEO_INFO_COMP_OFFSET(i,c) GST_VIDEO_FORMAT_INFO_OFFSET((i)->finfo,(i)->offset,(c))
+#define GST_VIDEO_INFO_COMP_STRIDE(i,c) GST_VIDEO_FORMAT_INFO_STRIDE((i)->finfo,(i)->stride,(c))
+#define GST_VIDEO_INFO_COMP_WIDTH(i,c) GST_VIDEO_FORMAT_INFO_SCALE_WIDTH((i)->finfo,(c),(i)->width)
+#define GST_VIDEO_INFO_COMP_HEIGHT(i,c) GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT((i)->finfo,(c),GST_VIDEO_INFO_FIELD_HEIGHT(i))
+#define GST_VIDEO_INFO_COMP_PLANE(i,c) GST_VIDEO_FORMAT_INFO_PLANE((i)->finfo,(c))
+#define GST_VIDEO_INFO_COMP_PSTRIDE(i,c) GST_VIDEO_FORMAT_INFO_PSTRIDE((i)->finfo,(c))
+#define GST_VIDEO_INFO_COMP_POFFSET(i,c) GST_VIDEO_FORMAT_INFO_POFFSET((i)->finfo,(c))
+
+GST_VIDEO_API
+GstVideoInfo * gst_video_info_new (void);
+
+GST_VIDEO_API
+void gst_video_info_init (GstVideoInfo *info);
+
+GST_VIDEO_API
+GstVideoInfo * gst_video_info_copy (const GstVideoInfo *info);
+
+GST_VIDEO_API
+void gst_video_info_free (GstVideoInfo *info);
+
+GST_VIDEO_API
+GstVideoInfo * gst_video_info_new_from_caps (const GstCaps * caps);
+
+GST_VIDEO_API
+gboolean gst_video_info_set_format (GstVideoInfo *info, GstVideoFormat format,
+ guint width, guint height);
+
+GST_VIDEO_API
+gboolean gst_video_info_set_interlaced_format
+ (GstVideoInfo *info,
+ GstVideoFormat format,
+ GstVideoInterlaceMode mode,
+ guint width,
+ guint height);
+
+GST_VIDEO_API
+gboolean gst_video_info_from_caps (GstVideoInfo *info, const GstCaps * caps);
+
+GST_VIDEO_API
+GstCaps * gst_video_info_to_caps (const GstVideoInfo *info);
+
+GST_VIDEO_API
+gboolean gst_video_info_convert (const GstVideoInfo *info,
+ GstFormat src_format,
+ gint64 src_value,
+ GstFormat dest_format,
+ gint64 *dest_value);
+
+GST_VIDEO_API
+gboolean gst_video_info_is_equal (const GstVideoInfo *info,
+ const GstVideoInfo *other);
+
+#include <gst/video/video.h>
+
+GST_VIDEO_API
+gboolean gst_video_info_align (GstVideoInfo * info, GstVideoAlignment * align);
+
+GST_VIDEO_API
+gboolean gst_video_info_align_full (GstVideoInfo * info, GstVideoAlignment * align, gsize plane_size[GST_VIDEO_MAX_PLANES]);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoInfo, gst_video_info_free)
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_INFO_H__ */
diff --git a/include/gst/video/video-multiview.h b/include/gst/video/video-multiview.h
new file mode 100644
index 0000000000..275f0ac29e
--- /dev/null
+++ b/include/gst/video/video-multiview.h
@@ -0,0 +1,108 @@
+/* GStreamer
+ * Copyright (C) <2015> Jan Schmidt <jan@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_MULTIVIEW_H__
+#define __GST_VIDEO_MULTIVIEW_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoMultiviewFlagsSet:
+ *
+ * See #GstVideoMultiviewFlags.
+ */
+#define GST_TYPE_VIDEO_MULTIVIEW_FLAGSET (gst_video_multiview_flagset_get_type())
+GST_VIDEO_API
+GType gst_video_multiview_flagset_get_type (void);
+
+GST_VIDEO_API
+const gchar * gst_video_multiview_mode_to_caps_string (GstVideoMultiviewMode mview_mode);
+
+GST_VIDEO_API
+GstVideoMultiviewMode gst_video_multiview_mode_from_caps_string (const gchar * caps_mview_mode);
+
+GST_VIDEO_API
+const GValue *gst_video_multiview_get_mono_modes(void);
+
+GST_VIDEO_API
+const GValue *gst_video_multiview_get_unpacked_modes(void);
+
+GST_VIDEO_API
+const GValue *gst_video_multiview_get_doubled_height_modes(void);
+
+GST_VIDEO_API
+const GValue *gst_video_multiview_get_doubled_width_modes(void);
+
+GST_VIDEO_API
+const GValue *gst_video_multiview_get_doubled_size_modes(void);
+
+GST_VIDEO_API
+void gst_video_multiview_video_info_change_mode (GstVideoInfo *info,
+ GstVideoMultiviewMode out_mview_mode, GstVideoMultiviewFlags out_mview_flags);
+
+GST_VIDEO_API
+gboolean gst_video_multiview_guess_half_aspect (GstVideoMultiviewMode mv_mode,
+ guint width, guint height, guint par_n, guint par_d);
+
+
+#if 0 /* Place-holder for later MVC support */
+#define GST_VIDEO_MULTIVIEW_META_API_TYPE (gst_video_multiview_meta_api_get_type())
+#define GST_VIDEO_MULTIVIEW_META_INFO (gst_video_multiview_meta_get_info())
+
+typedef struct _GstVideoMultiviewMeta GstVideoMultiviewMeta;
+typedef struct _GstVideoMultiviewViewInfo GstVideoMultiviewViewInfo;
+
+GType gst_video_multiview_meta_api_get_type (void);
+const GstMetaInfo * gst_video_multiview_meta_get_info (void);
+
+GstVideoMultiviewMeta * gst_buffer_add_video_multiview_meta (GstBuffer *buffer, guint n_views);
+#define gst_buffer_get_video_multiview_meta(b) ((GstVideoMultiviewMeta *)gst_buffer_get_meta((b),GST_VIDEO_MULTIVIEW_META_API_TYPE))
+
+void gst_video_multiview_meta_set_n_views (GstVideoMultiviewMeta *mview_meta, guint n_views);
+
+typedef enum {
+ GST_VIDEO_MULTIVIEW_VIEW_UNKNOWN = 0,
+ GST_VIDEO_MULTIVIEW_VIEW_MONO = 1,
+ GST_VIDEO_MULTIVIEW_VIEW_LEFT = 2,
+ GST_VIDEO_MULTIVIEW_VIEW_RIGHT = 3
+} GstVideoMultiviewViewLabel;
+
+struct _GstVideoMultiviewViewInfo {
+ GstVideoMultiviewViewLabel view_label;
+
+ guint meta_id; /* id of the GstVideoMeta for this view */
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstVideoMultiviewMeta {
+ GstMeta meta;
+
+ guint n_views;
+ GstVideoMultiviewViewInfo *view_info;
+};
+#endif
+
+G_END_DECLS
+
+#endif
diff --git a/include/gst/video/video-overlay-composition.h b/include/gst/video/video-overlay-composition.h
new file mode 100644
index 0000000000..7981e024d6
--- /dev/null
+++ b/include/gst/video/video-overlay-composition.h
@@ -0,0 +1,310 @@
+/* GStreamer Video Overlay Composition
+ * Copyright (C) 2011 Intel Corporation
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_OVERLAY_COMPOSITION_H__
+#define __GST_VIDEO_OVERLAY_COMPOSITION_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoOverlayRectangle:
+ *
+ * An opaque video overlay rectangle object. A rectangle contains a single
+ * overlay rectangle which can be added to a composition.
+ */
+#define GST_TYPE_VIDEO_OVERLAY_RECTANGLE \
+ (gst_video_overlay_rectangle_get_type ())
+#define GST_VIDEO_OVERLAY_RECTANGLE_CAST(obj) \
+ ((GstVideoOverlayRectangle *)(obj))
+#define GST_VIDEO_OVERLAY_RECTANGLE(obj) \
+ (GST_VIDEO_OVERLAY_RECTANGLE_CAST(obj))
+#define GST_IS_VIDEO_OVERLAY_RECTANGLE(obj) \
+ (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_VIDEO_OVERLAY_RECTANGLE))
+
+typedef struct _GstVideoOverlayRectangle GstVideoOverlayRectangle;
+
+/**
+ * gst_video_overlay_rectangle_ref:
+ * @comp: a a #GstVideoOverlayRectangle.
+ *
+ * Increases the refcount of the given rectangle by one.
+ *
+ * Note that the refcount affects the writeability
+ * of @comp, use gst_video_overlay_rectangle_copy() to ensure a rectangle can
+ * be modified (there is no gst_video_overlay_rectangle_make_writable() because
+ * it is unlikely that someone will hold the single reference to the rectangle
+ * and not know that that's the case).
+ *
+ * Returns: (transfer full): @comp
+ */
+static inline GstVideoOverlayRectangle *
+gst_video_overlay_rectangle_ref (GstVideoOverlayRectangle * comp)
+{
+ return (GstVideoOverlayRectangle *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * gst_video_overlay_rectangle_unref:
+ * @comp: (transfer full): a #GstVideoOverlayRectangle.
+ *
+ * Decreases the refcount of the rectangle. If the refcount reaches 0, the
+ * rectangle will be freed.
+ */
+static inline void
+gst_video_overlay_rectangle_unref (GstVideoOverlayRectangle * comp)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * GstVideoOverlayFormatFlags:
+ * @GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE: no flags
+ * @GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA: RGB are premultiplied by A/255.
+ * @GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA: a global-alpha value != 1 is set.
+ *
+ * Overlay format flags.
+ */
+typedef enum {
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE = 0,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA = (1<<0),
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA = (1<<1)
+} GstVideoOverlayFormatFlags;
+
+#define GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION "meta:GstVideoOverlayComposition"
+
+/**
+ * GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB:
+ *
+ * Supported RGB overlay video format.
+ */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB GST_VIDEO_FORMAT_BGRA
+#else
+#define GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB GST_VIDEO_FORMAT_ARGB
+#endif
+
+/**
+ * GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_YUV:
+ *
+ * Supported YUV overlay video format.
+ */
+#define GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_YUV GST_VIDEO_FORMAT_AYUV
+
+/**
+ * GST_VIDEO_OVERLAY_COMPOSITION_BLEND_FORMATS:
+ *
+ * Video formats supported by gst_video_overlay_composition_blend(), for
+ * use in overlay elements' pad template caps.
+ *
+ * Since: 1.2
+ */
+#define GST_VIDEO_OVERLAY_COMPOSITION_BLEND_FORMATS GST_VIDEO_FORMATS_ALL
+
+GST_VIDEO_API
+GType gst_video_overlay_rectangle_get_type (void);
+
+GST_VIDEO_API
+GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_raw (GstBuffer * pixels,
+ gint render_x, gint render_y,
+ guint render_width, guint render_height,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle,
+ gint render_x,
+ gint render_y,
+ guint render_width,
+ guint render_height);
+
+GST_VIDEO_API
+gboolean gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle * rectangle,
+ gint * render_x,
+ gint * render_y,
+ guint * render_width,
+ guint * render_height);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_raw (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_ayuv (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_raw (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_ayuv (GstVideoOverlayRectangle * rectangle,
+ GstVideoOverlayFormatFlags flags);
+
+GST_VIDEO_API
+GstVideoOverlayFormatFlags gst_video_overlay_rectangle_get_flags (GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+gfloat gst_video_overlay_rectangle_get_global_alpha (GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+void gst_video_overlay_rectangle_set_global_alpha (GstVideoOverlayRectangle * rectangle,
+ gfloat global_alpha);
+
+/**
+ * GstVideoOverlayComposition:
+ *
+ * An opaque video overlay composition object. A composition contains
+ * multiple overlay rectangles.
+ */
+#define GST_TYPE_VIDEO_OVERLAY_COMPOSITION \
+ (gst_video_overlay_composition_get_type ())
+#define GST_VIDEO_OVERLAY_COMPOSITION_CAST(obj) \
+ ((GstVideoOverlayComposition *)(obj))
+#define GST_VIDEO_OVERLAY_COMPOSITION(obj) \
+ (GST_VIDEO_OVERLAY_COMPOSITION_CAST(obj))
+#define GST_IS_VIDEO_OVERLAY_COMPOSITION(obj) \
+ (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_VIDEO_OVERLAY_COMPOSITION))
+
+typedef struct _GstVideoOverlayComposition GstVideoOverlayComposition;
+
+/**
+ * gst_video_overlay_composition_ref:
+ * @comp: a a #GstVideoOverlayComposition.
+ *
+ * Increases the refcount of the given composition by one.
+ *
+ * Note that the refcount affects the writeability
+ * of @comp, use gst_video_overlay_composition_make_writable() to ensure
+ * a composition and its rectangles can be modified.
+ *
+ * Returns: (transfer full): @comp
+ */
+static inline GstVideoOverlayComposition *
+gst_video_overlay_composition_ref (GstVideoOverlayComposition * comp)
+{
+ return (GstVideoOverlayComposition *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * gst_video_overlay_composition_unref:
+ * @comp: (transfer full): a #GstVideoOverlayComposition.
+ *
+ * Decreases the refcount of the composition. If the refcount reaches 0, the
+ * composition will be freed.
+ */
+static inline void
+gst_video_overlay_composition_unref (GstVideoOverlayComposition * comp)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
+}
+
+GST_VIDEO_API
+GType gst_video_overlay_composition_get_type (void);
+
+GST_VIDEO_API
+GstVideoOverlayComposition * gst_video_overlay_composition_copy (GstVideoOverlayComposition * comp);
+
+GST_VIDEO_API
+GstVideoOverlayComposition * gst_video_overlay_composition_make_writable (GstVideoOverlayComposition * comp);
+
+GST_VIDEO_API
+GstVideoOverlayComposition * gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+void gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition * comp,
+ GstVideoOverlayRectangle * rectangle);
+
+GST_VIDEO_API
+guint gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition * comp);
+
+GST_VIDEO_API
+GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp, guint n);
+
+GST_VIDEO_API
+guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp);
+
+/* blend composition onto raw video buffer */
+
+GST_VIDEO_API
+gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
+ GstVideoFrame * video_buf);
+
+/* attach/retrieve composition from buffers */
+
+#define GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE \
+ (gst_video_overlay_composition_meta_api_get_type())
+#define GST_VIDEO_OVERLAY_COMPOSITION_META_INFO \
+ (gst_video_overlay_composition_meta_get_info())
+
+typedef struct _GstVideoOverlayCompositionMeta GstVideoOverlayCompositionMeta;
+
+/**
+ * GstVideoOverlayCompositionMeta:
+ * @meta: parent #GstMeta
+ * @overlay: the attached #GstVideoOverlayComposition
+ *
+ * Extra buffer metadata describing image overlay data.
+ */
+struct _GstVideoOverlayCompositionMeta
+{
+ GstMeta meta;
+
+ GstVideoOverlayComposition *overlay;
+};
+
+GST_VIDEO_API
+GType gst_video_overlay_composition_meta_api_get_type (void);
+
+GST_VIDEO_API
+const GstMetaInfo *gst_video_overlay_composition_meta_get_info (void);
+
+GST_VIDEO_API
+GstVideoOverlayCompositionMeta * gst_buffer_add_video_overlay_composition_meta (GstBuffer * buf,
+ GstVideoOverlayComposition * comp);
+
+#define gst_buffer_get_video_overlay_composition_meta(b) \
+ ((GstVideoOverlayCompositionMeta*)gst_buffer_get_meta((b),GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE))
+#define gst_buffer_remove_video_overlay_composition_meta(b,m) \
+ gst_buffer_remove_meta((b),((GstMeta *) m))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoOverlayComposition, gst_video_overlay_composition_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoOverlayRectangle, gst_video_overlay_rectangle_unref)
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_OVERLAY_COMPOSITION_H__ */
diff --git a/include/gst/video/video-prelude.h b/include/gst/video/video-prelude.h
new file mode 100644
index 0000000000..47a30dfef1
--- /dev/null
+++ b/include/gst/video/video-prelude.h
@@ -0,0 +1,41 @@
+/* GStreamer Video Library
+ * Copyright (C) 2018 GStreamer developers
+ *
+ * video-prelude.h: prelude include header for gst-video library
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_PRELUDE_H__
+#define __GST_VIDEO_PRELUDE_H__
+
+#include <gst/gst.h>
+
+#ifdef BUILDING_GST_VIDEO
+#define GST_VIDEO_API GST_API_EXPORT /* from config.h */
+#else
+#define GST_VIDEO_API GST_API_IMPORT
+#endif
+
+#ifndef GST_DISABLE_DEPRECATED
+#define GST_VIDEO_DEPRECATED GST_VIDEO_API
+#define GST_VIDEO_DEPRECATED_FOR(f) GST_VIDEO_API
+#else
+#define GST_VIDEO_DEPRECATED G_DEPRECATED GST_VIDEO_API
+#define GST_VIDEO_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_VIDEO_API
+#endif
+
+#endif /* __GST_VIDEO_PRELUDE_H__ */
diff --git a/include/gst/video/video-resampler.h b/include/gst/video/video-resampler.h
new file mode 100644
index 0000000000..ffe9ddac01
--- /dev/null
+++ b/include/gst/video/video-resampler.h
@@ -0,0 +1,178 @@
+/* GStreamer
+ * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_RESAMPLER_H__
+#define __GST_VIDEO_RESAMPLER_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstVideoResampler GstVideoResampler;
+
+/**
+ * GstVideoResamplerMethod:
+ * @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
+ * upsampling and drops when downsampling
+ * @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
+ * missing samples and averaging to downsample
+ * @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
+ * @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
+ *
+ * Different subsampling and upsampling methods
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_RESAMPLER_METHOD_NEAREST,
+ GST_VIDEO_RESAMPLER_METHOD_LINEAR,
+ GST_VIDEO_RESAMPLER_METHOD_CUBIC,
+ GST_VIDEO_RESAMPLER_METHOD_SINC,
+ GST_VIDEO_RESAMPLER_METHOD_LANCZOS
+} GstVideoResamplerMethod;
+
+/**
+ * GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
+ *
+ * G_TYPE_DOUBLE, B parameter of the cubic filter. The B
+ * parameter controls the bluriness. Values between 0.0 and
+ * 2.0 are accepted. 1/3 is the default.
+ *
+ * Below are some values of popular filters:
+ * B C
+ * Hermite 0.0 0.0
+ * Spline 1.0 0.0
+ * Catmull-Rom 0.0 1/2
+ * Mitchell 1/3 1/3
+ * Robidoux 0.3782 0.3109
+ * Robidoux
+ * Sharp 0.2620 0.3690
+ * Robidoux
+ * Soft 0.6796 0.1602
+ */
+#define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
+/**
+ * GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
+ *
+ * G_TYPE_DOUBLE, C parameter of the cubic filter. The C
+ * parameter controls the Keys alpha value. Values between 0.0 and
+ * 2.0 are accepted. 1/3 is the default.
+ *
+ * See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
+ */
+#define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
+
+/**
+ * GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
+ *
+ * G_TYPE_DOUBLE, specifies the size of filter envelope for
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 1.0 and 5.0. 2.0 is the default.
+ */
+#define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
+
+/**
+ * GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
+ *
+ * G_TYPE_DOUBLE, specifies sharpness of the filter for
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 0.5 and 1.5. 1.0 is the default.
+ */
+#define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
+
+/**
+ * GST_VIDEO_RESAMPLER_OPT_SHARPEN:
+ *
+ * G_TYPE_DOUBLE, specifies sharpening of the filter for
+ * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
+ * 0.0 and 1.0. 0.0 is the default.
+ */
+#define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
+/**
+ * GST_VIDEO_RESAMPLER_OPT_MAX_TAPS:
+ *
+ * G_TYPE_INT, limits the maximum number of taps to use.
+ * 16 is the default.
+ */
+#define GST_VIDEO_RESAMPLER_OPT_MAX_TAPS "GstVideoResampler.max-taps"
+
+/**
+ * GstVideoResamplerFlags:
+ * @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
+ * @GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: when no taps are given, half the
+ * number of calculated taps. This can be used when making scalers
+ * for the different fields of an interlaced picture. Since: 1.10
+ *
+ * Different resampler flags.
+ *
+ * Since: 1.6
+ */
+typedef enum {
+ GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
+ GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS = (1 << 0),
+} GstVideoResamplerFlags;
+
+/**
+ * GstVideoResampler:
+ * @in_size: the input size
+ * @out_size: the output size
+ * @max_taps: the maximum number of taps
+ * @n_phases: the number of phases
+ * @offset: array with the source offset for each output element
+ * @phase: array with the phase to use for each output element
+ * @n_taps: array with new number of taps for each phase
+ * @taps: the taps for all phases
+ *
+ * A structure holding resampler information.
+ *
+ * Since: 1.6
+ */
+struct _GstVideoResampler
+{
+ gint in_size;
+ gint out_size;
+ guint max_taps;
+ guint n_phases;
+ guint32 *offset;
+ guint32 *phase;
+ guint32 *n_taps;
+ gdouble *taps;
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+
+GST_VIDEO_API
+gboolean gst_video_resampler_init (GstVideoResampler *resampler,
+ GstVideoResamplerMethod method,
+ GstVideoResamplerFlags flags,
+ guint n_phases, guint n_taps,
+ gdouble shift,
+ guint in_size, guint out_size,
+ GstStructure *options);
+
+GST_VIDEO_API
+void gst_video_resampler_clear (GstVideoResampler *resampler);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_RESAMPLER_H__ */
diff --git a/include/gst/video/video-scaler.h b/include/gst/video/video-scaler.h
new file mode 100644
index 0000000000..7dc331666e
--- /dev/null
+++ b/include/gst/video/video-scaler.h
@@ -0,0 +1,101 @@
+/* GStreamer
+ * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_SCALER_H__
+#define __GST_VIDEO_SCALER_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video-format.h>
+#include <gst/video/video-color.h>
+#include <gst/video/video-resampler.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GST_VIDEO_SCALER_OPT_DITHER_METHOD:
+ *
+ * #GstVideoDitherMethod, The dither method to use for propagating
+ * quatization errors.
+ */
+#define GST_VIDEO_SCALER_OPT_DITHER_METHOD "GstVideoScaler.dither-method"
+
+/**
+ * GstVideoScalerFlags:
+ * @GST_VIDEO_SCALER_FLAG_NONE: no flags
+ * @GST_VIDEO_SCALER_FLAG_INTERLACED: Set up a scaler for interlaced content
+ *
+ * Different scale flags.
+ */
+typedef enum {
+ GST_VIDEO_SCALER_FLAG_NONE = (0),
+ GST_VIDEO_SCALER_FLAG_INTERLACED = (1 << 0),
+} GstVideoScalerFlags;
+
+typedef struct _GstVideoScaler GstVideoScaler;
+
+GST_VIDEO_API
+GstVideoScaler * gst_video_scaler_new (GstVideoResamplerMethod method,
+ GstVideoScalerFlags flags,
+ guint n_taps,
+ guint in_size, guint out_size,
+ GstStructure * options);
+
+GST_VIDEO_API
+void gst_video_scaler_free (GstVideoScaler *scale);
+
+GST_VIDEO_API
+guint gst_video_scaler_get_max_taps (GstVideoScaler *scale);
+
+GST_VIDEO_API
+const gdouble * gst_video_scaler_get_coeff (GstVideoScaler *scale,
+ guint out_offset,
+ guint *in_offset,
+ guint *n_taps);
+
+GST_VIDEO_API
+void gst_video_scaler_horizontal (GstVideoScaler *scale,
+ GstVideoFormat format,
+ gpointer src, gpointer dest,
+ guint dest_offset, guint width);
+
+GST_VIDEO_API
+void gst_video_scaler_vertical (GstVideoScaler *scale,
+ GstVideoFormat format,
+ gpointer src_lines[], gpointer dest,
+ guint dest_offset, guint width);
+
+GST_VIDEO_API
+GstVideoScaler * gst_video_scaler_combine_packed_YUV (GstVideoScaler * y_scale,
+ GstVideoScaler *uv_scale,
+ GstVideoFormat in_format,
+ GstVideoFormat out_format);
+
+GST_VIDEO_API
+void gst_video_scaler_2d (GstVideoScaler *hscale,
+ GstVideoScaler *vscale,
+ GstVideoFormat format,
+ gpointer src, gint src_stride,
+ gpointer dest, gint dest_stride,
+ guint x, guint y,
+ guint width, guint height);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_SCALER_H__ */
diff --git a/include/gst/video/video-tile.h b/include/gst/video/video-tile.h
new file mode 100644
index 0000000000..8992bb351d
--- /dev/null
+++ b/include/gst/video/video-tile.h
@@ -0,0 +1,140 @@
+/* GStreamer
+ * Copyright (C) <2013> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_TILE_H__
+#define __GST_VIDEO_TILE_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoTileType:
+ * @GST_VIDEO_TILE_TYPE_INDEXED: Tiles are indexed. Use
+ * gst_video_tile_get_index () to retrieve the tile at the requested
+ * coordinates.
+ *
+ * Enum value describing the most common tiling types.
+ */
+typedef enum
+{
+ GST_VIDEO_TILE_TYPE_INDEXED = 0
+} GstVideoTileType;
+
+#define GST_VIDEO_TILE_TYPE_SHIFT (16)
+
+/**
+ * GST_VIDEO_TILE_TYPE_MASK: (value 65535)
+ */
+#define GST_VIDEO_TILE_TYPE_MASK ((1 << GST_VIDEO_TILE_TYPE_SHIFT) - 1)
+
+/**
+ * GST_VIDEO_TILE_MAKE_MODE:
+ * @num: the mode number to create
+ * @type: the tile mode type
+ *
+ * use this macro to create new tile modes.
+ */
+#define GST_VIDEO_TILE_MAKE_MODE(num, type) \
+ (((num) << GST_VIDEO_TILE_TYPE_SHIFT) | (GST_VIDEO_TILE_TYPE_ ##type))
+
+/**
+ * GST_VIDEO_TILE_MODE_TYPE:
+ * @mode: the tile mode
+ *
+ * Get the tile mode type of @mode
+ */
+#define GST_VIDEO_TILE_MODE_TYPE(mode) ((mode) & GST_VIDEO_TILE_TYPE_MASK)
+
+/**
+ * GST_VIDEO_TILE_MODE_IS_INDEXED:
+ * @mode: a tile mode
+ *
+ * Check if @mode is an indexed tile type
+ */
+#define GST_VIDEO_TILE_MODE_IS_INDEXED(mode) (GST_VIDEO_TILE_MODE_TYPE(mode) == GST_VIDEO_TILE_TYPE_INDEXED)
+
+
+#define GST_VIDEO_TILE_Y_TILES_SHIFT (16)
+
+/**
+ * GST_VIDEO_TILE_X_TILES_MASK: (value 65535)
+ */
+#define GST_VIDEO_TILE_X_TILES_MASK ((1 << GST_VIDEO_TILE_Y_TILES_SHIFT) - 1)
+
+/**
+ * GST_VIDEO_TILE_MAKE_STRIDE:
+ * @x_tiles: number of tiles in X
+ * @y_tiles: number of tiles in Y
+ *
+ * Encode the number of tile in X and Y into the stride.
+ */
+#define GST_VIDEO_TILE_MAKE_STRIDE(x_tiles, y_tiles) \
+ (((y_tiles) << GST_VIDEO_TILE_Y_TILES_SHIFT) | (x_tiles))
+
+/**
+ * GST_VIDEO_TILE_X_TILES:
+ * @stride: plane stride
+ *
+ * Extract the number of tiles in X from the stride value.
+ */
+#define GST_VIDEO_TILE_X_TILES(stride) ((stride) & GST_VIDEO_TILE_X_TILES_MASK)
+
+/**
+ * GST_VIDEO_TILE_Y_TILES:
+ * @stride: plane stride
+ *
+ * Extract the number of tiles in Y from the stride value.
+ */
+#define GST_VIDEO_TILE_Y_TILES(stride) ((stride) >> GST_VIDEO_TILE_Y_TILES_SHIFT)
+
+/**
+ * GstVideoTileMode:
+ * @GST_VIDEO_TILE_MODE_UNKNOWN: Unknown or unset tile mode
+ * @GST_VIDEO_TILE_MODE_ZFLIPZ_2X2: Every four adjacent blocks - two
+ * horizontally and two vertically are grouped together and are located
+ * in memory in Z or flipped Z order. In case of odd rows, the last row
+ * of blocks is arranged in linear order.
+ * @GST_VIDEO_TILE_MODE_LINEAR: Tiles are in row order. (Since: 1.18)
+ *
+ * Enum value describing the available tiling modes.
+ */
+typedef enum
+{
+ GST_VIDEO_TILE_MODE_UNKNOWN = 0,
+ GST_VIDEO_TILE_MODE_ZFLIPZ_2X2 = GST_VIDEO_TILE_MAKE_MODE (1, INDEXED),
+ /**
+ * GST_VIDEO_TILE_MODE_LINEAR:
+ *
+ * Tiles are in row order.
+ *
+ * Since: 1.18
+ */
+ GST_VIDEO_TILE_MODE_LINEAR = GST_VIDEO_TILE_MAKE_MODE (2, INDEXED),
+} GstVideoTileMode;
+
+GST_VIDEO_API
+guint gst_video_tile_get_index (GstVideoTileMode mode, gint x, gint y,
+ gint x_tiles, gint y_tiles);
+
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_TILE_H__ */
diff --git a/include/gst/video/video.h b/include/gst/video/video.h
new file mode 100644
index 0000000000..a31562a09b
--- /dev/null
+++ b/include/gst/video/video.h
@@ -0,0 +1,200 @@
+/* GStreamer
+ * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_H__
+#define __GST_VIDEO_H__
+
+#include <gst/gst.h>
+
+#include <gst/video/video-prelude.h>
+
+typedef struct _GstVideoAlignment GstVideoAlignment;
+
+#include <gst/video/video-format.h>
+#include <gst/video/video-color.h>
+#include <gst/video/video-dither.h>
+#include <gst/video/video-info.h>
+#include <gst/video/video-frame.h>
+#include <gst/video/video-enumtypes.h>
+#include <gst/video/video-converter.h>
+#include <gst/video/video-scaler.h>
+#include <gst/video/video-multiview.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoAlignment:
+ * @padding_left: extra pixels on the left side
+ * @padding_right: extra pixels on the right side
+ * @padding_top: extra pixels on the top
+ * @padding_bottom: extra pixels on the bottom
+ * @stride_align: array with extra alignment requirements for the strides
+ *
+ * Extra alignment parameters for the memory of video buffers. This
+ * structure is usually used to configure the bufferpool if it supports the
+ * #GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
+ */
+struct _GstVideoAlignment
+{
+ guint padding_top;
+ guint padding_bottom;
+ guint padding_left;
+ guint padding_right;
+ guint stride_align[GST_VIDEO_MAX_PLANES];
+};
+
+/**
+ * GstVideoOrientationMethod:
+ * @GST_VIDEO_ORIENTATION_IDENTITY: Identity (no rotation)
+ * @GST_VIDEO_ORIENTATION_90R: Rotate clockwise 90 degrees
+ * @GST_VIDEO_ORIENTATION_180: Rotate 180 degrees
+ * @GST_VIDEO_ORIENTATION_90L: Rotate counter-clockwise 90 degrees
+ * @GST_VIDEO_ORIENTATION_HORIZ: Flip horizontally
+ * @GST_VIDEO_ORIENTATION_VERT: Flip vertically
+ * @GST_VIDEO_ORIENTATION_UL_LR: Flip across upper left/lower right diagonal
+ * @GST_VIDEO_ORIENTATION_UR_LL: Flip across upper right/lower left diagonal
+ * @GST_VIDEO_ORIENTATION_AUTO: Select flip method based on image-orientation tag
+ * @GST_VIDEO_ORIENTATION_CUSTOM: Current status depends on plugin internal setup
+ *
+ * The different video orientation methods.
+ *
+ * Since: 1.10
+ */
+typedef enum {
+ GST_VIDEO_ORIENTATION_IDENTITY,
+ GST_VIDEO_ORIENTATION_90R,
+ GST_VIDEO_ORIENTATION_180,
+ GST_VIDEO_ORIENTATION_90L,
+ GST_VIDEO_ORIENTATION_HORIZ,
+ GST_VIDEO_ORIENTATION_VERT,
+ GST_VIDEO_ORIENTATION_UL_LR,
+ GST_VIDEO_ORIENTATION_UR_LL,
+ GST_VIDEO_ORIENTATION_AUTO,
+ GST_VIDEO_ORIENTATION_CUSTOM,
+} GstVideoOrientationMethod;
+
+/**
+ * GST_TYPE_VIDEO_ORIENTATION_METHOD:
+ *
+ * Since: 1.20
+ */
+
+/* metadata macros */
+/**
+ * GST_META_TAG_VIDEO_STR:
+ *
+ * This metadata is relevant for video streams.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_VIDEO_STR "video"
+/**
+ * GST_META_TAG_VIDEO_ORIENTATION_STR:
+ *
+ * This metadata stays relevant as long as video orientation is unchanged.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_VIDEO_ORIENTATION_STR "orientation"
+/**
+ * GST_META_TAG_VIDEO_SIZE_STR:
+ *
+ * This metadata stays relevant as long as video size is unchanged.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_VIDEO_SIZE_STR "size"
+/**
+ * GST_META_TAG_VIDEO_COLORSPACE_STR:
+ *
+ * This metadata stays relevant as long as video colorspace is unchanged.
+ *
+ * Since: 1.2
+ */
+#define GST_META_TAG_VIDEO_COLORSPACE_STR "colorspace"
+
+GST_VIDEO_API
+void gst_video_alignment_reset (GstVideoAlignment *align);
+
+
+/* some helper functions */
+
+GST_VIDEO_API
+gboolean gst_video_calculate_display_ratio (guint * dar_n,
+ guint * dar_d,
+ guint video_width,
+ guint video_height,
+ guint video_par_n,
+ guint video_par_d,
+ guint display_par_n,
+ guint display_par_d);
+
+GST_VIDEO_API
+gboolean gst_video_guess_framerate (GstClockTime duration,
+ gint * dest_n, gint * dest_d);
+
+/* convert/encode video sample from one format to another */
+
+typedef void (*GstVideoConvertSampleCallback) (GstSample * sample, GError *error, gpointer user_data);
+
+GST_VIDEO_API
+void gst_video_convert_sample_async (GstSample * sample,
+ const GstCaps * to_caps,
+ GstClockTime timeout,
+ GstVideoConvertSampleCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy_notify);
+
+GST_VIDEO_API
+GstSample * gst_video_convert_sample (GstSample * sample,
+ const GstCaps * to_caps,
+ GstClockTime timeout,
+ GError ** error);
+
+
+GST_VIDEO_API
+gboolean gst_video_orientation_from_tag (GstTagList * taglist,
+ GstVideoOrientationMethod * method);
+
+G_END_DECLS
+
+#include <gst/video/colorbalancechannel.h>
+#include <gst/video/colorbalance.h>
+#include <gst/video/gstvideoaffinetransformationmeta.h>
+#include <gst/video/gstvideoaggregator.h>
+#include <gst/video/gstvideocodecalphameta.h>
+#include <gst/video/gstvideodecoder.h>
+#include <gst/video/gstvideoencoder.h>
+#include <gst/video/gstvideofilter.h>
+#include <gst/video/gstvideometa.h>
+#include <gst/video/gstvideopool.h>
+#include <gst/video/gstvideosink.h>
+#include <gst/video/gstvideotimecode.h>
+#include <gst/video/gstvideoutils.h>
+#include <gst/video/navigation.h>
+#include <gst/video/video-anc.h>
+#include <gst/video/video-blend.h>
+#include <gst/video/videodirection.h>
+#include <gst/video/video-event.h>
+#include <gst/video/video-hdr.h>
+#include <gst/video/videoorientation.h>
+#include <gst/video/video-overlay-composition.h>
+#include <gst/video/videooverlay.h>
+
+#endif /* __GST_VIDEO_H__ */
diff --git a/include/gst/video/videodirection.h b/include/gst/video/videodirection.h
new file mode 100644
index 0000000000..127606c888
--- /dev/null
+++ b/include/gst/video/videodirection.h
@@ -0,0 +1,64 @@
+/* GStreamer
+ * Copyright (C) 2016 Igalia <calvaris@igalia.com>
+ *
+ * videodirection.h: video rotation and flipping interface
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_DIRECTION_H__
+#define __GST_VIDEO_DIRECTION_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_VIDEO_DIRECTION \
+ (gst_video_direction_get_type ())
+#define GST_VIDEO_DIRECTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_DIRECTION, GstVideoDirection))
+#define GST_IS_VIDEO_DIRECTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_DIRECTION))
+#define GST_VIDEO_DIRECTION_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_DIRECTION, GstVideoDirectionInterface))
+/**
+ * GstVideoDirection:
+ *
+ * Opaque #GstVideoDirection data structure.
+ *
+ * Since: 1.10
+ */
+typedef struct _GstVideoDirection GstVideoDirection;
+typedef struct _GstVideoDirectionInterface GstVideoDirectionInterface;
+
+/**
+ * GstVideoDirectionInterface:
+ * @iface: parent interface type.
+ *
+ * #GstVideoDirectionInterface interface.
+ *
+ * Since: 1.10
+ */
+struct _GstVideoDirectionInterface
+{
+ GTypeInterface iface;
+};
+
+GST_VIDEO_API
+GType gst_video_direction_get_type (void);
+
+G_END_DECLS
+#endif /* __GST_VIDEO_DIRECTION_H__ */
diff --git a/include/gst/video/videoorientation.h b/include/gst/video/videoorientation.h
new file mode 100644
index 0000000000..8414be62b9
--- /dev/null
+++ b/include/gst/video/videoorientation.h
@@ -0,0 +1,111 @@
+/* GStreamer
+ * Copyright (C) 2006 Nokia <stefan.kost@nokia.com
+ *
+ * videoorientation.h: video flipping and centering interface
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_ORIENTATION_H__
+#define __GST_VIDEO_ORIENTATION_H__
+
+#include <gst/gst.h>
+#include <gst/video/video-prelude.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_ORIENTATION \
+ (gst_video_orientation_get_type ())
+#define GST_VIDEO_ORIENTATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientation))
+#define GST_IS_VIDEO_ORIENTATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_ORIENTATION))
+#define GST_VIDEO_ORIENTATION_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientationInterface))
+
+/**
+ * GstVideoOrientation:
+ *
+ * Opaque #GstVideoOrientation data structure.
+ */
+typedef struct _GstVideoOrientation GstVideoOrientation;
+typedef struct _GstVideoOrientationInterface GstVideoOrientationInterface;
+
+/**
+ * GstVideoOrientationInterface:
+ * @iface: parent interface type.
+ * @get_hflip: virtual method to get horizontal flipping state
+ * @get_vflip: virtual method to get vertical flipping state
+ * @get_hcenter: virtual method to get horizontal centering state
+ * @get_vcenter: virtual method to get vertical centering state
+ * @set_hflip: virtual method to set horizontal flipping state
+ * @set_vflip: virtual method to set vertical flipping state
+ * @set_hcenter: virtual method to set horizontal centering state
+ * @set_vcenter: virtual method to set vertical centering state
+ *
+ * #GstVideoOrientationInterface interface.
+ */
+struct _GstVideoOrientationInterface {
+ GTypeInterface iface;
+
+ /* FIXME 0.11: fix awkward API? add some kind of get_supported flags thing
+ * and then just return booleans/int from all vfuncs requiring the caller
+ * to check the flags first */
+
+ /* virtual functions */
+ gboolean (* get_hflip) (GstVideoOrientation *video_orientation, gboolean *flip);
+ gboolean (* get_vflip) (GstVideoOrientation *video_orientation, gboolean *flip);
+ gboolean (* get_hcenter) (GstVideoOrientation *video_orientation, gint *center);
+ gboolean (* get_vcenter) (GstVideoOrientation *video_orientation, gint *center);
+
+ gboolean (* set_hflip) (GstVideoOrientation *video_orientation, gboolean flip);
+ gboolean (* set_vflip) (GstVideoOrientation *video_orientation, gboolean flip);
+ gboolean (* set_hcenter) (GstVideoOrientation *video_orientation, gint center);
+ gboolean (* set_vcenter) (GstVideoOrientation *video_orientation, gint center);
+};
+
+GST_VIDEO_API
+GType gst_video_orientation_get_type (void);
+
+/* virtual class function wrappers */
+
+GST_VIDEO_API
+gboolean gst_video_orientation_get_hflip (GstVideoOrientation *video_orientation, gboolean *flip);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_get_vflip (GstVideoOrientation *video_orientation, gboolean *flip);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_get_hcenter (GstVideoOrientation *video_orientation, gint *center);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_get_vcenter (GstVideoOrientation *video_orientation, gint *center);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_set_hflip (GstVideoOrientation *video_orientation, gboolean flip);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_set_vflip (GstVideoOrientation *video_orientation, gboolean flip);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_set_hcenter (GstVideoOrientation *video_orientation, gint center);
+
+GST_VIDEO_API
+gboolean gst_video_orientation_set_vcenter (GstVideoOrientation *video_orientation, gint center);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_ORIENTATION_H__ */
diff --git a/include/gst/video/videooverlay.h b/include/gst/video/videooverlay.h
new file mode 100644
index 0000000000..93530c4b39
--- /dev/null
+++ b/include/gst/video/videooverlay.h
@@ -0,0 +1,119 @@
+/* GStreamer Video Overlay Interface
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
+ * Copyright (C) 2011 Tim-Philipp Müller <tim@centricular.net>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_VIDEO_OVERLAY_H__
+#define __GST_VIDEO_OVERLAY_H__
+
+#include <gst/gst.h>
+#include <gst/video/gstvideosink.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VIDEO_OVERLAY \
+ (gst_video_overlay_get_type ())
+#define GST_VIDEO_OVERLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_OVERLAY, GstVideoOverlay))
+#define GST_IS_VIDEO_OVERLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_OVERLAY))
+#define GST_VIDEO_OVERLAY_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_OVERLAY, GstVideoOverlayInterface))
+
+/**
+ * GstVideoOverlay:
+ *
+ * Opaque #GstVideoOverlay interface structure
+ */
+typedef struct _GstVideoOverlay GstVideoOverlay;
+typedef struct _GstVideoOverlayInterface GstVideoOverlayInterface;
+
+/**
+ * GstVideoOverlayInterface:
+ * @iface: parent interface type.
+ * @expose: virtual method to handle expose events
+ * @handle_events: virtual method to handle events
+ * @set_render_rectangle: virtual method to set the render rectangle
+ * @set_window_handle: virtual method to configure the window handle
+ *
+ * #GstVideoOverlay interface
+ */
+struct _GstVideoOverlayInterface {
+ GTypeInterface iface;
+
+ /* virtual functions */
+ void (*expose) (GstVideoOverlay *overlay);
+
+ void (*handle_events) (GstVideoOverlay *overlay, gboolean handle_events);
+
+ void (*set_render_rectangle) (GstVideoOverlay *overlay,
+ gint x, gint y,
+ gint width, gint height);
+
+ void (*set_window_handle) (GstVideoOverlay *overlay, guintptr handle);
+};
+
+GST_VIDEO_API
+GType gst_video_overlay_get_type (void);
+
+/* virtual function wrappers */
+
+GST_VIDEO_API
+gboolean gst_video_overlay_set_render_rectangle (GstVideoOverlay * overlay,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
+GST_VIDEO_API
+void gst_video_overlay_expose (GstVideoOverlay * overlay);
+
+GST_VIDEO_API
+void gst_video_overlay_handle_events (GstVideoOverlay * overlay,
+ gboolean handle_events);
+
+GST_VIDEO_API
+void gst_video_overlay_set_window_handle (GstVideoOverlay * overlay,
+ guintptr handle);
+
+/* public methods to dispatch bus messages */
+
+GST_VIDEO_API
+void gst_video_overlay_got_window_handle (GstVideoOverlay * overlay,
+ guintptr handle);
+
+GST_VIDEO_API
+void gst_video_overlay_prepare_window_handle (GstVideoOverlay * overlay);
+
+GST_VIDEO_API
+gboolean gst_is_video_overlay_prepare_window_handle_message (GstMessage * msg);
+
+GST_VIDEO_API
+void gst_video_overlay_install_properties (GObjectClass * oclass,
+ gint last_prop_id);
+
+GST_VIDEO_API
+gboolean gst_video_overlay_set_property (GObject * object,
+ gint last_prop_id,
+ guint property_id,
+ const GValue * value);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_OVERLAY_H__ */
diff --git a/include/gst/webrtc/datachannel.h b/include/gst/webrtc/datachannel.h
new file mode 100644
index 0000000000..8146c65981
--- /dev/null
+++ b/include/gst/webrtc/datachannel.h
@@ -0,0 +1,52 @@
+/* GStreamer
+ * Copyright (C) 2018 Matthew Waters <matthew@centricular.com>
+ * Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_DATA_CHANNEL_H__
+#define __GST_WEBRTC_DATA_CHANNEL_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_data_channel_get_type(void);
+
+#define GST_TYPE_WEBRTC_DATA_CHANNEL (gst_webrtc_data_channel_get_type())
+#define GST_WEBRTC_DATA_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_DATA_CHANNEL,GstWebRTCDataChannel))
+#define GST_IS_WEBRTC_DATA_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_DATA_CHANNEL))
+#define GST_WEBRTC_DATA_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_DATA_CHANNEL,GstWebRTCDataChannelClass))
+#define GST_IS_WEBRTC_DATA_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_DATA_CHANNEL))
+#define GST_WEBRTC_DATA_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_DATA_CHANNEL,GstWebRTCDataChannelClass))
+
+GST_WEBRTC_API
+void gst_webrtc_data_channel_send_data (GstWebRTCDataChannel * channel, GBytes * data);
+
+GST_WEBRTC_API
+void gst_webrtc_data_channel_send_string (GstWebRTCDataChannel * channel, const gchar * str);
+
+GST_WEBRTC_API
+void gst_webrtc_data_channel_close (GstWebRTCDataChannel * channel);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCDataChannel, g_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_DATA_CHANNEL_H__ */
diff --git a/include/gst/webrtc/dtlstransport.h b/include/gst/webrtc/dtlstransport.h
new file mode 100644
index 0000000000..0198619566
--- /dev/null
+++ b/include/gst/webrtc/dtlstransport.h
@@ -0,0 +1,42 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_DTLS_TRANSPORT_H__
+#define __GST_WEBRTC_DTLS_TRANSPORT_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+#include <gst/webrtc/icetransport.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_dtls_transport_get_type(void);
+#define GST_TYPE_WEBRTC_DTLS_TRANSPORT (gst_webrtc_dtls_transport_get_type())
+#define GST_WEBRTC_DTLS_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_DTLS_TRANSPORT,GstWebRTCDTLSTransport))
+#define GST_IS_WEBRTC_DTLS_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_DTLS_TRANSPORT))
+#define GST_WEBRTC_DTLS_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_DTLS_TRANSPORT,GstWebRTCDTLSTransportClass))
+#define GST_IS_WEBRTC_DTLS_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_DTLS_TRANSPORT))
+#define GST_WEBRTC_DTLS_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_DTLS_TRANSPORT,GstWebRTCDTLSTransportClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCDTLSTransport, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_DTLS_TRANSPORT_H__ */
diff --git a/include/gst/webrtc/icetransport.h b/include/gst/webrtc/icetransport.h
new file mode 100644
index 0000000000..09f44e5b1e
--- /dev/null
+++ b/include/gst/webrtc/icetransport.h
@@ -0,0 +1,41 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_ICE_TRANSPORT_H__
+#define __GST_WEBRTC_ICE_TRANSPORT_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_transport_get_type(void);
+#define GST_TYPE_WEBRTC_ICE_TRANSPORT (gst_webrtc_ice_transport_get_type())
+#define GST_WEBRTC_ICE_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_ICE_TRANSPORT,GstWebRTCICETransport))
+#define GST_IS_WEBRTC_ICE_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_ICE_TRANSPORT))
+#define GST_WEBRTC_ICE_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_ICE_TRANSPORT,GstWebRTCICETransportClass))
+#define GST_IS_WEBRTC_ICE_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_ICE_TRANSPORT))
+#define GST_WEBRTC_ICE_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_ICE_TRANSPORT,GstWebRTCICETransportClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCICETransport, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_ICE_TRANSPORT_H__ */
diff --git a/include/gst/webrtc/rtcsessiondescription.h b/include/gst/webrtc/rtcsessiondescription.h
new file mode 100644
index 0000000000..5308c549a1
--- /dev/null
+++ b/include/gst/webrtc/rtcsessiondescription.h
@@ -0,0 +1,61 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_SESSION_DESCRIPTION_H__
+#define __GST_WEBRTC_SESSION_DESCRIPTION_H__
+
+#include <gst/gst.h>
+#include <gst/sdp/sdp.h>
+#include <gst/webrtc/webrtc_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+const gchar * gst_webrtc_sdp_type_to_string (GstWebRTCSDPType type);
+
+#define GST_TYPE_WEBRTC_SESSION_DESCRIPTION (gst_webrtc_session_description_get_type())
+GST_WEBRTC_API
+GType gst_webrtc_session_description_get_type (void);
+
+/**
+ * GstWebRTCSessionDescription:
+ * @type: the #GstWebRTCSDPType of the description
+ * @sdp: the #GstSDPMessage of the description
+ *
+ * See <https://www.w3.org/TR/webrtc/#rtcsessiondescription-class>
+ */
+struct _GstWebRTCSessionDescription
+{
+ GstWebRTCSDPType type;
+ GstSDPMessage *sdp;
+};
+
+GST_WEBRTC_API
+GstWebRTCSessionDescription * gst_webrtc_session_description_new (GstWebRTCSDPType type, GstSDPMessage *sdp);
+GST_WEBRTC_API
+GstWebRTCSessionDescription * gst_webrtc_session_description_copy (const GstWebRTCSessionDescription * src);
+GST_WEBRTC_API
+void gst_webrtc_session_description_free (GstWebRTCSessionDescription * desc);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCSessionDescription, gst_webrtc_session_description_free)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_PEERCONNECTION_H__ */
diff --git a/include/gst/webrtc/rtpreceiver.h b/include/gst/webrtc/rtpreceiver.h
new file mode 100644
index 0000000000..5f02fda818
--- /dev/null
+++ b/include/gst/webrtc/rtpreceiver.h
@@ -0,0 +1,42 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_RTP_RECEIVER_H__
+#define __GST_WEBRTC_RTP_RECEIVER_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+#include <gst/webrtc/dtlstransport.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_rtp_receiver_get_type(void);
+#define GST_TYPE_WEBRTC_RTP_RECEIVER (gst_webrtc_rtp_receiver_get_type())
+#define GST_WEBRTC_RTP_RECEIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiver))
+#define GST_IS_WEBRTC_RTP_RECEIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_RTP_RECEIVER))
+#define GST_WEBRTC_RTP_RECEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiverClass))
+#define GST_IS_WEBRTC_RTP_RECEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_RTP_RECEIVER))
+#define GST_WEBRTC_RTP_RECEIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiverClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPReceiver, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_RTP_RECEIVER_H__ */
diff --git a/include/gst/webrtc/rtpsender.h b/include/gst/webrtc/rtpsender.h
new file mode 100644
index 0000000000..b3ca9a0100
--- /dev/null
+++ b/include/gst/webrtc/rtpsender.h
@@ -0,0 +1,46 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_RTP_SENDER_H__
+#define __GST_WEBRTC_RTP_SENDER_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+#include <gst/webrtc/dtlstransport.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_rtp_sender_get_type(void);
+#define GST_TYPE_WEBRTC_RTP_SENDER (gst_webrtc_rtp_sender_get_type())
+#define GST_WEBRTC_RTP_SENDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_RTP_SENDER,GstWebRTCRTPSender))
+#define GST_IS_WEBRTC_RTP_SENDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_RTP_SENDER))
+#define GST_WEBRTC_RTP_SENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_RTP_SENDER,GstWebRTCRTPSenderClass))
+#define GST_IS_WEBRTC_RTP_SENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_RTP_SENDER))
+#define GST_WEBRTC_RTP_SENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_RTP_SENDER,GstWebRTCRTPSenderClass))
+
+GST_WEBRTC_API
+void gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender *sender,
+ GstWebRTCPriorityType priority);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPSender, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_RTP_SENDER_H__ */
diff --git a/include/gst/webrtc/rtptransceiver.h b/include/gst/webrtc/rtptransceiver.h
new file mode 100644
index 0000000000..569a39a46c
--- /dev/null
+++ b/include/gst/webrtc/rtptransceiver.h
@@ -0,0 +1,41 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_RTP_TRANSCEIVER_H__
+#define __GST_WEBRTC_RTP_TRANSCEIVER_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_rtp_transceiver_get_type(void);
+#define GST_TYPE_WEBRTC_RTP_TRANSCEIVER (gst_webrtc_rtp_transceiver_get_type())
+#define GST_WEBRTC_RTP_TRANSCEIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_RTP_TRANSCEIVER,GstWebRTCRTPTransceiver))
+#define GST_IS_WEBRTC_RTP_TRANSCEIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_RTP_TRANSCEIVER))
+#define GST_WEBRTC_RTP_TRANSCEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_RTP_TRANSCEIVER,GstWebRTCRTPTransceiverClass))
+#define GST_IS_WEBRTC_RTP_TRANSCEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_RTP_TRANSCEIVER))
+#define GST_WEBRTC_RTP_TRANSCEIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_RTP_TRANSCEIVER,GstWebRTCRTPTransceiverClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPTransceiver, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_RTP_TRANSCEIVER_H__ */
diff --git a/include/gst/webrtc/sctptransport.h b/include/gst/webrtc/sctptransport.h
new file mode 100644
index 0000000000..99a46eeded
--- /dev/null
+++ b/include/gst/webrtc/sctptransport.h
@@ -0,0 +1,42 @@
+/* GStreamer
+ * Copyright (C) 2018 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_SCTP_TRANSPORT_H__
+#define __GST_WEBRTC_SCTP_TRANSPORT_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+
+G_BEGIN_DECLS
+
+GST_WEBRTC_API
+GType gst_webrtc_sctp_transport_get_type(void);
+
+#define GST_TYPE_WEBRTC_SCTP_TRANSPORT (gst_webrtc_sctp_transport_get_type())
+#define GST_WEBRTC_SCTP_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_SCTP_TRANSPORT,GstWebRTCSCTPTransport))
+#define GST_IS_WEBRTC_SCTP_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_SCTP_TRANSPORT))
+#define GST_WEBRTC_SCTP_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_SCTP_TRANSPORT,GstWebRTCSCTPTransportClass))
+#define GST_IS_WEBRTC_SCTP_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_SCTP_TRANSPORT))
+#define GST_WEBRTC_SCTP_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_SCTP_TRANSPORT,GstWebRTCSCTPTransportClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCSCTPTransport, gst_object_unref)
+
+G_END_DECLS
+
+#endif /* __GST_WEBRTC_SCTP_TRANSPORT_H__ */
diff --git a/include/gst/webrtc/webrtc-enumtypes.h b/include/gst/webrtc/webrtc-enumtypes.h
new file mode 100644
index 0000000000..8c976ec1b8
--- /dev/null
+++ b/include/gst/webrtc/webrtc-enumtypes.h
@@ -0,0 +1,92 @@
+
+/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+
+#pragma once
+
+ #include <glib-object.h>
+ #include <gst/webrtc/webrtc_fwd.h>
+
+ G_BEGIN_DECLS
+
+/* enumerations from "webrtc_fwd.h" */
+
+GST_WEBRTC_API
+GType gst_webrtc_dtls_transport_state_get_type (void);
+#define GST_TYPE_WEBRTC_DTLS_TRANSPORT_STATE (gst_webrtc_dtls_transport_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_gathering_state_get_type (void);
+#define GST_TYPE_WEBRTC_ICE_GATHERING_STATE (gst_webrtc_ice_gathering_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_connection_state_get_type (void);
+#define GST_TYPE_WEBRTC_ICE_CONNECTION_STATE (gst_webrtc_ice_connection_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_signaling_state_get_type (void);
+#define GST_TYPE_WEBRTC_SIGNALING_STATE (gst_webrtc_signaling_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_peer_connection_state_get_type (void);
+#define GST_TYPE_WEBRTC_PEER_CONNECTION_STATE (gst_webrtc_peer_connection_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_role_get_type (void);
+#define GST_TYPE_WEBRTC_ICE_ROLE (gst_webrtc_ice_role_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_component_get_type (void);
+#define GST_TYPE_WEBRTC_ICE_COMPONENT (gst_webrtc_ice_component_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_sdp_type_get_type (void);
+#define GST_TYPE_WEBRTC_SDP_TYPE (gst_webrtc_sdp_type_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_rtp_transceiver_direction_get_type (void);
+#define GST_TYPE_WEBRTC_RTP_TRANSCEIVER_DIRECTION (gst_webrtc_rtp_transceiver_direction_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_dtls_setup_get_type (void);
+#define GST_TYPE_WEBRTC_DTLS_SETUP (gst_webrtc_dtls_setup_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_stats_type_get_type (void);
+#define GST_TYPE_WEBRTC_STATS_TYPE (gst_webrtc_stats_type_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_fec_type_get_type (void);
+#define GST_TYPE_WEBRTC_FEC_TYPE (gst_webrtc_fec_type_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_sctp_transport_state_get_type (void);
+#define GST_TYPE_WEBRTC_SCTP_TRANSPORT_STATE (gst_webrtc_sctp_transport_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_priority_type_get_type (void);
+#define GST_TYPE_WEBRTC_PRIORITY_TYPE (gst_webrtc_priority_type_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_data_channel_state_get_type (void);
+#define GST_TYPE_WEBRTC_DATA_CHANNEL_STATE (gst_webrtc_data_channel_state_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_bundle_policy_get_type (void);
+#define GST_TYPE_WEBRTC_BUNDLE_POLICY (gst_webrtc_bundle_policy_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_ice_transport_policy_get_type (void);
+#define GST_TYPE_WEBRTC_ICE_TRANSPORT_POLICY (gst_webrtc_ice_transport_policy_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_kind_get_type (void);
+#define GST_TYPE_WEBRTC_KIND (gst_webrtc_kind_get_type())
+
+GST_WEBRTC_API
+GType gst_webrtc_error_get_type (void);
+#define GST_TYPE_WEBRTC_ERROR (gst_webrtc_error_get_type())
+
+G_END_DECLS
+
+/* Generated data ends here */
+
diff --git a/include/gst/webrtc/webrtc.h b/include/gst/webrtc/webrtc.h
new file mode 100644
index 0000000000..e68a9dba82
--- /dev/null
+++ b/include/gst/webrtc/webrtc.h
@@ -0,0 +1,34 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_WEBRTC_H__
+#define __GST_WEBRTC_WEBRTC_H__
+
+#include <gst/gst.h>
+#include <gst/webrtc/webrtc_fwd.h>
+#include <gst/webrtc/webrtc-enumtypes.h>
+#include <gst/webrtc/dtlstransport.h>
+#include <gst/webrtc/icetransport.h>
+#include <gst/webrtc/rtcsessiondescription.h>
+#include <gst/webrtc/rtpreceiver.h>
+#include <gst/webrtc/rtpsender.h>
+#include <gst/webrtc/rtptransceiver.h>
+#include <gst/webrtc/datachannel.h>
+
+#endif /* __GST_WEBRTC_WEBRTC_H__ */
diff --git a/include/gst/webrtc/webrtc_fwd.h b/include/gst/webrtc/webrtc_fwd.h
new file mode 100644
index 0000000000..d181873884
--- /dev/null
+++ b/include/gst/webrtc/webrtc_fwd.h
@@ -0,0 +1,467 @@
+/* GStreamer
+ * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
+ *
+ * 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; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WEBRTC_FWD_H__
+#define __GST_WEBRTC_FWD_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The WebRTC library from gst-plugins-bad is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+
+/**
+ * SECTION:webrtc_fwd.h
+ * @title: GstWebRTC Enumerations
+ */
+
+#ifndef GST_WEBRTC_API
+# ifdef BUILDING_GST_WEBRTC
+# define GST_WEBRTC_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_WEBRTC_API GST_API_IMPORT
+# endif
+#endif
+
+#include <gst/webrtc/webrtc-enumtypes.h>
+
+/**
+ * GstWebRTCDTLSTransport:
+ */
+typedef struct _GstWebRTCDTLSTransport GstWebRTCDTLSTransport;
+typedef struct _GstWebRTCDTLSTransportClass GstWebRTCDTLSTransportClass;
+
+/**
+ * GstWebRTCICETransport:
+ */
+typedef struct _GstWebRTCICETransport GstWebRTCICETransport;
+typedef struct _GstWebRTCICETransportClass GstWebRTCICETransportClass;
+
+/**
+ * GstWebRTCRTPReceiver:
+ *
+ * An object to track the receiving aspect of the stream
+ *
+ * Mostly matches the WebRTC RTCRtpReceiver interface.
+ */
+typedef struct _GstWebRTCRTPReceiver GstWebRTCRTPReceiver;
+typedef struct _GstWebRTCRTPReceiverClass GstWebRTCRTPReceiverClass;
+
+/**
+ * GstWebRTCRTPSender:
+ *
+ * An object to track the sending aspect of the stream
+ *
+ * Mostly matches the WebRTC RTCRtpSender interface.
+ */
+typedef struct _GstWebRTCRTPSender GstWebRTCRTPSender;
+typedef struct _GstWebRTCRTPSenderClass GstWebRTCRTPSenderClass;
+
+typedef struct _GstWebRTCSessionDescription GstWebRTCSessionDescription;
+
+/**
+ * GstWebRTCRTPTransceiver:
+ *
+ * Mostly matches the WebRTC RTCRtpTransceiver interface.
+ */
+typedef struct _GstWebRTCRTPTransceiver GstWebRTCRTPTransceiver;
+typedef struct _GstWebRTCRTPTransceiverClass GstWebRTCRTPTransceiverClass;
+
+/**
+ * GstWebRTCDataChannel:
+ *
+ * Since: 1.18
+ */
+typedef struct _GstWebRTCDataChannel GstWebRTCDataChannel;
+typedef struct _GstWebRTCDataChannelClass GstWebRTCDataChannelClass;
+
+typedef struct _GstWebRTCSCTPTransport GstWebRTCSCTPTransport;
+typedef struct _GstWebRTCSCTPTransportClass GstWebRTCSCTPTransportClass;
+
+/**
+ * GstWebRTCDTLSTransportState:
+ * @GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW: new
+ * @GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED: closed
+ * @GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED: failed
+ * @GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING: connecting
+ * @GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED: connected
+ */
+typedef enum /*< underscore_name=gst_webrtc_dtls_transport_state >*/
+{
+ GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW,
+ GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED,
+ GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED,
+ GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING,
+ GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED,
+} GstWebRTCDTLSTransportState;
+
+/**
+ * GstWebRTCICEGatheringState:
+ * @GST_WEBRTC_ICE_GATHERING_STATE_NEW: new
+ * @GST_WEBRTC_ICE_GATHERING_STATE_GATHERING: gathering
+ * @GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE: complete
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcicegatheringstate>
+ */
+typedef enum /*< underscore_name=gst_webrtc_ice_gathering_state >*/
+{
+ GST_WEBRTC_ICE_GATHERING_STATE_NEW,
+ GST_WEBRTC_ICE_GATHERING_STATE_GATHERING,
+ GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE,
+} GstWebRTCICEGatheringState; /*< underscore_name=gst_webrtc_ice_gathering_state >*/
+
+/**
+ * GstWebRTCICEConnectionState:
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_NEW: new
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING: checking
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED: connected
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED: completed
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_FAILED: failed
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED: disconnected
+ * @GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED: closed
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtciceconnectionstate>
+ */
+typedef enum /*< underscore_name=gst_webrtc_ice_connection_state >*/
+{
+ GST_WEBRTC_ICE_CONNECTION_STATE_NEW,
+ GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING,
+ GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED,
+ GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED,
+ GST_WEBRTC_ICE_CONNECTION_STATE_FAILED,
+ GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED,
+ GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED,
+} GstWebRTCICEConnectionState;
+
+/**
+ * GstWebRTCSignalingState:
+ * @GST_WEBRTC_SIGNALING_STATE_STABLE: stable
+ * @GST_WEBRTC_SIGNALING_STATE_CLOSED: closed
+ * @GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER: have-local-offer
+ * @GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER: have-remote-offer
+ * @GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER: have-local-pranswer
+ * @GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER: have-remote-pranswer
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate>
+ */
+typedef enum /*< underscore_name=gst_webrtc_signaling_state >*/
+{
+ GST_WEBRTC_SIGNALING_STATE_STABLE,
+ GST_WEBRTC_SIGNALING_STATE_CLOSED,
+ GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER,
+ GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER,
+ GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER,
+ GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER,
+} GstWebRTCSignalingState;
+
+/**
+ * GstWebRTCPeerConnectionState:
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_NEW: new
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING: connecting
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED: connected
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED: disconnected
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_FAILED: failed
+ * @GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED: closed
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectionstate>
+ */
+typedef enum /*< underscore_name=gst_webrtc_peer_connection_state >*/
+{
+ GST_WEBRTC_PEER_CONNECTION_STATE_NEW,
+ GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING,
+ GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED,
+ GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED,
+ GST_WEBRTC_PEER_CONNECTION_STATE_FAILED,
+ GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED,
+} GstWebRTCPeerConnectionState;
+
+/**
+ * GstWebRTCICERole:
+ * @GST_WEBRTC_ICE_ROLE_CONTROLLED: controlled
+ * @GST_WEBRTC_ICE_ROLE_CONTROLLING: controlling
+ */
+typedef enum /*< underscore_name=gst_webrtc_ice_role >*/
+{
+ GST_WEBRTC_ICE_ROLE_CONTROLLED,
+ GST_WEBRTC_ICE_ROLE_CONTROLLING,
+} GstWebRTCICERole;
+
+/**
+ * GstWebRTCICEComponent:
+ * @GST_WEBRTC_ICE_COMPONENT_RTP: RTP component
+ * @GST_WEBRTC_ICE_COMPONENT_RTCP: RTCP component
+ */
+typedef enum /*< underscore_name=gst_webrtc_ice_component >*/
+{
+ GST_WEBRTC_ICE_COMPONENT_RTP,
+ GST_WEBRTC_ICE_COMPONENT_RTCP,
+} GstWebRTCICEComponent;
+
+/**
+ * GstWebRTCSDPType:
+ * @GST_WEBRTC_SDP_TYPE_OFFER: offer
+ * @GST_WEBRTC_SDP_TYPE_PRANSWER: pranswer
+ * @GST_WEBRTC_SDP_TYPE_ANSWER: answer
+ * @GST_WEBRTC_SDP_TYPE_ROLLBACK: rollback
+ *
+ * See <http://w3c.github.io/webrtc-pc/#rtcsdptype>
+ */
+typedef enum /*< underscore_name=gst_webrtc_sdp_type >*/
+{
+ GST_WEBRTC_SDP_TYPE_OFFER = 1,
+ GST_WEBRTC_SDP_TYPE_PRANSWER,
+ GST_WEBRTC_SDP_TYPE_ANSWER,
+ GST_WEBRTC_SDP_TYPE_ROLLBACK,
+} GstWebRTCSDPType;
+
+/**
+ * GstWebRTCRTPTransceiverDirection:
+ * @GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE: none
+ * @GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE: inactive
+ * @GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY: sendonly
+ * @GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY: recvonly
+ * @GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV: sendrecv
+ */
+typedef enum /*< underscore_name=gst_webrtc_rtp_transceiver_direction >*/
+{
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE,
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE,
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY,
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY,
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV,
+} GstWebRTCRTPTransceiverDirection;
+
+/**
+ * GstWebRTCDTLSSetup:
+ * @GST_WEBRTC_DTLS_SETUP_NONE: none
+ * @GST_WEBRTC_DTLS_SETUP_ACTPASS: actpass
+ * @GST_WEBRTC_DTLS_SETUP_ACTIVE: sendonly
+ * @GST_WEBRTC_DTLS_SETUP_PASSIVE: recvonly
+ */
+typedef enum /*< underscore_name=gst_webrtc_dtls_setup >*/
+{
+ GST_WEBRTC_DTLS_SETUP_NONE,
+ GST_WEBRTC_DTLS_SETUP_ACTPASS,
+ GST_WEBRTC_DTLS_SETUP_ACTIVE,
+ GST_WEBRTC_DTLS_SETUP_PASSIVE,
+} GstWebRTCDTLSSetup;
+
+/**
+ * GstWebRTCStatsType:
+ * @GST_WEBRTC_STATS_CODEC: codec
+ * @GST_WEBRTC_STATS_INBOUND_RTP: inbound-rtp
+ * @GST_WEBRTC_STATS_OUTBOUND_RTP: outbound-rtp
+ * @GST_WEBRTC_STATS_REMOTE_INBOUND_RTP: remote-inbound-rtp
+ * @GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP: remote-outbound-rtp
+ * @GST_WEBRTC_STATS_CSRC: csrc
+ * @GST_WEBRTC_STATS_PEER_CONNECTION: peer-connectiion
+ * @GST_WEBRTC_STATS_DATA_CHANNEL: data-channel
+ * @GST_WEBRTC_STATS_STREAM: stream
+ * @GST_WEBRTC_STATS_TRANSPORT: transport
+ * @GST_WEBRTC_STATS_CANDIDATE_PAIR: candidate-pair
+ * @GST_WEBRTC_STATS_LOCAL_CANDIDATE: local-candidate
+ * @GST_WEBRTC_STATS_REMOTE_CANDIDATE: remote-candidate
+ * @GST_WEBRTC_STATS_CERTIFICATE: certificate
+ */
+typedef enum /*< underscore_name=gst_webrtc_stats_type >*/
+{
+ GST_WEBRTC_STATS_CODEC = 1,
+ GST_WEBRTC_STATS_INBOUND_RTP,
+ GST_WEBRTC_STATS_OUTBOUND_RTP,
+ GST_WEBRTC_STATS_REMOTE_INBOUND_RTP,
+ GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP,
+ GST_WEBRTC_STATS_CSRC,
+ GST_WEBRTC_STATS_PEER_CONNECTION,
+ GST_WEBRTC_STATS_DATA_CHANNEL,
+ GST_WEBRTC_STATS_STREAM,
+ GST_WEBRTC_STATS_TRANSPORT,
+ GST_WEBRTC_STATS_CANDIDATE_PAIR,
+ GST_WEBRTC_STATS_LOCAL_CANDIDATE,
+ GST_WEBRTC_STATS_REMOTE_CANDIDATE,
+ GST_WEBRTC_STATS_CERTIFICATE,
+} GstWebRTCStatsType;
+
+/**
+ * GstWebRTCFECType:
+ * @GST_WEBRTC_FEC_TYPE_NONE: none
+ * @GST_WEBRTC_FEC_TYPE_ULP_RED: ulpfec + red
+ *
+ * Since: 1.14.1
+ */
+typedef enum /*< underscore_name=gst_webrtc_fec_type >*/
+{
+ GST_WEBRTC_FEC_TYPE_NONE,
+ GST_WEBRTC_FEC_TYPE_ULP_RED,
+} GstWebRTCFECType;
+
+/**
+ * GstWebRTCSCTPTransportState:
+ * @GST_WEBRTC_SCTP_TRANSPORT_STATE_NEW: new
+ * @GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTING: connecting
+ * @GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTED: connected
+ * @GST_WEBRTC_SCTP_TRANSPORT_STATE_CLOSED: closed
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcsctptransportstate>
+ *
+ * Since: 1.16
+ */
+typedef enum /*< underscore_name=gst_webrtc_sctp_transport_state >*/
+{
+ GST_WEBRTC_SCTP_TRANSPORT_STATE_NEW,
+ GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTING,
+ GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTED,
+ GST_WEBRTC_SCTP_TRANSPORT_STATE_CLOSED,
+} GstWebRTCSCTPTransportState;
+
+/**
+ * GstWebRTCPriorityType:
+ * @GST_WEBRTC_PRIORITY_TYPE_VERY_LOW: very-low
+ * @GST_WEBRTC_PRIORITY_TYPE_LOW: low
+ * @GST_WEBRTC_PRIORITY_TYPE_MEDIUM: medium
+ * @GST_WEBRTC_PRIORITY_TYPE_HIGH: high
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcprioritytype>
+ *
+ * Since: 1.16
+ */
+typedef enum /*< underscore_name=gst_webrtc_priority_type >*/
+{
+ GST_WEBRTC_PRIORITY_TYPE_VERY_LOW = 1,
+ GST_WEBRTC_PRIORITY_TYPE_LOW,
+ GST_WEBRTC_PRIORITY_TYPE_MEDIUM,
+ GST_WEBRTC_PRIORITY_TYPE_HIGH,
+} GstWebRTCPriorityType;
+
+/**
+ * GstWebRTCDataChannelState:
+ * @GST_WEBRTC_DATA_CHANNEL_STATE_NEW: new
+ * @GST_WEBRTC_DATA_CHANNEL_STATE_CONNECTING: connection
+ * @GST_WEBRTC_DATA_CHANNEL_STATE_OPEN: open
+ * @GST_WEBRTC_DATA_CHANNEL_STATE_CLOSING: closing
+ * @GST_WEBRTC_DATA_CHANNEL_STATE_CLOSED: closed
+ *
+ * See <http://w3c.github.io/webrtc-pc/#dom-rtcdatachannelstate>
+ *
+ * Since: 1.16
+ */
+typedef enum /*< underscore_name=gst_webrtc_data_channel_state >*/
+{
+ GST_WEBRTC_DATA_CHANNEL_STATE_NEW,
+ GST_WEBRTC_DATA_CHANNEL_STATE_CONNECTING,
+ GST_WEBRTC_DATA_CHANNEL_STATE_OPEN,
+ GST_WEBRTC_DATA_CHANNEL_STATE_CLOSING,
+ GST_WEBRTC_DATA_CHANNEL_STATE_CLOSED,
+} GstWebRTCDataChannelState;
+
+/**
+ * GstWebRTCBundlePolicy:
+ * @GST_WEBRTC_BUNDLE_POLICY_NONE: none
+ * @GST_WEBRTC_BUNDLE_POLICY_BALANCED: balanced
+ * @GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT: max-compat
+ * @GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE: max-bundle
+ *
+ * See https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24#section-4.1.1
+ * for more information.
+ *
+ * Since: 1.16
+ */
+typedef enum /*<underscore_name=gst_webrtc_bundle_policy>*/
+{
+ GST_WEBRTC_BUNDLE_POLICY_NONE,
+ GST_WEBRTC_BUNDLE_POLICY_BALANCED,
+ GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT,
+ GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE,
+} GstWebRTCBundlePolicy;
+
+/**
+ * GstWebRTCICETransportPolicy:
+ * @GST_WEBRTC_ICE_TRANSPORT_POLICY_ALL: all
+ * @GST_WEBRTC_ICE_TRANSPORT_POLICY_RELAY: relay
+ *
+ * See https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24#section-4.1.1
+ * for more information.
+ *
+ * Since: 1.16
+ */
+typedef enum /*<underscore_name=gst_webrtc_ice_transport_policy>*/
+{
+ GST_WEBRTC_ICE_TRANSPORT_POLICY_ALL,
+ GST_WEBRTC_ICE_TRANSPORT_POLICY_RELAY,
+} GstWebRTCICETransportPolicy;
+
+/**
+ * GstWebRTCKind:
+ * @GST_WEBRTC_KIND_UNKNOWN: Kind has not yet been set
+ * @GST_WEBRTC_KIND_AUDIO: Kind is audio
+ * @GST_WEBRTC_KIND_VIDEO: Kind is audio
+ *
+ * https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-kind
+ *
+ * Since: 1.20
+ */
+typedef enum /*<underscore_name=gst_webrtc_kind>*/
+{
+ GST_WEBRTC_KIND_UNKNOWN,
+ GST_WEBRTC_KIND_AUDIO,
+ GST_WEBRTC_KIND_VIDEO,
+} GstWebRTCKind;
+
+
+GST_WEBRTC_API
+GQuark gst_webrtc_error_quark (void);
+
+/**
+ * GST_WEBRTC_ERROR:
+ *
+ * Since: 1.20
+ */
+#define GST_WEBRTC_ERROR gst_webrtc_error_quark ()
+
+/**
+ * GstWebRTCError:
+ * @GST_WEBRTC_ERROR_DATA_CHANNEL_FAILURE: data-channel-failure
+ * @GST_WEBRTC_ERROR_DTLS_FAILURE: dtls-failure
+ * @GST_WEBRTC_ERROR_FINGERPRINT_FAILURE: fingerprint-failure
+ * @GST_WEBRTC_ERROR_SCTP_FAILURE: sctp-failure
+ * @GST_WEBRTC_ERROR_SDP_SYNTAX_ERROR: sdp-syntax-error
+ * @GST_WEBRTC_ERROR_HARDWARE_ENCODER_NOT_AVAILABLE: hardware-encoder-not-available
+ * @GST_WEBRTC_ERROR_ENCODER_ERROR: encoder-error
+ * @GST_WEBRTC_ERROR_INVALID_STATE: invalid-state (part of WebIDL specification)
+ * @GST_WEBRTC_ERROR_INTERNAL_FAILURE: GStreamer-specific failure, not matching any other value from the specification
+ *
+ * See <https://www.w3.org/TR/webrtc/#dom-rtcerrordetailtype> for more information.
+ *
+ * Since: 1.20
+ */
+typedef enum /*<underscore_name=gst_webrtc_error>*/
+{
+ GST_WEBRTC_ERROR_DATA_CHANNEL_FAILURE,
+ GST_WEBRTC_ERROR_DTLS_FAILURE,
+ GST_WEBRTC_ERROR_FINGERPRINT_FAILURE,
+ GST_WEBRTC_ERROR_SCTP_FAILURE,
+ GST_WEBRTC_ERROR_SDP_SYNTAX_ERROR,
+ GST_WEBRTC_ERROR_HARDWARE_ENCODER_NOT_AVAILABLE,
+ GST_WEBRTC_ERROR_ENCODER_ERROR,
+ GST_WEBRTC_ERROR_INVALID_STATE,
+ GST_WEBRTC_ERROR_INTERNAL_FAILURE
+} GstWebRTCError;
+
+
+#endif /* __GST_WEBRTC_FWD_H__ */
diff --git a/libs/win32/glib-2.0.lib b/libs/win32/glib-2.0.lib
new file mode 100644
index 0000000000..1c5dfff29f
--- /dev/null
+++ b/libs/win32/glib-2.0.lib
Binary files differ
diff --git a/libs/win32/gobject-2.0.lib b/libs/win32/gobject-2.0.lib
new file mode 100644
index 0000000000..cb91b31fe1
--- /dev/null
+++ b/libs/win32/gobject-2.0.lib
Binary files differ
diff --git a/libs/win32/gstreamer-1.0.lib b/libs/win32/gstreamer-1.0.lib
new file mode 100644
index 0000000000..79fdb92934
--- /dev/null
+++ b/libs/win32/gstreamer-1.0.lib
Binary files differ
diff --git a/libs/win32/gstrtp-1.0.lib b/libs/win32/gstrtp-1.0.lib
new file mode 100644
index 0000000000..12bce2ed6b
--- /dev/null
+++ b/libs/win32/gstrtp-1.0.lib
Binary files differ
diff --git a/libs/win32/gstsdp-1.0.lib b/libs/win32/gstsdp-1.0.lib
new file mode 100644
index 0000000000..7033b020c2
--- /dev/null
+++ b/libs/win32/gstsdp-1.0.lib
Binary files differ
diff --git a/libs/win32/gstwebrtc-1.0.lib b/libs/win32/gstwebrtc-1.0.lib
new file mode 100644
index 0000000000..a7f0d7335e
--- /dev/null
+++ b/libs/win32/gstwebrtc-1.0.lib
Binary files differ
diff --git a/libs/win64/glib-2.0.lib b/libs/win64/glib-2.0.lib
new file mode 100644
index 0000000000..f93e3742ef
--- /dev/null
+++ b/libs/win64/glib-2.0.lib
Binary files differ
diff --git a/libs/win64/gobject-2.0.lib b/libs/win64/gobject-2.0.lib
new file mode 100644
index 0000000000..0420fd2591
--- /dev/null
+++ b/libs/win64/gobject-2.0.lib
Binary files differ
diff --git a/libs/win64/gstreamer-1.0.lib b/libs/win64/gstreamer-1.0.lib
new file mode 100644
index 0000000000..f1187a5b8a
--- /dev/null
+++ b/libs/win64/gstreamer-1.0.lib
Binary files differ
diff --git a/libs/win64/gstrtp-1.0.lib b/libs/win64/gstrtp-1.0.lib
new file mode 100644
index 0000000000..2b1b0ed4e8
--- /dev/null
+++ b/libs/win64/gstrtp-1.0.lib
Binary files differ
diff --git a/libs/win64/gstsdp-1.0.lib b/libs/win64/gstsdp-1.0.lib
new file mode 100644
index 0000000000..1bef5e1eff
--- /dev/null
+++ b/libs/win64/gstsdp-1.0.lib
Binary files differ
diff --git a/libs/win64/gstwebrtc-1.0.lib b/libs/win64/gstwebrtc-1.0.lib
new file mode 100644
index 0000000000..cc6d6ea729
--- /dev/null
+++ b/libs/win64/gstwebrtc-1.0.lib
Binary files differ
diff --git a/protocols/JabberG/jabber.vcxproj b/protocols/JabberG/jabber.vcxproj
index 4d882b075d..cffe651bac 100644
--- a/protocols/JabberG/jabber.vcxproj
+++ b/protocols/JabberG/jabber.vcxproj
@@ -25,6 +25,11 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include\glib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\jabber.cpp" />
<ClCompile Include="src\jabber_adhoc.cpp" />
@@ -75,6 +80,7 @@
<ClCompile Include="src\jabber_userinfo.cpp" />
<ClCompile Include="src\jabber_util.cpp" />
<ClCompile Include="src\jabber_vcard.cpp" />
+ <ClCompile Include="src\jabber_voip.cpp" />
<ClCompile Include="src\jabber_xml.cpp" />
<ClCompile Include="src\jabber_xstatus.cpp" />
<ClCompile Include="src\jabber_zstream.cpp" />
@@ -107,7 +113,8 @@
</ItemGroup>
<ItemDefinitionGroup>
<Link>
- <AdditionalDependencies>libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>delayimp.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <DelayLoadDLLs>glib-2.0-0.dll;gobject-2.0-0.dll;gstreamer-1.0-0.dll;gstrtp-1.0-0.dll;gstsdp-1.0-0.dll;gstwebrtc-1.0-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/protocols/JabberG/jabber.vcxproj.filters b/protocols/JabberG/jabber.vcxproj.filters
index 30d426c7d2..7894068683 100644
--- a/protocols/JabberG/jabber.vcxproj.filters
+++ b/protocols/JabberG/jabber.vcxproj.filters
@@ -161,6 +161,9 @@
<ClCompile Include="src\jabber_mam.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\jabber_voip.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\jabber_byte.h">
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 4b6fada073..e49f93d8a8 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -78,7 +78,11 @@ const JabberFeatCapPair g_JabberFeatCapPairs[] =
{ JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGEN("Supports Roster Exchange") },
{ JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGEN("Supports direct chat invitations (XEP-0249)") },
{ JABBER_FEAT_OMEMO_DEVICELIST_NOTIFY, JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY, LPGEN("Receives information about OMEMO devices") },
- { JABBER_FEAT_CARBONS, JABBER_CAPS_CARBONS, LPGEN("Supports message carbons (XEP-0280)")},
+ { JABBER_FEAT_CARBONS, JABBER_CAPS_CARBONS, LPGEN("Supports message carbons (XEP-0280)")},
+ { JABBER_FEAT_JINGLE_ICEUDP, JABBER_CAPS_JINGLE_ICEUDP, LPGEN("Jingle ICE-UDP Transport") },
+ { JABBER_FEAT_JINGLE_RTP, JABBER_CAPS_JINGLE_RTP, LPGEN("Jingle RTP") },
+ { JABBER_FEAT_JINGLE_DTLS, JABBER_CAPS_JINGLE_DTLS, LPGEN("Jingle DTLS") },
+ { JABBER_FEAT_JINGLE_RTPAUDIO, JABBER_CAPS_JINGLE_RTPAUDIO, LPGEN("Jingle RTP Audio") },
};
const int g_cJabberFeatCapPairs = _countof(g_JabberFeatCapPairs);
@@ -347,6 +351,8 @@ JabberCapsBits CJabberProto::GetOwnCaps(bool IncludeDynamic)
jcb |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
if (!m_bMsgAck)
jcb &= ~(JABBER_CAPS_CHAT_MARKERS | JABBER_CAPS_MESSAGE_RECEIPTS);
+ if (m_bEnableVOIP)
+ jcb |= JABBER_CAPS_JINGLE | JABBER_CAPS_JINGLE_ICEUDP | JABBER_CAPS_JINGLE_RTP | JABBER_CAPS_JINGLE_DTLS | JABBER_CAPS_JINGLE_RTPAUDIO;
return jcb;
}
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index 76313d77aa..fc37993fb0 100644
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -195,6 +195,15 @@ typedef unsigned __int64 JabberCapsBits;
#define JABBER_FEAT_BITS "urn:xmpp:bob"
#define JABBER_CAPS_BITS ((JabberCapsBits)1<<50)
+#define JABBER_FEAT_JINGLE_ICEUDP "urn:xmpp:jingle:transports:ice-udp:1"
+#define JABBER_CAPS_JINGLE_ICEUDP ((JabberCapsBits)1<<51)
+#define JABBER_FEAT_JINGLE_RTP "urn:xmpp:jingle:apps:rtp:1"
+#define JABBER_CAPS_JINGLE_RTP ((JabberCapsBits)1<<52)
+#define JABBER_FEAT_JINGLE_DTLS "urn:xmpp:jingle:apps:dtls:0"
+#define JABBER_CAPS_JINGLE_DTLS ((JabberCapsBits)1<<53)
+#define JABBER_FEAT_JINGLE_RTPAUDIO "urn:xmpp:jingle:apps:rtp:audio"
+#define JABBER_CAPS_JINGLE_RTPAUDIO ((JabberCapsBits)1<<54)
+
#define JABBER_FEAT_ARCHIVE "urn:xmpp:archive"
#define JABBER_FEAT_BIND "urn:ietf:params:xml:ns:xmpp-bind"
#define JABBER_FEAT_CAPTCHA "urn:xmpp:captcha"
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index f37afe8eb4..808302b164 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -126,6 +126,13 @@ static int JabberPrebuildContactMenu(WPARAM hContact, LPARAM lParam)
return(ppro) ? ppro->OnPrebuildContactMenu(hContact, lParam) : 0;
}
+static INT_PTR JabberVOIPCallIinitiate(WPARAM hContact, LPARAM)
+{
+ CJabberProto *ppro = CMPlugin::getInstance(hContact);
+ ppro->VOIPCallIinitiate(hContact);
+ return 0;
+}
+
void g_MenuInit(void)
{
hStatusMenuInit = CreateHookableEvent(ME_JABBER_MENUINIT);
@@ -245,6 +252,16 @@ void g_MenuInit(void)
mi.hIcolibItem = g_plugin.getIconHandle(IDI_NODE_SERVER);
g_hMenuResourcesServer = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_SERVER);
+
+ SET_UID(mi, 0x2fe60fc5, 0x6417, 0x4f37, 0xa0, 0xbe, 0xa0, 0x59, 0x94, 0x11, 0x1d, 0xd9);
+ mi.root = nullptr;
+ mi.flags = 0;
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NODE_RSS);
+ mi.name.a = LPGEN("Voice call");
+ mi.pszService = "Jabber/VOIPCallIinitiate";
+ mi.position = -1999902010;
+ Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, JabberVOIPCallIinitiate);
}
void g_MenuUninit(void)
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 00313c3d5d..c23c101555 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -706,8 +706,9 @@ public:
m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable server-side history (XEP-0136)"), m_proto->m_bEnableMsgArchive);
m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable Message Archive Management (XEP-0313)"), m_proto->m_bEnableMam);
m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable carbon copies (XEP-0280)"), m_proto->m_bEnableCarbons);
- m_options.AddOption(LPGENW("Messaging"), LPGENW("Use Stream Management (XEP-0198) if possible (Testing)"), m_proto->m_bEnableStreamMgmt);
+ m_options.AddOption(LPGENW("Messaging"), LPGENW("Enable VOIP(for developers)"), m_proto->m_bEnableVOIP);
+ m_options.AddOption(LPGENW("Server options"), LPGENW("Use Stream Management (XEP-0198) if possible (Testing)"), m_proto->m_bEnableStreamMgmt);
m_options.AddOption(LPGENW("Server options"), LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_bDisable3920auth);
m_options.AddOption(LPGENW("Server options"), LPGENW("Enable stream compression (if possible)"), m_proto->m_bEnableZlib);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 946ae533f4..cdae4a4df3 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -101,6 +101,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
m_bEnableUserActivity(this, "EnableUserActivity", true),
m_bEnableUserMood(this, "EnableUserMood", true),
m_bEnableUserTune(this, "EnableUserTune", false),
+ m_bEnableVOIP(this, "EnableVOIP", false),
m_bEnableZlib(this, "EnableZlib", true),
m_bFixIncorrectTimestamps(this, "FixIncorrectTimestamps", true),
m_bGcLogAffiliations(this, "GcLogAffiliations", false),
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index ce8a4c0881..e13cd79e3e 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -203,6 +203,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
CMOption<bool> m_bEnableUserActivity;
CMOption<bool> m_bEnableUserMood;
CMOption<bool> m_bEnableUserTune;
+ CMOption<bool> m_bEnableVOIP;
CMOption<bool> m_bEnableZlib;
CMOption<bool> m_bFixIncorrectTimestamps;
CMOption<bool> m_bGcLogAffiliations;
@@ -886,6 +887,21 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName);
void SaveVcardToDB(HWND hwndPage, int iPage);
+ //---- jabber_voip.c -----------------------------------------------------------------
+
+ bool OnICECandidate(const TiXmlElement *Node, const char *from);
+ bool OnRTPDescription(const TiXmlElement *Node);
+ bool VOIPCreatePipeline();
+ bool VOIPTerminateSession();
+ bool VOIPCallAccept(const TiXmlElement *jingleNode, const char *from);
+ bool VOIPCallIinitiate(MCONTACT hContact);
+
+ CMStringA m_voipSession, m_voipPeerJid;
+ CMStringA m_voipICEPwd, m_voipICEUfrag, m_medianame;
+ bool m_isOutgoing;
+ struct _GstElement *m_pipe1 = NULL;
+ struct _GstElement *m_webrtc1 = NULL;
+
//---- jabber_xml.c ------------------------------------------------------------------
void OnConsoleProcessXml(const TiXmlElement *node, uint32_t flags);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index cedb5ed81b..ce3c613013 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1770,41 +1770,78 @@ bool CJabberProto::OnProcessJingle(const TiXmlElement *node)
if (child) {
if ((type = XmlGetAttr(node, "type")) == nullptr)
return false;
+ const char *szAction = XmlGetAttr(child, "action");
+ const char *szSid = XmlGetAttr(child, "sid");
if ((!mir_strcmp(type, "get") || !mir_strcmp(type, "set"))) {
- const char *szAction = XmlGetAttr(child, "action");
const char *idStr = XmlGetAttr(node, "id");
const char *from = XmlGetAttr(node, "from");
- if (szAction && !mir_strcmp(szAction, "session-initiate")) {
- // if this is a Jingle 'session-initiate' and noone processed it yet, reply with "unsupported-applications"
- m_ThreadInfo->send(XmlNodeIq("result", idStr, from));
-
- XmlNodeIq iq("set", SerialNext(), from);
- TiXmlElement *jingleNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE);
-
- jingleNode << XATTR("action", "session-terminate");
- const char *szInitiator = XmlGetAttr(child, "initiator");
- if (szInitiator)
- jingleNode << XATTR("initiator", szInitiator);
- const char *szSid = XmlGetAttr(child, "sid");
- if (szSid)
- jingleNode << XATTR("sid", szSid);
-
- jingleNode << XCHILD("reason")
- << XCHILD("unsupported-applications");
- m_ThreadInfo->send(iq);
- return true;
- }
- else {
- // if it's something else than 'session-initiate' and noone processed it yet, reply with "unknown-session"
- XmlNodeIq iq("error", idStr, from);
- TiXmlElement *errNode = iq << XCHILD("error");
- errNode << XATTR("type", "cancel");
- errNode << XCHILDNS("item-not-found", "urn:ietf:params:xml:ns:xmpp-stanzas");
- errNode << XCHILDNS("unknown-session", "urn:xmpp:jingle:errors:1");
- m_ThreadInfo->send(iq);
- return true;
+ const char *szInitiator = XmlGetAttr(child, "initiator");
+ auto *content = XmlGetChildByTag(child, "content", "creator", "initiator");
+
+ if (szAction && szSid) {
+ if (!mir_strcmp(szAction, "session-initiate")) {
+ // if this is a Jingle 'session-initiate' and noone processed it yet, reply with "unsupported-applications"
+ m_ThreadInfo->send(XmlNodeIq("result", idStr, from));
+
+ const TiXmlElement *descr = XmlGetChildByTag(content, "description", "xmlns", JABBER_FEAT_JINGLE_RTP);
+ if (m_bEnableVOIP && m_voipSession == "" && descr) {
+ if (VOIPCallAccept(child, from)) {
+ m_voipSession = szSid;
+ m_voipPeerJid = from;
+ return true;
+ }
+ }
+
+ XmlNodeIq iq("set", SerialNext(), from);
+ TiXmlElement *jingleNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE);
+ jingleNode << XATTR("action", "session-terminate");
+ if (szInitiator)
+ jingleNode << XATTR("initiator", szInitiator);
+ if (szSid)
+ jingleNode << XATTR("sid", szSid);
+ jingleNode << XCHILD("reason") << XCHILD("unsupported-applications");
+
+ m_ThreadInfo->send(iq);
+ return true;
+ }
+ else if (!mir_strcmp(szAction, "session-accept")) {
+ if (m_bEnableVOIP && m_voipSession == szSid) {
+ m_ThreadInfo->send(XmlNodeIq("result", idStr, from));
+ OnRTPDescription(child);
+ return true;
+ }
+ }
+ else if (!mir_strcmp(szAction, "session-terminate")) {
+ if (m_bEnableVOIP && m_voipSession == szSid) {
+ // EndCall()
+ m_ThreadInfo->send(XmlNodeIq("result", idStr, from));
+ VOIPTerminateSession();
+ m_voipSession.Empty();
+ m_voipPeerJid.Empty();
+ return true;
+ }
+ }
+ else if (!mir_strcmp(szAction, "transport-info")) {
+ auto *transport = XmlGetChildByTag(content, "transport", "xmlns", JABBER_FEAT_JINGLE_ICEUDP);
+ if (m_bEnableVOIP && m_voipSession == szSid && transport) {
+ m_ThreadInfo->send(XmlNodeIq("result", idStr, from));
+ if (const TiXmlElement *candidate = XmlFirstChild(transport, "candidate")) {
+ OnICECandidate(candidate, from);
+ return true;
+ }
+ }
+ }
}
+
+ // if it's something else than 'session-initiate' and noone processed it yet, reply with "unknown-session"
+ XmlNodeIq iq("error", idStr, from);
+ TiXmlElement *errNode = iq << XCHILD("error");
+ errNode << XATTR("type", "cancel");
+ errNode << XCHILDNS("item-not-found", "urn:ietf:params:xml:ns:xmpp-stanzas");
+ errNode << XCHILDNS("unknown-session", "urn:xmpp:jingle:errors:1");
+ m_ThreadInfo->send(iq);
+ return true;
}
}
return false;
diff --git a/protocols/JabberG/src/jabber_voip.cpp b/protocols/JabberG/src/jabber_voip.cpp
new file mode 100644
index 0000000000..2f45d61350
--- /dev/null
+++ b/protocols/JabberG/src/jabber_voip.cpp
@@ -0,0 +1,519 @@
+#include "stdafx.h"
+
+#include <gst/gst.h>
+#include <gst/sdp/sdp.h>
+#include <gst/rtp/rtp.h>
+
+#define GST_USE_UNSTABLE_API
+#include <gst/webrtc/webrtc.h>
+
+#pragma comment(lib, "glib-2.0.lib")
+#pragma comment(lib, "gobject-2.0.lib")
+#pragma comment(lib, "gstreamer-1.0.lib")
+#pragma comment(lib, "gstrtp-1.0.lib")
+#pragma comment(lib, "gstsdp-1.0.lib")
+#pragma comment(lib, "gstwebrtc-1.0.lib")
+
+static std::list<CMStringA> remotecands;
+
+bool GetCandidateProp(char *output, byte maxlen, const char *candidate, const char *prop)
+{
+ const char *pprop = strstr(candidate, prop);
+ if (!pprop)
+ return false;
+
+ const char *val = pprop + strlen(prop);
+ while (*val == ' ') val++;
+ int i = 0;
+ while (*val != 0 && *val != ' ' && i < maxlen - 1)
+ output[i++] = *val++;
+ output[i] = 0;
+
+ return i > 0;
+}
+
+static void handle_media_stream(GstPad *pad, GstElement *pipe, const char *convert_name, const char *sink_name)
+{
+ GstPad *qpad;
+ GstElement *q, *conv, *resample, *sink;
+ GstPadLinkReturn ret;
+
+ gst_print("Trying to handle stream with %s ! %s", convert_name, sink_name);
+
+ q = gst_element_factory_make("queue", NULL);
+ g_assert_nonnull(q);
+ conv = gst_element_factory_make(convert_name, NULL);
+ g_assert_nonnull(conv);
+ sink = gst_element_factory_make(sink_name, NULL);
+ g_assert_nonnull(sink);
+
+ if (g_strcmp0(convert_name, "audioconvert") == 0) {
+ /* Might also need to resample, so add it just in case.
+ * Will be a no-op if it's not required. */
+ resample = gst_element_factory_make("audioresample", NULL);
+ g_assert_nonnull(resample);
+ gst_bin_add_many(GST_BIN(pipe), q, conv, resample, sink, NULL);
+ gst_element_sync_state_with_parent(q);
+ gst_element_sync_state_with_parent(conv);
+ gst_element_sync_state_with_parent(resample);
+ gst_element_sync_state_with_parent(sink);
+ gst_element_link_many(q, conv, resample, sink, NULL);
+ }
+ else {
+ gst_bin_add_many(GST_BIN(pipe), q, conv, sink, NULL);
+ gst_element_sync_state_with_parent(q);
+ gst_element_sync_state_with_parent(conv);
+ gst_element_sync_state_with_parent(sink);
+ gst_element_link_many(q, conv, sink, NULL);
+ }
+
+ qpad = gst_element_get_static_pad(q, "sink");
+
+ ret = gst_pad_link(pad, qpad);
+ g_assert_cmphex(ret, == , GST_PAD_LINK_OK);
+}
+
+static void on_incoming_decodebin_stream(GstElement * /*decodebin*/, GstPad *pad, GstElement *pipe)
+{
+ GstCaps *caps;
+ const gchar *name;
+
+ if (!gst_pad_has_current_caps(pad)) {
+ gst_printerr("Pad '%s' has no caps, can't do anything, ignoring\n", GST_PAD_NAME(pad));
+ return;
+ }
+
+ caps = gst_pad_get_current_caps(pad);
+ name = gst_structure_get_name(gst_caps_get_structure(caps, 0));
+
+ if (g_str_has_prefix(name, "video")) {
+ handle_media_stream(pad, pipe, "videoconvert", "autovideosink");
+ }
+ else if (g_str_has_prefix(name, "audio")) {
+ handle_media_stream(pad, pipe, "audioconvert", "autoaudiosink");
+ }
+ else {
+ gst_printerr("Unknown pad %s, ignoring", GST_PAD_NAME(pad));
+ }
+}
+
+static void on_incoming_stream_cb(GstElement */*webrtc*/, GstPad *pad, GstElement *pipe)
+{
+ GstElement *decodebin;
+ GstPad *sinkpad;
+
+ if (GST_PAD_DIRECTION(pad) != GST_PAD_SRC)
+ return;
+
+ decodebin = gst_element_factory_make("decodebin", NULL);
+ g_signal_connect(decodebin, "pad-added", G_CALLBACK(on_incoming_decodebin_stream), pipe);
+ gst_bin_add(GST_BIN(pipe), decodebin);
+ gst_element_sync_state_with_parent(decodebin);
+
+ sinkpad = gst_element_get_static_pad(decodebin, "sink");
+ gst_pad_link(pad, sinkpad);
+ gst_object_unref(sinkpad);
+}
+
+void on_offer_created_cb(GstPromise *promise, gpointer user_data)
+{
+ GstWebRTCSessionDescription *offer = NULL;
+ CJabberProto *jproto = (CJabberProto *)user_data;
+
+ GstStructure const *reply = gst_promise_get_reply(promise);
+ gst_structure_get(reply, jproto->m_isOutgoing ? "offer" : "answer", GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &offer, NULL);
+ gst_promise_unref(promise);
+ if (!offer) {
+ gst_print("Cannot process sdp");
+ return;
+ }
+
+ GstPromise *local_desc_promise = gst_promise_new();
+ g_signal_emit_by_name(jproto->m_webrtc1, "set-local-description", offer, local_desc_promise);
+ gst_promise_interrupt(local_desc_promise);
+ gst_promise_unref(local_desc_promise);
+
+ gchar *sdp_string = gst_sdp_message_as_text(offer->sdp);
+ gst_print("VOIP - Wanna send SDP offer:\r\n%s\r\n", sdp_string);
+ g_free(sdp_string);
+
+ const GstSDPMedia *media_audio = NULL;
+ for (unsigned int i = 0; i < gst_sdp_message_medias_len(offer->sdp); i++) {
+ const GstSDPMedia *m = gst_sdp_message_get_media(offer->sdp, i);
+ if (!strcmp(m->media, "audio"))
+ media_audio = m;
+ }
+ if (!media_audio) {
+ gst_print("No audio media in SDP");
+ return;
+ }
+
+ jproto->m_voipICEPwd = gst_sdp_media_get_attribute_val(media_audio, "ice-pwd");
+ jproto->m_voipICEUfrag = gst_sdp_media_get_attribute_val(media_audio, "ice-ufrag");
+ jproto->m_medianame = gst_sdp_media_get_attribute_val(media_audio, "mid");
+
+ //send it all
+ bool outgoing = jproto->m_isOutgoing;
+ XmlNodeIq iq("set", jproto->SerialNext(), jproto->m_voipPeerJid);
+ TiXmlElement *rjNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE);
+ rjNode << XATTR("sid", jproto->m_voipSession)
+ << XATTR("action", outgoing ? "session-initiate" : "session-accept")
+ << XATTR("initiator", outgoing ? jproto->m_ThreadInfo->fullJID : jproto->m_voipPeerJid);
+ if (!outgoing)
+ rjNode << XATTR("responder", jproto->m_ThreadInfo->fullJID);
+
+ TiXmlElement *content = rjNode << XCHILD("content") << XATTR("creator", "initiator") << XATTR("name", jproto->m_medianame);
+ TiXmlElement *description = content << XCHILDNS("description", JABBER_FEAT_JINGLE_RTP) << XATTR("media", "audio");
+
+ auto *opuspayload = description << XCHILD("payload-type") << XATTR("id", "111") << XATTR("name", "opus") << XATTR("clockrate", "48000") << XATTR("channels", "2");
+
+ opuspayload << XCHILD("parameter") << XATTR("name", "minptime") << XATTR("value", "10");
+ opuspayload << XCHILD("parameter") << XATTR("name", "useinbandfec") << XATTR("value", "1");
+ opuspayload << XCHILDNS("rtcp-fb", "urn:xmpp:jingle:apps:rtp:rtcp-fb:0") << XATTR("type", "transport-cc");
+
+ description << XCHILDNS("rtp-hdrext", "urn:xmpp:jingle:apps:rtp:rtp-hdrext:0") << XATTR("id", "1") << XATTR("uri", "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01");
+ /*
+ auto* source = description << XCHILDNS("source", "urn:xmpp:jingle:apps:rtp:ssma:0") << XATTR("ssrc", "2165039095");
+ source << XCHILD("parameter") << XATTR("name", "cname") << XATTR("value", "8ee+PcGu8BNwq22f");
+ source << XCHILD("parameter") << XATTR("name", "msid") << XATTR("value", "my-media-stream2 my-audio-track2");
+ source << XCHILD("parameter") << XATTR("name", "mslabel") << XATTR("value", "my-media-stream2");
+ source << XCHILD("parameter") << XATTR("name", "label") << XATTR("value", "my-audio-track2");*/
+
+ description << XCHILD("rtcp-mux");
+
+ //fingerprint
+ char hash[100];
+ if (sscanf(gst_sdp_media_get_attribute_val(media_audio, "fingerprint"), "sha-256 %95s", hash) == 1) {
+ auto *transport = content << XCHILDNS("transport", JABBER_FEAT_JINGLE_ICEUDP);
+ transport << XATTR("pwd", jproto->m_voipICEPwd) << XATTR("ufrag", jproto->m_voipICEUfrag);
+
+ auto *fingerprint = transport << XCHILD("fingerprint", hash);
+ fingerprint << XATTR("xmlns", JABBER_FEAT_JINGLE_DTLS) << XATTR("hash", "sha-256")
+ << XATTR("setup", gst_sdp_media_get_attribute_val(media_audio, "setup"));
+ }
+
+ jproto->m_ThreadInfo->send(iq);
+
+ gst_webrtc_session_description_free(offer);
+}
+
+void on_negotiation_needed_cb(GstElement *webrtcbin, gpointer user_data)
+{
+ if (((CJabberProto *)user_data)->m_isOutgoing) {
+ gst_print("Creating negotiation offer\n");
+
+ GstPromise *promise = gst_promise_new_with_change_func(on_offer_created_cb, user_data, NULL);
+ g_signal_emit_by_name(G_OBJECT(webrtcbin), "create-offer", NULL, promise);
+ }
+}
+
+static void on_offer_set(GstPromise *promise, gpointer user_data)
+{
+ gst_promise_unref(promise);
+ promise = gst_promise_new_with_change_func(on_offer_created_cb, user_data, NULL);
+ g_signal_emit_by_name(((CJabberProto *)user_data)->m_webrtc1, "create-answer", NULL, promise);
+}
+
+void send_ice_candidate_message_cb(G_GNUC_UNUSED GstElement */*webrtcbin*/, guint mline_index, gchar *candidate, CJabberProto *jproto)
+{
+ // parse candidate and send
+ char foundation[11], component[11], protocol[4], priority[11], ip[40], port[6], type[6];
+ int ret = sscanf(candidate, "candidate:%10s %10s %3s %10s %39s %5s typ %5s",
+ foundation, component, protocol, priority, ip, port, type);
+ if (ret != 7 || strcmp(protocol, "UDP"))
+ return;
+
+ gst_print("VOIP - Wanna send ice candidate(m-line_index=%d):\r\n%s\r\n", mline_index, candidate);
+ for (char *p = protocol; *p; ++p) *p = tolower(*p);
+
+ XmlNodeIq iq("set", jproto->SerialNext(), jproto->m_voipPeerJid);
+ TiXmlElement *rjNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE);
+ rjNode << XATTR("action", "transport-info") << XATTR("sid", jproto->m_voipSession);
+
+ TiXmlElement *content = rjNode << XCHILD("content");
+ content << XATTR("creator", "initiator") << XATTR("name", jproto->m_medianame);
+
+ auto *transport = content << XCHILDNS("transport", JABBER_FEAT_JINGLE_ICEUDP);
+ transport << XATTR("pwd", jproto->m_voipICEPwd) << XATTR("ufrag", jproto->m_voipICEUfrag);
+
+ auto *candidateNode = transport << XCHILD("candidate");
+ candidateNode << XATTR("type", type) << XATTR("protocol", protocol) << XATTR("ip", ip)
+ << XATTR("port", port) << XATTR("priority", priority) << XATTR("foundation", foundation) << XATTR("component", component);
+
+ char attr[255];
+ if (GetCandidateProp(attr, 255, candidate, "raddr"))
+ candidateNode << XATTR("rel-addr", attr);
+ if (GetCandidateProp(attr, 255, candidate, "rport"))
+ candidateNode << XATTR("rel-port", attr);
+
+ jproto->m_ThreadInfo->send(iq);
+}
+
+static gboolean check_plugins(void)
+{
+ const gchar *needed[] = { "opus", "nice", "webrtc", "dtls", "srtp", "rtpmanager",
+ /*"vpx", "videotestsrc", "audiotestsrc",*/ NULL };
+
+ GstRegistry *registry = gst_registry_get();
+ gst_registry_scan_path(registry, "libs\\gst_plugins");
+ gboolean ret = TRUE;
+ for (int i = 0; needed[i]; i++) {
+ GstPlugin *plugin = gst_registry_find_plugin(registry, needed[i]);
+ if (!plugin) {
+ gst_print("Required gstreamer plugin '%s' not found\n", needed[i]);
+ ret = FALSE;
+ }
+ else gst_object_unref(plugin);
+ }
+
+ return ret;
+}
+
+void dbgprint(const gchar *string)
+{
+ OutputDebugStringA(string);
+}
+
+bool CJabberProto::VOIPCreatePipeline(void)
+{
+ //gstreamer init
+ static bool gstinited = 0;
+ if (!gstinited) {
+ if (!LoadLibrary(L"gstreamer-1.0-0.dll")) {
+ MessageBoxA(0, "Cannot load Gstreamer library!", 0, MB_OK | MB_ICONERROR);
+ return false;
+ }
+ gst_init(NULL, NULL);
+ g_set_print_handler(dbgprint);
+ gst_print("preved medved");
+ if (!check_plugins()) {
+ MessageBoxA(0, "Gstreamer plugins not found!", 0, MB_OK | MB_ICONERROR);
+ return false;
+ }
+ gstinited = 1;
+ }
+
+ #define STUN_SERVER "stun-server=stun://stun.tng.de:3478 "
+ #define RTP_CAPS_OPUS "application/x-rtp,media=audio,encoding-name=OPUS,payload="
+ #define RTP_TWCC_URI "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
+
+ GError *error = NULL;
+ m_pipe1 = gst_parse_launch(
+ "webrtcbin bundle-policy=max-bundle name=sendrecv "
+ STUN_SERVER
+ "autoaudiosrc ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay name=audiopay ! "
+ "queue ! " RTP_CAPS_OPUS "111 ! sendrecv. ", &error);
+
+ if (error) {
+ MessageBoxA(0, "Failed to parse launch: ", error->message, MB_OK);
+ g_error_free(error);
+ goto err;
+ }
+
+ m_webrtc1 = gst_bin_get_by_name(GST_BIN(m_pipe1), "sendrecv");
+ g_assert_nonnull(m_webrtc1);
+ if (!m_webrtc1)
+ MessageBoxA(0, "Epic fail", "cannot create m_webrtc1", MB_OK);
+
+ GstElement *audiopay = gst_bin_get_by_name(GST_BIN(m_pipe1), "audiopay");
+ g_assert_nonnull(audiopay);
+ GstRTPHeaderExtension *audio_twcc = gst_rtp_header_extension_create_from_uri(RTP_TWCC_URI);
+ g_assert_nonnull(audio_twcc);
+ gst_rtp_header_extension_set_id(audio_twcc, 1);
+ g_signal_emit_by_name(audiopay, "add-extension", audio_twcc);
+ g_clear_object(&audio_twcc);
+ g_clear_object(&audiopay);
+
+ // It will be called when the pipeline goes to PLAYING.
+ g_signal_connect(m_webrtc1, "on-negotiation-needed", G_CALLBACK(on_negotiation_needed_cb), this);
+ // It will be called when we obtain local ICE candidate
+ g_signal_connect(m_webrtc1, "on-ice-candidate", G_CALLBACK(send_ice_candidate_message_cb), this);
+ // idk
+ g_signal_connect(m_webrtc1, "pad-added", G_CALLBACK(on_incoming_stream_cb), m_pipe1);
+
+ // Lifetime is the same as the pipeline itself
+ gst_object_unref(m_webrtc1);
+
+ gst_print("Starting pipeline\n");
+ if (gst_element_set_state(GST_ELEMENT(m_pipe1), GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
+ goto err;
+
+ return true;
+
+err:
+ VOIPTerminateSession();
+ return FALSE;
+}
+
+bool CJabberProto::VOIPTerminateSession()
+{
+ gst_print("Terminating session");
+ if (m_pipe1) {
+ gst_element_set_state(GST_ELEMENT(m_pipe1), GST_STATE_NULL);
+ g_clear_object(&m_pipe1);
+ gst_print("Pipeline stopped\n");
+ gst_object_unref(m_pipe1);
+ }
+
+ m_voipICEPwd.Empty();
+ m_voipICEUfrag.Empty();
+ m_medianame.Empty();
+
+ m_voipSession.Empty();
+ m_voipPeerJid.Empty();
+ m_pipe1 = m_webrtc1 = NULL;
+ return true;
+}
+
+bool CJabberProto::OnRTPDescription(const TiXmlElement *jingleNode)
+{
+ // process remote offer
+ auto *content = XmlGetChildByTag(jingleNode, "content", "creator", "initiator");
+ auto *transport = XmlGetChildByTag(content, "transport", "xmlns", "urn:xmpp:jingle:transports:ice-udp:1");
+ auto *description = XmlGetChildByTag(content, "description", "xmlns", "urn:xmpp:jingle:apps:rtp:1");
+ auto *source = XmlGetChildByTag(description, "source", "xmlns", "urn:xmpp:jingle:apps:rtp:ssma:0");
+
+ CMStringA sdp_string(FORMAT, "v=0\r\no=- 0 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=ice-options:trickle\r\n"
+ "m=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:%s\r\na=ice-pwd:%s\r\na=rtcp-mux\r\na=sendrecv\r\na=rtpmap:111 OPUS/48000/2\r\n"
+
+ "a=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\n"
+ "a=ssrc:%s msid:%s\r\n"
+ "a=ssrc:%s cname:%s\r\n"
+
+ "a=mid:%s\r\na=setup:%s\r\na=fingerprint:sha-256 %s\r\na=rtcp-mux-only\r\n",
+ XmlGetAttr(transport, "ufrag"),
+ XmlGetAttr(transport, "pwd"),
+
+ XmlGetAttr(source, "ssrc"),
+ XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "msid"), "value"),
+ XmlGetAttr(source, "ssrc"),
+ XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "cname"), "value"),
+
+ XmlGetAttr(content, "name"),
+ XmlGetAttr(XmlFirstChild(transport, "fingerprint"), "setup"),
+ XmlFirstChild(transport, "fingerprint")->GetText());
+
+ GstSDPMessage *sdp;
+ int ret = gst_sdp_message_new(&sdp);
+ g_assert_cmphex(ret, == , GST_SDP_OK);
+ ret = gst_sdp_message_parse_buffer((guint8 *)sdp_string.c_str(), sdp_string.GetLength(), sdp);
+ if (ret != GST_SDP_OK) {
+ g_error("Could not parse SDP string\n");
+ return false;
+ }
+
+ gchar *str = gst_sdp_message_as_text(sdp);
+ gst_print("VOIP - Eating remote SDP offer:\r\n%s\r\n", str);
+ g_free(str);
+
+ if (m_isOutgoing) {
+ GstWebRTCSessionDescription *answer = gst_webrtc_session_description_new(GST_WEBRTC_SDP_TYPE_ANSWER, sdp);
+ g_assert_nonnull(answer);
+
+ GstPromise *promise = gst_promise_new();
+ g_signal_emit_by_name(m_webrtc1, "set-remote-description", answer, promise);
+ gst_promise_interrupt(promise);
+ gst_promise_unref(promise);
+ gst_webrtc_session_description_free(answer);
+ }
+ else {
+ // Set remote description on our pipeline
+ GstWebRTCSessionDescription *offer = gst_webrtc_session_description_new(GST_WEBRTC_SDP_TYPE_OFFER, sdp);
+ g_assert_nonnull(offer);
+
+ GstPromise *promise = gst_promise_new_with_change_func(on_offer_set, this, NULL);
+ g_signal_emit_by_name(m_webrtc1, "set-remote-description", offer, promise);
+ gst_webrtc_session_description_free(offer);
+ }
+
+ return true;
+}
+
+bool CJabberProto::OnICECandidate(const TiXmlElement *Node, const char *)
+{
+ CMStringA scandidate;
+ CMStringA proto(XmlGetAttr(Node, "protocol"));
+ proto.MakeUpper();
+
+ scandidate.AppendFormat("candidate:%s ", XmlGetAttr(Node, "foundation")); //FIXME
+ scandidate.AppendFormat("%s ", XmlGetAttr(Node, "component"));
+ scandidate.AppendFormat("%s ", proto.c_str());
+ scandidate.AppendFormat("%s ", XmlGetAttr(Node, "priority"));
+ scandidate.AppendFormat("%s ", XmlGetAttr(Node, "ip"));
+ scandidate.AppendFormat("%s ", XmlGetAttr(Node, "port"));
+ scandidate.AppendFormat("typ %s", XmlGetAttr(Node, "type"));
+
+ if (const char *tmp = XmlGetAttr(Node, "rel-addr"))
+ scandidate.AppendFormat(" raddr %s", tmp);
+ if (const char *tmp = XmlGetAttr(Node, "rel-port"))
+ scandidate.AppendFormat(" rport %s", tmp);
+ if (const char *generation = XmlGetAttr(Node, "generation"))
+ scandidate.AppendFormat(" generation %s", generation);
+
+ gst_print("VOIP - Accepting ICE candidate:\r\n%s\r\n", scandidate.c_str());
+ g_signal_emit_by_name(m_webrtc1, "add-ice-candidate", 0, scandidate.c_str());
+ return true;
+}
+
+bool CJabberProto::VOIPCallIinitiate(MCONTACT hContact)
+{
+ if (m_voipSession != "") {
+ VOIPTerminateSession();
+ MessageBoxA(0, "Terminated", NULL, 0);
+ return 0;
+ }
+
+ CMStringA jid(ptrA(getUStringA(hContact, "jid")));
+ if (jid == "")
+ return 0;
+ ptrA szResource(GetBestResourceName(jid));
+ if (szResource)
+ jid = MakeJid(jid, szResource);
+
+ CMStringA question(FORMAT, "Call %s?\r\n"
+ "It will disclose IP address to the peer and his server", jid.c_str());
+ if (MessageBoxA(0, question.c_str(), "Outgoing call", MB_YESNO | MB_ICONQUESTION) != IDYES)
+ return 0;
+
+ unsigned char tmp[16];
+ Utils_GetRandom(tmp, sizeof(tmp));
+
+ m_isOutgoing = true;
+ m_voipSession = ptrA(mir_base64_encode(tmp, sizeof(tmp)));
+ m_voipPeerJid = jid.c_str();
+
+ VOIPCreatePipeline();
+ return 0;
+}
+
+bool CJabberProto::VOIPCallAccept(const TiXmlElement *jingleNode, const char *from)
+{
+ if (!from || !jingleNode)
+ return false;
+
+ CMStringW question(FORMAT, TranslateT("Accept call from %s?\r\nIt will disclose IP address to the peer and his server"), from);
+ if (MessageBoxW(0, question, TranslateT("Incomig call"), MB_YESNO | MB_ICONQUESTION) != IDYES)
+ return false;
+
+ m_isOutgoing = false;
+
+ if (!VOIPCreatePipeline())
+ return false;
+
+ OnRTPDescription(jingleNode);
+
+ // ringing message
+ XmlNodeIq iq("set", SerialNext(), from);
+ TiXmlElement *rjNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE);
+ rjNode << XATTR("action", "session-info");
+ const char *szInitiator = XmlGetAttr(jingleNode, "initiator");
+ if (szInitiator)
+ rjNode << XATTR("initiator", szInitiator);
+ const char *szSid = XmlGetAttr(jingleNode, "sid");
+ if (szSid)
+ rjNode << XATTR("sid", szSid);
+ rjNode << XCHILDNS("ringing", "urn:xmpp:jingle:apps:rtp:info:1");
+
+ m_ThreadInfo->send(iq);
+ return true;
+}